Adds authorization permissions administrator dashboard

This commit is contained in:
BinaryAlley committed 2024-12-22 19:17:47 +02:00
1 parent 152cb48050
commit 583b8db865
106 files changed
+5916 -2085

No files matched your search

@@ -8,6 +8,7 @@ using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Runtime.CompilerServices;
@@ -206,7 +207,12 @@ public class ApiHttpClient : IApiHttpClient
string content = await response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
// if the response is successful, deserialize the content to TResponse and return it
if (response.IsSuccessStatusCode)
{
// handle empty content case
if (string.IsNullOrEmpty(content))
return default!;
return JsonSerializer.Deserialize<TResponse>(content, _jsonOptions)!;
}
else
{
ProblemDetailsModel? problemDetails = null;
@@ -52,7 +52,7 @@ public class AuthorizationService : IAuthorizationService
public async Task<bool> IsInRoleAsync(string role, CancellationToken cancellationToken)
{
GetAuthorizationResponse authorization = await GetUserAuthorizationAsync(cancellationToken).ConfigureAwait(false);
return authorization.Roles.Contains(role);
return authorization.Role == role;
}
/// <summary>
@@ -75,7 +75,7 @@ public class AuthorizationService : IAuthorizationService
{
GetAuthorizationResponse authorization = await GetUserAuthorizationAsync(CancellationToken.None);
if (requirement.Roles?.Length > 0 && !requirement.Roles.Any(role => authorization.Roles?.Contains(role) == true))
if (requirement.Roles?.Length > 0 && !requirement.Roles.Any(role => authorization.Role?.Contains(role) == true))
return false;
if (requirement.Permissions?.Length > 0 && !requirement.Permissions.Any(permission => authorization.Permissions.Contains(permission)))
@@ -10,11 +10,11 @@ namespace Lumina.Presentation.Web.Common.Models.Authorization;
/// Represents the response model for an account authorization request.
/// </summary>
/// <param name="UserId">The Id of the user for whom the authorization is retrieved.</param>
/// <param name="Roles">The collection of roles associated to the user.</param>
/// <param name="Role">The role associated to the user.</param>
/// <param name="Permissions">The collection of permissions associated to the user.</param>
[DebuggerDisplay("UserId: {UserId}")]
public record GetAuthorizationResponse(
Guid UserId,
string[] Roles,
string? Role,
AuthorizationPermission[] Permissions
);
@@ -1,15 +1,13 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Enums.Authorization;
using System;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Authorization;
/// <summary>
/// Represents a model for an authorization role.
/// Represents a model for an authorization role with its permissions.
/// </summary>
/// <param name="Id">The Id of the authorization role.</param>
/// <param name="Role">The authorization role.</param>
/// <param name="Permissions">The permissions of the authorization role.</param>
public record RolePermissionsModel(
RoleModel Role,
PermissionModel[] Permissions
@@ -10,7 +10,7 @@ namespace Lumina.Presentation.Web.Common.Models.Authorization;
/// </summary>
/// <param name="RoleId">The Id of the role.</param>
/// <param name="RoleName">The name of the role.</param>
/// <param name="Permissions">The collection or permissions of the role.</param>
/// <param name="Permissions">The collection of Ids of the permissions of the role.</param>
public record UpdateRoleRequestModel(
Guid RoleId,
string? RoleName,
@@ -0,0 +1,18 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Authorization;
/// <summary>
/// Represents the request model for updating the authorization role and permissions of a user.
/// </summary>
/// <param name="RoleId">The Id of the user.</param>
/// <param name="RoleId">The Id of the role.</param>
/// <param name="Permissions">The collection of Ids of the permissions of the user.</param>
public record UpdateUserRoleAndPermissionsRequestModel(
Guid UserId,
Guid? RoleId,
List<Guid>? Permissions
);
@@ -0,0 +1,15 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Presentation.Web.Common.Models.UsersManagement;
#endregion
namespace Lumina.Presentation.Web.Common.Models.Authorization;
/// <summary>
/// Represents a model for a user with its authorization permissions.
/// </summary>
/// <param name="User">The user.</param>
/// <param name="Permissions">The authorization permissions of the user.</param>
public record UserPermissionsModel(
UserModel User,
PermissionModel[] Permissions
);
@@ -40,7 +40,7 @@ public class AdminController : Controller
{
// get the list of roles and permissions from the API
ViewData["roles"] = await _apiHttpClient.GetAsync<RoleModel[]>($"roles/", cancellationToken).ConfigureAwait(false);
ViewData["rolePermissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
ViewData["permissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
return View();
}
@@ -53,6 +53,7 @@ public class AdminController : Controller
{
ViewData["users"] = await _apiHttpClient.GetAsync<UserModel[]>($"auth/users", cancellationToken).ConfigureAwait(false);
ViewData["roles"] = await _apiHttpClient.GetAsync<RoleModel[]>($"roles/", cancellationToken).ConfigureAwait(false);
ViewData["permissions"] = await _apiHttpClient.GetAsync<PermissionModel[]>($"permissions/", cancellationToken).ConfigureAwait(false);
return View();
}
@@ -68,6 +69,30 @@ public class AdminController : Controller
return Json(new { success = true, data = response });
}
/// <summary>
/// Gets the authorization permissions of a user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The Id of the user for whom to get the list of permissions.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpGet("get-permissions-by-user-id/{userId}")]
public async Task<IActionResult> GetPermissionsByUserId(Guid userId, CancellationToken cancellationToken)
{
PermissionModel[] response = await _apiHttpClient.GetAsync<PermissionModel[]>($"auth/users/{userId}/permissions", cancellationToken).ConfigureAwait(false);
return Json(new { success = true, data = response });
}
/// <summary>
/// Gets the authorization role of a user identified by <paramref name="userId"/>.
/// </summary>
/// <param name="userId">The Id of the user for whom to get the role.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpGet("get-role-by-user-id/{userId}")]
public async Task<IActionResult> GetRoleByUserId(Guid userId, CancellationToken cancellationToken)
{
RoleModel? response = await _apiHttpClient.GetAsync<RoleModel?>($"auth/users/{userId}/role", cancellationToken).ConfigureAwait(false);
return Json(new { success = true, data = response });
}
/// <summary>
/// Gets the collection of authorization roles.
/// </summary>
@@ -114,4 +139,16 @@ public class AdminController : Controller
await _apiHttpClient.DeleteAsync($"roles/{roleId}", cancellationToken).ConfigureAwait(false);
return Json(new { success = true });
}
/// <summary>
/// Updates an authorization role with the specified name and associated permissions.
/// </summary>
/// <param name="model">The model containing the data of the role to be updated.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
[HttpPut("update-user-authorization")]
public async Task<IActionResult> UpdateUserAuthorization([FromBody] UpdateUserRoleAndPermissionsRequestModel model, CancellationToken cancellationToken)
{
GetAuthorizationResponse response = await _apiHttpClient.PutAsync<GetAuthorizationResponse, UpdateUserRoleAndPermissionsRequestModel>($"auth/users/{model.UserId}/role-and-permissions", model, cancellationToken).ConfigureAwait(false);
return Json(new { success = true, data = response });
}
}
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Navigation nach oben nicht möglich!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Der letzte zugewiesene Admin-Rolle kann nicht entfernt werden!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Codec darf nicht leer sein!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>Benutzer-ID darf nicht leer sein!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>Benutzer muss entweder Rollen- oder direkte Berechtigungen haben!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Benutzername existiert bereits!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Cannot navigate up!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Cannot remove the last Admin role assigned to a user!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Codec cannot be empty!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>User Id cannot be empty!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>User must have permissions either from role permissions or direct user permissions</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Username already exists!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>¡No se puede navegar hacia arriba!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>¡No se puede eliminar el último rol de Admin asignado al usuario!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>¡El códec no puede estar vacío!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>¡El ID de usuario no puede estar vacío!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>¡El usuario debe tener permisos de rol o permisos directos!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>¡El nombre de usuario ya existe!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Impossible de remonter le dossier !</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Impossible de supprimer le dernier rôle Admin attribué à l'utilisateur!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Le codec ne peut pas être vide !</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>L'identifiant utilisateur ne peut pas être vide !</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>L'utilisateur doit avoir des permissions de rôle ou des permissions directes!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Le nom d'utilisateur existe déjà!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Impossibile navigare verso l'alto!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Impossibile rimuovere l'ultimo ruolo Admin assegnato all'utente!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Il codec non può essere vuoto!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>L'ID utente non può essere vuoto!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>L'utente deve avere permessi da ruolo o permessi diretti!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Il nome utente esiste già!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>上の階層に移動できません!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>最後の管理者権限を削除できません!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>コーデックを空にすることはできません!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>ユーザーIDを空にすることはできません!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>ユーザーにはロール権限か直接権限のいずれかが必要です!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>このユーザー名は既に使用されています!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Cannot navigate up!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Cannot remove the last Admin role assigned to a user!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Codec cannot be empty!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>User Id cannot be empty!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>User must have permissions either from role permissions or direct user permissions</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Username already exists!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Nu se poate naviga în sus!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Nu se poate elimina ultimul rol de Admin atribuit unui utilizator!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Codecul nu poate fi gol!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>ID-ul utilizatorului nu poate fi gol!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>Utilizatorul trebuie să aibă permisiuni din rol sau permisiuni directe!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Numele de utilizator există deja!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>Невозможно перейти на уровень выше!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>Невозможно удалить последнюю роль администратора, назначенную пользователю!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>Кодек не может быть пустым!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>Идентификатор пользователя не может быть пустым!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>У пользователя должны быть разрешения роли или прямые разрешения!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>Имя пользователя уже существует!</value>
</data>
@@ -141,6 +141,9 @@
<data name="CannotNavigateUp" xml:space="preserve">
<value>无法向上导航!</value>
</data>
<data name="CannotRemoveLastAdmin" xml:space="preserve">
<value>无法删除用户的最后一个管理员角色!</value>
</data>
<data name="CodecCannotBeEmpty" xml:space="preserve">
<value>编解码器不能为空!</value>
</data>
@@ -516,6 +519,9 @@
<data name="UserIdCannotBeEmpty" xml:space="preserve">
<value>用户ID不能为空!</value>
</data>
<data name="UserMustHaveRoleOrDirectPermissions" xml:space="preserve">
<value>用户必须具有角色权限或直接权限!</value>
</data>
<data name="UsernameAlreadyExists" xml:space="preserve">
<value>用户名已存在!</value>
</data>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Kann Benutzer löschen</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Kann Benutzer registrieren</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Kann Benutzer anzeigen</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Rollen</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Wählen Sie eine Rolle</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Benutzer auswählen</value>
</data>
<data name="Update" xml:space="preserve">
<value>Aktualisieren</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>Benutzerberechtigung aktualisiert!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Benutzer</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Can delete users</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Can register users</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Can view users</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Roles</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Select a role</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Select a user</value>
</data>
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>User authorization updated!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Users</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Puede eliminar usuarios</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Puede registrar usuarios</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Puede ver usuarios</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Roles</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Selecciona un rol</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Seleccionar usuario</value>
</data>
<data name="Update" xml:space="preserve">
<value>Actualizar</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>¡Autorización de usuario actualizada!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Usuarios</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Peut supprimer des utilisateurs</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Peut enregistrer des utilisateurs</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Peut voir les utilisateurs</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Rôles</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Sélectionnez un rôle</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Sélectionner un utilisateur</value>
</data>
<data name="Update" xml:space="preserve">
<value>Mettre à jour</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>Autorisation utilisateur mise à jour!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Utilisateurs</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Può eliminare utenti</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Può registrare utenti</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Può visualizzare utenti</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Ruoli</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Seleziona un ruolo</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Seleziona utente</value>
</data>
<data name="Update" xml:space="preserve">
<value>Aggiorna</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>Autorizzazione utente aggiornata!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Utenti</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>ユーザーを削除できます</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>ユーザーを登録できます</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>ユーザーを表示できます</value>
</data>
<data name="Roles" xml:space="preserve">
<value>ロール</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>ロールを選択してください</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>ユーザーを選択</value>
</data>
<data name="Update" xml:space="preserve">
<value>更新</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>ユーザー権限を更新しました!</value>
</data>
<data name="Users" xml:space="preserve">
<value>ユーザー</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Can delete users</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Can register users</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Can view users</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Roles</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Select a role</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Select a user</value>
</data>
<data name="Update" xml:space="preserve">
<value>Update</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>User authorization updated!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Users</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Poate șterge utilizatori</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Poate înregistra utilizatori</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Poate vizualiza utilizatori</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Roluri</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Selectare rol</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Selectare utilizator</value>
</data>
<data name="Update" xml:space="preserve">
<value>Actualizare</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>Autorizare utilizator actualizată!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Utilizatori</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>Может удалять пользователей</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>Может регистрировать пользователей</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>Может просматривать пользователей</value>
</data>
<data name="Roles" xml:space="preserve">
<value>Роли</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>Выберите роль</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>Выбрать пользователя</value>
</data>
<data name="Update" xml:space="preserve">
<value>Обновить</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>Авторизация пользователя обновлена!</value>
</data>
<data name="Users" xml:space="preserve">
<value>Пользователи</value>
</data>
</root>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="CanDeleteUsers" xml:space="preserve">
<value>可以删除用户</value>
</data>
<data name="CanRegisterUsers" xml:space="preserve">
<value>可以注册用户</value>
</data>
<data name="CanViewUsers" xml:space="preserve">
<value>可以查看用户</value>
</data>
<data name="Roles" xml:space="preserve">
<value>角色</value>
</data>
<data name="SelectARole" xml:space="preserve">
<value>选择一个角色</value>
</data>
<data name="SelectAUser" xml:space="preserve">
<value>选择用户</value>
</data>
<data name="Update" xml:space="preserve">
<value>更新</value>
</data>
<data name="UserAuthorizationUpdated" xml:space="preserve">
<value>用户授权已更新!</value>
</data>
<data name="Users" xml:space="preserve">
<value>用户</value>
</data>
</root>
@@ -2,100 +2,231 @@
/admin/manage-permissions/
*@
@using Lumina.Presentation.Web.Common.Models.Authorization
@using Lumina.Presentation.Web.Common.Models.UsersManagement
@using Lumina.Presentation.Web.Common.Services
@using Microsoft.AspNetCore.Mvc.Localization
@using Lumina.Presentation.Web.Common.Models.Authorization
@{
var roles = ViewData["roles"] as RoleModel[];
var rolePermissions = ViewData["rolePermissions"] as PermissionModel[];
}
var users = ViewData["users"] as UserModel[];
var permissions = ViewData["permissions"] as PermissionModel[];
// 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="rolesPermissionsForm" method="post" action="/Permissions/CreateRole">
<input type="hidden" name="rolesRoleId" id="rolesRoleId" value="" />
<!-- Roles dropdown row -->
<div class="h-30px w-100 text-end">
<label for="rolesRolesDropdown" class="text-light-one">@_localizer["Roles"]</label>
<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="rolesRolesDropdown">
<div class="shine-effect" style="top: 1px;"></div>
<input type="checkbox" id="rolesRolesDropdownToggle" class="enlightenment-toggle-checkbox" />
<label class="enlightenment-toggle" for="rolesRolesDropdownToggle">
<span class="enlightenment-selected-text">@_localizer["SelectARole"]</span>
</label>
<div class="enlightenment-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-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)
{
<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="rolesRoleInput" class="text-light-one">@_localizer["RoleName"]</label>
<input type="text" id="rolesRoleInput" name="roleName" class="enlightenment-input w-250px" />
</div>
<!-- Permissions row -->
<div class="containerRoles row panel inset">
<div class="explorerContainer">
<div class="explorer">
@if (rolePermissions is not null)
{
@foreach (var rolePermission in rolePermissions)
{
<div class="e no-border transparent">
<label class="enlightenment-checkbox-label">
<input type="checkbox" class="enlightenment-checkbox-hidden" name="rolePermissions" value="@rolePermission.Id">
<span class="enlightenment-checkbox"></span>
@_localizer[rolePermission.PermissionName.ToString()]
</label>
</div>
}
}
</div>
</div>
</div>
<!-- Submit Button Row -->
<div class="w-100 text-end">
<button type="button" class="abort-button f-14 h-24px v-align-t hidden" id="rolesDeleteRoleBtn">@_localizer["DeleteRole"]</button>
<button type="submit" class="confirm-button f-14 h-24px v-align-t" id="rolesConfirmBtn">@_localizer["CreateRole"]</button>
</div>
</form>
@* <div class="enlightenment-panel shadow-effect p-2 mx-auto panel w-90 mb-10" style="min-width: 320px; margin-top: 1rem;">
<div class="shine-effect"></div>
<form method="post" id="add-media-library-form" class="inline">
@Html.AntiForgeryToken()
@{
<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="None">@_localizer["None"]</span>
</label>
<div class="enlightenment-dropdown">
<div class="shine-effect" style="top: -4px;"></div>
<div class="enlightenment-option first-option disabled">@_localizer["None"]</div>
@foreach (var item in aa!)
@for (int i = 0; i < users.Length; i++)
{
<div class="enlightenment-option">@_localizer[item.ToString()]</div>
<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>
}
<p>a</p>
</div>
</form>
</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 data = await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateUserAuthorization", "Admin")', formData);
if (data)
notificationService.show('@_localizer["UserAuthorizationUpdated"]', NotificationType.SUCCESS);
}
async function fetchUserRoleAsync(userId) {
const url = '@_urlService.GetAbsoluteUrl("GetRoleByUserId", "Admin", 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("GetPermissionsByUserId", "Admin", 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>
}
@@ -1 +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;
}
@@ -8,7 +8,7 @@
@{
var roles = ViewData["roles"] as RoleModel[];
var rolePermissions = ViewData["rolePermissions"] as PermissionModel[];
var permissions = ViewData["permissions"] as PermissionModel[];
// 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();
}
@@ -54,15 +54,15 @@
<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 (rolePermissions is not null)
@if (permissions is not null)
{
@foreach (var rolePermission in rolePermissions)
@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="@rolePermission.Id">
<input type="checkbox" class="enlightenment-checkbox-hidden" name="authorization-role-permissions" value="@permission.Id">
<span class="enlightenment-checkbox"></span>
@_localizer[rolePermission.PermissionName.ToString()]
@_localizer[permission.PermissionName.ToString()]
</label>
</div>
}
@@ -82,28 +82,20 @@
@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')
// on Enter key pressed
form.addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
await handleRoleSubmit(e.target.closest('form'));
}
});
// on form submit event
form.addEventListener('submit', async (e) => {
e.preventDefault();
await handleRoleSubmit(e.target);
});
const dropdown = document.getElementById('authorization-roles-combobox-dropdown');
const roleIdInput = document.getElementById('authorization-roles-selected-id');
// create new or update existing role
async function handleRoleSubmit(form) {
async function handleRoleSubmitAsync() {
const formData = {
roleId: document.getElementById('authorization-roles-selected-id').value,
roleId: roleIdInput.value,
roleName: txtRoleName.value,
permissions: Array.from(form.querySelectorAll("input[name='authorization-role-permissions']:checked"))
.map(checkbox => checkbox.value)
@@ -111,57 +103,17 @@
const isRoleSelected = formData.roleId !== '';
const data = isRoleSelected ?
await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateRole", "Admin")', formData) :
await callApiPostAsync('@_urlService.GetAbsoluteUrl("CreateRole", "Admin")', formData);
const data = isRoleSelected ?
await callApiPutAsync('@_urlService.GetAbsoluteUrl("UpdateRole", "Admin")', formData) :
await callApiPostAsync('@_urlService.GetAbsoluteUrl("CreateRole", "Admin")', formData);
if (data) {
await fetchRoles();
await fetchRolesAsync();
notificationService.show(isRoleSelected ? '@_localizer["RoleUpdated"]' : '@_localizer["RoleCreated"]', NotificationType.SUCCESS);
}
}
btnDeleteRole.addEventListener('click', async function(e) {
const roleId = document.getElementById('authorization-roles-selected-id').value;
// ask the user for confirmation before deleting the role
if (await dialogService.show('@_localizer["DeleteRoleConfirm"]', jsLocalizedDialogs.confirmation, DialogButtons.YES_NO_CANCEL, DialogIcon.QUESTION) === DialogButton.YES) {
const url = '@_urlService.GetAbsoluteUrl("DeleteRole", "Admin", new { roleId = default(Guid) })';
const success = await callApiDeleteAsync(url.replace('/@(default(Guid))', `/${roleId}`)); // roleId needs to be replaced here, because GetAbsoluteUrl is server side, roleId is client side
if (success) {
await fetchRoles();
notificationService.show('@_localizer["RoleDeleted"]', NotificationType.SUCCESS);
}
}
});
// on role dropdown change
document.addEventListener('click', function(e) {
if (e.target.classList.contains('enlightenment-option')) {
const roleId = e.target.dataset.value;
const selectedText = e.target.textContent;
const txtRoleName = document.getElementById('txt-role-name');
txtRoleName.value = roleId ? selectedText : '';
fetchRolePermissions(roleId);
const roleIdInput = document.getElementById('authorization-roles-selected-id');
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"]';
}
}
});
async function fetchRoles() {
const url = '@_urlService.GetAbsoluteUrl("GetRoles", "Admin")';
const data = await callApiGetAsync(url);
async function fetchRolesAsync() {
const data = await callApiGetAsync('@_urlService.GetAbsoluteUrl("GetRoles", "Admin")');
if (data) {
// clear the roles drop down list
const rolesDropdown = document.querySelector("#authorization-roles-combobox .enlightenment-dropdown");
@@ -198,7 +150,7 @@
}
}
async function fetchRolePermissions(roleId) {
async function fetchRolePermissionsAsync(roleId) {
if (roleId) {
const url = '@_urlService.GetAbsoluteUrl("GetPermissionsByRoleId", "Admin", 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
@@ -221,6 +173,72 @@
.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("DeleteRole", "Admin", 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;
@@ -228,5 +246,18 @@
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>
}
@@ -70,30 +70,22 @@
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
document.getElementById('change-password-form').addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
const form = e.target.closest('form');
await handleChangePassword(form);
}
});
// create cleanup registry for this view
const cleanupFunctions = [];
document.getElementById('change-password-form').addEventListener('submit', async (e) => {
e.preventDefault();
await handleChangePassword(e.target);
});
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"]');
async function handleChangePassword(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');
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,
@@ -108,5 +100,37 @@
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>
}
@@ -64,28 +64,21 @@
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
document.getElementById('login-form').addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
const form = e.target.closest('form');
await handleLogin(form);
}
});
// create cleanup registry for this view
const cleanupFunctions = [];
document.getElementById('login-form').addEventListener('submit', async (e) => {
e.preventDefault();
await handleLogin(e.target);
});
async function handleLogin(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');
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,
@@ -105,8 +98,44 @@
else if (data)
window.location.href = data;
}
document.getElementById('btn-recover-password').addEventListener('click', () => {
// 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("RecoverPassword", "Auth")';
};
// 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>
}
@@ -58,29 +58,21 @@
</div>
@section Scripts {
<script type="text/javascript" data-form="@scriptId" defer>
document.getElementById('recover-password-form').addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
const form = e.target.closest('form');
await handleRecoverPassword(form);
}
});
// create cleanup registry for this view
const cleanupFunctions = [];
document.getElementById('recover-password-form').addEventListener('submit', async (e) => {
e.preventDefault();
await handleRecoverPassword(e.target);
});
async function handleRecoverPassword(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');
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
@@ -95,11 +87,51 @@
recoverPasswordSuccess.classList.replace('hidden', 'block');
}
}
document.getElementById('btn-login').addEventListener('click', () => {
// 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("Login", "Auth")';
});
document.getElementById('btn-redirect-login').addEventListener('click', () => {
};
// on login redirect button click
const handleBtnRedirectLoginClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
};
// 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>
}
@@ -99,28 +99,23 @@
</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');
document.getElementById('register-account-form').addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
const form = e.target.closest('form');
await handleRegisterAccount(form);
}
});
const spnTwoFaAttention = document.getElementById('register-two-fa-attention');
const useTwoFaInput = document.getElementById('hidden-use-two-fa');
document.getElementById('register-account-form').addEventListener('submit', async (e) => {
e.preventDefault();
await handleRegisterAccount(e.target);
});
async function handleRegisterAccount(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');
// perform the account registration
async function handleRegisterAccountAsync() {
const formData = {
Username: txtUsername.value,
Password: txtPassword.value,
@@ -147,18 +142,56 @@
}
}
}
document.querySelector('[name="Use2fa"]').addEventListener('change', function () {
// 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;
document.getElementById('register-two-fa-attention').classList.replace(
spnTwoFaAttention.classList.replace(
isChecked ? 'inline' : 'hidden',
isChecked ? 'hidden' : 'inline'
);
document.getElementById('hidden-use-two-fa').value = isChecked.toString();
useTwoFaInput.value = isChecked.toString();
};
// on login button click
const handleBtnLoginClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
};
// 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);
});
if (btnLogin) {
btnLogin.addEventListener('click', () => {
window.location.href = '@_urlService.GetAbsoluteUrl("Login", "Auth")';
});
}
// 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>
}
@@ -138,24 +138,18 @@
</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 formTable = document.querySelector('.form-table');
form.addEventListener('keypress', async (e) => {
if (e.key === 'Enter') {
e.preventDefault();
await handleAddMediaLibrary(e.target.closest('form'));
}
});
form.addEventListener('submit', async (e) => {
e.preventDefault();
await handleAddMediaLibrary(e.target);
});
async function handleAddMediaLibrary(form) {
// 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,
@@ -173,25 +167,7 @@
}
}
btnBackToLibraries.addEventListener('click', () => {
window.location.href = '@_urlService.GetAbsoluteUrl("Index", "LibraryManagement")';
});
btnAddNewLibrary.addEventListener('click', () => {
window.location.href = '@_urlService.GetAbsoluteUrl("EditLibrary", "LibraryManagement")';
});
document.getElementById('add-media-directory').addEventListener('click', function () {
showFileSystemBrowserDialogAsync('C:\\Users\\', true, false, addNewPaths); // TODO: take path and include hidden elements from settings
});
document.querySelectorAll('.remove-form-table-row-icon').forEach(icon => {
icon.addEventListener('click', function () {
this.parentElement.remove();
});
});
function addNewPaths(selectedPaths) {
function addNewFileSystemPaths(selectedPaths) {
// get the form table where the new paths will be added
const formTable = document.querySelector('.form-table');
// process the selected paths
@@ -210,5 +186,66 @@
}
});
}
// 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("Index", "LibraryManagement")';
};
// on add new library button click
const handleBtnAddNewLibraryClick = function() {
window.location.href = '@_urlService.GetAbsoluteUrl("EditLibrary", "LibraryManagement")';
};
// on add media directory image click
const handleImgAddMediaDirectoryClick = async function() {
await showFileSystemBrowserDialogAsync('C:\\Users\\', true, false, addNewFileSystemPaths); // 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();
};
// add listeners
form.addEventListener('keypress', handleEnterKey);
form.addEventListener('submit', handleSubmit);
btnBackToLibraries.addEventListener('click', handleBtnBackToLibrariesClick);
btnAddNewLibrary.addEventListener('click', handleBtnAddNewLibraryClick);
imgAddMediaDirectory.addEventListener('click', handleImgAddMediaDirectoryClick);
formTable.addEventListener('click', handleRowRemoval);
// 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);
formTable.removeEventListener('click', handleRowRemoval);
});
// 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>
}
@@ -4,11 +4,16 @@
@using Lumina.Presentation.Web.Common.Enums.Notifications
@using Lumina.Presentation.Web.Common.Exceptions
@using Lumina.Presentation.Web.Common.Models.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">
@@ -522,14 +527,23 @@
</div>
<div id="visible-selection-rectangle"></div>
<div id="selection-rectangle"></div>
<script defer src="~/js/file-system-browser-dialog.js" asp-append-version="true"></script>
<script defer>
document.addEventListener('DOMContentLoaded', async function () {
await initFileSystemBrowser(
'@Model.ServerBasePath',
'@Model.ClientBasePath',
'@Model.Path.Replace(@"\", @"\\")',
'@Model.ViewMode.ToString().ToLower()',
'@Model.IconSize.ToString().ToLower()');
});
<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>
@@ -29,6 +29,7 @@
<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)
@@ -47,12 +47,6 @@ class DialogService {
constructor() {
this.dialogQueue = [];
this.isDialogOpen = false;
// create dialog container inside the article element
const articleElement = document.querySelector('article');
this.container = document.createElement('div');
this.container.className = 'dialog-container';
articleElement.appendChild(this.container);
}
/**
@@ -104,7 +98,7 @@ class DialogService {
displayDialog(dialog) {
const modalBackground = document.getElementById('modal-background-article');
modalBackground.style.display = 'block';
this.container.style.display = 'block';
document.querySelector('.dialog-container').style.display = 'block';
const dialogElement = document.createElement('div');
dialogElement.className = 'dialog';
@@ -164,7 +158,7 @@ class DialogService {
};
document.addEventListener('keydown', keyHandler);
this.container.appendChild(dialogElement);
document.querySelector('.dialog-container').appendChild(dialogElement);
}
/**
@@ -174,7 +168,7 @@ class DialogService {
*/
handleButtonClick(buttonType) {
const currentDialog = this.dialogQueue.shift();
const dialogElement = this.container.querySelector('.dialog');
const dialogElement = document.querySelector('.dialog-container').querySelector('.dialog');
if (dialogElement)
dialogElement.remove();
@@ -182,7 +176,7 @@ class DialogService {
if (this.dialogQueue.length === 0) {
const modalBackground = document.getElementById('modal-background-article');
modalBackground.style.display = 'none';
this.container.style.display = 'none';
document.querySelector('.dialog-container').style.display = 'none';
}
currentDialog.resolve(buttonType);
File diff suppressed because it is too large. Load diff
+95 -90
View File
@@ -219,7 +219,7 @@ function initializeNavigation() {
bindNavigationLinks();
// handle browser back/forward
window.addEventListener('popstate', handlePopState);
window.addEventListener('popstate', handlePopStateAsync);
}
/**
@@ -229,7 +229,7 @@ function bindNavigationLinks() {
document.querySelectorAll('.nav-link').forEach(link => {
// only bind if not already bound
if (!link.dataset.boundNavigation) {
link.addEventListener('click', handleNavigation);
link.addEventListener('click', handleNavigationAsync);
link.dataset.boundNavigation = 'true';
}
});
@@ -239,17 +239,17 @@ function bindNavigationLinks() {
* Handles link clicks to navigate dynamically without reloading the page.
* @param {Event} e - The click event for a navigation link.
*/
async function handleNavigation(e) {
async function handleNavigationAsync(e) {
e.preventDefault();
const url = e.target.href;
await updateContent(url, true);
await updateContentAsync(url, true);
}
/**
* Restores page content and title when navigating with browser back/forward buttons.
* @param {PopStateEvent} e - The popstate event with previous state data.
*/
async function handlePopState(e) {
async function handlePopStateAsync(e) {
if (e.state) {
// if we have cached content in state, use it immediately
if (e.state.content) {
@@ -257,7 +257,7 @@ async function handlePopState(e) {
document.title = e.state.title;
}
// still fetch fresh content to ensure it's up to date
await updateContent(e.state.url, false);
await updateContentAsync(e.state.url, false);
}
}
@@ -266,8 +266,18 @@ async function handlePopState(e) {
* @param {string} url - URL to fetch new content from.
* @param {boolean} addToHistory - Whether to add the new state to history.
*/
async function updateContent(url, addToHistory) {
async function updateContentAsync(url, addToHistory) {
try {
// first, run cleanup of current view's scripts (unsubscribes handlers in the currently displayed razor views' script section, so it can be properly unloaded)
if (window.viewCleanups) {
Object.values(window.viewCleanups).forEach(cleanup => {
if (typeof cleanup === 'function')
cleanup();
});
// reset cleanups object
window.viewCleanups = {};
}
const response = await fetch(url);
const html = await response.text();
@@ -277,81 +287,96 @@ async function updateContent(url, addToHistory) {
const content = doc.querySelector('main').innerHTML;
const title = doc.querySelector('title')?.textContent || document.title;
// find scripts section content
const scriptsSection = doc.querySelector('[data-section="scripts"]');
// update the page
// update the page content
document.querySelector('main').innerHTML = content;
document.title = title;
// handle Scripts section of the loaded view
if (scriptsSection) {
// get or create scripts container
let scriptsContainer = document.querySelector('[data-section="scripts"]');
if (!scriptsContainer) {
scriptsContainer = document.createElement('div');
scriptsContainer.setAttribute('data-section', 'scripts');
document.body.appendChild(scriptsContainer);
}
// process all scripts in order: component scripts first, then view scripts
const componentScripts = doc.querySelectorAll('script[data-component-script]');
for (const script of componentScripts) {
const newScript = document.createElement('script');
// copy script attributes
Array.from(script.attributes).forEach(attr => {
newScript.setAttribute(attr.name, attr.value);
});
// clear existing scripts in container
scriptsContainer.innerHTML = '';
// extract and execute scripts
const scriptElements = Array.from(scriptsSection.getElementsByTagName('script'));
for (const script of scriptElements) {
const scriptId = script.getAttribute('data-form');
// remove existing script with same Id if it exists
const existingScript = document.querySelector(`script[data-form="${scriptId}"]`);
if (existingScript)
existingScript.remove();
const newScript = document.createElement('script');
// copy script attributes
Array.from(script.attributes).forEach(attr => {
newScript.setAttribute(attr.name, attr.value);
if (script.src) {
// wait for external script to fully load before continuing
await new Promise((resolve, reject) => {
newScript.onload = resolve;
newScript.onerror = reject;
document.body.appendChild(newScript);
});
// handle both inline and external scripts
if (script.src) {
newScript.src = script.src;
// wait for external script to load
await new Promise((resolve, reject) => {
newScript.onload = resolve;
newScript.onerror = reject;
});
} else {
// wrap inline scripts in a safety check
newScript.textContent = `
(function() {
const safeGetElement = (id) => document.getElementById(id);
const safeAddEventListener = (element, e, handler) => {
if (element)
element.addEventListener(e, handler);
};
${script.textContent}
})();
`;
}
// add script to scripts container
scriptsContainer.appendChild(newScript);
}
}
// execute component initialization scripts
const componentInits = doc.querySelectorAll('script[data-component-init]');
for (const script of componentInits) {
const newScript = document.createElement('script');
// copy script attributes
Array.from(script.attributes).forEach(attr => {
newScript.setAttribute(attr.name, attr.value);
});
newScript.textContent = script.textContent;
document.body.appendChild(newScript);
}
// process view scripts
const viewScripts = doc.querySelector('[data-section="scripts"]')?.getElementsByTagName('script') || [];
// get or create scripts container
let scriptsContainer = document.querySelector('[data-section="scripts"]');
if (!scriptsContainer) {
scriptsContainer = document.createElement('div');
scriptsContainer.setAttribute('data-section', 'scripts');
document.body.appendChild(scriptsContainer);
}
// clear existing scripts in container
scriptsContainer.innerHTML = '';
// process view scripts
for (const script of viewScripts) {
const scriptId = script.getAttribute('data-form');
// remove existing script with same Id if it exists
const existingScript = document.querySelector(`script[data-form="${scriptId}"]`);
if (existingScript)
existingScript.remove();
const newScript = document.createElement('script');
// copy script attributes
Array.from(script.attributes).forEach(attr => {
newScript.setAttribute(attr.name, attr.value);
});
// handle both inline and external scripts
if (script.src) {
newScript.src = script.src;
// wait for external script to load
await new Promise((resolve, reject) => {
newScript.onload = resolve;
newScript.onerror = reject;
});
} else {
// wrap inline scripts in a safety check
newScript.textContent = `
(function() {
const safeGetElement = (id) => document.getElementById(id);
const safeAddEventListener = (element, e, handler) => {
if (element)
element.addEventListener(e, handler);
};
${script.textContent}
})();
`;
}
// add script to scripts container
scriptsContainer.appendChild(newScript);
}
// bind navigation links in the new content
bindNavigationLinks();
// save to history if needed
if (addToHistory) {
const state = {
url: url,
content: content,
title: title
};
const state = { url, content, title };
history.pushState(state, title, url);
}
} catch (error) {
@@ -360,26 +385,6 @@ async function updateContent(url, addToHistory) {
}
}
/**
* Dynamically loads and executes scripts within the content area once.
* @param {HTMLElement} container - The container to scan for scripts.
*/
function executeScriptsOnce(container) {
// Find all script tags inside the container
container.querySelectorAll('script').forEach(script => {
if (!script.dataset.executed) {
const newScript = document.createElement('script');
newScript.textContent = script.textContent; // Inline scripts
if (script.src) newScript.src = script.src; // External scripts
newScript.async = script.async;
newScript.defer = script.defer;
script.dataset.executed = 'true'; // Mark the script as executed
document.body.appendChild(newScript);
}
});
}
//+======================================================================================+
//| Common Helper Functions |
//+======================================================================================+
@@ -432,7 +437,7 @@ function updateOperationProgress(completed, total) {
* @param {any} blob The blob to convert.
* @returns The converted Base64 string.
*/
async function blobToBase64(blob) {
async function blobToBase64Async(blob) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onloadend = () => resolve(reader.result.split(',')[1]);