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