feat: adds FastEndpoints endpoints, views and resources to the web project

This commit is contained in:
BinaryAlley committed 2026-08-17 11:52:23 -07:00
1 parent 733e174cac
commit d3b1c681dc
341 files changed
+44018 -113

No files matched your search

@@ -0,0 +1,232 @@
@*
/admin/manage-permissions/
*@
@using Lumina.Presentation.Web.Common.DTO.Authorization
@using Lumina.Presentation.Web.Common.DTO.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
var roles = ViewData["roles"] as RoleDto[];
var users = ViewData["users"] as UserDto[];
var permissions = ViewData["permissions"] as PermissionDto[];
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IViewLocalizer _localizer
@inject IUrlService _urlService
<form id="authorization-permissions-form" method="post" class="w-100 h-100 mx-auto pl-10 pr-10 pt-10 pb-10">
<div id="authorization-permissions-container">
<input type="hidden" name="authorization-users-selected-id" id="authorization-users-selected-id" value="" />
<input type="hidden" name="authorization-roles-selected-id" id="authorization-roles-selected-id" value="" />
<!-- Users dropdown row -->
<div class="h-30px w-100 text-end mb-5">
<label for="authorization-users-combobox" class="text-light-one">@_localizer["Users"]</label>
<div class="enlightenment-combobox w-250px inline-block" id="authorization-users-combobox">
<div class="shine-effect" style="top: 1px;"></div>
<input type="checkbox" id="authorization-users-combobox-toggle" class="enlightenment-toggle-checkbox" />
<label class="enlightenment-toggle" for="authorization-users-combobox-toggle">
<span class="enlightenment-selected-text">@_localizer["SelectAUser"]</span>
</label>
<div class="enlightenment-dropdown" id="authorization-users-combobox-dropdown">
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">@_localizer["SelectAUser"]</div>
@if (users is not null)
{
@for (int i = 0; i < users.Length; i++)
{
<div class="enlightenment-option @(i == users.Length - 1 ? "last-option" : "")" data-value="@users[i].Id">@users[i].Username</div>
}
}
</div>
</div>
</div>
<!-- Roles dropdown row -->
<div class="h-30px w-100 text-end mb-5">
<label for="authorization-roles-combobox" class="text-light-one">@_localizer["Roles"]</label>
<div class="enlightenment-combobox w-250px inline-block" id="authorization-roles-combobox">
<div class="shine-effect" style="top: 1px;"></div>
<input type="checkbox" id="authorization-roles-combobox-toggle" class="enlightenment-toggle-checkbox" />
<label class="enlightenment-toggle" for="authorization-roles-combobox-toggle">
<span class="enlightenment-selected-text">@_localizer["SelectARole"]</span>
</label>
<div class="enlightenment-dropdown" id="authorization-roles-combobox-dropdown">
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">@_localizer["SelectARole"]</div>
@if (roles is not null)
{
@for (int i = 0; i < roles.Length; i++)
{
<div class="enlightenment-option @(i == roles.Length - 1 ? "last-option" : "")" data-value="@roles[i].Id">@roles[i].RoleName</div>
}
}
</div>
</div>
</div>
<!-- Permissions row -->
<div id="authorization-permissions-permissions-container" class="">
<div id="authorization-permissions-permissions">
<div id="authorization-permissions-permissions-scroll" class="scroll-horizontal">
<div id="authorization-permissions-permissions-list" class="list" style="flex-direction: column;">
@if (permissions is not null)
{
@foreach (var permission in permissions)
{
<div class="e no-border transparent mt-5 mb-5">
<label class="enlightenment-checkbox-label">
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-permissions-permissions" value="@permission.Id">
<span class="enlightenment-checkbox"></span>
@_localizer[permission.PermissionName.ToString()]
</label>
</div>
}
}
</div>
</div>
</div>
</div>
<!-- Submit Button Row -->
<div class="w-100 h-25px mt-5 text-end">
<button id="btn-update-user" type="submit" class="confirm-button f-14 h-24px v-align-t" disabled>@_localizer["Update"]</button>
</div>
</div>
</form>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const btnUpdateUser = document.getElementById('btn-update-user');
const form = document.getElementById('authorization-permissions-form');
const rolesDropdown = document.getElementById('authorization-roles-combobox-dropdown');
const usersDropdown = document.getElementById('authorization-users-combobox-dropdown');
const roleIdInput = document.getElementById('authorization-roles-selected-id');
const userIdInput = document.getElementById('authorization-users-selected-id');
// update user permissions and role
async function handleUserAuthorizationSubmitAsync() {
const formData = {
userId: userIdInput.value,
roleId: roleIdInput.value !== '' ? roleIdInput.value : null,
permissions: Array.from(form.querySelectorAll("input[name='authorization-permissions-permissions']:checked"))
.map(checkbox => checkbox.value)
};
const result = await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Admin.UPDATE_USER_AUTHORIZATION)', formData);
if (result.success)
notificationService.show('@_localizer["UserAuthorizationUpdated"]', NotificationType.SUCCESS);
}
async function fetchUserRoleAsync(userId) {
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Admin.GET_ROLE_BY_USER_ID, new { userId = default(Guid) })';
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${userId}`)); // userId needs to be replaced here, because GetAbsoluteUrl is server side, userId is client side
if (data) {
var roleElement = document.querySelector('#authorization-roles-combobox .enlightenment-option[data-value="' + data.id + '"]');
var roleName = roleElement.textContent;
document.querySelector('#authorization-roles-combobox .enlightenment-selected-text').textContent = roleName;
document.querySelector('#authorization-roles-combobox .enlightenment-toggle').dataset.value = data.id;
roleIdInput.value = data.id;
}
}
async function fetchUserPermissionsAsync(userId) {
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Admin.GET_PERMISSIONS_BY_USER_ID, new { userId = default(Guid) })';
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${userId}`)); // userId needs to be replaced here, because GetAbsoluteUrl is server side, userId is client side
if (data) {
// clear all checkboxes
document.querySelectorAll("input[name='authorization-permissions-permissions']")
.forEach(input => input.checked = false);
// check the checkboxes for which permissions are assigned
data.forEach(p => {
const checkbox = document.querySelector(`input[name='authorization-permissions-permissions'][value='${p.id}']`);
if (checkbox)
checkbox.checked = true;
});
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleUserAuthorizationSubmitAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleUserAuthorizationSubmitAsync();
};
// on document click
const handleDocumentClick = async function(e) {
// users dropdown change
if (e.target.closest('#authorization-users-combobox .enlightenment-option')) {
var selectedUserId = e.target.dataset.value;
document.querySelector('#authorization-roles-combobox .enlightenment-selected-text').textContent = '@_localizer["SelectARole"]';
document.querySelectorAll("input[name='authorization-permissions-permissions']").forEach(input => input.checked = false);
roleIdInput.value = '';
userIdInput.value = '';
if (selectedUserId) {
userIdInput.value = selectedUserId;
btnUpdateUser.disabled = false;
await fetchUserRoleAsync(selectedUserId);
await fetchUserPermissionsAsync(selectedUserId);
}
else
btnUpdateUser.disabled = true;
}
// roles dropdown change
else if (e.target.closest('#authorization-roles-combobox .enlightenment-option')) {
const roleId = e.target.dataset.value;
roleIdInput.value = roleId || '';
}
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
document.addEventListener('click', handleDocumentClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
document.removeEventListener('click', handleDocumentClick);
});
// when form's height changes, adjust the roles combobox dropdown maximum height accordingly, so it doesn't cause an <article> section overflow
const resizeObserver = new ResizeObserver(entries => {
const formHeight = form.getBoundingClientRect().height;
usersDropdown.style.maxHeight = `calc(${formHeight}px - 50px)`;
rolesDropdown.style.maxHeight = `calc(${formHeight}px - 90px)`;
usersDropdown.style.overflowY = `auto`;
rolesDropdown.style.overflowY = `auto`;
});
resizeObserver.observe(form);
// register cleanup for observer
cleanupFunctions.push(() => {
resizeObserver.disconnect();
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,46 @@
#authorization-permissions-container {
display: flex;
margin: auto;
width: 100%;
height: 100%;
flex-direction: column;
flex-wrap: nowrap;
}
#authorization-permissions-permissions-container {
flex-grow: 1;
min-width: 135px;
min-height: 0px;
}
#authorization-permissions-permissions {
border: 1px solid var(--border-color-light-high);
border-top: 1px solid var(--border-color-dark);
border-left: 1px solid var(--border-color-dark);
margin: auto;
padding-left: 5px;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: left;
align-items: stretch;
}
#authorization-permissions-permissions-scroll {
background-color: #232323;
margin: auto;
width: 100%;
height: 100%;
}
#authorization-permissions-permissions-list {
margin: 1px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
border: 0px solid black;
padding: 0px;
gap: 0px 10px;
}
@@ -0,0 +1,263 @@
@*
/admin/manage-roles/
*@
@using Lumina.Presentation.Web.Common.DTO.Authorization
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
var roles = ViewData["roles"] as RoleDto[];
var permissions = ViewData["permissions"] as PermissionDto[];
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IViewLocalizer _localizer
@inject IUrlService _urlService
<form id="authorization-roles-form" method="post" class="w-100 h-100 mx-auto pl-10 pr-10 pt-10 pb-10">
<div id="authorization-roles-container">
<input type="hidden" name="authorization-roles-selected-id" id="authorization-roles-selected-id" value="" />
<!-- Roles dropdown row -->
<div class="h-30px w-100 text-end mb-5">
<label for="authorization-roles-combobox" class="text-light-one">@_localizer["Roles"]</label>
<div class="enlightenment-combobox w-250px inline-block" id="authorization-roles-combobox">
<div class="shine-effect" style="top: 1px;"></div>
<input type="checkbox" id="authorization-roles-combobox-toggle" class="enlightenment-toggle-checkbox" />
<label class="enlightenment-toggle" for="authorization-roles-combobox-toggle">
<span class="enlightenment-selected-text">@_localizer["SelectARole"]</span>
</label>
<div class="enlightenment-dropdown" id="authorization-roles-combobox-dropdown">
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">@_localizer["SelectARole"]</div>
@if (roles is not null)
{
@for (int i = 0; i < roles.Length; i++)
{
<div class="enlightenment-option @(i == roles.Length - 1 ? "last-option" : "")" data-value="@roles[i].Id">@roles[i].RoleName</div>
}
}
</div>
</div>
</div>
<!-- Role name input row -->
<div class="h-30px w-100 text-end mb-5">
<label for="txt-role-name" class="text-light-one">@_localizer["RoleName"]</label>
<input type="text" id="txt-role-name" name="authorization-role-name" class="enlightenment-input w-250px" />
</div>
<!-- Permissions row -->
<div id="authorization-roles-permissions-container" class="">
<div id="authorization-roles-permissions">
<div id="authorization-roles-permissions-scroll" class="scroll-horizontal">
<div id="authorization-roles-permissions-list" class="list" style="flex-direction: column;">
@if (permissions is not null)
{
@foreach (var permission in permissions)
{
<div class="e no-border transparent mt-5 mb-5">
<label class="enlightenment-checkbox-label">
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-role-permissions" value="@permission.Id">
<span class="enlightenment-checkbox"></span>
@_localizer[permission.PermissionName.ToString()]
</label>
</div>
}
}
</div>
</div>
</div>
</div>
<!-- Submit Button Row -->
<div class="w-100 h-25px mt-5 text-end">
<button id="btn-delete-role" type="button" class="abort-button f-14 h-24px v-align-t hidden">@_localizer["DeleteRole"]</button>
<button id="btn-confirm-role" type="submit" class="confirm-button f-14 h-24px v-align-t">@_localizer["CreateRole"]</button>
</div>
</div>
</form>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const btnDeleteRole = document.getElementById('btn-delete-role');
const btnConfirmRole = document.getElementById('btn-confirm-role');
const txtRoleName = document.getElementById('txt-role-name');
const form = document.getElementById('authorization-roles-form');
const dropdown = document.getElementById('authorization-roles-combobox-dropdown');
const roleIdInput = document.getElementById('authorization-roles-selected-id');
// create new or update existing role
async function handleRoleSubmitAsync() {
const formData = {
roleId: roleIdInput.value,
roleName: txtRoleName.value,
permissions: Array.from(form.querySelectorAll("input[name='authorization-role-permissions']:checked"))
.map(checkbox => checkbox.value)
};
const isRoleSelected = formData.roleId !== '';
const result = isRoleSelected ?
await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Admin.UPDATE_ROLE)', formData) :
{ success: (await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Admin.CREATE_ROLE)', formData)) !== undefined };
if (result.success) {
await fetchRolesAsync();
notificationService.show(isRoleSelected ? '@_localizer["RoleUpdated"]' : '@_localizer["RoleCreated"]', NotificationType.SUCCESS);
}
}
async function fetchRolesAsync() {
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Admin.GET_ROLES)');
if (data) {
// clear the roles drop down list
const rolesDropdown = document.querySelector("#authorization-roles-combobox .enlightenment-dropdown");
rolesDropdown.innerHTML = `
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">'@_localizer["SelectARole"]'</div>
`;
// populate the roles drop down
data.forEach((role, index) => {
const option = document.createElement('div');
option.className = `enlightenment-option ${index === data.length - 1 ? 'last-option' : ''}`;
option.dataset.value = role.id;
option.textContent = role.roleName;
rolesDropdown.appendChild(option);
});
// update the text of the toggle button of the combobox
document.querySelector('.enlightenment-selected-text').textContent = '@_localizer["SelectARole"]';
// all permissions should be "unchecked"
document.querySelectorAll("input[name='authorization-role-permissions']")
.forEach(input => input.checked = false);
// the delete button should be hidden
btnDeleteRole.classList.remove('inline');
btnDeleteRole.classList.add('hidden');
// the "update" button should be "create"
btnConfirmRole.textContent = '@_localizer["CreateRole"]';
// the input for the role name should also have its text emptied
txtRoleName.value = '';
}
}
async function fetchRolePermissionsAsync(roleId) {
if (roleId) {
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Admin.GET_PERMISSIONS_BY_ROLE_ID, new { roleId = default(Guid) })';
const data = await callApiGetAsync(url.replace('/@(default(Guid))', `/${roleId}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
if (data) {
// clear all checkboxes
document.querySelectorAll("input[name='authorization-role-permissions']")
.forEach(input => input.checked = false);
// check the checkboxes for which permissions are assigned
data.permissions.forEach(p => {
const checkbox = document.querySelector(
`input[name='authorization-role-permissions'][value='${p.id}']`
);
if (checkbox) checkbox.checked = true;
});
}
} else {
// if no role is selected, clear checkboxes
document.querySelectorAll("input[name='authorization-role-permissions']")
.forEach(input => input.checked = false);
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleRoleSubmitAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleRoleSubmitAsync();
};
// on delete role button click
const handleBtnDeleteRoleClick = async function(e) {
// ask the user for confirmation before deleting the role
if (await dialogService.show('@_localizer["DeleteRoleConfirm"]', jsLocalizedDialogs.confirmation, DialogButtons.YES_NO, DialogIcon.QUESTION) === DialogButton.YES) {
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Admin.DELETE_ROLE, new { roleId = default(Guid) })';
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${roleIdInput.value}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
if (success) {
await fetchRolesAsync();
notificationService.show('@_localizer["RoleDeleted"]', NotificationType.SUCCESS);
}
}
};
// on document click
const handleDocumentClick = async function(e) {
// roles dropdown change
if (e.target.closest('#authorization-roles-combobox .enlightenment-option')) {
const roleId = e.target.dataset.value;
const selectedText = e.target.textContent;
txtRoleName.value = roleId ? selectedText : '';
await fetchRolePermissionsAsync(roleId);
if (roleId) {
btnDeleteRole.classList.remove('hidden');
btnDeleteRole.classList.add('inline');
btnConfirmRole.textContent = '@_localizer["UpdateRole"]';
roleIdInput.value = roleId;
} else {
roleIdInput.value = '';
btnDeleteRole.classList.remove('inline');
btnDeleteRole.classList.add('hidden');
btnConfirmRole.textContent = '@_localizer["CreateRole"]';
}
}
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
btnDeleteRole.addEventListener('click', handleBtnDeleteRoleClick);
document.addEventListener('click', handleDocumentClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
btnDeleteRole.removeEventListener('click', handleBtnDeleteRoleClick);
document.removeEventListener('click', handleDocumentClick);
});
// when form's height changes, adjust the roles combobox dropdown maximum height accordingly, so it doesn't cause an <article> section overflow
const resizeObserver = new ResizeObserver(entries => {
const formHeight = form.getBoundingClientRect().height;
dropdown.style.maxHeight = `calc(${formHeight}px - 50px)`;
dropdown.style.overflowY = `auto`;
});
resizeObserver.observe(form);
// register cleanup for observer
cleanupFunctions.push(() => {
resizeObserver.disconnect();
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,46 @@
#authorization-roles-container {
display: flex;
margin: auto;
width: 100%;
height: 100%;
flex-direction: column;
flex-wrap: nowrap;
}
#authorization-roles-permissions-container {
flex-grow: 1;
min-width: 135px;
min-height: 0px;
}
#authorization-roles-permissions {
border: 1px solid var(--border-color-light-high);
border-top: 1px solid var(--border-color-dark);
border-left: 1px solid var(--border-color-dark);
margin: auto;
padding-left: 5px;
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: left;
align-items: stretch;
}
#authorization-roles-permissions-scroll {
background-color: #232323;
margin: auto;
width: 100%;
height: 100%;
}
#authorization-roles-permissions-list {
margin: 1px;
display: flex;
flex-direction: column;
flex-wrap: wrap;
border: 0px solid black;
padding: 0px;
gap: 0px 10px;
}
@@ -0,0 +1,17 @@
@*
/auth/access-denied/
*@
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer _localizer
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-55 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<div class="text-center w-100">
<p class="invalid-feedback f-18 w-100"><b>@_localizer["NotAllowedToAccessResource"]</b></p>
</div>
</div>
</div>
@@ -0,0 +1,136 @@
@*
/auth/change-password/
*@
@using Lumina.Presentation.Web.Common.Requests.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model ChangePasswordRequest
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-55 mb-10" style="min-width: 320px; margin-top: 1rem;">
<div class="shine-effect"></div>
<form method="post" id="change-password-form" class="inline">
@Html.AntiForgeryToken()
<input type="text" name="username" autocomplete="username" value="@User.Identity!.Name" hidden />
<div class="form-container">
<!-- Current Password -->
<div class="form-row" id="div-current-password">
<div class="form-label">
<label asp-for="CurrentPassword">@_localizer["CurrentPassword"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="password" asp-for="CurrentPassword" autocomplete="new-password" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionCurrentPassword"]</small>
</div>
<!-- New Password -->
<div class="form-row" id="div-new-password">
<div class="form-label">
<label asp-for="NewPassword">@_localizer["NewPassword"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="password" asp-for="NewPassword" autocomplete="new-password" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionNewPassword"]</small>
</div>
<!-- New Password Confirm-->
<div class="form-row" id="div-new-password-confirm">
<div class="form-label">
<label asp-for="NewPasswordConfirm">@_localizer["NewPasswordConfirm"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="password" asp-for="NewPasswordConfirm" autocomplete="new-password" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionNewPasswordConfirm"]</small>
</div>
<div class="form-row" id="div-change-password-submit" style="justify-content: center;">
<button type="submit" class="confirm-button h-22px">@_localizer["ChangePasswordKey"]</button>
</div>
</div>
</form>
<!-- section registration success -->
<div class="text-center w-100">
<p id="change-password-success" class="text-light-one w-100 hidden">@_localizer["PasswordChanged"]</p>
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const form = document.getElementById('change-password-form');
const txtCurrentPassword = form.querySelector('[name="CurrentPassword"]');
const txtNewPassword = form.querySelector('[name="NewPassword"]');
const txtNewPasswordConfirm = form.querySelector('[name="NewPasswordConfirm"]');
const changePasswordSuccess = document.getElementById('change-password-success');
const divCurrentPassword = document.getElementById('div-current-password');
const divNewPassword = document.getElementById('div-new-password');
const divNewPasswordConfirm = document.getElementById('div-new-password-confirm');
const divChangePasswordSubmit = document.getElementById('div-change-password-submit');
// perform the password change
async function handleChangePasswordAsync() {
const formData = {
CurrentPassword: txtCurrentPassword.value,
NewPassword: txtNewPassword.value,
NewPasswordConfirm: txtNewPasswordConfirm.value
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.CHANGE_PASSWORD)', formData);
if (data && data.isPasswordChanged === true) {
changePasswordSuccess.classList.replace('hidden', 'block');
divCurrentPassword.classList.add('hidden');
divNewPassword.classList.add('hidden');
divNewPasswordConfirm.classList.add('hidden');
divChangePasswordSubmit.classList.add('hidden');
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleChangePasswordAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleChangePasswordAsync();
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,141 @@
@*
/auth/login/
*@
@using Lumina.Presentation.Web.Common.Requests.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model LoginRequest
<div style="display: grid; grid-template-rows: auto 1fr;"> <!--container with two rows, one fixed, one filling remaining space-->
<div style ="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="login-form" class="inline">
@Html.AntiForgeryToken()
<input type="hidden" name="ReturnUrl" value="@ViewData["ReturnUrl"]" />
<div class="form-container">
<!-- Username -->
<div class="form-row">
<div class="form-label">
<label asp-for="Username">@_localizer["Username"]</label>:
</div>
<div class="form-field">
<input asp-for="Username" autocomplete="username" class="enlightenment-input" />
</div>
</div>
<!-- Password -->
<div class="form-row">
<div class="form-label">
<label asp-for="Password">@_localizer["Password"]</label>:
</div>
<div class="form-field">
<input type="password" asp-for="Password" autocomplete="current-password" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button id="btn-recover-password" type="button" class="abort-button h-22px">@_localizer["RecoverPassword"]</button>
<button id="btn-login" type="submit" class="confirm-button h-22px">@_localizer["LoginKey"]</button>
</div>
<!-- 2FA -->
<div class="form-row mt-10 hidden" id="div-totp-code">
<div class="form-label">
<label asp-for="TotpCode">@_localizer["TotpCode"]</label>
</div>
<div class="form-field">
<input type="number" asp-for="TotpCode" autocomplete="one-time-code" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button type="submit" id="btn-validate-totp" class="confirm-button h-22px hidden">@_localizer["ValidateCode"]</button>
</div>
</div>
</form>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const form = document.getElementById('login-form');
const returnUrlInput = form.querySelector('[name="ReturnUrl"]');
const txtUsername = form.querySelector('[name="Username"]');
const txtPassword = form.querySelector('[name="Password"]');
const txtTotpCode = form.querySelector('[name="TotpCode"]');
const divTotpCode = document.getElementById('div-totp-code');
const btnLogin = document.getElementById('btn-login');
const btnRecoverPassword = document.getElementById('btn-recover-password');
const btnValidateTotp = document.getElementById('btn-validate-totp');
// perform the authentication
async function handleLoginAsync() {
const formData = {
Username: txtUsername.value,
Password: txtPassword.value,
TotpCode: txtTotpCode.value,
ReturnUrl: returnUrlInput.value
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN)', formData);
if (data && data.isTotpRequired === true) {
txtUsername.disabled = true;
txtPassword.disabled = true;
btnLogin.disabled = true;
btnRecoverPassword.disabled = true;
divTotpCode.classList.replace('hidden', 'inline');
btnValidateTotp.classList.replace('hidden', 'block');
txtTotpCode.focus();
}
else if (data)
window.location.href = data;
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleLoginAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleLoginAsync();
};
// on recover password button click
const handleBtnRecoverPasswordClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.RECOVER_PASSWORD_VIEW)';
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
btnRecoverPassword.addEventListener('click', handleBtnRecoverPasswordClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
btnRecoverPassword.removeEventListener('click', handleBtnRecoverPasswordClick);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,137 @@
@*
/auth/recover-password/
*@
@using Lumina.Presentation.Web.Common.Requests.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model RecoverPasswordRequest
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="recover-password-form" class="inline">
@Html.AntiForgeryToken()
<div class="form-container">
<!-- Username -->
<div class="form-row" id="div-username">
<div class="form-label">
<label asp-for="Username">@_localizer["Username"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input asp-for="Username" autocomplete="username" class="enlightenment-input" />
</div>
</div>
<!-- 2FA -->
<div class="form-row" id="div-totp-code">
<div class="form-label">
<label asp-for="TotpCode">@_localizer["TotpCode"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="number" asp-for="TotpCode" autocomplete="one-time-code" class="enlightenment-input" />
</div>
</div>
<div class="form-row">
<button id="btn-login" type="button" class="abort-button h-22px">@_localizer["BackToLogin"]</button>
<button type="submit" id="btn-validate-totp" class="confirm-button h-22px">@_localizer["ValidateCode"]</button>
</div>
</div>
</form>
<!-- section registration success -->
<div class="text-center w-100">
<p id="recover-password-success" class="text-light-one w-100 hidden">@_localizer["PasswordTemporarilyReset"]</p>
<button id="btn-redirect-login" type="submit" class="confirm-button h-22px hidden">@_localizer["Login"]</button>
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const form = document.getElementById('recover-password-form');
const txtUsername = form.querySelector('[name="Username"]');
const txtTotpCode = form.querySelector('[name="TotpCode"]');
const recoverPasswordSuccess = document.getElementById('recover-password-success');
const btnRedirectLogin = document.getElementById('btn-redirect-login');
const btnLogin = document.getElementById('btn-login');
const btnValidateTotp = document.getElementById('btn-validate-totp');
const divUsername = document.getElementById('div-username');
const divTotpCode = document.getElementById('div-totp-code');
// perform the password recovery
async function handleRecoverPasswordAsync() {
const formData = {
Username: txtUsername.value,
TotpCode: txtTotpCode.value
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.RECOVER_PASSWORD)', formData);
if (data && data.isPasswordReset === true) {
divUsername.classList.add('hidden');
btnValidateTotp.classList.add('hidden');
btnLogin.classList.add('hidden');
divTotpCode.classList.add('hidden');
btnRedirectLogin.classList.replace('hidden', 'inline');
recoverPasswordSuccess.classList.replace('hidden', 'block');
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleRecoverPasswordAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleRecoverPasswordAsync();
};
// on login button click
const handleBtnLoginClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)';
};
// on login redirect button click
const handleBtnRedirectLoginClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)';
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
btnLogin.addEventListener('click', handleBtnLoginClick);
btnRedirectLogin.addEventListener('click', handleBtnRedirectLoginClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
btnLogin.removeEventListener('click', handleBtnLoginClick);
btnRedirectLogin.removeEventListener('click', handleBtnRedirectLoginClick);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,197 @@
@*
/auth/register/
*@
@using Lumina.Presentation.Web.Common.Requests.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
string? registrationType = ViewData["RegistrationType"] as string;
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model RegisterRequest
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="register-account-form" class="inline">
@Html.AntiForgeryToken()
<!-- section for determining registration type (regular user/admin) -->
<input type="hidden" name="RegistrationType" value="@registrationType" />
<div class="form-container">
@if (registrationType == "Admin")
{
<div class="form-row">
<p class="invalid-feedback w-95 text-center f-18">@_localizer["AdminAccountRegistration"]</p>
</div>
}
<!-- Username -->
<div class="form-row">
<div class="form-label">
<label asp-for="Username">@_localizer["Username"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input asp-for="Username" autocomplete="username" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionUsername"]</small>
</div>
<!-- Password -->
<div class="form-row">
<div class="form-label">
<label asp-for="Password">@_localizer["Password"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="password" asp-for="Password" autocomplete="new-password" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionPassword"]</small>
</div>
<!-- Password Confirm-->
<div class="form-row">
<div class="form-label">
<label asp-for="PasswordConfirm">@_localizer["PasswordConfirm"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input type="password" asp-for="PasswordConfirm" autocomplete="new-password" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionPasswordConfirm"]</small>
</div>
<!-- 2FA -->
<input type="hidden" id="hidden-use-two-fa" name="use2fa" value="true">
<div class="form-row">
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="Use2fa" class="enlightenment-checkbox-hidden" value="true" checked/>
<span class="enlightenment-checkbox"></span>
@_localizer["EnableTwoFactorAuthentication"]
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["Description2Fa"]</small>
</div>
<div class="form-row">
<span id="register-two-fa-attention" class="invalid-feedback w-95 text-center hidden">@_localizer["DisclaimerTwoFactor"]</span>
</div>
<div class="form-row" style="justify-content: center;">
<button type="submit" class="confirm-button h-22px">@_localizer["RegisterKey"]</button>
</div>
</div>
</form>
<!-- section registration success -->
<div class="text-center w-100">
<p id="register-success" class="text-light-one w-100 hidden">@_localizer["AccountCreated"]</p>
<img id="totp-image" class="w-200px h-200px h-align-m mx-auto mt-10 hidden" />
<p id="totp-message" class="text-light-one w-100 hidden">@_localizer["ScanTotpCode"]</p>
@if (User?.Identity?.IsAuthenticated == false)
{
<button id="btn-login" type="button" class="confirm-button h-22px mx-auto mt-10 hidden">@_localizer["Login"]</button>
}
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const form = document.getElementById('register-account-form');
const txtUsername = form.querySelector('[name="Username"]');
const txtPassword = form.querySelector('[name="Password"]');
const txtPasswordConfirm = form.querySelector('[name="PasswordConfirm"]');
const chkUse2FA = form.querySelector('[name="Use2fa"]');
const registerSuccess = document.getElementById('register-success');
const totpMessage = document.querySelector('#totp-message');
const totpImage = document.querySelector('#totp-image');
const btnLogin = document.getElementById('btn-login');
const spnTwoFaAttention = document.getElementById('register-two-fa-attention');
const useTwoFaInput = document.getElementById('hidden-use-two-fa');
// perform the account registration
async function handleRegisterAccountAsync() {
const formData = {
Username: txtUsername.value,
Password: txtPassword.value,
PasswordConfirm: txtPasswordConfirm.value,
Use2fa: chkUse2FA.checked,
RegistrationType: form.querySelector('[name="RegistrationType"]').value
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER)', formData);
if (data) {
txtUsername.value = '';
txtPassword.value = '';
txtPasswordConfirm.value = '';
form.classList.replace('inline', 'hidden');
registerSuccess.classList.replace('hidden', 'inline');
if (btnLogin)
btnLogin.classList.replace('hidden', 'block');
if (chkUse2FA.checked) {
totpMessage.classList.remove('hidden');
totpMessage.classList.add('block');
totpImage.classList.remove('hidden');
totpImage.classList.add('block');
totpImage.setAttribute('src', data.totpSecret);
}
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleRegisterAccountAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleRegisterAccountAsync();
};
// on use 2FA change event
const handleChkUse2FAChange = function() {
const isChecked = this.checked;
spnTwoFaAttention.classList.replace(
isChecked ? 'inline' : 'hidden',
isChecked ? 'hidden' : 'inline'
);
useTwoFaInput.value = isChecked.toString();
};
// on login button click
const handleBtnLoginClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)';
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
chkUse2FA.addEventListener('click', handleChkUse2FAChange);
btnLogin.addEventListener('click', handleBtnLoginClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
chkUse2FA.removeEventListener('click', handleChkUse2FAChange);
btnLogin.removeEventListener('click', handleBtnLoginClick);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,94 @@
@*
/
*@
@using Lumina.Presentation.Web.Common.DTO.Libraries
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IViewLocalizer _localizer
@inject IUrlService _urlService
<div class="cotton-candy">
<div style="display: grid; grid-template-rows: auto 1fr;">
<!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div id="libraries-container" class="cards-container justify-start pl-10 pr-10 w-100 h-100">
<p id="no-libraries" class="hidden">@_localizer["NoLibraries"]</p>
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
let isInitialized = false;
const librariesContainer = document.getElementById('libraries-container');
const noLibrariesMessage = document.getElementById('no-libraries');
async function InitializeAsync() {
if (isInitialized)
return;
isInitialized = true;
// get the media libraries
// TODO: add setting check whether the user desires this feature or not
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_ENABLED_LIBRARIES)');
if (data && data.length > 0) {
noLibrariesMessage.classList.replace('block', 'hidden');
librariesContainer.classList.replace('justify-center', 'justify-start');
// populate media library items
data.forEach((library) => {
// book libraries are browsable, so their panel is rendered as a link to their browse page
const isBrowsable = library.libraryType === 'Book';
const browseUrl = isBrowsable
? '@_urlService.GetAbsoluteUrl(WebRoutes.Books.INDEX)' + '?libraryId=' + library.id
: null;
const libraryElement = isBrowsable ? document.createElement('a') : document.createElement('div');
libraryElement.className = isBrowsable ? 'media-panel nav-link no-underline' : 'media-panel';
if (browseUrl)
libraryElement.href = browseUrl;
// the cover image is optional, so it is only rendered when the library has one
const coverImageHtml = library.coverImage
? `<img src="${globalConfiguration.serverBasePath}/media/libraries/${library.id}/${library.coverImage.substring(library.coverImage.lastIndexOf('cover.'))}" />`
: '';
libraryElement.innerHTML = `
${coverImageHtml}
<span class="text-light-two"><strong>${library.title}</strong></span>
`;
librariesContainer.appendChild(libraryElement);
});
// bind the AJAX navigation behavior to the library links, which were created after the initial navigation binding
bindNavigationLinks();
} else {
noLibrariesMessage.classList.replace('hidden', 'block');
librariesContainer.classList.replace('justify-start', 'justify-center');
}
}
// add listeners
document.addEventListener('DOMContentLoaded', InitializeAsync);
// register cleanup for these listeners
cleanupFunctions.push(() => {
document.removeEventListener('DOMContentLoaded', InitializeAsync);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,6 @@
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>
@@ -0,0 +1,630 @@
@*
/library/manage
*@
@using Lumina.Presentation.Web.Common.DTO.Libraries
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@using System.Security.Claims
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
<style>
/* main container */
.td-scan {
display: flex;
align-items: center;
gap: 3px;
padding: 4px 0;
min-height: 50px;
}
/* text label */
.scan-job-status {
flex: 1;
padding: 0 10px;
min-width: 0;
}
/* progress bar container */
.scan-progress {
flex: 0 0 80px;
height: 20px;
display: flex;
flex-direction: column;
margin: 10px;
gap: 2px;
}
/* progress bars */
.scan-progress-total,
.scan-progress-job {
height: 50%;
background: #ddd;
position: relative;
overflow: hidden;
}
.scan-progress-total > div,
.scan-progress-job > div {
height: 100%;
background: #4CAF50;
position: relative;
overflow: hidden;
transition: width 0.3s ease;
}
.scan-progress-total > div::after,
.scan-progress-job > div::after {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient( 90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 50%, rgba(255,255,255,0) 100% );
animation: progress-pulse 8s infinite;
}
.icon-groups {
flex: 0 0 auto; /* prevent shrinking */
display: flex;
gap: 10px;
margin-left: auto; /* push to right */
}
/* status icons subgroup */
.status-icons {
display: flex;
gap: 5px;
flex-shrink: 0;
}
/* action icons subgroup */
.action-icons {
display: flex;
gap: 5px;
flex-shrink: 0;
}
/* icon groups */
/* status icons (right margin group) */
img[src*="green.png"],
img[src*="red.png"],
img[src*="yellow.png"] {
width: 20px;
height: 20px;
}
/* action icons (fixed size group) */
img[src*="stop.svg"],
img[src*="trigger.svg"],
img[src*="delete.svg"],
a > img[src*="edit.svg"] {
width: 20px;
height: 20px;
cursor: pointer;
}
@@keyframes progress-pulse {
0% {
left: -100%;
}
15% {
left: 100%;
}
100% {
left: 100%;
}
}
</style>
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect mx-auto panel w-75 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">
@_localizer["Libraries"]
</h1>
</div>
<table id="media-libraries-table" style="display: none;">
<thead class="text-light-two">
<tr>
<th class="w-30">@_localizer["Title"]</th>
<th class="w-15">@_localizer["LibraryType"]</th>
<th class="w-10">@_localizer["Enabled"]</th>
<th class="w-10">@_localizer["Locked"]</th>
<th class="w-35">@_localizer["Actions"]</th>
</tr>
</thead>
<tbody>
<!-- libraries will be populated here -->
</tbody>
</table>
<div class="form-row pt-10">
<button id="btn-scan-all-libraries" style="display: none;" type="button" class="confirm-button w-250px">@_localizer["ScanAllLibraries"]</button>
<button id="btn-cancel-libraries-scan" style="display: none;" type="button" class="abort-button w-180px">@_localizer["CancelScan"]</button>
</div>
<p id="no-media-libaries" class="text-center">@_localizer["NoLibraries"]</p>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
let isInitialized = false;
const jsLocalizedLibraryScanStatuses = {
Completed: '@_localizer["Completed"]',
Failed: '@_localizer["Failed"]',
Canceled: '@_localizer["Canceled"]'
};
const jsLocalizedLibraryScanJobsStatuses = {
DiscoveringFiles: '@_localizer["DiscoveringFiles"]',
ComparingFileHashes: '@_localizer["ComparingFileHashes"]',
HashingFileContents: '@_localizer["HashingFileContents"]',
EnrichingMetadata: '@_localizer["EnrichingMetadata"]',
SavingScanData: '@_localizer["SavingScanData"]'
};
const jsLocalizedLibraryTypes = {
Book: '@_localizer["Book"]',
EBook: '@_localizer["EBook"]',
BookSeries: '@_localizer["BookSeries"]',
ComicBook: '@_localizer["ComicBook"]',
ComicSeries: '@_localizer["ComicSeries"]',
Magazine: '@_localizer["Magazine"]',
Manga: '@_localizer["Manga"]',
GraphicNovel: '@_localizer["GraphicNovel"]',
AcademicPaper: '@_localizer["AcademicPaper"]',
SheetMusic: '@_localizer["SheetMusic"]',
Screenplay: '@_localizer["Screenplay"]',
TvShow: '@_localizer["TvShow"]',
Movie: '@_localizer["Movie"]',
FilmSeries: '@_localizer["FilmSeries"]',
FilmFranchise: '@_localizer["FilmFranchise"]',
Concert: '@_localizer["Concert"]',
Documentary: '@_localizer["Documentary"]',
Tutorial: '@_localizer["Tutorial"]',
Personal: '@_localizer["Personal"]',
Anime: '@_localizer["Anime"]',
Youtube: '@_localizer["Youtube"]',
Videoclip: '@_localizer["Videoclip"]',
Music: '@_localizer["Music"]',
AudioBook: '@_localizer["AudioBook"]',
LivePerformance: '@_localizer["LivePerformance"]',
Interview: '@_localizer["Interview"]',
Cover: '@_localizer["Cover"]',
Remix: '@_localizer["Remix"]',
Soundeffect: '@_localizer["Soundeffect"]',
Podcast: '@_localizer["Podcast"]',
RadioShow: '@_localizer["RadioShow"]',
PhotoAlbum: '@_localizer["PhotoAlbum"]',
Other: '@_localizer["Other"]'
};
const btnScanAllLibraries = document.getElementById('btn-scan-all-libraries');
const btnCancelLibrariesScan = document.getElementById('btn-cancel-libraries-scan');
// SignalR
const signalRConnection = new signalR.HubConnectionBuilder()
.withUrl('http://localhost:5214/scanProgressHub')
.withAutomaticReconnect({
nextRetryDelayInMilliseconds: retryContext =>
Math.min(retryContext.elapsedMilliseconds * 2, 10000)
})
.configureLogging(signalR.LogLevel.Warning)
.build();
// get media libraries
const loadLibrariesAsync = async function() {
const response = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_LIBRARIES)');
const table = document.getElementById('media-libraries-table');
const tbody = table.querySelector('tbody') || table.appendChild(document.createElement('tbody'));
const noMediaLibrary = document.getElementById('no-media-libaries');
if (response && response.length > 0) {
table.style.display = 'table';
noMediaLibrary.style.display = 'none';
btnScanAllLibraries.style.display = 'block';
tbody.innerHTML = response.map(library => {
const editUrl = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.EDIT_LIBRARY, new { id = default(Guid) })'
.replace('/@(default(Guid))', `/${library.id}`);
return `
<tr data-library-id="${library.id}">
<td title="${library.title}">${library.title}</td>
<td>${jsLocalizedLibraryTypes[library.libraryType]}</td>
<td class="text-center">${library.isEnabled === true ? `@_localizer["Yes"]` : `@_localizer["No"]`}</td>
<td class="text-center">${library.isLocked === true ? `@_localizer["Yes"]` : `@_localizer["No"]`}</td>
<td class="td-scan">
<span class="scan-job-status hidden">Downloading metadata</span>
<div class="scan-progress hidden">
<div class="scan-progress-total"><div></div></div>
<div class="scan-progress-job"><div></div></div>
</div>
<div class="icon-groups">
<div class="status-icons">
<img src="/images/ui/green.png" alt="@_localizer["Completed"]" title="@_localizer["Completed"]" class="hidden status-icon" />
<img src="/images/ui/red.png" alt="@_localizer["Failed"]" title="@_localizer["Failed"]" class="hidden status-icon" />
<img src="/images/ui/yellow.png" alt="@_localizer["Canceled"]" title="@_localizer["Canceled"]" class="hidden status-icon" />
</div>
<div class="action-icons">
<img src="/images/ui/stop.svg" alt="@_localizer["CancelScan"]" title="@_localizer["CancelScan"]" class="hidden action-icon" />
<img src="/images/ui/trigger.svg" alt="@_localizer["Scan"]" title="@_localizer["Scan"]" class="action-icon" />
<a href="${editUrl}">
<img src="/images/ui/edit.svg" alt="@_localizer["Edit"]" title="@_localizer["Edit"]" class="action-icon" />
</a>
<img src="/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="mr-5 action-icon" />
</div>
</div>
</td>
</tr>
`;
}).join('');
} else {
btnScanAllLibraries.style.display = 'none';
table.style.display = 'none';
noMediaLibrary.style.display = 'block';
}
};
// get which libraries have active scans
const getRunningLibraryScansAsync = async function() {
const response = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_RUNNING_LIBRARY_SCANS)');
if (response && response.length > 0) {
await Promise.all(response.map(async scan => {
const row = document.querySelector(`tr[data-library-id="${scan.libraryId}"]`);
if (row) {
// restore UI state
const scanProgress = row.querySelector('.scan-progress');
const totalProgressDiv = row.querySelector('.scan-progress-total > div');
const jobProgressDiv = row.querySelector('.scan-progress-job > div');
const statusSpan = row.querySelector('.scan-job-status');
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
row.setAttribute('data-scan-id', scan.scanId);
statusSpan.textContent = jsLocalizedLibraryScanJobsStatuses[scan.currentJobProgress.currentOperation];
statusSpan.classList.remove('hidden');
scanProgress.classList.remove('hidden');
totalProgressDiv.style.width = `${scan.overallProgressPercentage}%`;
jobProgressDiv.style.width = `${scan.currentJobProgress.progressPercentage}%`;
scanIcon.classList.add('hidden');
cancelScanIcon.classList.remove('hidden');
// re-subscribe to SignalR
await signalRConnection.invoke('SubscribeToScan', scan.scanId, '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value');
}
}));
}
};
// on delete library icon click
const handleDeleteLibraryClick = async function(e) {
if (e.target.matches('img[src*="delete.svg"]')) {
const row = e.target.closest('tr');
if (await dialogService.show('@_localizer["DeleteLibraryConfirm"]', jsLocalizedDialogs.confirmation, DialogButtons.YES_NO, DialogIcon.QUESTION) === DialogButton.YES) {
const libraryId = row.getAttribute('data-library-id');
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.DELETE_LIBRARY, new { id = default(Guid) })';
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${libraryId}`));
if (success) {
await loadLibrariesAsync(); // reload the entire library list
notificationService.show('@_localizer["LibraryDeleted"]', NotificationType.SUCCESS);
}
}
}
};
// on scan all libraries button click
const handleScanAllLibrariesClick = async function(e) {
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.SCAN_LIBRARIES)', {});
if (data) {
btnScanAllLibraries.style.display = 'none';
btnCancelLibrariesScan.style.display = 'block';
// toggle icons only for libraries that had their scan started
const tbody = document.querySelector('tbody');
data.forEach(async scan => {
const row = tbody.querySelector(`tr[data-library-id="${scan.libraryId}"]`);
if (row) {
row.setAttribute('data-scan-id', scan.scanId);
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
const completedIdon = row.querySelector('img[src*="green.png"]');
const failedIdon = row.querySelector('img[src*="red.png"]');
const canceledIdon = row.querySelector('img[src*="yellow.png"]');
// hide scan status icons
completedIdon.classList.add('hidden');
failedIdon.classList.add('hidden');
canceledIdon.classList.add('hidden');
// toggle visibility on scan action icons
scanIcon.classList.add('hidden');
cancelScanIcon.classList.remove('hidden');
const scanId = scan.scanId;
const userId = '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value';
await signalRConnection.invoke('SubscribeToScan', scanId, userId);
}
});
}
};
// on scan library icon click
const handleScanLibraryClick = async function(e) {
if (e.target.matches('img[src*="trigger.svg"]')) {
const row = e.target.closest('tr');
const libraryId = row.getAttribute('data-library-id');
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.SCAN_LIBRARY, new { id = default(Guid) })';
const success = await callApiPostAsync(url.replace('/@(default(Guid))', `/${libraryId}`));
if (success) {
row.setAttribute('data-scan-id', success.scanId);
const scanIcon = e.target;
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
const completedIdon = row.querySelector('img[src*="green.png"]');
const failedIdon = row.querySelector('img[src*="red.png"]');
const canceledIdon = row.querySelector('img[src*="yellow.png"]');
// hide scan status icons
completedIdon.classList.add('hidden');
failedIdon.classList.add('hidden');
canceledIdon.classList.add('hidden');
// toggle visibility on scan action icons
scanIcon.classList.add('hidden');
cancelScanIcon.classList.remove('hidden');
const scanId = success.scanId;
const userId = '@User.FindFirst(ClaimTypes.NameIdentifier)?.Value';
await signalRConnection.invoke('SubscribeToScan', scanId, userId);
}
}
};
// on cancel all libraries scan button click
const handleCancelLibrariesScanClick = async function(e) {
await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.CANCEL_LIBRARIES_SCAN)', {});
btnCancelLibrariesScan.style.display = 'none';
btnScanAllLibraries.style.display = 'block';
// toggle icons for all active scan rows
const rows = document.querySelectorAll('tr[data-scan-id]');
rows.forEach(row => {
// remove the scan Id, its no longer being scanned
row.removeAttribute('data-scan-id');
const statusSpan = row.querySelector('.scan-job-status');
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses['Canceled']}.`;
const scanProgress = row.querySelector('.scan-progress');
scanProgress.classList.add('hidden');
// show scan status icon
const completedIdon = row.querySelector('img[src*="yellow.png"]');
completedIdon.classList.remove('hidden');
// toggle scan action icons
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
scanIcon.classList.remove('hidden');
cancelScanIcon.classList.add('hidden');
});
};
// on cancel library scan icon click
const handleCancelLibraryScanClick = async function(e) {
if (e.target.matches('img[src*="stop.svg"]')) {
const row = e.target.closest('tr');
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.CANCEL_LIBRARY_SCAN, new { libraryId = default(Guid), scanId = default(Guid) })';
// make a list of values from DOM that are needed as URL query params (they need to be in the order they appear in the URL!)
const params = [
row.getAttribute('data-library-id'),
row.getAttribute('data-scan-id')
];
// split URL into segments for precise replacement
const segments = url.split('/');
let paramIndex = 0;
// replace each default GUID sequentially with the values of the query params list, in the order they were added
const finalUrl = segments.map(segment =>
segment === '00000000-0000-0000-0000-000000000000'
? params[paramIndex++]
: segment
).join('/');
await callApiPostAsync(finalUrl);
// remove the scan Id, its no longer being scanned
row.removeAttribute('data-scan-id');
const statusSpan = row.querySelector('.scan-job-status');
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses['Canceled']}.`;
const scanProgress = row.querySelector('.scan-progress');
scanProgress.classList.add('hidden');
// show scan status icon
const completedIdon = row.querySelector('img[src*="yellow.png"]');
completedIdon.classList.remove('hidden');
// toggle scan action icons
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
scanIcon.classList.remove('hidden');
cancelScanIcon.classList.add('hidden');
// toggle scan action buttons
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
}
};
// handle all SignalR stuff
function setupSignalRHandlers() {
const onReconnecting = error => {
console.log(error ? `SignalR reconnected with error: ${error}` : "SignalR reconnecting...");
};
const onReconnected = connectionId => {
console.log('SignalR reconnected:', connectionId);
};
const onClose = error => {
console.log(error ? `SignalR connection closed with error: ${error}` : "SignalR connection closed");
};
// progress update handler
const progressHandler = (progress) => {
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
rows.forEach(row => {
// update status text
const statusSpan = row.querySelector('.scan-job-status');
statusSpan.textContent = jsLocalizedLibraryScanJobsStatuses[progress.currentJobProgress.currentOperation];
statusSpan.classList.remove('hidden');
// update progress bars
const scanProgress = row.querySelector('.scan-progress');
const totalProgressDiv = row.querySelector('.scan-progress-total > div');
const jobProgressDiv = row.querySelector('.scan-progress-job > div');
scanProgress.classList.remove('hidden');
totalProgressDiv.style.width = `${progress.overallProgressPercentage}%`;
jobProgressDiv.style.width = `${progress.currentJobProgress.progressPercentage}%`;
// toggle scan action icons
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
scanIcon.classList.add('hidden');
cancelScanIcon.classList.remove('hidden');
});
};
// scan completion handler
const completionHandler = (progress) => {
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
rows.forEach(row => {
// remove the scan Id, its no longer being scanned
row.removeAttribute('data-scan-id');
const statusSpan = row.querySelector('.scan-job-status');
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses[progress.status]}.`;
const scanProgress = row.querySelector('.scan-progress');
scanProgress.classList.add('hidden');
// show scan status icon
const completedIdon = row.querySelector('img[src*="green.png"]');
completedIdon.classList.remove('hidden');
// toggle scan action icons
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
scanIcon.classList.remove('hidden');
cancelScanIcon.classList.add('hidden');
});
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
};
// scan failure handler
const failureHandler = (progress) => {
const rows = document.querySelectorAll(`tr[data-scan-id="${progress.scanId}"]`);
rows.forEach(row => {
// remove the scan Id, its no longer being scanned
row.removeAttribute('data-scan-id');
const statusSpan = row.querySelector('.scan-job-status');
statusSpan.textContent = `${jsLocalizedLibraryScanStatuses[progress.status]}.`;
const scanProgress = row.querySelector('.scan-progress');
scanProgress.classList.add('hidden');
// show scan status icon
const completedIdon = row.querySelector('img[src*="red.png"]');
completedIdon.classList.remove('hidden');
// toggle scan action icons
const scanIcon = row.querySelector('img[src*="trigger.svg"]');
const cancelScanIcon = row.querySelector('img[src*="stop.svg"]');
scanIcon.classList.remove('hidden');
cancelScanIcon.classList.add('hidden');
});
const hasActiveScans = document.querySelectorAll('tr[data-scan-id]').length > 0;
btnCancelLibrariesScan.style.display = hasActiveScans ? 'block' : 'none';
btnScanAllLibraries.style.display = hasActiveScans ? 'none' : 'block';
};
// subscribe to events
signalRConnection.on("libraryScanProgressUpdateEvent", progressHandler);
signalRConnection.on("libraryScanFinishedEvent", completionHandler);
signalRConnection.on("libraryScanFailedEvent", failureHandler);
signalRConnection.onclose(onClose);
signalRConnection.onreconnecting(onReconnecting);
signalRConnection.onreconnected(onReconnected);
// add to cleanup
cleanupFunctions.push(() => {
signalRConnection.off("libraryScanProgressUpdateEvent", progressHandler);
signalRConnection.off("libraryScanFinishedEvent", completionHandler);
signalRConnection.off("libraryScanFailedEvent", failureHandler);
signalRConnection.off("close", onClose);
signalRConnection.off("reconnecting", onReconnecting);
signalRConnection.off("reconnected", onReconnected);
});
}
// add listeners
btnScanAllLibraries.addEventListener('click', handleScanAllLibrariesClick);
btnCancelLibrariesScan.addEventListener('click', handleCancelLibrariesScanClick);
document.addEventListener('click', handleDeleteLibraryClick);
document.addEventListener('click', handleScanLibraryClick);
document.addEventListener('click', handleCancelLibraryScanClick);
document.addEventListener('DOMContentLoaded', InitializeAsync);
// register cleanup for these listeners
cleanupFunctions.push(() => {
// proper connection stop
if (signalRConnection.state === 'Connected')
signalRConnection.stop().then(() => console.log('SignalR connection stopped'));
btnScanAllLibraries.removeEventListener('click', handleScanAllLibrariesClick);
btnCancelLibrariesScan.removeEventListener('click', handleCancelLibrariesScanClick);
document.removeEventListener('click', handleDeleteLibraryClick);
document.removeEventListener('click', handleScanLibraryClick);
document.removeEventListener('click', handleCancelLibraryScanClick);
document.removeEventListener('DOMContentLoaded', InitializeAsync);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
async function InitializeAsync() {
if (isInitialized)
return;
isInitialized = true;
try {
await loadLibrariesAsync();
await signalRConnection.start();
setupSignalRHandlers();
await getRunningLibraryScansAsync();
} catch (err) {
console.error('SignalR connection failed:', err);
}
}
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,477 @@
@*
/library/manage/item/{id:guid}
*@
@using Lumina.Presentation.Web.Common.DTO.Libraries
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
var id = Context.Request.RouteValues["id"] as string;
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model LibraryDto
@await Component.InvokeAsync("FileSystemBrowser")
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="add-media-library-form" class="inline">
@Html.AntiForgeryToken()
<input type="hidden" asp-for="Id" value="@id" />
<input type="hidden" asp-for="UserId" value="@Model.UserId"/>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">
@(_localizer[id is not null ? "EditLibrary" : "AddNewLibrary"])
</h1>
</div>
<div class="form-container">
<h3 class="text-light-two">@_localizer["GeneralInformation"]</h3>
<!-- Title -->
<div class="form-row">
<div class="form-label">
<label asp-for="Title">@_localizer["Title"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input asp-for="Title" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionTitle"]</small>
</div>
<!-- Library Type -->
<div class="form-row">
<div class="form-label">
<label asp-for="LibraryType">@_localizer["LibraryType"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<div class="enlightenment-combobox inline-block w-100">
<div class="shine-effect" style="top: 1px;"></div>
<input type="checkbox" class="enlightenment-toggle-checkbox" id="library-type" />
<label class="enlightenment-toggle" for="library-type">
<span id="library-selected-item" class="enlightenment-selected-text" data-value="@(Model.LibraryType ?? "Book")">@(Model.LibraryType ?? _localizer["Book"].Value)</span>
</label>
<div class="enlightenment-dropdown">
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">@_localizer["WrittenContent"]</div>
<div class="enlightenment-option" data-value="Book">@_localizer["Book"]</div>
<div class="enlightenment-option" data-value="EBook">@_localizer["EBook"]</div>
<div class="enlightenment-option" data-value="BookSeries">@_localizer["BookSeries"]</div>
<div class="enlightenment-option" data-value="ComicBook">@_localizer["ComicBook"]</div>
<div class="enlightenment-option" data-value="ComicSeries">@_localizer["ComicSeries"]</div>
<div class="enlightenment-option" data-value="Magazine">@_localizer["Magazine"]</div>
<div class="enlightenment-option" data-value="Manga">@_localizer["Manga"]</div>
<div class="enlightenment-option" data-value="GraphicNovel">@_localizer["GraphicNovel"]</div>
<div class="enlightenment-option" data-value="AcademicPaper">@_localizer["AcademicPaper"]</div>
<div class="enlightenment-option" data-value="SheetMusic">@_localizer["SheetMusic"]</div>
<div class="enlightenment-option" data-value="Screenplay">@_localizer["Screenplay"]</div>
<div class="enlightenment-option disabled">@_localizer["VideoContent"]</div>
<div class="enlightenment-option" data-value="TvShow">@_localizer["TvShow"]</div>
<div class="enlightenment-option" data-value="Movie">@_localizer["Movie"]</div>
<div class="enlightenment-option" data-value="FilmSeries">@_localizer["FilmSeries"]</div>
<div class="enlightenment-option" data-value="FilmFranchise">@_localizer["FilmFranchise"]</div>
<div class="enlightenment-option" data-value="Concert">@_localizer["Concert"]</div>
<div class="enlightenment-option" data-value="Documentary">@_localizer["Documentary"]</div>
<div class="enlightenment-option" data-value="Tutorial">@_localizer["Tutorial"]</div>
<div class="enlightenment-option" data-value="Personal">@_localizer["Personal"]</div>
<div class="enlightenment-option" data-value="Anime">@_localizer["Anime"]</div>
<div class="enlightenment-option" data-value="Youtube">@_localizer["Youtube"]</div>
<div class="enlightenment-option" data-value="Videoclip">@_localizer["Videoclip"]</div>
<div class="enlightenment-option disabled">@_localizer["AudioContent"]</div>
<div class="enlightenment-option" data-value="Music">@_localizer["Music"]</div>
<div class="enlightenment-option" data-value="AudioBook">@_localizer["AudioBook"]</div>
<div class="enlightenment-option" data-value="LivePerformance">@_localizer["LivePerformance"]</div>
<div class="enlightenment-option" data-value="Interview">@_localizer["Interview"]</div>
<div class="enlightenment-option" data-value="Cover">@_localizer["Cover"]</div>
<div class="enlightenment-option" data-value="Remix">@_localizer["Remix"]</div>
<div class="enlightenment-option" data-value="Soundeffect">@_localizer["Soundeffect"]</div>
<div class="enlightenment-option" data-value="Podcast">@_localizer["Podcast"]</div>
<div class="enlightenment-option" data-value="RadioShow">@_localizer["RadioShow"]</div>
<div class="enlightenment-option disabled">@_localizer["VisualContent"]</div>
<div class="enlightenment-option" data-value="PhotoAlbum">@_localizer["PhotoAlbum"]</div>
<div class="enlightenment-option disabled">@_localizer["MiscellaneousContent"]</div>
<div class="enlightenment-option last-option" data-value="Other">@_localizer["Other"]</div>
</div>
</div>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionLibraryType"]</small>
</div>
<!-- Cover -->
<div class="form-row mt-10">
<div class="form-label">
<label asp-for="CoverImage">@_localizer["CoverImage"]</label>:
<img src="~/images/ui/add-file.svg" alt="@_localizer["AddImage"]" id="add-media-cover" title="@_localizer["AddImage"]" class="add-form-table-row-icon ml-5" />
</div>
</div>
<div class="form-row">
<div id="add-media-cover-form-table" class="form-table w-100">
@if (Model.CoverImage is not null)
{
<div class="form-table-row">
<span title="@Model.CoverImage">@Model.CoverImage</span>
<img src="~/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="remove-form-table-row-icon" />
</div>
}
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionCover"]</small>
</div>
<!-- Directories -->
<div class="form-row mt-10">
<div class="form-label">
<label asp-for="ContentLocations">@_localizer["Directories"]</label>
<span class="mandatory-field">*</span>:
<img src="~/images/ui/add-directory.svg" alt="@_localizer["AddDirectory"]" id="add-media-directory" title="@_localizer["AddDirectory"]" class="add-form-table-row-icon ml-5" />
</div>
</div>
<div class="form-row">
<div id="add-media-directory-form-table" class="form-table w-100">
@for (int i = 0; i < Model.ContentLocations.Count; i++)
{
<div class="form-table-row">
<span title="@Model.ContentLocations[i]">@Model.ContentLocations[i]</span>
<img src="~/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="remove-form-table-row-icon" />
</div>
}
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionDirectories"]</small>
</div>
<h3 class="text-light-two">@_localizer["AdvancedSettings"]</h3>
<div class="form-row">
<div class="form-label">
<label asp-for="IsEnabled">@_localizer["Enabled"]</label>:
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="IsEnabled" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionEnabled"]</small>
</div>
<div class="form-row">
<div class="form-label">
<label asp-for="IsLocked">@_localizer["Locked"]</label>:
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="IsLocked" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionLocked"]</small>
</div>
<div class="form-row">
<div class="form-label">
<label asp-for="DownloadMetadataFromWeb">@_localizer["DownloadMetadataFromWeb"]</label>:
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="DownloadMetadataFromWeb" class="enlightenment-checkbox-hidden"/>
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionDownloadMetadataFromWeb"]</small>
</div>
<div class="form-row">
<div class="form-label">
<label asp-for="ShouldSaveMetadataInMediaDirectories">@_localizer["ShouldSaveMetadataInMediaDirectories"]:</label>
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="ShouldSaveMetadataInMediaDirectories" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSaveMetadataInMediaDirectories"]</small>
</div>
<div class="form-row">
<div class="form-label">
<label asp-for="ShouldSkipUnchangedDirectoriesDuringScan">@_localizer["ShouldSkipUnchangedDirectoriesDuringScan"]:</label>
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="ShouldSkipUnchangedDirectoriesDuringScan" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionShouldSkipUnchangedDirectoriesDuringScan"]</small>
</div>
@if (id is not null)
{
<h3 class="text-light-two">@_localizer["MetadataProviders"]</h3>
<div class="form-row">
<table id="metadata-providers-table" class="w-100">
<thead>
<tr>
<th class="w-50">@_localizer["Name"]</th>
<th class="w-15 text-center">@_localizer["Enabled"]</th>
<th class="w-35 text-center">@_localizer["Order"]</th>
</tr>
</thead>
<tbody>
<!-- metadata providers will be populated here -->
</tbody>
</table>
<small class="form-label text-disabled form-description">@_localizer["DescriptionMetadataProviders"]</small>
</div>
}
<div class="form-row">
<button type="submit" class="confirm-button w-100px">@_localizer["Save"]</button>
</div>
</div>
</form>
<!-- section success -->
<div class="text-center w-100">
<p id="save-success" class="text-light-one w-100 hidden">@_localizer["LibrarySaved"]</p>
<button id="btn-back-to-libraries" type="button" class="abort-button h-22px w-180px mx-auto mt-10 hidden">@_localizer["BackToLibraries"]</button>
<button id="btn-add-new-library" type="button" class="confirm-button h-22px w-180px mx-auto mt-10 hidden">@_localizer["AddNewLibrary"]</button>
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
const saveSuccess = document.getElementById('save-success');
const btnBackToLibraries = document.getElementById('btn-back-to-libraries');
const btnAddNewLibrary = document.getElementById('btn-add-new-library');
const form = document.getElementById('add-media-library-form');
const imgAddMediaDirectory = document.getElementById('add-media-directory');
const imgAddCover = document.getElementById('add-media-cover');
const mediaCoverFormTable = document.getElementById('add-media-cover-form-table');
const mediaDirectoriesFormTable = document.getElementById('add-media-directory-form-table');
const chkIsEnabled = form.querySelector('[name="IsEnabled"]');
const chkIsLocked = form.querySelector('[name="IsLocked"]');
const chkDownloadMetadataFromWeb = form.querySelector('[name="DownloadMetadataFromWeb"]');
const chkShouldSaveMetadataInMediaDirectories = form.querySelector('[name="ShouldSaveMetadataInMediaDirectories"]');
const chkShouldSkipUnchangedDirectoriesDuringScan = form.querySelector('[name="ShouldSkipUnchangedDirectoriesDuringScan"]');
// create new or update existing media library
async function handleAddMediaLibraryAsync() {
const formData = {
Id: form.querySelector('[name="Id"]').value || null,
UserId: form.querySelector('[name="UserId"]').value || null,
Title: form.querySelector('[name="Title"]').value,
LibraryType: form.querySelector('#library-selected-item').getAttribute('data-value'),
ContentLocations: Array.from(mediaDirectoriesFormTable.querySelectorAll('.form-table-row span'))
.map(span => span.textContent),
CoverImage: (() => {
// get the first (and only) span in the mediaCoverFormTable, if it exists
const coverSpan = mediaCoverFormTable.querySelector('.form-table-row span');
return coverSpan ? coverSpan.textContent : null; // return null if no cover image is selected
})(),
IsEnabled: chkIsEnabled.checked,
IsLocked: chkIsLocked.checked,
DownloadMetadataFromWeb: chkDownloadMetadataFromWeb.checked,
ShouldSaveMetadataInMediaDirectories: chkShouldSaveMetadataInMediaDirectories.checked,
ShouldSkipUnchangedDirectoriesDuringScan: chkShouldSkipUnchangedDirectoriesDuringScan.checked
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.SAVE_LIBRARY)', formData);
if (data) {
form.classList.replace('inline', 'hidden');
saveSuccess.classList.replace('hidden', 'inline');
btnAddNewLibrary.classList.replace('hidden', 'block');
btnBackToLibraries.classList.replace('hidden', 'block');
}
}
function addMediaLibraryDirectories(selectedPaths) {
// process the selected paths (remove quotes and split by comma)
const paths = selectedPaths.slice(1, -1).split('","');
// add each path as a new row
paths.forEach(path => {
// normalize the path for comparison
const normalizedPath = path.replace(/\\\\/g, '\\');
// use querySelectorAll and compare explicitly, so that duplicates are not permitted
const existingPaths = Array.from(mediaDirectoriesFormTable.querySelectorAll('span[title]'));
const isDuplicate = existingPaths.some(span => span.getAttribute('title') === normalizedPath);
if (!isDuplicate) {
mediaDirectoriesFormTable.insertAdjacentHTML('beforeend', `
<div class="form-table-row">
<span title="${normalizedPath}">${normalizedPath}</span>
<img src="/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="remove-form-table-row-icon" onclick="this.closest('.form-table-row').remove();" />
</div>
`);
}
});
}
function addMediaLibraryCoverImage(selectedPaths) {
// process the selected paths
const paths = selectedPaths.slice(1, -1).split('","');
// ensure only one row is allowed by first clearing all previous rows
mediaCoverFormTable.innerHTML = '';
// add the first valid path (if any) as a new row
if (paths.length > 0) {
const path = paths[0]; // only use the first path
mediaCoverFormTable.insertAdjacentHTML('beforeend', `
<div class="form-table-row">
<span title="${path}">${path}</span>
<img src="/images/ui/delete.svg" alt="@_localizer["Remove"]" title="@_localizer["Remove"]" class="remove-form-table-row-icon" onclick="this.closest('.form-table-row').remove();" />
</div>
`);
}
}
// on Enter key pressed
const handleEnterKey = async function(e) {
if (e.key === 'Enter') {
e.preventDefault();
await handleAddMediaLibraryAsync();
}
};
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleAddMediaLibraryAsync();
};
// on back to libraries button click
const handleBtnBackToLibrariesClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.INDEX)';
};
// on add new library button click
const handleBtnAddNewLibraryClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.EDIT_LIBRARY)';
};
// on add media directory image click
const handleImgAddMediaDirectoryClick = async function() {
await showFileSystemBrowserDialogAsync('C:\\Users\\', true, false, addMediaLibraryDirectories); // TODO: take path and include hidden elements from settings
};
// on add cover image click
const handleImgAddCoverClick = async function() {
await showFileSystemBrowserDialogAsync('C:\\Users\\', true, true, addMediaLibraryCoverImage); // TODO: take path and include hidden elements from settings
};
// on remove row icon click
const handleRowRemoval = (e) => {
if (e.target.matches('.remove-form-table-row-icon'))
e.target.parentElement.remove();
};
const id = '@id';
const metadataProvidersTable = document.getElementById('metadata-providers-table');
const metadataProvidersTbody = metadataProvidersTable ? metadataProvidersTable.querySelector('tbody') : null;
// loads the metadata providers configured for the library, when editing an existing library
async function loadMetadataProvidersAsync() {
if (!id || !metadataProvidersTbody) return;
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.GET_METADATA_PROVIDERS, new { libraryId = default(Guid) })'
.replace('/@(default(Guid))', `/${id}`); // libraryId needs to be replaced here, because GetAbsoluteUrl is server side, libraryId is client side
const response = await callApiGetAsync(url);
if (response && response.length > 0) {
metadataProvidersTbody.innerHTML = response.map((provider, index) => renderMetadataProviderRow(provider, index, response.length)).join('');
}
}
// renders a metadata provider row of the library
function renderMetadataProviderRow(provider, index, count) {
return `
<tr data-provider-plugin-id="${provider.pluginId}">
<td>${provider.name}</td>
<td class="text-center">
<input type="checkbox" class="metadata-provider-enabled" ${provider.isEnabled ? 'checked' : ''} />
</td>
<td class="text-center">
<button type="button" class="metadata-provider-move-up confirm-button f-12 h-20px" ${index === 0 ? 'disabled' : ''}>@_localizer["MoveUp"]</button>
<button type="button" class="metadata-provider-move-down abort-button f-12 h-20px" ${index === count - 1 ? 'disabled' : ''}>@_localizer["MoveDown"]</button>
</td>
</tr>`;
}
// on metadata provider move button click, reorders the providers and persists the new order
async function handleMetadataProviderReorderAsync(e) {
const button = e.target.closest('.metadata-provider-move-up, .metadata-provider-move-down');
if (!button || !metadataProvidersTbody) return;
const row = button.closest('tr');
if (button.classList.contains('metadata-provider-move-up')) {
const previousRow = row.previousElementSibling;
if (previousRow) metadataProvidersTbody.insertBefore(row, previousRow);
} else {
const nextRow = row.nextElementSibling;
if (nextRow) metadataProvidersTbody.insertBefore(nextRow, row);
}
await saveMetadataProviderOrderAsync();
}
// persists the current order of the metadata providers of the library
async function saveMetadataProviderOrderAsync() {
if (!id || !metadataProvidersTbody) return;
const pluginIds = Array.from(metadataProvidersTbody.querySelectorAll('tr[data-provider-plugin-id]'))
.map(row => row.getAttribute('data-provider-plugin-id'));
const result = await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.REORDER_METADATA_PROVIDERS)', { libraryId: id, pluginIds: pluginIds });
if (result.success) {
notificationService.show('@_localizer["OrderSaved"]', NotificationType.SUCCESS);
}
}
// on metadata provider enabled checkbox change, persists the new state
async function handleMetadataProviderEnabledChangeAsync(e) {
if (e.target.matches('.metadata-provider-enabled')) {
const row = e.target.closest('tr');
const pluginId = row.getAttribute('data-provider-plugin-id');
const isEnabled = e.target.checked;
const result = await callApiPutAsync('@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.SET_METADATA_PROVIDER_ENABLED)', { libraryId: id, pluginId: pluginId, isEnabled: isEnabled });
if (!result.success) {
e.target.checked = !isEnabled;
}
}
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
btnBackToLibraries.addEventListener('click', handleBtnBackToLibrariesClick);
btnAddNewLibrary.addEventListener('click', handleBtnAddNewLibraryClick);
imgAddMediaDirectory.addEventListener('click', handleImgAddMediaDirectoryClick);
imgAddCover.addEventListener('click', handleImgAddCoverClick);
mediaCoverFormTable.addEventListener('click', handleRowRemoval);
mediaDirectoriesFormTable.addEventListener('click', handleRowRemoval);
if (metadataProvidersTbody) {
metadataProvidersTbody.addEventListener('click', handleMetadataProviderReorderAsync);
metadataProvidersTbody.addEventListener('change', handleMetadataProviderEnabledChangeAsync);
}
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('keypress', handleEnterKey);
form.removeEventListener('submit', handleSubmit);
btnBackToLibraries.removeEventListener('click', handleBtnBackToLibrariesClick);
btnAddNewLibrary.removeEventListener('click', handleBtnAddNewLibraryClick);
imgAddMediaDirectory.removeEventListener('click', handleImgAddMediaDirectoryClick);
imgAddCover.removeEventListener('click', handleImgAddCoverClick);
mediaCoverFormTable.removeEventListener('click', handleRowRemoval);
mediaDirectoriesFormTable.removeEventListener('click', handleRowRemoval);
if (metadataProvidersTbody) {
metadataProvidersTbody.removeEventListener('click', handleMetadataProviderReorderAsync);
metadataProvidersTbody.removeEventListener('change', handleMetadataProviderEnabledChangeAsync);
}
});
// load the metadata providers when editing an existing library
if (id) {
loadMetadataProvidersAsync();
}
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,317 @@
@*
/library/written-content-library/books-library/books?libraryId=...
*@
@using Lumina.Presentation.Web.Common.DTO.Libraries
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IViewLocalizer _localizer
@inject IUrlService _urlService
@model LibraryDto
<div class="cotton-candy">
<div style="display: grid; grid-template-rows: auto 1fr;">
<!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="pl-10 pr-10 pb-10">
<div class="text-center">
<h1 class="text-light-two engraved-title">@(Model.Title ?? string.Empty)</h1>
</div>
<div class="form-row">
<input id="search-input" type="text" class="enlightenment-input w-200px" placeholder="@_localizer["Search"]" />
<button id="search-button" type="button" class="confirm-button">@_localizer["Search"]</button>
<button id="sort-toggle" type="button" class="confirm-button">@_localizer["SortAscending"]</button>
<span id="count-label" class="text-light-two"></span>
</div>
<div style="display: flex; align-items: flex-start;">
<div id="books-container" class="cards-container justify-start h-100" style="flex: 1; min-width: 0;">
<p id="no-items" class="hidden text-light-two">@_localizer["NoItems"]</p>
<p id="no-items-matching" class="hidden text-light-two">@_localizer["NoItemsMatchFilters"]</p>
</div>
<div id="alpha-picker" class="alpha-picker"></div>
</div>
<div id="pagination" class="form-row mx-auto w-25 hidden" style="justify-content: center;">
<button id="prev-page" type="button" class="abort-button">@_localizer["Previous"]</button>
<span id="page-indicator" class="text-light-two"></span>
<button id="next-page" type="button" class="confirm-button">@_localizer["Next"]</button>
</div>
</div>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
let isInitialized = false;
let requestSequence = 0;
const libraryId = '@(Model.Id ?? Guid.Empty)';
const booksContainer = document.getElementById('books-container');
const noItemsMessage = document.getElementById('no-items');
const noItemsMatchingMessage = document.getElementById('no-items-matching');
const searchInput = document.getElementById('search-input');
const searchButton = document.getElementById('search-button');
const sortToggle = document.getElementById('sort-toggle');
const countLabel = document.getElementById('count-label');
const alphaPicker = document.getElementById('alpha-picker');
const pagination = document.getElementById('pagination');
const prevPageButton = document.getElementById('prev-page');
const nextPageButton = document.getElementById('next-page');
const pageIndicator = document.getElementById('page-indicator');
// the special alpha keys for numbers and symbols, followed by the letters
const alphaKeys = ['#', '*', ...Array.from({ length: 26 }, (_, index) => String.fromCharCode(65 + index))];
const state = {
currentPage: 1,
perPage: null,
searchTerm: '',
alphaKey: null,
ignoreThePrefix: false,
sortOrder: 'Ascending'
};
const jsLocalizedStrings = {
all: '@_localizer["All"]',
items: '@_localizer["Items"]',
of: '@_localizer["Of"]',
page: '@_localizer["Page"]',
sortAscending: '@_localizer["SortAscending"]',
sortDescending: '@_localizer["SortDescending"]'
};
// builds the URL of the retrieval endpoint, from the current state
function buildItemsUrl() {
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Books.GET_LIBRARY_ITEMS)';
const params = new URLSearchParams();
params.set('libraryId', libraryId);
if (state.perPage !== null) {
params.set('currentPage', state.currentPage);
params.set('perPage', state.perPage);
}
if (state.searchTerm !== '')
params.set('searchTerm', state.searchTerm);
if (state.alphaKey !== null)
params.set('filterAlphaKey', state.alphaKey);
params.set('ignoreThePrefixForAlphaPicker', state.ignoreThePrefix);
params.set('sortOrder', state.sortOrder);
return `${url}?${params.toString()}`;
}
// retrieves the books and renders them, ignoring stale responses of earlier requests
async function loadItemsAsync() {
const requestId = ++requestSequence;
const response = await callApiGetAsync(buildItemsUrl());
if (requestId !== requestSequence)
return;
if (response)
renderItems(response);
}
// renders the retrieved books, the count label and the pagination controls
function renderItems(response) {
booksContainer.querySelectorAll('.media-panel').forEach(card => card.remove());
const hasActiveFilters = state.searchTerm !== '' || state.alphaKey !== null;
if (response.count === 0) {
booksContainer.classList.add('justify-center');
noItemsMessage.classList.toggle('hidden', hasActiveFilters);
noItemsMatchingMessage.classList.toggle('hidden', !hasActiveFilters);
} else {
booksContainer.classList.remove('justify-center');
noItemsMessage.classList.add('hidden');
noItemsMatchingMessage.classList.add('hidden');
response.data.forEach(book => booksContainer.appendChild(createBookCard(book)));
}
updateCountLabel(response);
updatePagination(response);
}
// creates a portrait card for a book, with its cover image (or a placeholder) and its title
function createBookCard(book) {
const card = document.createElement('div');
card.className = 'media-panel';
card.style.width = '160px';
card.style.height = '240px';
const image = document.createElement('img');
image.src = book.coverPath
? `${globalConfiguration.serverBasePath}${book.coverPath}`
: `/images/ui/book-placeholder.svg`;
image.alt = book.title;
const titleSpan = document.createElement('span');
titleSpan.className = 'text-light-two';
const title = document.createElement('strong');
title.textContent = book.title;
titleSpan.appendChild(title);
card.appendChild(image);
card.appendChild(titleSpan);
return card;
}
// updates the count label: total items when pagination is off, displayed range out of total when it is on
function updateCountLabel(response) {
if (state.perPage === null)
countLabel.textContent = `${response.count} ${jsLocalizedStrings.items}`;
else if (response.count === 0)
countLabel.textContent = `0 ${jsLocalizedStrings.items}`;
else {
const start = (response.currentPage - 1) * response.perPage + 1;
const end = Math.min(response.currentPage * response.perPage, response.count);
countLabel.textContent = `${start}-${end} ${jsLocalizedStrings.of} ${response.count}`;
}
}
// updates the pagination controls, which are only visible when pagination is enabled
function updatePagination(response) {
if (state.perPage === null) {
pagination.classList.add('hidden');
return;
}
const totalPages = Math.max(1, response.numberOfPages);
pagination.classList.remove('hidden');
pageIndicator.textContent = `${jsLocalizedStrings.page} ${response.currentPage} ${jsLocalizedStrings.of} ${totalPages}`;
prevPageButton.disabled = response.currentPage <= 1;
nextPageButton.disabled = response.currentPage >= totalPages;
}
// builds the alpha picker column, with the "All" key followed by the numbers, symbols and letters keys
function buildAlphaPicker() {
const allKey = document.createElement('span');
allKey.className = 'alpha-key';
allKey.dataset.alphaKey = '';
allKey.textContent = jsLocalizedStrings.all;
allKey.addEventListener('click', () => handleAlphaKeyClick(null));
alphaPicker.appendChild(allKey);
alphaKeys.forEach(key => {
const alphaKey = document.createElement('span');
alphaKey.className = 'alpha-key';
alphaKey.dataset.alphaKey = key;
alphaKey.textContent = key;
alphaKey.addEventListener('click', () => handleAlphaKeyClick(key));
alphaPicker.appendChild(alphaKey);
});
updateAlphaPickerActiveState();
}
// highlights the currently active key of the alpha picker
function updateAlphaPickerActiveState() {
alphaPicker.querySelectorAll('.alpha-key').forEach(key => {
const keyValue = key.dataset.alphaKey === '' ? null : key.dataset.alphaKey;
key.classList.toggle('alpha-key-active', keyValue === state.alphaKey);
});
}
// applies the given alpha key (null clears the alpha filter) and reloads the books
function handleAlphaKeyClick(key) {
state.alphaKey = key;
state.currentPage = 1;
updateAlphaPickerActiveState();
loadItemsAsync();
}
// applies the search term and reloads the books
function handleSearch() {
state.searchTerm = searchInput.value.trim();
state.currentPage = 1;
loadItemsAsync();
}
// triggers the search when the Enter key is pressed in the search input
function handleSearchKeydown(event) {
if (event.key === 'Enter') {
event.preventDefault();
handleSearch();
}
}
// toggles the sort direction and reloads the books
function handleSortToggle() {
state.sortOrder = state.sortOrder === 'Ascending' ? 'Descending' : 'Ascending';
sortToggle.textContent = state.sortOrder === 'Ascending' ? jsLocalizedStrings.sortAscending : jsLocalizedStrings.sortDescending;
state.currentPage = 1;
loadItemsAsync();
}
// applies an alpha filter when a letter is pressed while the search input does not have focus; Escape clears the alpha filter
function handleAlphaKeydown(event) {
if (document.activeElement === searchInput)
return;
if (event.key.length === 1 && /[a-zA-Z]/.test(event.key))
handleAlphaKeyClick(event.key.toUpperCase());
else if (event.key === 'Escape')
handleAlphaKeyClick(null);
}
// loads the settings of the current user, which drive pagination and the alpha picker prefix handling
async function loadSettingsAsync() {
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS)');
if (data) {
state.ignoreThePrefix = data.ignoreThePrefixForAlphaPicker === true;
state.perPage = data.isPaginationEnabled === true ? data.itemsPerPage : null;
}
}
// navigates to the previous page
function handlePrevPageClick() {
state.currentPage = Math.max(1, state.currentPage - 1);
loadItemsAsync();
}
// navigates to the next page
function handleNextPageClick() {
state.currentPage = state.currentPage + 1;
loadItemsAsync();
}
// add listeners
searchButton.addEventListener('click', handleSearch);
searchInput.addEventListener('keydown', handleSearchKeydown);
sortToggle.addEventListener('click', handleSortToggle);
prevPageButton.addEventListener('click', handlePrevPageClick);
nextPageButton.addEventListener('click', handleNextPageClick);
document.addEventListener('keydown', handleAlphaKeydown);
document.addEventListener('DOMContentLoaded', InitializeAsync);
// register cleanup for these listeners
cleanupFunctions.push(() => {
searchButton.removeEventListener('click', handleSearch);
searchInput.removeEventListener('keydown', handleSearchKeydown);
sortToggle.removeEventListener('click', handleSortToggle);
prevPageButton.removeEventListener('click', handlePrevPageClick);
nextPageButton.removeEventListener('click', handleNextPageClick);
document.removeEventListener('keydown', handleAlphaKeydown);
document.removeEventListener('DOMContentLoaded', InitializeAsync);
});
async function InitializeAsync() {
if (isInitialized)
return;
isInitialized = true;
sortToggle.textContent = jsLocalizedStrings.sortAscending;
buildAlphaPicker();
await loadSettingsAsync();
await loadItemsAsync();
}
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,200 @@
@*
/plugins
*@
@using Lumina.Presentation.Web.Common.DTO.Plugins
@using Lumina.Presentation.Web.Common.Enums.Plugins
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@model PluginDto[]
@{
var settingsByPluginId = ViewData["pluginSettings"] as Dictionary<Guid, PluginSettingsDto> ?? new Dictionary<Guid, PluginSettingsDto>();
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect mx-auto panel w-75 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">
@_localizer["Plugins"]
</h1>
</div>
@if (Model.Length > 0)
{
<table class="w-100 text-light-two">
<thead>
<tr>
<th class="w-25">@_localizer["Name"]</th>
<th class="w-15">@_localizer["Author"]</th>
<th class="w-10">@_localizer["Version"]</th>
<th class="w-30">@_localizer["Description"]</th>
<th class="w-10">@_localizer["LoadStatus"]</th>
<th class="w-10">@_localizer["Settings"]</th>
</tr>
</thead>
<tbody>
@foreach (PluginDto plugin in Model)
{
<tr data-plugin-id="@plugin.Id">
<td>@plugin.Name</td>
<td>@plugin.Author</td>
<td>@plugin.Version</td>
<td>@plugin.Description</td>
<td>
@if (plugin.LoadStatus == PluginLoadStatus.Loaded)
{
<span class="text-light-one">@_localizer["Loaded"]</span>
}
else
{
<span class="text-disabled">@_localizer["FailedToLoad"]</span>
}
</td>
<td class="text-center">
@if (plugin.LoadStatus == PluginLoadStatus.Loaded && settingsByPluginId.ContainsKey(plugin.Id))
{
<button type="button" class="btn-plugin-settings-toggle confirm-button f-12 h-20px">@_localizer["Settings"]</button>
}
</td>
</tr>
@if (plugin.LoadStatus == PluginLoadStatus.FailedToLoad && !string.IsNullOrWhiteSpace(plugin.LoadError))
{
<tr>
<td colspan="6" class="text-disabled">
@_localizer["LoadError"]: @plugin.LoadError
</td>
</tr>
}
@if (plugin.LoadStatus == PluginLoadStatus.Loaded && settingsByPluginId.ContainsKey(plugin.Id))
{
PluginSettingsDto pluginSettings = settingsByPluginId[plugin.Id];
<tr class="plugin-settings-row hidden">
<td colspan="6">
<div class="plugin-settings-panel w-75 mx-auto mt-5 mb-5" data-plugin-id="@plugin.Id">
@foreach (PluginSettingDescriptorDto descriptor in pluginSettings.Schema)
{
string currentValue = pluginSettings.Settings is not null && pluginSettings.Settings.ContainsKey(descriptor.Key)
? pluginSettings.Settings[descriptor.Key]
: descriptor.DefaultValue ?? string.Empty;
<div class="form-row">
<div class="form-label">
<label>@descriptor.Label</label>:
</div>
<div class="form-field">
@if (descriptor.Type == PluginSettingType.Text)
{
<input type="text" class="enlightenment-input" name="@descriptor.Key" value="@currentValue" />
}
else if (descriptor.Type == PluginSettingType.Number)
{
<input type="number" class="enlightenment-input" name="@descriptor.Key" value="@currentValue" />
}
else if (descriptor.Type == PluginSettingType.Boolean)
{
bool isChecked = bool.TryParse(currentValue, out bool parsedChecked) && parsedChecked;
<label class="enlightenment-checkbox-label">
<input type="checkbox" class="enlightenment-checkbox-hidden" name="@descriptor.Key" @(isChecked ? "checked" : "") />
<span class="enlightenment-checkbox"></span>
</label>
}
else if (descriptor.Type == PluginSettingType.Select)
{
<select class="enlightenment-input" name="@descriptor.Key">
@foreach (string allowedValue in descriptor.AllowedValues ?? [])
{
if (allowedValue == currentValue)
{
<option value="@allowedValue" selected>@allowedValue</option>
}
else
{
<option value="@allowedValue">@allowedValue</option>
}
}
</select>
}
</div>
</div>
}
<div class="form-row text-end">
<button type="button" class="btn-save-plugin-settings confirm-button f-12 h-22px">@_localizer["Save"]</button>
</div>
</div>
</td>
</tr>
}
}
</tbody>
</table>
}
else
{
<p id="no-plugins" class="text-center">@_localizer["NoPlugins"]</p>
}
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
// on settings toggle button click, show/hide the settings row of the plugin
const handleSettingsToggleClick = function(e) {
if (e.target.matches('.btn-plugin-settings-toggle')) {
const row = e.target.closest('tr');
const settingsRow = row.nextElementSibling;
if (settingsRow && settingsRow.classList.contains('plugin-settings-row')) {
settingsRow.classList.toggle('hidden');
}
}
};
// on save plugin settings button click, collect the settings of the panel and send them to the API
const handleSavePluginSettingsClick = async function(e) {
if (e.target.matches('.btn-save-plugin-settings')) {
const panel = e.target.closest('.plugin-settings-panel');
const pluginId = panel.getAttribute('data-plugin-id');
const settings = {};
panel.querySelectorAll('input[name], select[name]').forEach(input => {
if (input.type === 'checkbox') {
settings[input.name] = input.checked.toString();
} else {
settings[input.name] = input.value;
}
});
const url = '@_urlService.GetAbsoluteUrl(WebRoutes.Plugins.UPDATE_PLUGIN_SETTINGS)';
const result = await callApiPutAsync(url, { pluginId: pluginId, settings: settings });
if (result.success) {
notificationService.show('@_localizer["SettingsSaved"]', NotificationType.SUCCESS);
}
}
};
// add listeners
document.addEventListener('click', handleSettingsToggleClick);
document.addEventListener('click', handleSavePluginSettingsClick);
// register cleanup for these listeners
cleanupFunctions.push(() => {
document.removeEventListener('click', handleSettingsToggleClick);
document.removeEventListener('click', handleSavePluginSettingsClick);
});
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,549 @@
@using Lumina.Presentation.Web.Common.DTO.Common
@using Lumina.Presentation.Web.Common.Api
@using Lumina.Presentation.Web.Common.Enums.FileSystem
@using Lumina.Presentation.Web.Common.Enums.Notifications
@using Lumina.Presentation.Web.Common.Exceptions
@using Lumina.Presentation.Web.Common.DTO.FileSystemManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.AspNetCore.Components
@using System.Text.Json
@using System.Text
@{
var componentScriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IViewLocalizer _localizer
<div id="file-system-browser-dialog" class="container-background above-modal">
<div id="file-system-browser-content">
<div id="file-system-browser-header">
<div id="file-system-browser-shine-spark"></div>
<div id="file-system-browser-shine-effect"></div>
<div id="file-system-browser-header-navigation-container">
<!--File System Navigator-->
<div id="navigator-view-mode-container">
<!--List View Mode-->
<svg id="navigator-list-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ListView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,5 h8 v8 h-8 z M11,9 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,13 h8 v8 h-8 z M11,17 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M3,21 h8 v8 h-8 z M11,25 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M5,23 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,5 h8 v8 h-8 z M28,9 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,13 h8 v8 h-8 z M28,17 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M20,21 h8 v8 h-8 z M28,25 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill list" filter="url(#glow)" d="M22,23 h4 v4 h-4 z" />
</g>
</svg>
<!--Details View Mode-->
<svg id="navigator-details-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["DetailsView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,5 h8 v8 h-8 z M11,9 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,13 h8 v8 h-8 z M11,17 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M3,21 h8 v8 h-8 z M11,25 h4" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M5,23 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,8.5 h5 v1 h-5 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,16.5 h5 v1 h-5 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M17.5,24.5 h5 v1 h-5 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,8.5 h5 v1 h-5 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,16.5 h5 v1 h-5 z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill details" filter="url(#glow)" d="M25,24.5 h5 v1 h-5 z" />
</g>
</svg>
<!--Small Icons View Mode-->
<svg id="navigator-small-icons-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["SmallIconsView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M4,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M6,23 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M12,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M14,23 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,5 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,7 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,13 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,15 h4 v4 h-4 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M20,21 h8 v8 h-8 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill small-icons" filter="url(#glow)" d="M22,23 h4 v4 h-4 z" />
</g>
</svg>
<!--Medium Icons View Mode-->
<svg id="navigator-medium-icons-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["MediumIconsView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M4,5 h12 v12 h-12 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M6,7 h8 v8 h-8 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M4,17 h12 v12 h-12 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M6,19 h8 v8 h-8 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M16,5 h12 v12 h-12 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M18,7 h8 v8 h-8 z" />
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M16,17 h12 v12 h-12 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill medium-icons" filter="url(#glow)" d="M18,19 h8 v8 h-8 z" />
</g>
</svg>
<!--Large Icons View Mode-->
<svg id="navigator-large-icons-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["LargeIconsView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill large-icons" filter="url(#glow)" d="M4,5 h24 v24 h-24 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill large-icons" filter="url(#glow)" d="M6,7 h20 v20 h-20 z" />
</g>
</svg>
<!--Extra Large Icons View Mode-->
<svg id="navigator-extra-large-icons-view" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ExtraLargeIconsView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="stroke:currentColor;" class="navigator-icon-fill extra-large-icons" filter="url(#glow)" d="M4,5 h24 v24 h-24 z" fill="none" stroke-width="1" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill extra-large-icons" filter="url(#glow)" d="M11,12 L16,17 L21,12 L26,17 V7 H6 V17 Z" fill="none" stroke-width="1" />
</g>
</svg>
</div>
<div id="navigator-navigation-controls-container">
<!--Navigation-->
<div id="navigator-history">
<img src="~/images/ui/back.svg" id="navigator-navigate-back" class="navigation-icon" alt="@_localizer["Back"]" title="@_localizer["Back"]" />
<img src="~/images/ui/forward.svg" id="navigator-navigate-forward" class="navigation-icon" alt="@_localizer["Forward"]" title="@_localizer["Forward"]" />
<img src="~/images/ui/up.svg" id="navigator-navigate-up" class="navigation-icon" alt="@_localizer["UpOneLevel"]" title="@_localizer["UpOneLevel"]" />
</div>
<!--Toggle Tree View-->
<svg id="navigator-toggle-tree-view-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ToggleTreeView"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(6,6) scale(0.55)">
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill tree-view" filter="url(#glow)" d="M 4 4 L 4 14 L 9 14 L 9 23 L 18 23 L 18 28 L 28 28 L 28 18 L 18 18 L 18 22 L 10 22 L 10 14 L 14 14 L 14 9 L 18 9 L 18 14 L 28 14 L 28 4 L 18 4 L 18 8 L 14 8 L 14 4 L 4 4 z M 5 5 L 13 5 L 13 13 L 5 13 L 5 5 z M 19 5 L 27 5 L 27 13 L 19 13 L 19 5 z" />
</g>
</svg>
<!--Toggle Thumbnails-->
<svg id="navigator-toggle-thumbnails-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ToggleThumbanils"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(3,2.5) scale(0.32)">
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill thumbnails" filter="url(#glow)" d="M 20,17L 44.25,17L 56,28.75L 56,59L 20,59L 20,17 Z M 24,21L 24,55L 52,55L 52,34L 39,34L 39,21L 24,21 Z M 43,22.25L 43,30L 50.75,30L 43,22.25 Z M 27,47.5L 30,50.5L 42.5,38L 47.5,43L 51,39L 51,54L 25,54L 25,50L 27,47.5 Z M 33,22C 33,26.3723 29.3723,30 25,30L 25,22L 33,22 Z " />
</g>
</svg>
<!--Toggle Hidden Elements-->
<svg id="navigator-toggle-hidden-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ToggleHiddenItems"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(5,5) scale(0.85)">
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" d="M14.3307 7.16929C13.5873 7.05887 12.806 7 12 7C7.02944 7 3 9.23858 3 12C3 13.4401 4.09589 14.738 5.84963 15.6504L8.21192 13.2881C8.07452 12.8839 8 12.4506 8 12C8 9.79086 9.79086 8 12 8C12.4506 8 12.8839 8.07452 13.2881 8.21192L14.3307 7.16929Z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" d="M11.2308 15.9261C11.4797 15.9746 11.7369 16 12 16C14.2091 16 16 14.2091 16 12C16 11.7369 15.9746 11.4797 15.9261 11.2308L18.5726 8.58427C20.0782 9.47809 21 10.6792 21 12C21 14.7614 16.9706 17 12 17C11.4016 17 10.8169 16.9676 10.2512 16.9057L11.2308 15.9261Z" />
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill hidden-elements" filter="url(#glow)" d="M17.7929 5.20711C18.1834 4.81658 18.8166 4.81658 19.2071 5.20711C19.5976 5.59763 19.5976 6.2308 19.2071 6.62132L6.47919 19.3492C6.08866 19.7398 5.4555 19.7398 5.06497 19.3492C4.67445 18.9587 4.67445 18.3256 5.06497 17.935L17.7929 5.20711Z" />
</g>
</svg>
<!--Toggle Selection Mode-->
<svg id="navigator-toggle-selection-button" class="navigator-icon" width="30" height="30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>@_localizer["ToggleSelectionMode"]</title>
<defs>
<filter id="glow" x="-50%" y="-50%" width="200%" height="200%">
<feComponentTransfer in="SourceAlpha" result="adjustedAlpha">
<feFuncA type="table" tableValues="0 0.5 1" />
</feComponentTransfer>
<feGaussianBlur in="adjustedAlpha" stdDeviation="2" result="blur" />
<feFlood flood-color="#039bfc" result="color" />
<feComposite in="color" in2="blur" operator="in" result="softGlowColored" />
<feMerge>
<feMergeNode in="softGlowColored" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
<linearGradient id="linearGradient1" x1="5" x2="195" y1="174.76" y2="174.76" gradientTransform="matrix(.32632 0 0 .095367 -.63187 42.834)" gradientUnits="userSpaceOnUse">
<stop stop-color="#039bfc" stop-opacity="0" offset="0" />
<stop stop-color="#039bfc" offset=".225" />
<stop stop-color="#039bfc" offset=".5" />
<stop stop-color="#039bfc" offset=".775" />
<stop stop-color="#039bfc" stop-opacity="0" offset="1" />
</linearGradient>
</defs>
<g transform="translate(0,-0.5) scale(0.475)">
<rect x=".99971" y="59" width="62.001" height="1" ry="0" fill="url(#linearGradient)" stroke-width="3.7796" style="mix-blend-mode:normal;paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g stroke-linecap="round" stroke-linejoin="round" stroke-width="0.5">
<rect x="4.5" y="4.5" width="21" height="21" ry="2.5" fill="none" stroke="#039bfc" style="paint-order:stroke fill markers" filter="url(#glow)" />
</g>
<g transform="translate(8,8) scale(0.030)">
<path xmlns="http://www.w3.org/2000/svg" style="fill:currentColor;" class="navigator-icon-fill selection-mode" filter="url(#glow)" d="M161.9,21.9v21.9h131.2V0H161.9v43.7V21.9v21.9h131.2V0H161.9v43.7V21.9z M406.6,425.9L393,408.7l-52.4,41.6l-79.4-102.1 l-53,61.8l-38.9-217.9l198.1,99.1l-78.6,26.2l100.9,122.4L406.6,425.9L393,408.7L406.6,425.9l16.9-13.9l-60.4-73.2l118.3-39.4 L110.8,114l70.4,394.5l78.2-91.2l73.7,94.7l104.5-82.9l-14.2-17.2L406.6,425.9z M424.3,87.5V0h-87.5v43.7l43.7,0l0,43.7H424.3 L424.3,87.5z M118.1,0H30.7v87.5h43.7l0-43.7l43.7,0V0L118.1,0z M30.7,306.2v87.5h87.5v-43.7l-43.7,0l0-43.7H30.7z M402.5,131.2 h-21.9v87.5h43.7v-87.5h-43.7H402.5h-21.9v87.5h43.7v-87.5h-43.7H402.5z M52.5,262.4h21.9V131.2H30.7v131.2h43.7H52.5h21.9V131.2 H30.7v131.2h43.7H52.5z" />
</g>
</svg>
</div>
<!--Navigator-->
<div id="navigator-address-bar-container">
<div id="navigator-address-bar-group">
<input type="text" class="enlightenment-input navigator-address-bar-input" Name="navigator-address-bar-input" autocomplete="on" id="navigator-address-bar-input" />
<div id="navigator-address-bar">
<ul id="navigator-path-segments">
</ul>
</div>
</div>
<button id="navigator-edit-path-button" class="navigator-edit-path-button abort-button f-16" style="height:28px; width:35px;">
<img src="~/images/ui/edit.svg" id="navigator-edit-icon" alt="@_localizer["EditPath"]" title="@_localizer["EditPath"]" />
</button>
<button id="navigator-navigate-button" class="navigator-navigate-button confirm-button f-16" style="height:28px; width:35px;">
<img src="~/images/ui/check.svg" id="navigator-navigate-icon" alt="@_localizer["Navigate"]" title="@_localizer["Navigate"]" />
</button>
<button class="file-system-browser-content-new-directory abort-button f-16" style="height:28px; width:35px;">
<img src="~/images/ui/new-directory.svg" id="navigator-new-directory-icon" alt="@_localizer["NewDirectory"]" title="@_localizer["NewDirectory"]" />
</button>
<button class="file-system-browser-content-favorite-directory abort-button f-16" style="height:28px; width:35px;">
<img src="~/images/ui/favorite-star.svg" class="navigation-icon favorite-unselected" alt="@_localizer["FavoriteDirectory"]" title="@_localizer["FavoriteDirectory"]" />
</button>
</div>
<!--End File System Navigator-->
</div>
</div>
<div id="file-system-browser-file-system-container">
<!--File System Tree View-->
<div id="file-system-browser-file-system-treeview-container">
<div id="file-system-browser-file-system-treeview">
<div id="file-system-browser-treeview" class="treeview">
</div>
</div>
</div>
<!--End File System Tree View-->
<div id="file-system-browser-file-system-directories-container">
<div id="file-system-browser-file-system-directories">
<div id="file-system-browser-file-system-explorer-container" class="scroll-horizontal">
<div id="file-system-browser-file-system-explorer-details-header" style="height: 0px;">
<span>@_localizer["Name"]</span>
</div>
<div id="file-system-browser-file-system-explorer">
</div>
</div>
</div>
</div>
</div>
<div id="file-system-browser-actions-container">
<div id="file-system-browser-actions-path-container">
<label class="text-light-one">@_localizer["Directory"]</label>
<input type="text" id="file-system-browser-selected-element" Name="file-system-browser-selected-element" class="enlightenment-input w-100" readonly autocomplete="on" />
</div>
<div id="file-system-browser-actions">
<button id="file-system-browser-cancel-button" class="abort-button w-100px">@_localizer["Cancel"]</button>
<button id="file-system-browser-confirm-button" class="confirm-button w-100px" disabled>@_localizer["Open"]</button>
</div>
</div>
</div>
@* <div id="divModal"></div>
<label class="text-light-one">@_localizer["EnterNewDirectoryName"]</label>
<EnlightenmentInput Type="text" Name="newDirectoryName" AutoComplete="true" />
<EnlightenmentButton IsConfirmButton="false">@_localizer["Cancel"]</EnlightenmentButton>
<EnlightenmentButton>@_localizer["Confirm"]</EnlightenmentButton> *@
</div>
<div id="visible-selection-rectangle"></div>
<div id="selection-rectangle"></div>
<script defer src="~/js/file-system-browser-dialog.js" data-component-script="file-system-browser"></script>
<script defer data-component-init="file-system-browser">
// this outer function executes immediately and creates a scope for the variables
(function() {
// this inner function contains the actual initialization code that needs to run
async function checkAndInit() {
if (typeof initFileSystemBrowser === 'undefined' || typeof callApiGetAsync === 'undefined') {
setTimeout(checkAndInit, 10);
return;
}
await initFileSystemBrowser(
'@Model.ServerBasePath',
'@Model.ClientBasePath',
'@Model.Path.Replace(@"\", @"\\")',
'@Model.ViewMode.ToString().ToLower()',
'@Model.IconSize.ToString().ToLower()');
}
checkAndInit().catch(error => console.error('Failed to initialize file system browser:', error));
})();
</script>
@@ -0,0 +1,26 @@
@using Lumina.Presentation.Web.Common.DTO.Common
@model ErrorViewDto
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
@@ -0,0 +1,19 @@
@*
/not-found/
*@
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer _localizer
<div style="display: grid; grid-template-rows: auto 1fr;">
<!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-55 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<div class="text-center w-100">
<p class="invalid-feedback f-18 w-100"><b>@_localizer["PageNotFound"]</b></p>
<p class="invalid-feedback f-18 w-100"><b>@_localizer["ThereIsNoPage"]</b></p>
</div>
</div>
</div>
@@ -0,0 +1,88 @@
@using Lumina.Presentation.Web.Common.DTO.Configuration
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.Extensions.Options
@inject IViewLocalizer _localizer
@inject IOptions<ServerConfigurationDto> _serverConfigurationModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Lumina</title>
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/button.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/checkbox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/combobox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/file-system-browser.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/file-system-tree-view-node.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/navigation-menu.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/notification.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/dialog.css" asp-append-version="true" />
<link rel="stylesheet" href="~/css/textbox.css" asp-append-version="true" />
<link rel="stylesheet" href="~/Lumina.Presentation.Web.styles.css" asp-append-version="true" />
</head>
<body>
<div id="page">
<header>
@await Html.PartialAsync("_NavMenu")
</header>
<main role="main" style="@(User?.Identity?.IsAuthenticated == false ? "bottom: 0px;" : string.Empty)">
<article class="h-100"> <!--needs to be 100% height so that child pages that require full height as well, can stretch-->
@RenderBody()
<div id="modal-background-article"></div>
<div class="dialog-container"></div>
</article>
</main>
@if (User?.Identity?.IsAuthenticated == true)
{
<!--Audio player-->
<div class="audio-player-container">
<video controls
preload="auto"
height="50" width="600">
<source src="http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" type="video/mp4">
</video>
<a id="audio-player-full-height-toggle">@_localizer["ToggleFullHeight"]</a>
<a id="audio-player-close">@_localizer["ToggleVisibility"]</a>
</div>
}
</div>
<!--Modal grid background-->
<div id="modal-background-menu"></div>
<script>
var globalConfiguration = {
serverBasePath: '@(_serverConfigurationModel.Value.BaseAddress):@(_serverConfigurationModel.Value.Port)',
apiBasePath: '@(_serverConfigurationModel.Value.BaseAddress):@(_serverConfigurationModel.Value.Port)/api/v@(_serverConfigurationModel.Value.ApiVersion)',
};
var jsLocalizedMessages = {
navigationFailed: '@_localizer["NavigationFailed"]',
};
var jsLocalizedDialogs = {
// button texts
ok: '@_localizer["Ok"]',
cancel: '@_localizer["Cancel"]',
yes: '@_localizer["Yes"]',
no: '@_localizer["No"]',
retry: '@_localizer["Retry"]',
abort: '@_localizer["Abort"]',
ignore: '@_localizer["Ignore"]',
// default titles
confirmation: '@_localizer["Confirmation"]',
warning: '@_localizer["Warning"]',
error: '@_localizer["Error"]',
information: '@_localizer["Information"]'
};
</script>
<script src="~/libs/microsoft-signalr/signalr.min.js" asp-append-version="true"></script>
<script defer src="~/js/notifications.js" asp-append-version="true"></script>
<script defer src="~/js/dialogs.js" asp-append-version="true"></script>
<script defer src="~/js/site.js" asp-append-version="true"></script>
<div data-section="scripts">
@await RenderSectionAsync("Scripts", required: false)
</div>
</body>
</html>
@@ -0,0 +1 @@

@@ -0,0 +1,226 @@
@using Lumina.Presentation.Web.Common.Authorization
@using Lumina.Presentation.Web.Common.Enums.Authorization
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@using System.Threading
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@inject IAuthorizationService _auth
<input type="checkbox" id="hamburger-input" class="burger-shower" />
<label id="hamburger-menu" for="hamburger-input">
<span></span>
<span></span>
<span></span>
<nav id="mobile-menu">
<div id="mobile-menu-content">
<div class="mobile-menu-heading">
Lumina
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)"><span>@_localizer["Home"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Account"]
</div>
<ul>
@if (User?.Identity?.IsAuthenticated == false)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)"><span>@_localizer["Login"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)"><span>@_localizer["RecoverPassword"]</span></a></li>
}
else
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGOUT)"><span>@_localizer["Logout"]</span></a></li>
}
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER_VIEW)" class="nav-link"><span>@_localizer["Register"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.CHANGE_PASSWORD_VIEW)" class="nav-link"><span>@_localizer["ChangePassword"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.PROFILE_VIEW)" class="nav-link"><span>@_localizer["Profile"]</span></a></li>
}
</ul>
@if (User?.Identity?.IsAuthenticated == true)
{
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None))
{
<div class="mobile-menu-heading">
@_localizer["Administrator"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_ROLES)" class="nav-link"><span>@_localizer["ManageRoles"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_PERMISSIONS)" class="nav-link"><span>@_localizer["ManagePermissions"]</span></a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Plugins.INDEX)" class="nav-link"><span>@_localizer["Plugins"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Library"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.INDEX)" class="nav-link"><span>@_localizer["ManageLibraries"]</span></a></li>
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None) || await _auth.HasPermissionAsync(AuthorizationPermission.CanCreateLibraries, CancellationToken.None))
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.ADD_LIBRARY)" class="nav-link"><span>@_localizer["AddNewLibrary"]</span></a></li>
}
</ul>
<div class="mobile-menu-heading">
@_localizer["WrittenContent"]
</div>
<ul>
<li><a href="library/written-content-library/books-library/books" class="nav-link"><span>@_localizer["Books"]</span></a></li>
<li><a href="library/written-content/magazines" class="nav-link"><span>@_localizer["Magazines"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Audio"]
</div>
<ul>
<li><a href="library/audio/music" class="nav-link"><span>@_localizer["Music"]</span></a></li>
<li><a href="library/audio/interviews" class="nav-link"><span>@_localizer["Interviews"]</span></a></li>
</ul>
<div class="mobile-menu-heading">
@_localizer["Video"]
</div>
<ul>
<li><a href="library/video/movies" class="nav-link"><span>@_localizer["Movies"]</span></a></li>
<li><a href="library/video/tvshows" class="nav-link"><span>@_localizer["TvShows"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Language"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=zh-cn&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>简体中文</span></a></li><!--CN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=de-de&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Deutsch</span></a></li><!--DE-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=en-us&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>English</span></a></li><!--EN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=es-es&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Español</span></a></li><!--ES-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=fr-fr&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Français</span></a></li><!--FR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=it-it&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Italiano</span></a></li><!--IT-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ja-jp&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>日本語</span></a></li><!--JP-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ro-ro&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Română</span></a></li><!--RO-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ru-ru&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set"><span>Русский</span></a></li><!--RU-->
</ul>
@if (User?.Identity?.IsAuthenticated == true)
{
<div class="mobile-menu-heading">
@_localizer["Tools"]
</div>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Settings.INDEX)" class="nav-link"><span>@_localizer["Settings"]</span></a></li>
</ul>
}
<div class="mobile-menu-heading">
@_localizer["Help"]
</div>
<ul>
<li><a href="help/documentation" class="nav-link"><span>@_localizer["Documentation"]</span></a></li>
<li><a href="help/about" class="nav-link"><span>@_localizer["About"]</span></a></li>
</ul>
</div>
</nav>
</label>
<nav class="menubar">
<ul>
<li tabindex="0" class="top-level-menuitem">
<label for="account-menu">Lumina</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Home.INDEX_CULTURED)">@_localizer["Home"]</a></li>
</ul>
</li>
<li tabindex="0" class="top-level-menuitem">
<label for="account-menu">@_localizer["Account"]</label>
<ul>
@if (User?.Identity?.IsAuthenticated == false)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGIN_VIEW)">@_localizer["Login"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.RECOVER_PASSWORD_VIEW)">@_localizer["RecoverPassword"]</a></li>
}
else
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.LOGOUT)">@_localizer["Logout"]</a></li>
}
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.REGISTER_VIEW)" class="nav-link">@_localizer["Register"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.CHANGE_PASSWORD_VIEW)" class="nav-link">@_localizer["ChangePassword"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Authentication.PROFILE_VIEW)" class="nav-link">@_localizer["Profile"]</a></li>
}
</ul>
</li>
@if (User?.Identity?.IsAuthenticated == true)
{
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None))
{
<li tabindex="1" class="top-level-menuitem">
<label for="administrator-menu">@_localizer["Administrator"]</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_ROLES)" class="nav-link">@_localizer["ManageRoles"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Admin.MANAGE_PERMISSIONS)" class="nav-link">@_localizer["ManagePermissions"]</a></li>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Plugins.INDEX)" class="nav-link">@_localizer["Plugins"]</a></li>
</ul>
</li>
}
<li tabindex="2" class="top-level-menuitem">
<label for="library-menu">@_localizer["Library"]</label>
<ul>
<li tabindex="0"><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.INDEX)" class="nav-link">@_localizer["ManageLibraries"]</a></li>
@if (await _auth.IsInRoleAsync("Admin", CancellationToken.None) || await _auth.HasPermissionAsync(AuthorizationPermission.CanCreateLibraries, CancellationToken.None))
{
<li tabindex="0"><a href="@_urlService.GetAbsoluteUrl(WebRoutes.LibraryManagement.ADD_LIBRARY)" class="nav-link">@_localizer["AddNewLibrary"]</a></li>
}
<li class="has-submenu" tabindex="0">
<label>@_localizer["WrittenContent"]</label>
<ul>
<li><a href="library/written-content-library/books-library/books" class="nav-link">@_localizer["Books"]</a></li>
<li><a href="library/written-content/magazines" class="nav-link">@_localizer["Magazines"]</a></li>
</ul>
</li>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Audio"]</label>
<ul>
<li><a href="library/audio/music" class="nav-link">@_localizer["Music"]</a></li>
<li><a href="library/audio/interviews" class="nav-link">@_localizer["Interviews"]</a></li>
</ul>
</li>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Video"]</label>
<ul>
<li><a href="library/video/movies" class="nav-link">@_localizer["Movies"]</a></li>
<li><a href="library/video/tvshows" class="nav-link">@_localizer["TvShows"]</a></li>
</ul>
</li>
</ul>
</li>
}
<li tabindex="3" class="top-level-menuitem">
<label for="tools-menu">@_localizer["Tools"]</label>
<ul>
<li class="has-submenu" tabindex="0">
<label>@_localizer["Language"]</label>
<ul>
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=zh-cn&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">简体中文</a></li><!--CN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=de-de&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Deutsch</a></li><!--DE-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=en-us&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">English</a></li><!--EN-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=es-es&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Español</a></li><!--ES-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=fr-fr&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Français</a></li><!--FR-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=it-it&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Italiano</a></li><!--IT-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ja-jp&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">日本語</a></li><!--JP-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ro-ro&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Română</a></li><!--RO-->
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Language.SET_LANGUAGE)?newCulture=ru-ru&returnUrl=@Uri.EscapeDataString(Context.Request.Path + Context.Request.QueryString)" class="lang-set">Русский</a></li><!--RU-->
</ul>
</li>
@if (User?.Identity?.IsAuthenticated == true)
{
<li><a href="@_urlService.GetAbsoluteUrl(WebRoutes.Settings.INDEX)" class="nav-link">@_localizer["Settings"]</a></li>
}
</ul>
</li>
<li tabindex="4" class="top-level-menuitem">
<label for="help-menu">@_localizer["Help"]</label>
<ul>
<li><a href="help/documentation" class="nav-link">@_localizer["Documentation"]</a></li>
<li><a href="help/about" class="nav-link">@_localizer["About"]</a></li>
</ul>
</li>
</ul>
</nav>
@@ -0,0 +1,152 @@
@*
/tools/settings
*@
@using Lumina.Presentation.Web.Common.DTO.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@{
// generate a unique id for the scripts section of this view, so it can be dynamically loaded/unloaded by the global AJAX navigator handler
var scriptId = ScriptIdentifierHelper.GenerateScriptId();
}
@inject IUrlService _urlService
@inject IViewLocalizer _localizer
@model UserSettingsDto
<div style="display: grid; grid-template-rows: auto 1fr;"><!--container with two rows, one fixed, one filling remaining space-->
<div style="min-height: 1rem;"></div><!--the first row is a dummy row for "margin", because setting a margin on the next row would offset the parent's position-->
<div class="enlightenment-panel shadow-effect mx-auto panel w-50 mb-10" style="min-width: 320px;">
<div class="shine-effect"></div>
<form method="post" id="user-settings-form" class="inline">
@Html.AntiForgeryToken()
<div class="form-row">
<h1 class="text-light-two w-100 text-center pt-0 pb-0 engraved-title">
@_localizer["Settings"]
</h1>
</div>
<div class="form-container">
<!-- Pagination -->
<div class="form-row">
<div class="form-label">
<label asp-for="IsPaginationEnabled">@_localizer["EnablePagination"]</label>:
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="IsPaginationEnabled" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionEnablePagination"]</small>
</div>
<!-- Items per page -->
<div class="form-row">
<div class="form-label">
<label asp-for="ItemsPerPage">@_localizer["ItemsPerPage"]</label>
<span class="mandatory-field">*</span>:
</div>
<div class="form-field">
<input asp-for="ItemsPerPage" min="1" step="1" class="enlightenment-input" />
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionItemsPerPage"]</small>
</div>
<!-- Alpha picker -->
<div class="form-row">
<div class="form-label">
<label asp-for="IgnoreThePrefixForAlphaPicker">@_localizer["IgnoreThePrefixForAlphaPicker"]</label>:
</div>
<div class="form-field">
<label class="enlightenment-checkbox-label">
<input type="checkbox" asp-for="IgnoreThePrefixForAlphaPicker" class="enlightenment-checkbox-hidden" />
<span class="enlightenment-checkbox"></span>
</label>
</div>
<small class="form-label text-disabled form-description">@_localizer["DescriptionIgnoreThePrefixForAlphaPicker"]</small>
</div>
<div class="form-row" style="justify-content: center;">
<button type="submit" class="confirm-button h-22px">@_localizer["Save"]</button>
</div>
</div>
</form>
</div>
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
// create cleanup registry for this view
const cleanupFunctions = [];
let isInitialized = false;
const form = document.getElementById('user-settings-form');
const checkboxIsPaginationEnabled = document.getElementById('IsPaginationEnabled');
const inputItemsPerPage = document.getElementById('ItemsPerPage');
const checkboxIgnoreThePrefixForAlphaPicker = document.getElementById('IgnoreThePrefixForAlphaPicker');
// toggle the enabled state of the items per page input based on the pagination checkbox
function updateItemsPerPageEnabledState() {
inputItemsPerPage.disabled = !checkboxIsPaginationEnabled.checked;
}
// load the settings of the current user
async function loadUserSettingsAsync() {
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.GET_USER_SETTINGS)');
if (data) {
checkboxIsPaginationEnabled.checked = data.isPaginationEnabled === true;
inputItemsPerPage.value = data.itemsPerPage;
checkboxIgnoreThePrefixForAlphaPicker.checked = data.ignoreThePrefixForAlphaPicker === true;
updateItemsPerPageEnabledState();
}
}
// save the settings of the current user
async function handleSaveUserSettingsAsync() {
const formData = {
IsPaginationEnabled: checkboxIsPaginationEnabled.checked,
ItemsPerPage: Number(inputItemsPerPage.value),
IgnoreThePrefixForAlphaPicker: checkboxIgnoreThePrefixForAlphaPicker.checked
};
const data = await callApiPostAsync('@_urlService.GetAbsoluteUrl(WebRoutes.Settings.UPDATE_USER_SETTINGS)', formData);
if (data && data.isUpdated === true)
notificationService.show('@_localizer["SettingsSaved"]', NotificationType.SUCCESS);
}
// on form submit event
const handleSubmit = async function(e) {
e.preventDefault();
await handleSaveUserSettingsAsync();
};
// on pagination checkbox change, update the enabled state of the items per page input
const handlePaginationCheckboxChange = function() {
updateItemsPerPageEnabledState();
};
// add listeners
form.addEventListener('submit', handleSubmit);
checkboxIsPaginationEnabled.addEventListener('change', handlePaginationCheckboxChange);
document.addEventListener('DOMContentLoaded', InitializeAsync);
// register cleanup for these listeners
cleanupFunctions.push(() => {
form.removeEventListener('submit', handleSubmit);
checkboxIsPaginationEnabled.removeEventListener('change', handlePaginationCheckboxChange);
document.removeEventListener('DOMContentLoaded', InitializeAsync);
});
async function InitializeAsync() {
if (isInitialized)
return;
isInitialized = true;
await loadUserSettingsAsync();
}
// store all cleanups for this view on window object using the scriptId
window.viewCleanups = window.viewCleanups || {};
window.viewCleanups['@scriptId'] = () => {
cleanupFunctions.forEach(cleanup => cleanup());
console.log(`Unloaded @scriptId`);
};
console.log(`Loaded @scriptId`);
</script>
}
@@ -0,0 +1,4 @@
@using Lumina.Presentation.Web
@using Lumina.Presentation.Web.Common.Routes
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}