remvoe sanitzer from views and use extensions instead of keys

This commit is contained in:
2025-08-23 00:54:27 +02:00
parent a080aaec95
commit 7a011930df
13 changed files with 300 additions and 122 deletions

View File

@@ -18,12 +18,12 @@
var pages = document?.Elements?.Select(e => e.Page) ?? Array.Empty<int>();
int? signatureCount = document?.Elements?.Count();
var stPageIndexes = string.Join(pages.Count() > 1 ? ", " : "", pages.Take(pages.Count() - 1))
+ (pages.Count() > 1 ? $" {_localizer[WebKey.and].TrySanitize(_sanitizer)} " : "") + pages.LastOrDefault();
+ (pages.Count() > 1 ? $" {_localizer.And()} " : "") + pages.LastOrDefault();
var isReadOnly = false;
if (ViewData["IsReadOnly"] is bool isReadOnly_bool)
isReadOnly = isReadOnly_bool;
ViewData["Title"] = isReadOnly ? _localizer[WebKey.ViewDoc] : _localizer[WebKey.SignDoc];
ViewData["Title"] = isReadOnly ? _localizer.ViewDoc() : _localizer.SignDoc();
}
<div class="envelope-view">
@if (!isReadOnly)
@@ -34,13 +34,13 @@
<path d="m10.036 8.278 9.258-7.79A1.979 1.979 0 0 0 18 0H2A1.987 1.987 0 0 0 .641.541l9.395 7.737Z" />
<path d="M11.241 9.817c-.36.275-.801.425-1.255.427-.428 0-.845-.138-1.187-.395L0 2.6V14a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V2.5l-8.759 7.317Z" />
</svg>
<span>@_localizer[WebKey.Complete]</span>
<span>@_localizer.Complete()</span>
</button>
<button class="btn_reject btn btn-danger btn-desktop" type="button">
<svg width="25px" height="25px" viewBox="43.5 43.5 512 512" version="1.1" fill="currentColor" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<path class="st0" d="M263.24,43.5c-117.36,0-212.5,95.14-212.5,212.5s95.14,212.5,212.5,212.5s212.5-95.14,212.5-212.5 S380.6,43.5,263.24,43.5z M367.83,298.36c17.18,17.18,17.18,45.04,0,62.23v0c-17.18,17.18-45.04,17.18-62.23,0l-42.36-42.36 l-42.36,42.36c-17.18,17.18-45.04,17.18-62.23,0v0c-17.18-17.18-17.18-45.04,0-62.23L201.01,256l-42.36-42.36 c-17.18-17.18-17.18-45.04,0-62.23v0c17.18-17.18,45.04-17.18,62.23,0l42.36,42.36l42.36-42.36c17.18-17.18,45.04-17.18,62.23,0v0 c17.18,17.18,17.18,45.04,0,62.23L325.46,256L367.83,298.36z" />
</svg>
<span>@_localizer[WebKey.Reject]</span>
<span>@_localizer.Reject()</span>
</button>
<button class="btn_refresh btn btn-secondary btn-desktop" type="button">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
@@ -68,7 +68,7 @@
<div class="logo">
<img class="@cImg["Company"].GetClassIn("Show")" src="@cImg["Company"].Src" alt="logo">
</div>
<h2>@($"{envelope?.Title}".TrySanitize(_sanitizer))</h2>
<h2>@($"{envelope?.Title}")</h2>
@if (isReadOnly)
{
var dateTimeSt = string.Empty;
@@ -78,18 +78,18 @@
}
else
{
<h6>@($"{@envelope?.Message}".TrySanitize(_sanitizer))</h6>
<h6>@($"{@envelope?.Message}")</h6>
}
<p>
<small class="text-body-secondary">
@Html.Raw(string.Format(_localizer[WebKey.EnvelopeInfo2], /* sanitize separately but don't sanitize the URI */
envelope?.AddedWhen.ToString(userCulture?.Info?.DateTimeFormat).TrySanitize(_sanitizer),
$"{sender?.Prename} {sender?.Name}".TrySanitize(_sanitizer),
sender?.Email.TrySanitize(_sanitizer),
envelope?.Title.TrySanitize(_sanitizer),
sender?.Prename.TrySanitize(_sanitizer),
sender?.Name.TrySanitize(_sanitizer),
sender?.Email.TrySanitize(_sanitizer)))
@Html.Raw(_localizer.EnvelopeInfo2().Format(
envelope?.AddedWhen.ToString(userCulture?.Info?.DateTimeFormat),
$"{sender?.Prename} {sender?.Name}",
sender?.Email,
envelope?.Title,
sender?.Prename,
sender?.Name,
sender?.Email))
</small>
</p>
</div>
@@ -212,6 +212,6 @@
var documentBase64String = Convert.ToBase64String(documentBytes);
var envelopeKey = ViewData["EnvelopeKey"] as string;
@:document.addEventListener("DOMContentLoaded", async () => await new App("@envelopeKey.TrySanitize(_sanitizer)", @Html.Raw(envelopeReceiverJson.TrySanitize(_sanitizer)), B64ToBuff("@Html.Raw(documentBase64String.TrySanitize(_sanitizer))"), "@ViewData["PSPDFKitLicenseKey"]", "@userCulture?.Info?.TwoLetterISOLanguageName").init())
@:document.addEventListener("DOMContentLoaded", async () => await new App("@envelopeKey", @Html.Raw(envelopeReceiverJson), B64ToBuff("@Html.Raw(documentBase64String)"), "@ViewData["PSPDFKitLicenseKey"]", "@userCulture?.Info?.TwoLetterISOLanguageName").init())
}
</script>