Added a lot of stuff

This commit is contained in:
schnulller
2022-05-29 20:27:34 +02:00
parent 9504b89f30
commit 7929a34f5a
14 changed files with 308 additions and 143 deletions

View File

@@ -1,16 +1,55 @@
namespace HaWeb.Models;
using HaDocument.Models;
using System.Web;
public class BriefeMetaViewModel
{
public Meta Meta { get; private set; }
public bool HasMarginals { get; private set; }
public bool ShowZHData { get; private set; }
public bool HasText { get; set; } = true;
private string? _ParsedSenders;
private string? _ParsedReceivers;
private string? _ParsedZHString;
public string? ParsedSenders
{
get => _ParsedSenders;
set
{
if (value != null)
_ParsedSenders = HttpUtility.HtmlEncode(value);
else
_ParsedSenders = value;
}
}
public string? ParsedReceivers
{
get => _ParsedReceivers;
set
{
if (value != null)
_ParsedReceivers = HttpUtility.HtmlEncode(value);
else
_ParsedReceivers = value;
}
}
public string? ParsedZHString
{
get => _ParsedZHString;
set
{
if (value != null)
_ParsedZHString = HttpUtility.HtmlEncode(value);
else
_ParsedZHString = value;
}
}
public string? ParsedSenders { get; set; }
public string? ParsedReceivers { get; set; }
public string? ParsedZHString { get; set; }
public (BriefeMetaViewModel, string)? Next { get; set; }
public (BriefeMetaViewModel, string)? Prev { get; set; }

View File

@@ -1,4 +1,5 @@
namespace HaWeb.Models;
using System.Web;
public class BriefeViewModel
{
@@ -6,14 +7,70 @@ public class BriefeViewModel
public string Index { get; private set; }
public BriefeMetaViewModel MetaData { get; private set; }
private List<(string, string, string)>? _ParsedMarginals;
private List<(string, string, string, string, string, string)>? _ParsedEdits;
public List<(string, string, string, string, string)>? _ParsedHands;
public string? ParsedText { get; set; }
public List<(string, string, string)>? ParsedMarginals { get; set; }
public string? ParsedTradition { get; set; }
public bool MinWidth { get; set; } = false;
// From, Until, Reference, Edit, sartpage, startline
public List<(string, string, string, string, string, string)>? ParsedEdits { get; set; }
public List<(string, string, string, string, string, string)>? ParsedEdits
{
get => _ParsedEdits;
set
{
if (value != null)
_ParsedEdits = value.Select(x => (
HttpUtility.HtmlEncode(x.Item1),
HttpUtility.HtmlEncode(x.Item2),
x.Item3,
x.Item4,
HttpUtility.HtmlAttributeEncode(x.Item5),
HttpUtility.HtmlAttributeEncode(x.Item6)
)).ToList();
else
_ParsedEdits = null;
}
}
// From, Until, Person, startpage, startline
public List<(string, string, string, string, string)>? ParsedHands { get; set; }
public List<(string, string, string, string, string)>? ParsedHands
{
get => _ParsedHands;
set
{
if (value != null)
_ParsedHands = value.Select(x => (
HttpUtility.HtmlEncode(x.Item1),
HttpUtility.HtmlEncode(x.Item2),
HttpUtility.HtmlEncode(x.Item3),
HttpUtility.HtmlAttributeEncode(x.Item4),
HttpUtility.HtmlAttributeEncode(x.Item5)
)).ToList();
else
_ParsedHands = null;
}
}
// Page, Line, Element
public List<(string, string, string)>? ParsedMarginals
{
get => _ParsedMarginals;
set
{
if (value != null)
_ParsedMarginals = value.Select(x => (
HttpUtility.HtmlEncode(x.Item1),
HttpUtility.HtmlEncode(x.Item2),
x.Item3
)).ToList();
else
_ParsedMarginals = null;
}
}
public BriefeViewModel(string id, string index, BriefeMetaViewModel meta)
{
Id = id;

View File

@@ -1,20 +1,56 @@
namespace HaWeb.Models;
using System.Web;
public class RegisterViewModel {
public class RegisterViewModel
{
public string Category { get; private set; }
public string Id { get; private set; }
public string Title { get; private set; }
public string Title { get; private set; }
private List<(string, string)>? _AvailableCategories;
private List<(string, string)>? _AvailableSideCategories;
public string? Search { get; set; } = null;
public bool? MaxSearch { get; set; } = null;
public List<CommentModel> ParsedComments { get; private set; }
public List<(string, string)>? AvailableCategories { get; set; } = null;
public List<(string, string)>? AvailableSideCategories { get; set; } = null;
public RegisterViewModel(string category, string id, List<CommentModel> parsedComments, string title) {
this.Category = category;
this.Id = id;
// Title, URL
public List<(string, string)>? AvailableCategories
{
get => _AvailableCategories;
set
{
if (value != null)
_AvailableCategories = value.Select(x => (
HttpUtility.HtmlEncode(x.Item1),
HttpUtility.HtmlAttributeEncode(x.Item2))
).ToList();
else
_AvailableCategories = null;
}
}
// Title, URL
public List<(string, string)>? AvailableSideCategories
{
get => _AvailableSideCategories;
set
{
if (value != null)
_AvailableSideCategories = value.Select(x => (
HttpUtility.HtmlEncode(x.Item1),
HttpUtility.HtmlAttributeEncode(x.Item2))
).ToList();
else
_AvailableSideCategories = null;
}
}
public RegisterViewModel(string category, string id, List<CommentModel> parsedComments, string title)
{
this.Category = HttpUtility.HtmlAttributeEncode(category);
this.Id = HttpUtility.HtmlAttributeEncode(id);
this.ParsedComments = parsedComments;
this.Title = title;
this.Title = HttpUtility.HtmlEncode(title);
}
}