mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-29 01:05:32 +00:00
Search Page Adjustments
This commit is contained in:
@@ -65,27 +65,9 @@ public class IndexController : Controller {
|
||||
[Route("/HKB/")]
|
||||
// Order of actions:
|
||||
// Filter, sort by year, paginate, sort by Meta.Sort & .Order, parse
|
||||
public IActionResult Index(string? search, int page = 0) {
|
||||
public IActionResult Index(int page = 0) {
|
||||
var lib = _lib.GetLibrary();
|
||||
List<IGrouping<int, Meta>>? metasbyyear = null;
|
||||
if (search != null) {
|
||||
var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
stopwatch.Start();
|
||||
search = search.Trim();
|
||||
var res = _xmlService.SearchCollection("letters", search, _readerService);
|
||||
if (res == null || !res.Any()) return _error404();
|
||||
var ret = res.ToDictionary(
|
||||
x => x.Index,
|
||||
x => x.Results
|
||||
.Select(y => new SearchResult(search, x.Index) { Page = y.Page, Line = y.Line, Preview = y.Preview })
|
||||
.ToList()
|
||||
);
|
||||
var keys = res.Select(x => x.Index).Where(x => lib.Metas.ContainsKey(x)).Select(x => lib.Metas[x]);
|
||||
var letters = keys.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
|
||||
stopwatch.Stop();
|
||||
Console.WriteLine("SEARCH: " + stopwatch.ElapsedMilliseconds);
|
||||
return _paginateSend(lib, page, letters, null, null, null, search, ret);
|
||||
}
|
||||
metasbyyear = lib.MetasByYear.OrderBy(x => x.Key).ToList();
|
||||
return _paginateSend(lib, page, metasbyyear);
|
||||
}
|
||||
@@ -125,7 +107,7 @@ public class IndexController : Controller {
|
||||
};
|
||||
}
|
||||
|
||||
private List<(int StartYear, int EndYear)>? _paginate(List<IGrouping<int, Meta>>? letters) {
|
||||
internal static List<(int StartYear, int EndYear)>? Paginate(List<IGrouping<int, Meta>>? letters, int lettersForPage) {
|
||||
if (letters == null || !letters.Any()) return null;
|
||||
List<(int StartYear, int EndYear)>? res = null;
|
||||
int startyear = 0;
|
||||
@@ -135,7 +117,7 @@ public class IndexController : Controller {
|
||||
startyear = letterlist.Key;
|
||||
}
|
||||
count += letterlist.Count();
|
||||
if (count >= _lettersForPage) {
|
||||
if (count >= lettersForPage) {
|
||||
if (res == null) res = new List<(int StartYear, int EndYear)>();
|
||||
res.Add((startyear, letterlist.Key));
|
||||
count = 0;
|
||||
@@ -154,10 +136,8 @@ public class IndexController : Controller {
|
||||
List<IGrouping<int, Meta>> metasbyyear,
|
||||
string? person = null,
|
||||
string? zhvolume = null,
|
||||
string? zhpage = null,
|
||||
string? activeSearch = null,
|
||||
Dictionary<string, List<SearchResult>>? searchResults = null) {
|
||||
var pages = _paginate(metasbyyear);
|
||||
string? zhpage = null) {
|
||||
var pages = Paginate(metasbyyear, _lettersForPage);
|
||||
if (pages != null && page >= pages.Count) return _error404();
|
||||
if (pages == null && page > 0) return _error404();
|
||||
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters = null;
|
||||
@@ -173,7 +153,7 @@ public class IndexController : Controller {
|
||||
List<(string Volume, List<string> Pages)>? availablePages = null;
|
||||
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;
|
||||
var model = new IndexViewModel(letters, page, pages, _getAvailablePersons(lib), availablePages.OrderBy(x => x.Volume).ToList(), zhvolume, zhpage, activeSearch, searchResults);
|
||||
var model = new IndexViewModel(letters, page, pages, _getAvailablePersons(lib), availablePages.OrderBy(x => x.Volume).ToList(), zhvolume, zhpage);
|
||||
if (person != null) model.ActivePerson = person;
|
||||
return View("~/Views/HKB/Dynamic/Index.cshtml", model);
|
||||
}
|
||||
|
||||
@@ -23,57 +23,21 @@ public class SucheController : Controller {
|
||||
_lettersForPage = config.GetValue<int>("LettersOnPage");
|
||||
}
|
||||
|
||||
[Route("/HKB/Suche/{letterno}")]
|
||||
public IActionResult GoTo(string letterno) {
|
||||
if (String.IsNullOrWhiteSpace(letterno)) return _error404();
|
||||
letterno = letterno.Trim();
|
||||
var lib = _lib.GetLibrary();
|
||||
var letter = lib.Metas.Where(x => x.Value.Autopsic == letterno);
|
||||
if (letter != null)
|
||||
return RedirectToAction("Index", "Briefe", new { id = letterno });
|
||||
return _error404();
|
||||
}
|
||||
|
||||
[Route("/HKB/Suche/{zhvolume}/{zhpage}")]
|
||||
public IActionResult GoToZH(string zhvolume, string zhpage) {
|
||||
if (String.IsNullOrWhiteSpace(zhvolume) || String.IsNullOrWhiteSpace(zhpage)) return _error404();
|
||||
zhvolume = zhvolume.Trim();
|
||||
zhpage = zhpage.Trim();
|
||||
var lib = _lib.GetLibrary();
|
||||
var pages = lib.Structure.ContainsKey(zhvolume) ? lib.Structure[zhvolume] : null;
|
||||
if (pages == null) return _error404();
|
||||
var lines = pages.ContainsKey(zhpage) ? pages[zhpage] : null;
|
||||
if (lines == null) return _error404();
|
||||
var letters = lines.Aggregate(new HashSet<string>(), (x, y) => { x.Add(y.Value); return x; });
|
||||
if (letters != null && letters.Any() && letters.Count == 1) {
|
||||
string? autopsic = null;
|
||||
if (lib.Metas.ContainsKey(letters.First())) {
|
||||
autopsic = lib.Metas[letters.First()].Autopsic;
|
||||
}
|
||||
if (autopsic == null) return _error404();
|
||||
return RedirectToAction("Index", "Briefe", new { id = autopsic });
|
||||
}
|
||||
if (letters != null && letters.Any()) {
|
||||
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, null, zhvolume, zhpage);
|
||||
}
|
||||
return _error404();
|
||||
}
|
||||
|
||||
[Route("/HKB/Suche")]
|
||||
// Order of actions:
|
||||
// Filter, sort by year, paginate, sort by Meta.Sort & .Order, parse
|
||||
public IActionResult Index(string? search, int page = 0) {
|
||||
public IActionResult Index(string search, string category = "letters", int page = 0) {
|
||||
if (search == null) return _error404();
|
||||
var lib = _lib.GetLibrary();
|
||||
List<IGrouping<int, Meta>>? metasbyyear = null;
|
||||
if (search != null) {
|
||||
var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
var stopwatch = new System.Diagnostics.Stopwatch();
|
||||
stopwatch.Start();
|
||||
|
||||
if (category == "letters") {
|
||||
if (String.IsNullOrWhiteSpace(search))
|
||||
return _paginateSendLetters(lib, page, search, SearchResultType.InvalidSearchTerm, null, null);
|
||||
search = search.Trim();
|
||||
var res = _xmlService.SearchCollection("letters", search, _readerService);
|
||||
if (res == null || !res.Any()) return _error404();
|
||||
if (res == null || !res.Any())
|
||||
return _paginateSendLetters(lib, page, search, SearchResultType.NotFound, null, null);
|
||||
var ret = res.ToDictionary(
|
||||
x => x.Index,
|
||||
x => x.Results
|
||||
@@ -82,29 +46,16 @@ public class SucheController : Controller {
|
||||
);
|
||||
var keys = res.Select(x => x.Index).Where(x => lib.Metas.ContainsKey(x)).Select(x => lib.Metas[x]);
|
||||
var letters = keys.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
|
||||
stopwatch.Stop();
|
||||
Console.WriteLine("SEARCH: " + stopwatch.ElapsedMilliseconds);
|
||||
return _paginateSend(lib, page, letters, null, null, null, search, ret);
|
||||
return _paginateSendLetters(lib, page, search, SearchResultType.Success, ret, letters);
|
||||
} else if (category == " register") {
|
||||
|
||||
}
|
||||
metasbyyear = lib.MetasByYear.OrderBy(x => x.Key).ToList();
|
||||
return _paginateSend(lib, page, metasbyyear);
|
||||
}
|
||||
|
||||
[Route("/HKB/Suche/Person/{person}")]
|
||||
public IActionResult Person(string person, int page = 0) {
|
||||
if (String.IsNullOrWhiteSpace(person)) return _error404();
|
||||
person = person.Trim();
|
||||
var lib = _lib.GetLibrary();
|
||||
List<IGrouping<int, Meta>>? metasbyyear = null;
|
||||
var letters = lib.Metas
|
||||
.Where(x => x.Value.Senders.Contains(person) || x.Value.Receivers.Contains(person))
|
||||
.Select(x => x.Value);
|
||||
if (letters == null) return _error404();
|
||||
metasbyyear = letters.ToLookup(x => x.Sort.Year).OrderBy(x => x.Key).ToList();
|
||||
return _paginateSend(lib, page, metasbyyear, person);
|
||||
stopwatch.Stop();
|
||||
Console.WriteLine("SEARCH: " + stopwatch.ElapsedMilliseconds);
|
||||
return _error404();
|
||||
}
|
||||
|
||||
|
||||
private List<(string Key, string Person)> _getAvailablePersons(ILibrary lib) {
|
||||
return lib.Persons
|
||||
.OrderBy(x => x.Value.Surname)
|
||||
@@ -125,39 +76,28 @@ public class SucheController : Controller {
|
||||
};
|
||||
}
|
||||
|
||||
private List<(int StartYear, int EndYear)>? _paginate(List<IGrouping<int, Meta>>? letters) {
|
||||
if (letters == null || !letters.Any()) return null;
|
||||
List<(int StartYear, int EndYear)>? res = null;
|
||||
int startyear = 0;
|
||||
int count = 0;
|
||||
foreach (var letterlist in letters) {
|
||||
if (count == 0) {
|
||||
startyear = letterlist.Key;
|
||||
}
|
||||
count += letterlist.Count();
|
||||
if (count >= _lettersForPage) {
|
||||
if (res == null) res = new List<(int StartYear, int EndYear)>();
|
||||
res.Add((startyear, letterlist.Key));
|
||||
count = 0;
|
||||
}
|
||||
if (letterlist == letters.Last()) {
|
||||
if (res == null) res = new List<(int StartYear, int EndYear)>();
|
||||
res.Add((startyear, letterlist.Key));
|
||||
}
|
||||
}
|
||||
return res;
|
||||
private List<string>? _paginate(List<(int StartYear, int EndYear)>? pages) {
|
||||
return pages != null ? pages.Select(x => {
|
||||
if (x.StartYear != x.EndYear)
|
||||
return x.StartYear + "–" + x.EndYear;
|
||||
else
|
||||
return x.StartYear.ToString();
|
||||
}).ToList() : null;
|
||||
}
|
||||
|
||||
private IActionResult _paginateSend(
|
||||
private List<string>? _paginate(List<string> comments) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private IActionResult _paginateSendLetters(
|
||||
ILibrary lib,
|
||||
int page,
|
||||
List<IGrouping<int, Meta>> metasbyyear,
|
||||
string? person = null,
|
||||
string? zhvolume = null,
|
||||
string? zhpage = null,
|
||||
string? activeSearch = null,
|
||||
Dictionary<string, List<SearchResult>>? searchResults = null) {
|
||||
var pages = _paginate(metasbyyear);
|
||||
string activeSearch,
|
||||
SearchResultType SRT,
|
||||
Dictionary<string, List<SearchResult>>? searchResults,
|
||||
List<IGrouping<int, Meta>>? metasbyyear
|
||||
) {
|
||||
var pages = IndexController.Paginate(metasbyyear, _lettersForPage);
|
||||
if (pages != null && page >= pages.Count) return _error404();
|
||||
if (pages == null && page > 0) return _error404();
|
||||
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters = null;
|
||||
@@ -170,11 +110,7 @@ public class SucheController : Controller {
|
||||
.ThenBy(x => x.Meta.Order)
|
||||
.ToList()))
|
||||
.ToList();
|
||||
List<(string Volume, List<string> Pages)>? availablePages = null;
|
||||
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;
|
||||
var model = new SucheViewModel(letters, page, pages, _getAvailablePersons(lib), availablePages.OrderBy(x => x.Volume).ToList(), zhvolume, zhpage, activeSearch, searchResults);
|
||||
if (person != null) model.ActivePerson = person;
|
||||
var model = new SucheViewModel(SearchType.Letter, SearchResultType.Success, page, _paginate(pages), activeSearch, searchResults, letters);
|
||||
return View("~/Views/HKB/Dynamic/Suche.cshtml", model);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@ public class IndexViewModel {
|
||||
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 Dictionary<string, List<SearchResult>>? SearchResults { get; private set; }
|
||||
|
||||
public IndexViewModel(
|
||||
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters,
|
||||
@@ -21,9 +19,7 @@ public class IndexViewModel {
|
||||
List<(string Key, string Name)>? availablePersons,
|
||||
List<(string Volume, List<string> Pages)>? availablePages,
|
||||
string? activeVolume,
|
||||
string? activePage,
|
||||
string? activeSearch,
|
||||
Dictionary<string, List<SearchResult>>? searchResults
|
||||
string? activePage
|
||||
) {
|
||||
Letters = letters;
|
||||
if (letters != null)
|
||||
@@ -36,7 +32,5 @@ public class IndexViewModel {
|
||||
AvailablePages = availablePages;
|
||||
ActiveVolume = activeVolume;
|
||||
ActivePage = activePage;
|
||||
ActiveSearch = activeSearch;
|
||||
SearchResults = searchResults;
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ public class SearchResult {
|
||||
public string Index { get; private set; }
|
||||
public string? Page { get; set; }
|
||||
public string? Line { get; set; }
|
||||
public string? Lemma { get; set; }
|
||||
public string? Link { get; set; }
|
||||
public string? Preview { get; set; }
|
||||
// TODO:
|
||||
public string? ParsedPreview { get; set; }
|
||||
|
||||
@@ -1,41 +1,48 @@
|
||||
namespace HaWeb.Models;
|
||||
using HaDocument.Models;
|
||||
|
||||
public enum SearchType {
|
||||
Letter,
|
||||
Register,
|
||||
Marginals
|
||||
}
|
||||
|
||||
public enum SearchResultType {
|
||||
Success,
|
||||
OutOfBounds,
|
||||
NotFound,
|
||||
InvalidSearchTerm
|
||||
}
|
||||
|
||||
public class SucheViewModel {
|
||||
public List<(int Year, List<BriefeMetaViewModel> LetterList)>? Letters { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
public int ActiveYear { get; private set; }
|
||||
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 int ActivePage { get; private set; }
|
||||
public List<string>? AvailablePages { get; private set; }
|
||||
public string ActiveSearch { get; private set; }
|
||||
public Dictionary<string, List<SearchResult>>? SearchResults { get; private set; }
|
||||
public SearchResultType SearchResultType { get; private set; }
|
||||
public SearchType SearchType { 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,
|
||||
List<(string Volume, List<string> Pages)>? availablePages,
|
||||
string? activeVolume,
|
||||
string? activePage,
|
||||
string? activeSearch,
|
||||
Dictionary<string, List<SearchResult>>? searchResults
|
||||
SearchType searchType,
|
||||
SearchResultType searchResultType,
|
||||
int activePage,
|
||||
List<string>? availablePages,
|
||||
string activeSearch,
|
||||
Dictionary<string, List<SearchResult>>? searchResults,
|
||||
List<(int Year, List<BriefeMetaViewModel> LetterList)>? letters
|
||||
) {
|
||||
Letters = letters;
|
||||
if (letters != null)
|
||||
Count = letters.Select(x => x.LetterList.Count).Aggregate(0, (x, y) => { x += y; return x; });
|
||||
else
|
||||
Count = 0;
|
||||
ActiveYear = activeYear;
|
||||
AvailableYears = availableYears;
|
||||
AvailablePersons = availablePersons;
|
||||
AvailablePages = availablePages;
|
||||
ActiveVolume = activeVolume;
|
||||
|
||||
SearchType = searchType;
|
||||
SearchResultType = searchResultType;
|
||||
ActivePage = activePage;
|
||||
AvailablePages = availablePages;
|
||||
ActiveSearch = activeSearch;
|
||||
SearchResults = searchResults;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="ha-indexnav">
|
||||
@if (Model.AvailableYears != null && Model.AvailableYears.Any() && Model.AvailableYears.Count > 1) {
|
||||
@for(var i = 0; i < Model.AvailableYears.Count; i++) {
|
||||
<a class="@(Model.ActiveYear == i ? "active" : "")" asp-route-person="@Model.ActivePerson" asp-route-search="@Model.ActiveSearch" asp-controller="Index" asp-route-page="@i">
|
||||
<a class="@(Model.ActiveYear == i ? "active" : "")" asp-route-person="@Model.ActivePerson" asp-controller="Index" asp-route-page="@i">
|
||||
@if (Model.AvailableYears[i].StartYear != Model.AvailableYears[i].EndYear) {
|
||||
<span>
|
||||
@Model.AvailableYears[i].StartYear-@Model.AvailableYears[i].EndYear
|
||||
@@ -38,15 +38,6 @@
|
||||
<div class="ha-letterlistentry">
|
||||
<a asp-controller="Briefe" asp-action="Index" asp-route-id="@letter.Meta.Autopsic">
|
||||
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true, false))
|
||||
@*
|
||||
<div class="ha-letterlistentryheader">
|
||||
<div class="ha-letterlistautopsic">@letter.Meta.Autopsic</div>
|
||||
<div class="ha-letterlistpills">@await Html.PartialAsync("/Views/Shared/_Pills.cshtml", (letter, true))</div>
|
||||
</div>
|
||||
<div class="ha-letterlistletterdata">
|
||||
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true, true))
|
||||
</div>
|
||||
*@
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
@@ -152,12 +143,9 @@
|
||||
<div class="ha-searchfilter">
|
||||
<div class="ha-filtertitle">
|
||||
Volltextsuche
|
||||
@if (Model.ActiveSearch != null) {
|
||||
<a class="ha-reversefilter" asp-controller="Index" asp-action="Index">← Auswahl aufheben</a>
|
||||
}
|
||||
</div>
|
||||
<form class="ha-searchform" id="ha-searchform" asp-controller="Suche" asp-action="Index" method="get">
|
||||
<input id="ha-searchformtext" name="search" type="text" placeholder="Suchbegriff" value="@Model.ActiveSearch"/>
|
||||
<input id="ha-searchformtext" name="search" type="text" placeholder="Suchbegriff"/>
|
||||
<button id="ha-searchformsubmit" type="submit">Suchen</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -10,20 +10,46 @@
|
||||
|
||||
<div class="ha-searchhead">
|
||||
<h1>Suche</h1>
|
||||
|
||||
@* Full-Text-Search *@
|
||||
<div class="ha-searchfilter">
|
||||
<div class="ha-filtertitle">
|
||||
@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" asp-controller="Suche" asp-action="Index" method="get">
|
||||
<input id="ha-searchformtext" name="search" type="text" placeholder="Suchbegriff" value="@Model.ActiveSearch"/>
|
||||
<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;
|
||||
}
|
||||
|
||||
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));
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="ha-searchnav">
|
||||
@if (Model.AvailableYears != null && Model.AvailableYears.Any() && Model.AvailableYears.Count > 1) {
|
||||
@for(var i = 0; i < Model.AvailableYears.Count; i++) {
|
||||
<a class="@(Model.ActiveYear == i ? "active" : "")" asp-route-person="@Model.ActivePerson" asp-route-search="@Model.ActiveSearch" asp-controller="Suche" asp-route-page="@i">
|
||||
@if (Model.AvailableYears[i].StartYear != Model.AvailableYears[i].EndYear) {
|
||||
<span>
|
||||
@Model.AvailableYears[i].StartYear-@Model.AvailableYears[i].EndYear
|
||||
</span>
|
||||
}
|
||||
else {
|
||||
<span>
|
||||
@Model.AvailableYears[i].StartYear
|
||||
</span>
|
||||
}
|
||||
@if (Model.AvailablePages != null && Model.AvailablePages.Any() && Model.AvailablePages.Count > 1) {
|
||||
@for(var i = 0; i < Model.AvailablePages.Count; i++) {
|
||||
<a class="@(Model.ActivePage == i ? "active" : "")" asp-route-search="@Model.ActiveSearch" asp-controller="Suche" asp-route-page="@i">
|
||||
<span>
|
||||
@Model.AvailablePages[i]
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
}
|
||||
@@ -38,15 +64,6 @@
|
||||
<div class="ha-letterlistentry">
|
||||
<a asp-controller="Briefe" asp-action="Index" asp-route-id="@letter.Meta.Autopsic">
|
||||
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true, false))
|
||||
@*
|
||||
<div class="ha-letterlistentryheader">
|
||||
<div class="ha-letterlistautopsic">@letter.Meta.Autopsic</div>
|
||||
<div class="ha-letterlistpills">@await Html.PartialAsync("/Views/Shared/_Pills.cshtml", (letter, true))</div>
|
||||
</div>
|
||||
<div class="ha-letterlistletterdata">
|
||||
@await Html.PartialAsync("/Views/Shared/_LetterHead.cshtml", (letter, true, true))
|
||||
</div>
|
||||
*@
|
||||
</a>
|
||||
|
||||
@if (Model.SearchResults != null && Model.SearchResults.ContainsKey(letter.Meta.Index)) {
|
||||
@@ -67,152 +84,8 @@
|
||||
</div>
|
||||
|
||||
<div class="ha-filterlist">
|
||||
@* Go To Letter *@
|
||||
<div class="ha-gotofilter">
|
||||
<div class="ha-filtertitle">H K 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 = "/HKB/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 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 H Band</span>
|
||||
<select id="ha-zhformvolume">
|
||||
@foreach (var volume in Model.AvailablePages) {
|
||||
<option>@volume.Volume</option>
|
||||
}
|
||||
</select>
|
||||
<span>/ </span>
|
||||
<input id="ha-zhformpage" type="text" value="@Model.ActivePage" placeholder="Seite"/>
|
||||
<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 = "/HKB/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" asp-controller="Suche" asp-action="Index" method="get">
|
||||
<input id="ha-searchformtext" name="search" type="text" placeholder="Suchbegriff" value="@Model.ActiveSearch"/>
|
||||
<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;
|
||||
}
|
||||
|
||||
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));
|
||||
});
|
||||
</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="Person" asp-route-person="@person.Key" asp-route-page="@null">
|
||||
@person.Name
|
||||
</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"StoredFilePathLinux": "/home/simon/Downloads/test/",
|
||||
"StoredFilePathWindows": "C:/Users/simon/Downloads/test/",
|
||||
"StoredFilePathWindows": "D:/test/",
|
||||
"FileSizeLimit": 52428800,
|
||||
"AvailableStartYear": 1700,
|
||||
"AvailableEndYear": 1800,
|
||||
|
||||
Reference in New Issue
Block a user