Anpassungen CMIF

This commit is contained in:
Simon Martens
2024-11-20 16:52:03 +01:00
parent 9c01db37ea
commit 190bf4a4f6
3 changed files with 49 additions and 46 deletions

View File

@@ -1,18 +1,14 @@
using System;
using HaXMLReader.EvArgs;
using HaXMLReader.Interfaces;
using HaDocument.Models;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace HaDocument.Reactors {
class PersonDefsReactor : Reactor {
internal Dictionary<string, Person> CreatedInstances;
// State
private string Index;
private string Name;
private string? Index;
private string? Name;
private string Prename = "";
private string Surname = "";
private string? Reference;
@@ -45,7 +41,7 @@ namespace HaDocument.Reactors {
Prename = tag["vorname"];
Surname = tag["nachname"];
Reference = String.IsNullOrWhiteSpace(tag["ref"]) ? null : tag["ref"];
IsOrg = tag["org"] == "true";
IsOrg = String.IsNullOrWhiteSpace(tag["org"]) ? false : tag["org"] == "true";
if (!String.IsNullOrWhiteSpace(tag["komm"])) Komm = tag["komm"];
Add();
_active = false;
@@ -63,6 +59,7 @@ namespace HaDocument.Reactors {
}
public void Add() {
if (Index == null || Name == null) return;
CreatedInstances.Add(Index, new Person(Index, Name, Prename, Surname, Komm, Reference, null, IsOrg));
}
}

View File

@@ -27,13 +27,9 @@ public class TitleStatement {
[XmlElement("editor")]
public List<Editor>? Editor { get; set; } = new List<Editor>() {
new Editor() {
Email = "keidel@tss-hd.de",
Name = "Leonard Keidel",
Email = "post@hamann-ausgabe.de",
Name = "Janina Reibold, Leonard Keidel, Simon Martens",
},
new Editor() {
Email = "reibold@tss-hd.de",
Name = "Janina Reibold",
}
};
}
@@ -148,6 +144,8 @@ public class CorrespondenceAction {
public List<PersonName>? PersonName { get; set; }
[XmlElement("placeName")]
public List<PlaceName>? PlaceName { get; set; }
[XmlElement("orgName")]
public List<string>? OrgName { get; set; }
[XmlElement("date")]
public Date? Date { get; set; }
}
@@ -209,6 +207,7 @@ public class TeiDocument {
var UNKNOWN_URL = "http://correspSearch.net/unknown";
var UNKNOWN_TEXT = "Unbekannt";
var LETTER_URL = "https://hamann-ausgabe.de/HKB/Briefe/";
var PERSON_URL = "https://hamann-ausgabe.de/HKB/Person/";
var DATE_OUTPUT = "yyyy-MM-dd";
List<CorrespondenceDescription> cds = new List<CorrespondenceDescription>();
foreach (var meta in lib.Metas.Values) {
@@ -252,46 +251,52 @@ public class TeiDocument {
}
}
if (meta.Senders != null && meta.Senders.Count() > 0) {
sent.PersonName = new List<PersonName>();
var PersonName = new List<PersonName>();
var OrgName = new List<string>();
foreach (var sender in meta.Senders) {
var pn = new PersonName();
if (sender == "-1") {
pn.Name = UNKNOWN_TEXT;
pn.Reference = UNKNOWN_URL;
PersonName.Add(new PersonName() { Name = UNKNOWN_TEXT, Reference = UNKNOWN_URL });
}
else if (lib.Persons.ContainsKey(sender)) {
pn.Name = lib.Persons[sender].Name;
if (lib.Persons[sender].Reference != null && !string.IsNullOrWhiteSpace(lib.Persons[sender].Reference)) {
pn.Reference = lib.Persons[sender].Reference;
var libpers = lib.Persons[sender];
if (libpers.IsOrg) {
OrgName.Add(libpers.Name);
}
else {
var pref = PERSON_URL + libpers.Index;
if (libpers.Reference != null && !string.IsNullOrWhiteSpace(libpers.Reference))
pref = libpers.Reference;
PersonName.Add(new PersonName() { Name = libpers.Name, Reference = pref });
}
}
else {
pn = null;
}
if (pn != null) sent.PersonName.Add(pn);
}
if (PersonName.Count() > 0) sent.PersonName = PersonName;
if (OrgName.Count() > 0) sent.OrgName = OrgName;
}
cd.CorrespondenceActions = new List<CorrespondenceAction>() { sent };
var recieved = new CorrespondenceAction();
if (meta.Receivers != null && meta.Receivers.Count() > 0) {
recieved.PersonName = new List<PersonName>();
foreach (var sender in meta.Receivers) {
var pn = new PersonName();
if (sender == "-1") {
pn.Name = UNKNOWN_TEXT;
pn.Reference = UNKNOWN_URL;
var PersonName = new List<PersonName>();
var OrgName = new List<string>();
foreach (var reciever in meta.Receivers) {
if (reciever == "-1") {
PersonName.Add(new PersonName() { Name = UNKNOWN_TEXT, Reference = UNKNOWN_URL });
}
else if (lib.Persons.ContainsKey(sender)) {
pn.Name = lib.Persons[sender].Name;
if (lib.Persons[sender].Reference != null && !string.IsNullOrWhiteSpace(lib.Persons[sender].Reference)) {
pn.Reference = lib.Persons[sender].Reference;
else if (lib.Persons.ContainsKey(reciever)) {
var libpers = lib.Persons[reciever];
if (libpers.IsOrg) {
OrgName.Add(libpers.Name);
}
else {
var pref = PERSON_URL + libpers.Index;
if (libpers.Reference != null && !string.IsNullOrWhiteSpace(libpers.Reference))
pref = libpers.Reference;
PersonName.Add(new PersonName() { Name = libpers.Name, Reference = pref });
}
}
else {
pn = null;
}
if (pn != null) recieved.PersonName.Add(pn);
}
if (PersonName.Count() > 0) recieved.PersonName = PersonName;
if (OrgName.Count() > 0) recieved.OrgName = OrgName;
}
recieved.Type = "received";
cd.CorrespondenceActions.Add(recieved);

View File

@@ -2,18 +2,18 @@
<html class="h-full w-full overflow-hidden" lang="de" id="top">
<head>
@await Html.PartialAsync("/Views/Shared/_Head.cshtml")
@await Html.PartialAsync("/Views/Shared/_Head.cshtml")
</head>
<body class="h-full w-full" hx-boost="true">
<div class="flex flex-col h-full">
@await Html.PartialAsync("/Views/Shared/_HKBMenu.cshtml")
<main role="main" class="mb-6 w-full desktop:max-w-screen-desktop mx-auto grow">
@RenderBody()
</main>
<div class="w-full">
@await Html.PartialAsync("/Views/Shared/_Footer.cshtml")
</div>
@await Html.PartialAsync("/Views/Shared/_HKBMenu.cshtml")
<main role="main" class="mb-6 w-full desktop:max-w-screen-desktop mx-auto grow">
@RenderBody()
</main>
<div class="w-full">
@await Html.PartialAsync("/Views/Shared/_Footer.cshtml")
</div>
</div>
@await Html.PartialAsync("/Views/Shared/_ScrollButton.cshtml")
<feature name="Notifications">
@@ -22,4 +22,5 @@
@await RenderSectionAsync("JavaScript", false)
@await Html.PartialAsync("/Views/Shared/_Scripts.cshtml")
</body>
</html>