mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-28 16:55:32 +00:00
A lot of stuff related to parsing; index page input validation
This commit is contained in:
@@ -6,10 +6,14 @@ using HaDocument.Models;
|
|||||||
namespace HaDocument.Comparers {
|
namespace HaDocument.Comparers {
|
||||||
public class CommentComparer : IComparer<Comment> {
|
public class CommentComparer : IComparer<Comment> {
|
||||||
public int Compare(Comment first, Comment second) {
|
public int Compare(Comment first, Comment second) {
|
||||||
if (first.Order != second.Order)
|
if (first.Order.HasValue && second.Order.HasValue)
|
||||||
return first.Order.CompareTo(second.Order);
|
return first.Order.Value.CompareTo(second.Order.Value);
|
||||||
|
else if (first.Order.HasValue)
|
||||||
|
return 1;
|
||||||
|
else if (second.Order.HasValue)
|
||||||
|
return -1;
|
||||||
else
|
else
|
||||||
return first.Index.CompareTo(second.Index);
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,12 @@ VisualStudioVersion = 17.5.002.0
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HaDocumentV6", "HaDocumentV6.csproj", "{2D3B1B5C-5E0B-4050-A102-E44F025511BE}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HaDocumentV6", "HaDocumentV6.csproj", "{2D3B1B5C-5E0B-4050-A102-E44F025511BE}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaWeb", "..\HaWeb\HaWeb.csproj", "{73B7CCC1-3486-4F6C-807C-F74BF86EE42F}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HamannPrinter", "..\HamannPrinter\HamannPrinter.csproj", "{2E4EB350-E88B-40FF-BF0F-E3C98D0C1590}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HaXMLReaderV6", "..\HaXMLReaderV6\HaXMLReaderV6.csproj", "{68504F7C-8919-4F92-91AA-3D2952AE942F}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -15,6 +21,18 @@ Global
|
|||||||
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
{2D3B1B5C-5E0B-4050-A102-E44F025511BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{73B7CCC1-3486-4F6C-807C-F74BF86EE42F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{73B7CCC1-3486-4F6C-807C-F74BF86EE42F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{73B7CCC1-3486-4F6C-807C-F74BF86EE42F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{73B7CCC1-3486-4F6C-807C-F74BF86EE42F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{2E4EB350-E88B-40FF-BF0F-E3C98D0C1590}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{2E4EB350-E88B-40FF-BF0F-E3C98D0C1590}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{2E4EB350-E88B-40FF-BF0F-E3C98D0C1590}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{2E4EB350-E88B-40FF-BF0F-E3C98D0C1590}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{68504F7C-8919-4F92-91AA-3D2952AE942F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{68504F7C-8919-4F92-91AA-3D2952AE942F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{68504F7C-8919-4F92-91AA-3D2952AE942F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{68504F7C-8919-4F92-91AA-3D2952AE942F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
public interface IHaElement {
|
public interface IHaElement : IComparable {
|
||||||
|
abstract public string ElementName { get; }
|
||||||
|
abstract public string[] XPath { get; }
|
||||||
|
abstract public string ElementRules { get; }
|
||||||
|
abstract public XElement? XElement { get; }
|
||||||
|
abstract public bool Searchable { get; }
|
||||||
|
abstract public string GetKey();
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,20 @@
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace HaDocument.Models {
|
namespace HaDocument.Models {
|
||||||
public class App {
|
public class App : IHaElement {
|
||||||
|
public string ElementName { get; } = "appDef";
|
||||||
|
public string[] XPath { get; } = {
|
||||||
|
"/opus/data/definitions/appDefs/appDef",
|
||||||
|
"/opus/definitions/appDefs/appDef"
|
||||||
|
};
|
||||||
|
public string ElementRules { get; } = "Pfad: /opus/definitions/appDefs. Pflicht-Attribute: index (einmalig), name, category.";
|
||||||
|
public bool Searchable { get; } = false;
|
||||||
|
public XElement? XElement { get; }
|
||||||
|
|
||||||
public string Index { get; } = "";
|
public string Index { get; } = "";
|
||||||
public string Name { get; } = "";
|
public string Name { get; } = "";
|
||||||
public string Category { get; } = "";
|
public string Category { get; } = "";
|
||||||
|
|
||||||
public XElement? XElement { get; }
|
|
||||||
|
|
||||||
public App(
|
public App(
|
||||||
string index,
|
string index,
|
||||||
string name,
|
string name,
|
||||||
@@ -28,7 +35,17 @@ namespace HaDocument.Models {
|
|||||||
element.Attribute("name")!.Value,
|
element.Attribute("name")!.Value,
|
||||||
element.Attribute("category")!.Value,
|
element.Attribute("category")!.Value,
|
||||||
element
|
element
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetKey() => this.Index;
|
||||||
|
|
||||||
|
public int CompareTo(object? obj) {
|
||||||
|
if (obj == null) return 1;
|
||||||
|
var other = (App)obj;
|
||||||
|
if (Int32.TryParse(Index, out var thisindex) && Int32.TryParse(other.Index, out var otherindex) )
|
||||||
|
return thisindex.CompareTo(otherindex);
|
||||||
|
return String.Compare(this.Index, other.Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,21 @@
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace HaDocument.Models {
|
namespace HaDocument.Models {
|
||||||
public class Backlink {
|
public class Backlink : IHaElement {
|
||||||
public string Href { get; } = "";
|
public string ElementName { get; } = "link";
|
||||||
|
public string[] XPath { get; } = {
|
||||||
|
"/opus/data/marginalien/marginal//link",
|
||||||
|
"/opus/marginalien/marginal//link",
|
||||||
|
"/opus/kommentare/kommentar//link",
|
||||||
|
"/opus/data/kommentare/kommentar//link",
|
||||||
|
"/opus/traditions/letterTradition//link",
|
||||||
|
"/opus/data/traditions/letterTradition//link",
|
||||||
|
};
|
||||||
|
public string ElementRules { get; } = "Pfad: /opus/marginalien, /opus/kommentare, /opus/traditions. Pflicht-Attribute: letter.";
|
||||||
|
public bool Searchable { get; } = false;
|
||||||
|
public XElement? XElement { get; } = null;
|
||||||
|
|
||||||
|
public string Href { get; } = "";
|
||||||
public string? Letter { get; } = "";
|
public string? Letter { get; } = "";
|
||||||
public string? Page { get; } = "";
|
public string? Page { get; } = "";
|
||||||
public string? Line { get; } = "";
|
public string? Line { get; } = "";
|
||||||
@@ -14,13 +26,15 @@ namespace HaDocument.Models {
|
|||||||
string? letter,
|
string? letter,
|
||||||
string? page,
|
string? page,
|
||||||
string? line,
|
string? line,
|
||||||
string? comment = null
|
string? comment = null,
|
||||||
|
XElement? xElement = null
|
||||||
) {
|
) {
|
||||||
Href = href;
|
Href = href;
|
||||||
Letter = letter;
|
Letter = letter;
|
||||||
Page = page;
|
Page = page;
|
||||||
Line = line;
|
Line = line;
|
||||||
Comment = comment;
|
Comment = comment;
|
||||||
|
XElement = xElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Backlink? FromXElement(XElement element) {
|
public static Backlink? FromXElement(XElement element) {
|
||||||
@@ -34,7 +48,9 @@ namespace HaDocument.Models {
|
|||||||
element.Attribute("subref")?.Value ?? element.Attribute("ref")!.Value,
|
element.Attribute("subref")?.Value ?? element.Attribute("ref")!.Value,
|
||||||
marginal.Attribute("letter")!.Value,
|
marginal.Attribute("letter")!.Value,
|
||||||
marginal.Attribute("page")!.Value,
|
marginal.Attribute("page")!.Value,
|
||||||
marginal.Attribute("line")!.Value
|
marginal.Attribute("line")!.Value,
|
||||||
|
null,
|
||||||
|
element
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +62,8 @@ namespace HaDocument.Models {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
subsection.Attribute("id")!.Value
|
subsection.Attribute("id")!.Value,
|
||||||
|
element
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,11 +75,20 @@ namespace HaDocument.Models {
|
|||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
kommentar.Attribute("id")!.Value
|
kommentar.Attribute("id")!.Value,
|
||||||
|
element
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string GetKey() {
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int CompareTo(object? obj) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,25 +1,36 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace HaDocument.Models {
|
||||||
|
public class Comment : IHaElement {
|
||||||
|
public string ElementName { get; } = "link";
|
||||||
|
public string[] XPath { get; } = {
|
||||||
|
"/opus/kommentare/kommentar/kommcat/kommentar",
|
||||||
|
"/opus/data/kommentare/kommentar/kommcat/kommentar",
|
||||||
|
};
|
||||||
|
public string ElementRules { get; } = "Pfad: /opus/kommentare/kommentar. Pflicht-Attribute: id (einmalig).";
|
||||||
|
public bool Searchable { get; } = true;
|
||||||
|
public XElement? XElement { get; }
|
||||||
|
|
||||||
namespace HaDocument.Models{
|
|
||||||
public class Comment {
|
|
||||||
public string Element { get; } = "";
|
public string Element { get; } = "";
|
||||||
public string Index { get; } = "";
|
public string Index { get; } = "";
|
||||||
public string Type { get; } = "";
|
public string Type { get; } = "";
|
||||||
public string Lemma { get; } = "";
|
public string Lemma { get; } = "";
|
||||||
public string Parent { get; } = "";
|
public string Parent { get; } = "";
|
||||||
public int Order { get; } = -1;
|
public int? Order { get; } = null;
|
||||||
public ImmutableSortedDictionary<string, Comment> Kommentare { get; }
|
public ImmutableSortedDictionary<string, Comment>? Kommentare { get; }
|
||||||
|
|
||||||
public Comment(
|
public Comment(
|
||||||
string entry,
|
string entry,
|
||||||
string index,
|
string index,
|
||||||
string type,
|
string? type,
|
||||||
string lemma,
|
string? lemma,
|
||||||
int order,
|
int? order,
|
||||||
SortedDictionary<string, Comment> subComments,
|
ImmutableSortedDictionary<string, Comment>? subComments,
|
||||||
string parent=""
|
string? parent = null,
|
||||||
|
XElement? xelement = null
|
||||||
) {
|
) {
|
||||||
Element = entry;
|
Element = entry;
|
||||||
Index = index;
|
Index = index;
|
||||||
@@ -27,10 +38,58 @@ namespace HaDocument.Models{
|
|||||||
Lemma = lemma;
|
Lemma = lemma;
|
||||||
Order = order;
|
Order = order;
|
||||||
Parent = parent;
|
Parent = parent;
|
||||||
if (subComments != null)
|
XElement = xelement;
|
||||||
Kommentare = ImmutableSortedDictionary.ToImmutableSortedDictionary(subComments);
|
Kommentare = subComments;
|
||||||
else
|
}
|
||||||
Kommentare = null;
|
|
||||||
|
public String GetKey() => Index;
|
||||||
|
|
||||||
|
public int CompareTo(object? obj) {
|
||||||
|
if (obj == null) return 1;
|
||||||
|
var other = (Comment)obj;
|
||||||
|
if (!String.IsNullOrWhiteSpace(Parent) && !String.IsNullOrWhiteSpace(other.Parent) &&
|
||||||
|
(Parent == other.Parent)) {
|
||||||
|
if (Order.HasValue && other.Order.HasValue)
|
||||||
|
return Order.Value!.CompareTo(other.Order.Value);
|
||||||
|
else if (Order.HasValue)
|
||||||
|
return 1;
|
||||||
|
else if (other.Order.HasValue)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return String.Compare(Index, other.Index);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Comment? FromXElement(XElement? element) {
|
||||||
|
if (element == null || !element.HasAttributes || element.IsEmpty) return null;
|
||||||
|
if (element.Attribute("id")?.Value == null) return null;
|
||||||
|
var cat = element.Ancestors("kommcat");
|
||||||
|
if (element.Name == "kommentar")
|
||||||
|
return new Comment(
|
||||||
|
element.ToString(),
|
||||||
|
element.Attribute("id")!.Value,
|
||||||
|
(cat.Any() ? cat.First().Attribute("value")?.Value : null) ?? element.Attribute("type")?.Value,
|
||||||
|
element.Element("lemma")?.Value,
|
||||||
|
element.Attribute("sort")?.Value != null ? (Int32.TryParse(element.Attribute("sort")!.Value, out var s) ? s : null) : null,
|
||||||
|
element.Elements("subsection").Any() ? element.Elements("subsection").Select(x => FromXElement(x)).ToImmutableSortedDictionary(x => x.Index, y => y) : null,
|
||||||
|
null,
|
||||||
|
element
|
||||||
|
);
|
||||||
|
else if (element.Name == "subsection") {
|
||||||
|
if (element.Ancestors("kommentar").Any() || element.Ancestors("kommentar")!.First().Attribute("id")?.Value == null) return null;
|
||||||
|
return new Comment(
|
||||||
|
element.ToString(),
|
||||||
|
element.Attribute("id")!.Value,
|
||||||
|
(cat.Any() ? cat.First().Attribute("value")?.Value : null) ?? element.Attribute("type")?.Value,
|
||||||
|
element.Element("lemma")?.Value,
|
||||||
|
element.Attribute("sort")?.Value != null ? (Int32.TryParse(element.Attribute("sort")!.Value, out var s) ? s : null) : null,
|
||||||
|
null,
|
||||||
|
element.Ancestors("kommentar")!.First().Attribute("id")!.Value,
|
||||||
|
element
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,8 +31,9 @@ namespace HaDocument.Models {
|
|||||||
Reference = reference;
|
Reference = reference;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Editreason? FromXElement(XElement element) {
|
public static Editreason? FromXElement(XElement edit, XElement editreason) {
|
||||||
throw new NotImplementedException("We need two Elements for editreason");
|
if (edit == null || editreason == null || !edit.HasAttributes || !editreason.HasAttributes) return null;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ using HaDocument.Models;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System;
|
using System;
|
||||||
using HaDocument.Comparers;
|
using HaDocument.Comparers;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
namespace HaDocument.Reactors {
|
namespace HaDocument.Reactors {
|
||||||
class CommentReactor : Reactor {
|
class CommentReactor : Reactor {
|
||||||
@@ -149,7 +150,7 @@ namespace HaDocument.Reactors {
|
|||||||
Type,
|
Type,
|
||||||
Lemma,
|
Lemma,
|
||||||
Order,
|
Order,
|
||||||
Subcomments
|
Subcomments == null ? null : ImmutableSortedDictionary.ToImmutableSortedDictionary(Subcomments, x => x.Key, y => y.Value)
|
||||||
));
|
));
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using HaDocument.Models;
|
|||||||
using HaXMLReader.Interfaces;
|
using HaXMLReader.Interfaces;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using HaWeb.XMLParser;
|
using HaWeb.XMLParser;
|
||||||
|
using System.Collections.Immutable;
|
||||||
|
|
||||||
namespace HaWeb.Controllers;
|
namespace HaWeb.Controllers;
|
||||||
|
|
||||||
@@ -144,8 +145,7 @@ public class IndexController : Controller {
|
|||||||
.ThenBy(x => x.Meta.Order)
|
.ThenBy(x => x.Meta.Order)
|
||||||
.ToList()))
|
.ToList()))
|
||||||
.ToList();
|
.ToList();
|
||||||
List<(string Volume, List<string> Pages)>? availablePages = null;
|
var availablePages = lib.Structure.Where(x => x.Key != "-1").ToDictionary(x => x.Key, y => y.Value.Keys.ToList());
|
||||||
availablePages = lib.Structure.Where(x => x.Key != "-1").Select(x => (x.Key, x.Value.Select(x => x.Key).ToList())).ToList();
|
|
||||||
zhvolume = zhvolume == null ? "1" : zhvolume;
|
zhvolume = zhvolume == null ? "1" : zhvolume;
|
||||||
|
|
||||||
var lastletter = lib.MetasByDate.Last();
|
var lastletter = lib.MetasByDate.Last();
|
||||||
@@ -156,7 +156,8 @@ public class IndexController : Controller {
|
|||||||
"ZH " + HTMLHelpers.ConversionHelpers.ToRoman(Int32.Parse(lastletter.ZH.Volume)) + ", S. " + lastletter.ZH.Page,
|
"ZH " + HTMLHelpers.ConversionHelpers.ToRoman(Int32.Parse(lastletter.ZH.Volume)) + ", S. " + lastletter.ZH.Page,
|
||||||
pages,
|
pages,
|
||||||
_getAvailablePersons(),
|
_getAvailablePersons(),
|
||||||
availablePages.OrderBy(x => x.Volume).ToList(),
|
availablePages,
|
||||||
|
lib.Letters.Keys.ToList(),
|
||||||
zhvolume,
|
zhvolume,
|
||||||
zhpage,
|
zhpage,
|
||||||
person
|
person
|
||||||
|
|||||||
@@ -49,8 +49,14 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
|
|||||||
if (doc == null) doc = XDocument.Load(path, LoadOptions.PreserveWhitespace);
|
if (doc == null) doc = XDocument.Load(path, LoadOptions.PreserveWhitespace);
|
||||||
|
|
||||||
// 1. Parse the Document, create search Index
|
// 1. Parse the Document, create search Index
|
||||||
|
var sw = new Stopwatch();
|
||||||
|
sw.Start();
|
||||||
if (_xmlService != null)
|
if (_xmlService != null)
|
||||||
_xmlService.CreateSearchables(doc);
|
_xmlService.CreateCollections(doc);
|
||||||
|
sw.Stop();
|
||||||
|
Console.WriteLine("Parsed Collections, elapsed: " + sw.ElapsedMilliseconds);
|
||||||
|
sw.Restart();
|
||||||
|
|
||||||
// 2. Set ILibrary
|
// 2. Set ILibrary
|
||||||
try {
|
try {
|
||||||
Library = HaDocument.Document.Create(new HaWeb.Settings.HaDocumentOptions() { HamannXMLFilePath = path, AvailableYearRange = (_startYear, _endYear) }, doc.Root);
|
Library = HaDocument.Document.Create(new HaWeb.Settings.HaDocumentOptions() { HamannXMLFilePath = path, AvailableYearRange = (_startYear, _endYear) }, doc.Root);
|
||||||
@@ -58,6 +64,7 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
|
|||||||
if (ModelState != null) ModelState.AddModelError("Error", "Das Dokument konnte nicht geparst werden: " + ex.Message);
|
if (ModelState != null) ModelState.AddModelError("Error", "Das Dokument konnte nicht geparst werden: " + ex.Message);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("Parsed ILib, elapsed: " + sw.ElapsedMilliseconds);
|
||||||
|
|
||||||
// 3a. Set Available Persons
|
// 3a. Set Available Persons
|
||||||
var persons = Library.Metas.SelectMany(x => x.Value.Senders.Union(x.Value.Receivers)).Distinct();
|
var persons = Library.Metas.SelectMany(x => x.Value.Senders.Union(x.Value.Receivers)).Distinct();
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
namespace HaWeb.Models;
|
namespace HaWeb.Models;
|
||||||
|
|
||||||
|
using System.Collections.Immutable;
|
||||||
using HaDocument.Models;
|
using HaDocument.Models;
|
||||||
|
|
||||||
public class IndexViewModel {
|
public class IndexViewModel {
|
||||||
@@ -8,15 +10,16 @@ public class IndexViewModel {
|
|||||||
public List<(int StartYear, int EndYear)>? AvailableYears { get; private set; }
|
public List<(int StartYear, int EndYear)>? AvailableYears { get; private set; }
|
||||||
public string? ActivePerson { get; set; }
|
public string? ActivePerson { get; set; }
|
||||||
public CommentModel? PersonComment { get; set; }
|
public CommentModel? PersonComment { get; set; }
|
||||||
|
public List<string>? AvailableLetters { get; private set; }
|
||||||
public List<(string Key, string Name)>? AvailablePersons { get; private set; }
|
public List<(string Key, string Name)>? AvailablePersons { get; private set; }
|
||||||
public List<(string Volume, List<string> Pages)>? AvailablePages { get; private set; }
|
public Dictionary<string, List<string>>? AvailablePages { get; private set; }
|
||||||
public string? ActiveVolume { get; private set; }
|
public string? ActiveVolume { get; private set; }
|
||||||
public string? ActivePage { get; private set; }
|
public string? ActivePage { get; private set; }
|
||||||
|
|
||||||
public string EndYear { get; private set; }
|
public string EndYear { get; private set; }
|
||||||
|
|
||||||
public string EndPageString { get; private set; }
|
public string EndPageString { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public IndexViewModel(
|
public IndexViewModel(
|
||||||
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters,
|
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters,
|
||||||
int activeYear,
|
int activeYear,
|
||||||
@@ -24,7 +27,8 @@ public class IndexViewModel {
|
|||||||
string endPageString,
|
string endPageString,
|
||||||
List<(int StartYear, int EndYear)>? availableYears,
|
List<(int StartYear, int EndYear)>? availableYears,
|
||||||
List<(string Key, string Name)>? availablePersons,
|
List<(string Key, string Name)>? availablePersons,
|
||||||
List<(string Volume, List<string> Pages)>? availablePages,
|
Dictionary<string, List<string>>? availablePages,
|
||||||
|
List<string>? availableLetters,
|
||||||
string? activeVolume,
|
string? activeVolume,
|
||||||
string? activePage,
|
string? activePage,
|
||||||
string? activePerson
|
string? activePerson
|
||||||
@@ -34,6 +38,7 @@ public class IndexViewModel {
|
|||||||
Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; });
|
Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; });
|
||||||
else
|
else
|
||||||
Count = 0;
|
Count = 0;
|
||||||
|
AvailableLetters = availableLetters;
|
||||||
ActiveYear = activeYear;
|
ActiveYear = activeYear;
|
||||||
AvailableYears = availableYears;
|
AvailableYears = availableYears;
|
||||||
AvailablePersons = availablePersons;
|
AvailablePersons = availablePersons;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using System.Xml.Linq;
|
|||||||
public class BackLinkCollection : HaWeb.XMLParser.IXMLCollection {
|
public class BackLinkCollection : HaWeb.XMLParser.IXMLCollection {
|
||||||
private static readonly Random _random = new Random();
|
private static readonly Random _random = new Random();
|
||||||
public string Key { get; } = "backlinks";
|
public string Key { get; } = "backlinks";
|
||||||
public string[] xPath { get; } = new string[] { "/opus/data/marginalien/marginal/link", "/opus/marginalien/marginal/link" };
|
public string[] xPath { get; } = new string[] { "/opus/data/marginalien/marginal//link", "/opus/marginalien/marginal//link", "/opus/kommentare/kommentar//link", "/opus/data/kommentare/kommentar//link" };
|
||||||
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
||||||
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = GetDataFields;
|
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = GetDataFields;
|
||||||
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = GetLookups;
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = GetLookups;
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
namespace HaWeb.Settings.XMLCollections;
|
|
||||||
using HaWeb.Models;
|
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using HaWeb.Models;
|
||||||
|
|
||||||
public class EditCollection : HaWeb.XMLParser.IXMLCollection {
|
public class EditCollection : HaWeb.XMLParser.IXMLCollection {
|
||||||
public string Key { get; } = "edits";
|
public string Key { get; } = "edits";
|
||||||
public string[] xPath { get; } = new string[] { "/opus/edits/editreason", "/opus/data/edits/editreason" };
|
public string[] xPath { get; } = new string[] {
|
||||||
|
"/opus/data/document/letterText//edit",
|
||||||
|
"/opus/document/letterText//edit",
|
||||||
|
"/opus/data/traditions/letterTradition//edit",
|
||||||
|
"/opus/traditions/letterTradition//edit"
|
||||||
|
};
|
||||||
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
||||||
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
|
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
|
||||||
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
|
||||||
@@ -13,7 +17,7 @@ public class EditCollection : HaWeb.XMLParser.IXMLCollection {
|
|||||||
public bool Searchable { get; } = true;
|
public bool Searchable { get; } = true;
|
||||||
|
|
||||||
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||||
var index = elem.Attribute("index");
|
var index = elem.Attribute("ref");
|
||||||
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||||
return index.Value;
|
return index.Value;
|
||||||
else return null;
|
else return null;
|
||||||
|
|||||||
21
HaWeb/Settings/XMLCollections/EditreasonCollection.cs
Normal file
21
HaWeb/Settings/XMLCollections/EditreasonCollection.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
namespace HaWeb.Settings.XMLCollections;
|
||||||
|
using HaWeb.Models;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
public class EditreasonCollection : HaWeb.XMLParser.IXMLCollection {
|
||||||
|
public string Key { get; } = "editreasons";
|
||||||
|
public string[] xPath { get; } = new string[] { "/opus/edits/editreason", "/opus/data/edits/editreason" };
|
||||||
|
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
||||||
|
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
|
||||||
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
|
||||||
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, IEnumerable<CollectedItem>>?>? SortingsGeneration { get; } = null;
|
||||||
|
public HaWeb.XMLParser.IXMLCollection[]? SubCollections { get; } = null;
|
||||||
|
public bool Searchable { get; } = true;
|
||||||
|
|
||||||
|
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||||
|
var index = elem.Attribute("index");
|
||||||
|
if (index != null && !String.IsNullOrWhiteSpace(index.Value))
|
||||||
|
return index.Value;
|
||||||
|
else return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
23
HaWeb/Settings/XMLCollections/HandCollection.cs
Normal file
23
HaWeb/Settings/XMLCollections/HandCollection.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Xml.Linq;
|
||||||
|
using HaWeb.Models;
|
||||||
|
|
||||||
|
public class HandCollection : HaWeb.XMLParser.IXMLCollection {
|
||||||
|
public string Key { get; } = "hands";
|
||||||
|
public string[] xPath { get; } = new string[] {
|
||||||
|
"/opus/data/document/letterText//hand",
|
||||||
|
"/opus/document/letterText//hand",
|
||||||
|
"/opus/data/traditions/letterTradition//hand",
|
||||||
|
"/opus/traditions/letterTradition//hand"
|
||||||
|
};
|
||||||
|
public Func<XElement, string?> GenerateKey { get; } = GetKey;
|
||||||
|
public Func<XElement, IDictionary<string, string>?>? GenerateDataFields { get; } = null;
|
||||||
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, ILookup<string, CollectedItem>>?>? GroupingsGeneration { get; } = null;
|
||||||
|
public Func<IEnumerable<CollectedItem>, IDictionary<string, IEnumerable<CollectedItem>>?>? SortingsGeneration { get; } = null;
|
||||||
|
public HaWeb.XMLParser.IXMLCollection[]? SubCollections { get; } = null;
|
||||||
|
public bool Searchable { get; } = true;
|
||||||
|
|
||||||
|
public static Func<XElement, string?> GetKey { get; } = (elem) => {
|
||||||
|
// TODO IMPLEMENT
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@
|
|||||||
ViewData["showCredits"] = "true";
|
ViewData["showCredits"] = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
<script defer src="/js/index.js" asp-append-version="true"></script>
|
|
||||||
|
|
||||||
<div class="ha-index">
|
<div class="ha-index">
|
||||||
@if (Model.Letters != null) {
|
@if (Model.Letters != null) {
|
||||||
@@ -77,6 +76,7 @@
|
|||||||
<input name="id" type="text" id="ha-gotoletternumber" class="ha-gotoletternumber" />
|
<input name="id" type="text" id="ha-gotoletternumber" class="ha-gotoletternumber" />
|
||||||
<button type="submit" id="ha-gotoformsubmit">Nachschlagen</button>
|
<button type="submit" id="ha-gotoformsubmit">Nachschlagen</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="mr-2 leading-snug text-base px-1 text-red-700 bg-red-50 text-left h-5 whitespace-nowrap overflow-hidden opacity-0" id="ha-gotoinfo"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@* ZH Loopkup *@
|
@* ZH Loopkup *@
|
||||||
@@ -97,15 +97,15 @@
|
|||||||
<form class="ha-zhform" id="ha-zhform">
|
<form class="ha-zhform" id="ha-zhform">
|
||||||
<span>Z H Band</span>
|
<span>Z H Band</span>
|
||||||
<select name="zhvolume" id="ha-zhformvolume">
|
<select name="zhvolume" id="ha-zhformvolume">
|
||||||
@foreach (var volume in Model.AvailablePages) {
|
@foreach (var volume in Model.AvailablePages.OrderBy(x => x.Key)) {
|
||||||
<option>@volume.Volume</option>
|
<option>@volume.Key</option>
|
||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
<span>/ </span>
|
<span>/ </span>
|
||||||
<input name="zhpage" id="ha-zhformpage" type="text" value="@Model.ActivePage" placeholder="Seite"/>
|
<input name="zhpage" id="ha-zhformpage" type="text" value="@Model.ActivePage" placeholder="Seite"/>
|
||||||
<button id="ha-zhformsubmit" type="submit">Nachschlagen</button>
|
<button id="ha-zhformsubmit" type="submit">Nachschlagen</button>
|
||||||
</form>
|
</form>
|
||||||
|
<div class="mr-2 leading-snug text-base px-1 text-red-700 bg-red-50 text-left h-5 whitespace-nowrap overflow-hidden opacity-0" id="ha-zhsearchinfo"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -150,4 +150,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var AvailableLetters = new Set(@Html.Raw(Json.Serialize(Model.AvailableLetters)))
|
||||||
|
var AvailablePages = @Html.Raw(Json.Serialize(Model.AvailablePages))
|
||||||
|
</script>
|
||||||
|
<script defer src="/js/index.js" asp-append-version="true"></script>
|
||||||
@@ -18,16 +18,17 @@
|
|||||||
<div class="ha-activefilterinfo">
|
<div class="ha-activefilterinfo">
|
||||||
@if (Model.SearchType == SearchType.Letters) {
|
@if (Model.SearchType == SearchType.Letters) {
|
||||||
<span><span class="">Briefe</span>@if(Model.IncludeComments == true) {<span> und Stellenkommentare</span>}, die »@Model.ActiveSearch« enthalten. </span><br>
|
<span><span class="">Briefe</span>@if(Model.IncludeComments == true) {<span> und Stellenkommentare</span>}, die »@Model.ActiveSearch« enthalten. </span><br>
|
||||||
|
<a class="ha-reversefilter" asp-controller="Index" asp-action="Index">← Briefübersicht</a>
|
||||||
}
|
}
|
||||||
@if (Model.SearchType == SearchType.Register) {
|
@if (Model.SearchType == SearchType.Register) {
|
||||||
<span><span class="">Registereinträge</span>, die »@Model.ActiveSearch« enthalten. </span><br>
|
<span><span class="">Registereinträge</span>, die »@Model.ActiveSearch« enthalten. </span><br>
|
||||||
<a class="ha-reversefilter" asp-controller="Register" asp-action="Allgemein">← Registerübersicht</a><span> / </span>
|
<a class="ha-reversefilter" asp-controller="Register" asp-action="Allgemein">← Register</a><span></span>
|
||||||
}
|
}
|
||||||
@if (Model.SearchType == SearchType.Science) {
|
@if (Model.SearchType == SearchType.Science) {
|
||||||
<span><span class="">Bibliografische Einträge</span>, die »@Model.ActiveSearch« enthalten. </span><br>
|
<span><span class="">Bibliografische Einträge</span>, die »@Model.ActiveSearch« enthalten. </span><br>
|
||||||
<a class="ha-reversefilter" asp-controller="Register" asp-action="Forschung">← Forschungsbibliographie</a><span> / </span>
|
<a class="ha-reversefilter" asp-controller="Register" asp-action="Forschung">← Forschungsbibliographie</a><span></span>
|
||||||
}
|
}
|
||||||
<a class="ha-reversefilter" asp-controller="Index" asp-action="Index">← Briefübersicht</a>
|
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -47,17 +48,17 @@
|
|||||||
<div class="ha-alternativesearches">
|
<div class="ha-alternativesearches">
|
||||||
@if (Model.SearchType != SearchType.Letters) {
|
@if (Model.SearchType != SearchType.Letters) {
|
||||||
<a asp-controller="Suche" asp-action="Briefe" asp-route-search="@Model.ActiveSearch" asp-route-comments="true" >
|
<a asp-controller="Suche" asp-action="Briefe" asp-route-search="@Model.ActiveSearch" asp-route-comments="true" >
|
||||||
Stattdessen Briefe / Stellenkommentare nach »@Model.ActiveSearch« durchsuchen →
|
Briefe & Stellenkommentare nach »@Model.ActiveSearch« durchsuchen →
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@if (Model.SearchType != SearchType.Register) {
|
@if (Model.SearchType != SearchType.Register) {
|
||||||
<a asp-controller="Suche" asp-action="Register" asp-route-search="@Model.ActiveSearch" >
|
<a asp-controller="Suche" asp-action="Register" asp-route-search="@Model.ActiveSearch" >
|
||||||
Stattdessen Register nach »@Model.ActiveSearch« durchsuchen →
|
Register nach »@Model.ActiveSearch« durchsuchen →
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
@if (Model.SearchType != SearchType.Science) {
|
@if (Model.SearchType != SearchType.Science) {
|
||||||
<a asp-controller="Suche" asp-action="Science" asp-route-search="@Model.ActiveSearch" >
|
<a asp-controller="Suche" asp-action="Science" asp-route-search="@Model.ActiveSearch" >
|
||||||
Stattdessen Forschungsbibliographie nach »@Model.ActiveSearch« durchsuchen →
|
Forschungsbibliographie nach »@Model.ActiveSearch« durchsuchen →
|
||||||
</a>
|
</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public interface IXMLInteractionService {
|
|||||||
public Dictionary<string, SyntaxCheckModel>? GetSCCache();
|
public Dictionary<string, SyntaxCheckModel>? GetSCCache();
|
||||||
public void SetSCCache(Dictionary<string, SyntaxCheckModel>? cache);
|
public void SetSCCache(Dictionary<string, SyntaxCheckModel>? cache);
|
||||||
public XMLParsingState? Collect(List<IFileInfo> Files, Dictionary<string, IXMLRoot>? rootDefs); // XMLFileProvider
|
public XMLParsingState? Collect(List<IFileInfo> Files, Dictionary<string, IXMLRoot>? rootDefs); // XMLFileProvider
|
||||||
public void CreateSearchables(XDocument document); // XMLFileProvider
|
public void CreateCollections(XDocument document); // XMLFileProvider
|
||||||
public Dictionary<string, SyntaxCheckModel>? Test(XMLParsingState? state, string gitcommit); // XMLFileProvider (optimal), Controller (right now)
|
public Dictionary<string, SyntaxCheckModel>? Test(XMLParsingState? state, string gitcommit); // XMLFileProvider (optimal), Controller (right now)
|
||||||
// Controller
|
// Controller
|
||||||
public List<(CollectedItem Item, List<(string Page, string Line, string Preview, string? Identifier)> Results)>? SearchCollection(string collection, string searchword, IReaderService reader, ILibrary? lib);
|
public List<(CollectedItem Item, List<(string Page, string Line, string Preview, string? Identifier)> Results)>? SearchCollection(string collection, string searchword, IReaderService reader, ILibrary? lib);
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ public class XMLInteractionService : IXMLInteractionService {
|
|||||||
return res.ToList();
|
return res.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateSearchables(XDocument document) {
|
public void CreateCollections(XDocument document) {
|
||||||
if (document == null || _RootDefs == null) return;
|
if (document == null || _RootDefs == null) return;
|
||||||
int numProcs = Environment.ProcessorCount;
|
int numProcs = Environment.ProcessorCount;
|
||||||
int concurrencyLevel = numProcs * 2;
|
int concurrencyLevel = numProcs * 2;
|
||||||
|
|||||||
@@ -155,7 +155,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ha-index .ha-indexbody .ha-filterlist {
|
.ha-index .ha-indexbody .ha-filterlist {
|
||||||
@apply hidden md:flex flex-col gap-y-9 pb-4 float-right max-w-lg basis-1/3 min-w-0 shrink
|
@apply hidden md:flex flex-col gap-y-5 pb-4 float-right max-w-lg basis-1/3 min-w-0 shrink
|
||||||
}
|
}
|
||||||
|
|
||||||
.ha-index .ha-indexbody .ha-filterlist .ha-filtertitle {
|
.ha-index .ha-indexbody .ha-filterlist .ha-filtertitle {
|
||||||
@@ -194,6 +194,7 @@
|
|||||||
@apply float-right inline-block px-2 border bg-slate-50 disabled:bg-gray-200 border-slate-200 hover:border-black disabled:hover:border-slate-200 disabled:text-gray-600
|
@apply float-right inline-block px-2 border bg-slate-50 disabled:bg-gray-200 border-slate-200 hover:border-black disabled:hover:border-slate-200 disabled:text-gray-600
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform {
|
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform {
|
||||||
@apply py-1 pl-1 pr-2
|
@apply py-1 pl-1 pr-2
|
||||||
}
|
}
|
||||||
@@ -213,6 +214,10 @@
|
|||||||
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform select {
|
.ha-index .ha-indexbody .ha-filterlist .ha-zhsearchfilter .ha-zhform select {
|
||||||
@apply px-1
|
@apply px-1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ha-index .ha-indexbody .ha-filterlist .ha-searchfilter {
|
||||||
|
@apply mb-5
|
||||||
|
}
|
||||||
|
|
||||||
.ha-index .ha-indexbody .ha-filterlist .ha-searchfilter .ha-searchform {
|
.ha-index .ha-indexbody .ha-filterlist .ha-searchfilter .ha-searchform {
|
||||||
@apply py-1 pl-1 pr-2 flex flex-row gap-x-2
|
@apply py-1 pl-1 pr-2 flex flex-row gap-x-2
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,19 +1,49 @@
|
|||||||
|
function encode(e){return e.replace(/[^]/g,function(e){return"&#"+e.charCodeAt(0)+";"})}
|
||||||
|
|
||||||
const ACTIVATEGOTOFILTER = function(filter, button) {
|
const ACTIVATEGOTOFILTER = function(filter, button) {
|
||||||
let f = filter.value;
|
let f = filter.value;
|
||||||
|
let gotoinfo = document.getElementById("ha-gotoinfo");
|
||||||
|
|
||||||
if (f === "") {
|
if (f === "") {
|
||||||
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof AvailableLetters !== 'undefined' && AvailableLetters != null && !AvailableLetters.has(f)) {
|
||||||
|
if (gotoinfo != null) {
|
||||||
|
gotoinfo.classList.remove("opacity-0");
|
||||||
|
gotoinfo.innerHTML = "Brief Nr. " + encode(f) + " gibt es nicht.";
|
||||||
|
}
|
||||||
|
button.disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ACTIVATEZHSEARCH = function(volume, page, button) {
|
const ACTIVATEZHSEARCH = function(volume, page, button) {
|
||||||
let vol = volume.options[volume.selectedIndex].value;
|
let vol = volume.options[volume.selectedIndex].value;
|
||||||
let pg = page.value;
|
let pg = page.value;
|
||||||
|
let gotoinfo = document.getElementById("ha-zhsearchinfo");
|
||||||
|
|
||||||
if (pg === "") {
|
if (pg === "") {
|
||||||
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = true;
|
button.disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof AvailablePages !== 'undefined' && AvailablePages != null && AvailablePages[vol] != null && !(AvailablePages[vol].indexOf(pg) >= 0)) {
|
||||||
|
if (gotoinfo != null) {
|
||||||
|
gotoinfo.classList.remove("opacity-0");
|
||||||
|
gotoinfo.innerHTML = "ZH Bd. " + encode(vol) + ", S. " + encode(pg) + " gibt es nicht.";
|
||||||
|
}
|
||||||
|
button.disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gotoinfo != null && !gotoinfo.classList.contains("opacity-0")) gotoinfo.classList.add("opacity-0");
|
||||||
button.disabled = false;
|
button.disabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ if (document.getElementById("ha-scrollbutton") !== null) {
|
|||||||
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
|
||||||
})
|
})
|
||||||
// TODO: workaround, bc window does not recieve scroll events anymore
|
// TODO: workaround, bc window does not recieve scroll events anymore
|
||||||
setInterval(() => scrollFunction(), 2500);
|
setInterval(() => scrollFunction(), 1500);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user