Somehow did the first page

This commit is contained in:
schnulller
2022-06-16 21:47:57 +02:00
parent 25e032be63
commit 078c4b75b8
13 changed files with 347 additions and 74 deletions

View File

@@ -40,7 +40,7 @@ public class SucheController : Controller {
var metas = lib.Metas.Where(x => letters.Contains(x.Key)).Select(x => x.Value);
if (metas == null) return _error404();
var metasbyyear = metas.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
return _paginateSend(lib, 0, metasbyyear);
return _paginateSend(lib, 0, metasbyyear, null, zhvolume, zhpage);
}
return _error404();
}
@@ -106,7 +106,7 @@ public class SucheController : Controller {
return res;
}
private IActionResult _paginateSend(ILibrary lib, int page, List<IGrouping<int, Meta>>? metasbyyear, string? person = null) {
private IActionResult _paginateSend(ILibrary lib, int page, List<IGrouping<int, Meta>>? metasbyyear, string? person = null, string? zhvolume = null, string? zhpage = null) {
var pages = _paginate(metasbyyear);
if (pages != null && page >= pages.Count) return _error404();
if (pages == null && page > 0) return _error404();
@@ -120,7 +120,10 @@ public class SucheController : Controller {
.ThenBy(x => x.Meta.Order)
.ToList()))
.ToList();
var model = new SucheViewModel(letters, page, pages, _getAvailablePersons(lib));
List<(string Volume, List<string> Pages)>? availablePages = null;
availablePages = lib.Structure.Select(x => (x.Key, x.Value.Select(x => x.Key).ToList())).ToList();
zhvolume = zhvolume == null ? "1" : zhvolume;
var model = new SucheViewModel(letters, page, pages, _getAvailablePersons(lib), availablePages.OrderBy(x => x.Volume).ToList(), zhvolume, zhpage);
if (person != null) model.ActivePerson = person;
return View("Index", model);
}

View File

@@ -34,11 +34,9 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
}
public ILibrary? SetLibrary(string filepath, ModelStateDictionary? ModelState = null) {
try
{
try {
Library = HaDocument.Document.Create(new HaWeb.Settings.HaDocumentOptions() { HamannXMLFilePath = filepath, AvailableYearRange = (StartYear, EndYear) });
}
catch (Exception ex) {
} catch (Exception ex) {
if (ModelState != null) ModelState.AddModelError("Error", "Das Dokument konnte nicht geparst werden: " + ex.Message);
return null;
}
@@ -52,7 +50,7 @@ public class HaDocumentWrapper : IHaDocumentWrappper {
private void _AutoLoad(List<IFileInfo> files) {
var orderdlist = files.OrderByDescending(x => x.LastModified);
foreach(var item in orderdlist) {
foreach (var item in orderdlist) {
if (SetLibrary(item.PhysicalPath) != null) {
_xmlProvider.SetInProduction(item);
return;

View File

@@ -7,8 +7,20 @@ public class SucheViewModel {
public List<(int StartYear, int EndYear)>? AvailableYears { get; private set; }
public string? ActivePerson {get; set; }
public List<(string Key, string Name)>? AvailablePersons { get; private set; }
public List<(string Volume, List<string> Pages)>? AvailablePages { get; private set; }
public string? ActiveVolume { get; private set; }
public string? ActivePage { get; private set; }
public string? ActiveSearch { get; private set; }
public SucheViewModel(List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters, int activeYear, List<(int StartYear, int EndYear)>? availableYears, List<(string Key, string Name)>? availablePersons) {
public SucheViewModel(
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters,
int activeYear,
List<(int StartYear, int EndYear)>? availableYears,
List<(string Key, string Name)>? availablePersons,
List<(string Volume, List<string> Pages)>? availablePages,
string? activeVolume,
string? activePage
) {
Letters = letters;
if (letters != null)
Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; });
@@ -17,5 +29,8 @@ public class SucheViewModel {
ActiveYear = activeYear;
AvailableYears = availableYears;
AvailablePersons = availablePersons;
AvailablePages = availablePages;
ActiveVolume = activeVolume;
ActivePage = activePage;
}
}

View File

@@ -48,16 +48,16 @@ Veränderungenen in der Funktionalität für den Benutzer
- Anzeige Briefe beim Namen (?)
- GeoCities und Personen-Verweise (?)
Veränderungen in der Funktionalität für die Forscher
Veränderungen in der Funktionalität für die Redakteure
- Online-Syntaxcheck für XML-Dateien
- Online-Cross-Dateien-Check (bsp. verweist jede Marginalie auf eine existierende Zeile)
- Erstellung einer HAMANN.xml-Datei
- Hochladen der HAMANN.xml-Datei auf die Plattform
Veränderungen im Code
- Anpassung des Codes an .NET 6 (Kopieren / Einfügen)
- Anpassung des Codes an .NET 6
- Umzug nach CSS Framework Tailwind
- Code wird aufgeräumt und sortiert
- Code ist aufgeräumt und sortiert
- Leichtere Anpassungen an zukünftige Bedürfnisse (Wartungszeiten minimieren)
- Auslagerungen einzelner Einstellungen in Einstellungsdateien
- Code open source zugänglich machen?

View File

@@ -7,7 +7,6 @@
</div>
</div>
<div class="ha-metadata">
<div class="ha-metadatarows">
<div class="ha-metadataupperrow">
<div class="ha-metadatadate">
@Model.Letter.Meta.Date
@@ -93,24 +92,22 @@
}
}
</div>
<div class="ha-metadatapersons">
@if (!String.IsNullOrWhiteSpace(Model.Letter.ParsedReceivers)) {
@if (Model.Letter.Meta.isDraft == HaDocument.Models.OptionalBool.True) {
<span>@Html.Raw(Model.Letter.ParsedSenders)</span>
<div class="ha-tooltip">
<div class="ha-tooltiptext" style="bottom: 100%;">
Entwurf
</div>
<div class="ha-metadatapersons">
@if (!String.IsNullOrWhiteSpace(Model.Letter.ParsedReceivers)) {
@if (Model.Letter.Meta.isDraft == HaDocument.Models.OptionalBool.True) {
<span>@Html.Raw(Model.Letter.ParsedSenders)</span>
<div class="ha-tooltip">
<div class="ha-tooltiptext" style="bottom: 100%;">
Entwurf
</div>
<span>@Html.Raw(Model.Letter.ParsedReceivers)</span>
}
else {
<span>@Html.Raw(Model.Letter.ParsedSenders) → @Html.Raw(Model.Letter.ParsedReceivers)</span>
}
}
</div>
</div>
</div>
<span>@Html.Raw(Model.Letter.ParsedReceivers)</span>
}
else {
<span>@Html.Raw(Model.Letter.ParsedSenders) → @Html.Raw(Model.Letter.ParsedReceivers)</span>
}
}
</div>
</div>
</div>

View File

@@ -7,9 +7,11 @@
<div class="ha-search">
@if (Model.Letters != null) {
<div class="ha-letterlisthead">
<div class="ha-searchhead">
<h1>Briefauswahl</h1>
<div class="ha-letterlistnav">
<div class="ha-searchnav">
@if (Model.AvailableYears != null && Model.AvailableYears.Any()) {
@for(var i = 0; i < Model.AvailableYears.Count; i++) {
<a class="@(Model.ActiveYear == i ? "active" : "")" asp-route-person="@Model.ActivePerson" asp-controller="Suche" asp-action="Index" asp-route-page="@i">
@@ -28,23 +30,177 @@
}
</div>
</div>
<div class="ha-personlist">
@if(Model.AvailablePersons != null) {
@foreach (var person in Model.AvailablePersons) {
<a class="@(Model.ActivePerson == person.Key ? "active" : "")" asp-controller="Suche" asp-action="Index" asp-route-person="@person.Key" asp-route-page="@null">
@person.Name
<div class="ha-searchbody">
<div class="ha-letterlist">
@* Letter Loop *@
@foreach (var year in Model.Letters) {
foreach (var letter in year.LetterList) {
<a class="ha-letterlistentry" asp-controller="Briefe" asp-action="Index" asp-route-id="@letter.Meta.Autopsic">
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true))
</a>
}
}
</div>
<div class="ha-letterlist">
@foreach (var year in Model.Letters) {
foreach (var letter in year.LetterList) {
<a asp-controller="Briefe" asp-action="Index" asp-route-id="@letter.Meta.Autopsic">
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true))
</a>
}
}
</div>
<div class="ha-filterlist">
@* Go To Letter *@
<div class="ha-gotofilter">
<div class="ha-filtertitle">H&hairsp;K&hairsp;B</div>
<form class="ha-gotoform" id="ha-gotoform">
<div class="ha-gototext">
Briefnummer
</div>
<input type="text" id="ha-gotoletternumber" class="ha-gotoletternumber" />
<button type="submit" id="ha-gotoformsubmit">Nachschlagen</button>
</form>
</div>
<script>
const ACTIVATEGOTOFILTER = function(filter, button) {
let f = filter.value;
if (f === "") {
button.disabled = true;
return;
}
button.disabled = false;
}
const SUBMITGOTO = function(filter) {
let f = filter.value;
window.location.href = "/Suche/" + f;
}
window.addEventListener("load", () => {
let gotofilter = document.getElementById("ha-gotoletternumber");
let gotosubmitbtn = document.getElementById("ha-gotoformsubmit");
let gotoform = document.getElementById("ha-gotoform");
ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn);
gotofilter.addEventListener("input", () => ACTIVATEGOTOFILTER(gotofilter, gotosubmitbtn));
gotoform.addEventListener("submit", (ev) => {
ev.preventDefault();
SUBMITGOTO(gotofilter);
});
});
</script>
@* ZH Loopkup *@
@if (Model.AvailablePages != null) {
<div class="ha-zhsearchfilter">
<div class="ha-filtertitle">
Suche in Z&hairsp;H
@if (Model.ActivePage != null) {
<a class="ha-reversefilter" asp-controller="Suche" asp-action="index">← Auswahl aufheben</a>
}
</div>
<form class="ha-zhform" id="ha-zhform">
<span>Z&hairsp;H Band</span>
<select id="ha-zhformvolume">
@foreach (var volume in Model.AvailablePages) {
<option>@volume.Volume</option>
}
</select>
<span>, Seite</span>
<input id="ha-zhformpage" type="text" value="@Model.ActivePage"/>
<button id="ha-zhformsubmit" type="submit">Nachschlagen</button>
</form>
</div>
<script>
const ACTIVATEZHSEARCH = function(volume, page, button) {
let vol = volume.options[volume.selectedIndex].value;
let pg = page.value;
if (pg === "") {
button.disabled = true;
return;
}
button.disabled = false;
}
const SUBMITZHSEARCH = function(volume, page) {
let vol = volume.options[volume.selectedIndex].value;
let pg = page.value;
window.location.href = "/Suche/" + vol + "/" + pg;
}
window.addEventListener("load", () => {
let vol = document.getElementById("ha-zhformvolume");
let pg = document.getElementById("ha-zhformpage");
let zhsubmitbtn = document.getElementById("ha-zhformsubmit");
let zhsearchform = document.getElementById("ha-zhform");
ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn);
vol.addEventListener("change", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
pg.addEventListener("input", () => ACTIVATEZHSEARCH(vol, pg, zhsubmitbtn));
zhsearchform.addEventListener("submit", (ev) => {
ev.preventDefault();
SUBMITZHSEARCH(vol, pg);
});
});
</script>
}
@* Full-Text-Search *@
<div class="ha-searchfilter">
<div class="ha-filtertitle">
Volltextsuche
@if (Model.ActiveSearch != null) {
<a class="ha-reversefilter" asp-controller="Suche" asp-action="index">← Auswahl aufheben</a>
}
</div>
<form class="ha-searchform" id="ha-searchform">
<input id="ha-searchformtext" type="text" placeholder="Suchbegriff"/>
<button id="ha-searchformsubmit" type="submit">Suchen</button>
</form>
</div>
<script>
const ACTIVATESEARCHFILTER = function(filter, button) {
let f = filter.value;
if (f === "") {
button.disabled = true;
return;
}
button.disabled = false;
}
const SUBMITSEARCH = function(filter) {
let f = filter.value;
window.location.href = "/Suche/" + f;
}
window.addEventListener("load", () => {
let searchfilter = document.getElementById("ha-searchformtext");
let searchsubmitbtn = document.getElementById("ha-searchformsubmit");
let searchform = document.getElementById("ha-searchform");
ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn);
searchfilter.addEventListener("input", () => ACTIVATESEARCHFILTER(searchfilter, searchsubmitbtn));
searchform.addEventListener("submit", (ev) => {
ev.preventDefault();
SUBMITSEARCH(searchfilter);
});
});
</script>
@* Person Filter *@
@if(Model.AvailablePersons != null) {
<div class="ha-personfilter">
<div class="ha-filtertitle">
Korrespondenzpartner:innen
@if (Model.ActivePerson != null) {
<a class="ha-reversefilter" asp-controller="Suche" asp-action="index">← Auswahl aufheben</a>
}
</div>
<div class="ha-personlist">
<a class="ha-personlistperson @(Model.ActivePerson == null ? "active" : "")" asp-controller="Suche" asp-action="Index">Alle</a>
@foreach (var person in Model.AvailablePersons) {
<a class="ha-personlistperson @(Model.ActivePerson == person.Key ? "active" : "")" asp-controller="Suche" asp-action="Index" asp-route-person="@person.Key" asp-route-page="@null">
@person.Name
</a>
}
</div>
</div>
}
</div>
</div>
}
</div>

View File

@@ -16,27 +16,15 @@
}
.ha-letterhead .ha-metadata {
@apply flex self-end grow shrink-0
}
.ha-letterhead .ha-metadata .ha-metadatarows {
@apply flex flex-col
@apply flex self-end grow flex-col
}
.ha-letterhead .ha-metadata .ha-metadataupperrow {
@apply flex flex-row leading-snug
}
.strikethrough {
@apply line-through
}
.ha-letterhead
.ha-metadata
.ha-metadatarows
.ha-metadataupperrow
.ha-metadatadate {
@apply flex caps-petite numeric-mediaeval
.ha-letterhead .ha-metadata .ha-metadataupperrow .ha-metadatadate {
@apply flex caps-petite numeric-mediaeval whitespace-nowrap
}
.ha-letterhead .ha-metadata .ha-tooltip {
@@ -52,7 +40,7 @@
}
.ha-letterhead .ha-metadata .ha-metadataupperrow .ha-pill {
@apply text-sm rounded px-1.5 ml-2 py-0.5 leading-none caps-allpetite tracking-wide
@apply text-sm rounded px-1.5 ml-2 py-0.5 leading-none caps-allpetite tracking-wide whitespace-nowrap
}
.ha-letterhead .ha-metadata .ha-metadataupperrow .ha-pill .ha-cross {

File diff suppressed because one or more lines are too long

View File

@@ -79,7 +79,7 @@
}
.ha-register .ha-register-head h1 {
@apply font-bold text-xl desktop:font-normal desktop:text-4xl mb-6 inline-block
@apply font-bold text-2xl desktop:font-normal desktop:text-5xl mb-6 inline-block
}
.ha-register .ha-register-head .ha-register-add {

View File

@@ -1,9 +1,121 @@
@layer components {
.ha-search {
@apply pt-9 md:pt-12 px-9 md:px-16 bg-slate-50
@apply bg-slate-50
}
.ha-search .ha-letterlist {
.ha-search .ha-searchhead {
@apply pt-9 md:pt-12 px-9 md:px-16 border-b-2
}
.ha-search .ha-searchhead h1 {
@apply font-bold text-2xl desktop:font-normal desktop:text-5xl mb-6 inline-block font-serif
}
.ha-search .ha-searchhead .ha-searchnav {
@apply font-sans oldstyle-nums
}
.ha-search .ha-searchhead .ha-searchnav a {
@apply mr-3 inline-block
}
.ha-search .ha-searchhead .ha-searchnav a.active {
@apply border-b-4
}
.ha-search .ha-searchbody {
@apply pt-4 pr-4 clear-both flex flex-row gap-x-4
}
.ha-search .ha-searchbody .ha-letterlist {
@apply pl-6 pb-4 basis-2/3 grow-0
}
.ha-search .ha-searchbody .ha-letterlist .ha-letterlistentry:not(:first-child) {
@apply block mt-4
}
.ha-search .ha-searchbody .ha-filterlist {
@apply flex flex-col gap-y-5 pb-4 float-right max-w-lg basis-1/3 min-w-0 shrink
}
.ha-search .ha-searchbody .ha-filterlist > div {
@apply border border-slate-200 hover:shadow transition-shadow duration-200 bg-slate-50
}
.ha-search .ha-searchbody .ha-filterlist .ha-filtertitle {
@apply text-2xl px-3 pb-2 pt-3 font-serif leading-none border-b bg-slate-100
}
.ha-search .ha-searchbody .ha-filterlist .ha-reversefilter {
@apply inline-block text-sm ml-2
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter {
@apply flex flex-row bg-slate-100
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter .ha-filtertitle {
@apply inline-block border-none
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter form .ha-gototext {
@apply inline-block font-sans mr-2
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter form {
@apply inline-block font-sans py-2 pr-2 grow
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter form input {
@apply w-14 px-1 border
}
.ha-search .ha-searchbody .ha-filterlist .ha-gotofilter form button {
@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-slate-600
}
.ha-search .ha-searchbody .ha-filterlist .ha-zhsearchfilter .ha-zhform {
@apply py-2 px-3
}
.ha-search .ha-searchbody .ha-filterlist .ha-zhsearchfilter .ha-zhform > span {
@apply whitespace-nowrap
}
.ha-search .ha-searchbody .ha-filterlist .ha-zhsearchfilter .ha-zhform input {
@apply w-14 px-1 border
}
.ha-search .ha-searchbody .ha-filterlist .ha-zhsearchfilter .ha-zhform button {
@apply float-right px-2 border bg-slate-50 border-slate-200 disabled:bg-gray-200 hover:border-black disabled:hover:border-slate-200 disabled:text-slate-600
}
.ha-search .ha-searchbody .ha-filterlist .ha-zhsearchfilter .ha-zhform select {
@apply px-1
}
.ha-search .ha-searchbody .ha-filterlist .ha-searchfilter .ha-searchform {
@apply py-2 px-3 flex flex-row gap-x-2
}
.ha-search .ha-searchbody .ha-filterlist .ha-searchfilter .ha-searchform input {
@apply px-1 border grow min-w-0
}
.ha-search .ha-searchbody .ha-filterlist .ha-searchfilter .ha-searchform button {
@apply float-right px-2 border border-slate-200 hover:border-black disabled:bg-gray-200 disabled:hover:border-slate-200 disabled:text-slate-600
}
.ha-search .ha-searchbody .ha-filterlist .ha-personfilter .ha-personlist {
@apply max-h-64 overflow-y-auto overflow-x-hidden pb-2
}
.ha-search .ha-searchbody .ha-filterlist .ha-personfilter .ha-personlist a {
@apply block px-3 hover:!bg-slate-200 !transition-none
}
.ha-search .ha-searchbody .ha-filterlist .ha-personfilter .ha-personlist a:nth-child(even) {
@apply block bg-slate-100
}
}

View File

@@ -45,6 +45,10 @@
@apply transition-colors duration-100
}
.strikethrough {
@apply line-through
}
body {
@apply text-base desktop:text-lg w-full h-full;
}

View File

@@ -5,11 +5,11 @@
}
.ha-static h3 {
@apply text-hamannHighlight dark:text-white dark:font-bold
@apply text-hamannSlate-900 dark:text-white dark:font-bold
}
.ha-static table th {
@apply text-hamannHighlight dark:text-white dark:font-bold
@apply text-hamannSlate-900 dark:text-white dark:font-bold
}
.ha-static table tr:nth-child(even) {
@@ -22,7 +22,7 @@
}
.ha-static h1 {
@apply font-bold text-xl desktop:font-normal desktop:text-4xl mb-9
@apply font-bold text-2xl desktop:font-normal desktop:text-5xl mb-9 unhyphenate
}
.ha-static h2 {
@@ -30,7 +30,7 @@
}
.ha-static h3 {
@apply mt-4 mb-2
@apply mt-4 mb-2 font-bold
}
.ha-static table {
@@ -38,7 +38,7 @@
}
.ha-static table th {
@apply pl-2 pr-2 desktop:pr-4 text-left font-normal
@apply pl-2 pr-2 desktop:pr-4 text-left font-bold
}
.ha-static table tr td {

View File

@@ -40,7 +40,7 @@
<personDef index="29" name="" />
<personDef index="30" name="" />
<personDef index="31" name="Immanuel Kant" vorname="Immanuel" nachname="Kant" />
<personDef index="32" name="," />
<personDef index="32" name="" />
<personDef index="33" name="Georg David Kypke" vorname="Georg David" nachname="Kypke" />
<personDef index="34" name="" />
<personDef index="35" name="Christ Anton Tottien" vorname="Christ Anton" nachname="Tottien" />