mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-12-16 06:25:31 +00:00
Added Upload functionality; still a bit janky in selecting the files to use...
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
namespace HaWeb;
|
||||
|
||||
public static class Features {
|
||||
// If Admin Pages are reachable
|
||||
public const string AdminService = "AdminService";
|
||||
// If the Upload of files is possible, also syntaxcheck and crossreference check
|
||||
public const string UploadService = "UploadService";
|
||||
public const string UpdateService = "UpdateService";
|
||||
// If uploaded Files can be published locally
|
||||
public const string LocalPublishService = "LocalPublishService";
|
||||
// If this server can publish files remotely (e.g. www.hamann-ausgabe.de)
|
||||
public const string RemotePublishService = "RemotePublishService";
|
||||
// If this server can accept files from a remote authenticated source
|
||||
public const string RemotePublishSourceService = "RemotePublishSourceService";
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ class HaDocumentOptions : IHaDocumentOptions {
|
||||
public string HamannXMLFilePath { get; set; } = @"Hamann.xml";
|
||||
public string[] AvailableVolumes { get; set; } = { };
|
||||
public bool NormalizeWhitespace { get; set; } = true;
|
||||
public (int, int) AvailableYearRange {get; set; } = (1751, 1788);
|
||||
public (int, int) AvailableYearRange {get; set; } = (1700, 1790);
|
||||
}
|
||||
@@ -43,4 +43,10 @@ public class CommentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("kommentare") == null)
|
||||
file.AddFirst(new XElement("kommentare"));
|
||||
file.Element("kommentare")!.AddFirst(document.Root);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,12 +13,12 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return false;
|
||||
};
|
||||
|
||||
public Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
var index = elem.Attribute("ref");
|
||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
return index.Value;
|
||||
else return null;
|
||||
};
|
||||
// public Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||
// var index = elem.Attribute("ref");
|
||||
// if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||
// return index.Value;
|
||||
// else return null;
|
||||
// };
|
||||
|
||||
public List<(string, string?)>? GenerateFields(XMLRootDocument document) {
|
||||
return null;
|
||||
@@ -38,4 +38,14 @@ public class DescriptionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("descriptions") == null)
|
||||
file.AddFirst(new XElement("descriptions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("descriptions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ namespace HaWeb.Settings.XMLRoots;
|
||||
using System.Xml.Linq;
|
||||
using HaWeb.Models;
|
||||
using HaWeb.XMLParser;
|
||||
using System.IO;
|
||||
|
||||
public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
public string Type { get; } = "Brieftext";
|
||||
@@ -38,4 +39,14 @@ public class DocumentRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("document") == null)
|
||||
file.AddFirst(new XElement("document"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("document");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,4 +38,14 @@ public class EditsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("edits") == null)
|
||||
file.AddFirst(new XElement("edits"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("edits");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,4 +38,14 @@ public class MarginalsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("marginalien") == null)
|
||||
file.AddFirst(new XElement("marginalien"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("marginalien");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,4 +36,14 @@ public class ReferencesRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("definitions") == null)
|
||||
file.AddFirst(new XElement("definitions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("definitions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -38,4 +38,13 @@ public class TraditionsRoot : HaWeb.XMLParser.IXMLRoot {
|
||||
return opus;
|
||||
}
|
||||
|
||||
public void MergeIntoFile(XElement file, XMLRootDocument document) {
|
||||
if (file.Element("traditions") == null)
|
||||
file.AddFirst(new XElement("traditions"));
|
||||
var elements = document.Root.Elements().Where(x => IsCollectedObject(x));
|
||||
var root = file.Element("traditions");
|
||||
foreach (var element in elements) {
|
||||
root!.Add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user