reset admin
This commit is contained in:
		@ -7,52 +7,48 @@
 | 
			
		||||
@inject IStringLocalizer<Add> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Upload" Heading="Upload Files" ResourceKey="UploadFiles">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="upload" HelpText="Upload the file you want" ResourceKey="Upload">Upload: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager UploadMultiple="true" ShowFiles="false" FolderId="@_folderId" />
 | 
			
		||||
                    </div>
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Upload" Heading="Upload Files" ResourceKey="UploadFiles">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="upload" HelpText="Upload the file you want" ResourceKey="Upload">Upload: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <FileManager UploadMultiple="true" ShowFiles="false" FolderId="@_folderId" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Download" Heading="Download Files" ResourceKey="DownloadFiles">
 | 
			
		||||
            @if (_folders != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="url" HelpText="Enter the url of the file you wish to download" ResourceKey="Url">Url: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="url" class="form-control" @bind="@url" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="folder" HelpText="Select the folder to save the file in" ResourceKey="Folder">Folder: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="folder" class="form-select" @bind="@_folderId" required>
 | 
			
		||||
                                <option value="-1"><@Localizer["Folder.Select"]></option>
 | 
			
		||||
                                @foreach (Folder folder in _folders)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Download" Heading="Download Files" ResourceKey="DownloadFiles">
 | 
			
		||||
        @if (_folders != null)
 | 
			
		||||
        {
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="url" HelpText="Enter the url of the file you wish to download" ResourceKey="Url">Url: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="url" class="form-control" @bind="@url" />
 | 
			
		||||
                </div>
 | 
			
		||||
                <button type="button" class="btn btn-success" @onclick="Download">@SharedLocalizer["Download"]</button>
 | 
			
		||||
                <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
</form>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="folder" HelpText="Select the folder to save the file in" ResourceKey="Folder">Folder: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="folder" class="form-select" @bind="@_folderId">
 | 
			
		||||
                        <option value="-1"><@Localizer["Folder.Select"]></option>
 | 
			
		||||
                        @foreach (Folder folder in _folders)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
            <button type="button" class="btn btn-success" @onclick="Download">@SharedLocalizer["Download"]</button>
 | 
			
		||||
            <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
</TabStrip>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string url = string.Empty;
 | 
			
		||||
    private List<Folder> _folders;
 | 
			
		||||
    private int _folderId = -1;
 | 
			
		||||
@ -71,46 +67,37 @@
 | 
			
		||||
 | 
			
		||||
    private async Task Download()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        if (url == string.Empty || _folderId == -1)
 | 
			
		||||
        {
 | 
			
		||||
            if (url == string.Empty || _folderId == -1)
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.UrlFolder"], MessageType.Warning);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var filename = url.Substring(url.LastIndexOf("/", StringComparison.Ordinal) + 1);
 | 
			
		||||
 | 
			
		||||
            if (!Constants.UploadableFiles.Split(',')
 | 
			
		||||
                    .Contains(Path.GetExtension(filename).ToLower().Replace(".", "")))
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Download.InvalidExtension"], MessageType.Warning);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!filename.IsPathOrFileValid())
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.UrlName"], MessageType.Warning);
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                await FileService.UploadFileAsync(url, _folderId);
 | 
			
		||||
                await logger.LogInformation("File Downloaded Successfully From Url {Url}", url);
 | 
			
		||||
                AddModuleMessage(Localizer["Success.Download.File"], MessageType.Success);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Downloading File From Url {Url} {Error}", url, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Download.InvalidUrl"], MessageType.Error);
 | 
			
		||||
            }
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.UrlFolder"], MessageType.Warning);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
 | 
			
		||||
        var filename = url.Substring(url.LastIndexOf("/", StringComparison.Ordinal) + 1);
 | 
			
		||||
 | 
			
		||||
        if (!Constants.UploadableFiles.Split(',')
 | 
			
		||||
                .Contains(Path.GetExtension(filename).ToLower().Replace(".", "")))
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Download.InvalidExtension"], MessageType.Warning);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!filename.IsPathOrFileValid())
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.UrlName"], MessageType.Warning);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            await FileService.UploadFileAsync(url, _folderId);
 | 
			
		||||
            await logger.LogInformation("File Downloaded Successfully From Url {Url}", url);
 | 
			
		||||
            AddModuleMessage(Localizer["Success.Download.File"], MessageType.Success);
 | 
			
		||||
        }
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            await logger.LogError(ex, "Error Downloading File From Url {Url} {Error}", url, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Download.InvalidUrl"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,43 +8,39 @@
 | 
			
		||||
 | 
			
		||||
@if (_folders != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="The name of the file" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="parent" HelpText="The folder where the file is located" ResourceKey="Folder">Folder: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="parent" class="form-select" @bind="@_folderId">
 | 
			
		||||
                        @foreach (Folder folder in _folders)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="size" HelpText="The size of the file (in bytes)" ResourceKey="Size">Size: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="size" class="form-control" @bind="@_size" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="name" HelpText="The name of the file" ResourceKey="Name">Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveFile">@SharedLocalizer["Save"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        <AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
 | 
			
		||||
    </form>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="parent" HelpText="The folder where the file is located" ResourceKey="Folder">Folder: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="parent" class="form-select" @bind="@_folderId">
 | 
			
		||||
                @foreach (Folder folder in _folders)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                }
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="size" HelpText="The size of the file (in bytes)" ResourceKey="Size">Size: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="size" class="form-control" @bind="@_size" readonly />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveFile">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private int _fileId = -1;
 | 
			
		||||
    private string _name;
 | 
			
		||||
    private List<Folder> _folders;
 | 
			
		||||
@ -86,35 +82,26 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveFile()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (_name.IsPathOrFileValid())
 | 
			
		||||
            {
 | 
			
		||||
                if (_name.IsPathOrFileValid())
 | 
			
		||||
                {
 | 
			
		||||
                    File file = await FileService.GetFileAsync(_fileId);
 | 
			
		||||
                    file.Name = _name;
 | 
			
		||||
                    file.FolderId = _folderId;
 | 
			
		||||
                    file = await FileService.UpdateFileAsync(file);
 | 
			
		||||
                    await logger.LogInformation("File Saved {File}", file);
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.File.InvalidName"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
                File file = await FileService.GetFileAsync(_fileId);
 | 
			
		||||
                file.Name = _name;
 | 
			
		||||
                file.FolderId = _folderId;
 | 
			
		||||
                file = await FileService.UpdateFileAsync(file);
 | 
			
		||||
                await logger.LogInformation("File Saved {File}", file);
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving File {FileId} {Error}", _fileId, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.File.Save"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.File.InvalidName"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving File {FileId} {Error}", _fileId, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.File.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,77 +8,73 @@
 | 
			
		||||
 | 
			
		||||
@if (_folders != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="parent" HelpText="Select the parent folder" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="parent" class="form-select" @bind="@_parentId" required>
 | 
			
		||||
                        @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="-1"><@Localizer["NoParent"]></option>
 | 
			
		||||
                        }
 | 
			
		||||
                        @foreach (Folder folder in _folders)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="Enter the folder name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="type" HelpText="Select the folder type. Private folders are only accessible by authorized users. Public folders can be accessed by all users" ResourceKey="Name">Type: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
                    {
 | 
			
		||||
                        <input id="type" class="form-control" readonly @bind="@_type" />
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        <select id="type" class="form-select" @bind="@_type" required>
 | 
			
		||||
                            <option value="@FolderTypes.Private">@Localizer[FolderTypes.Private]</option>
 | 
			
		||||
                            <option value="@FolderTypes.Public">@Localizer[FolderTypes.Public]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    }
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <div class="col-sm-12">
 | 
			
		||||
                    <Label Class="col-sm-3" For="permissions" HelpText="Select the permissions you want for the folder" ResourceKey="Permissions">Permissions: </Label>
 | 
			
		||||
                    <PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="@(PermissionNames.Browse + "," + PermissionNames.View + "," + PermissionNames.Edit)" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="parent" HelpText="Select the parent folder" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="parent" class="form-select" @bind="@_parentId">
 | 
			
		||||
                @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="-1"><@Localizer["NoParent"]></option>
 | 
			
		||||
                }
 | 
			
		||||
                @foreach (Folder folder in _folders)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
 | 
			
		||||
                }
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="name" HelpText="Enter the folder name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="type" HelpText="Select the folder type. Private folders are only accessible by authorized users. Public folders can be accessed by all users" ResourceKey="Name">Type: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
            {
 | 
			
		||||
                <input id="type" class="form-control" readonly @bind="@_type" />
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                <select id="type" class="form-select" @bind="@_type">
 | 
			
		||||
                    <option value="@FolderTypes.Private">@Localizer[FolderTypes.Private]</option>
 | 
			
		||||
                    <option value="@FolderTypes.Public">@Localizer[FolderTypes.Public]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            }
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <div class="col-sm-12">
 | 
			
		||||
            <Label Class="col-sm-3" For="permissions" HelpText="Select the permissions you want for the folder" ResourceKey="Permissions">Permissions: </Label>
 | 
			
		||||
            <PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="@(PermissionNames.Browse + "," + PermissionNames.View + "," + PermissionNames.Edit)" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
 | 
			
		||||
        @if (!_isSystem)
 | 
			
		||||
        {
 | 
			
		||||
            <button type="button" class="btn btn-success" @onclick="SaveFolder">@SharedLocalizer["Save"]</button>
 | 
			
		||||
            @((MarkupString)" ")
 | 
			
		||||
        }
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        @if (!_isSystem && PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
        {
 | 
			
		||||
            @((MarkupString)" ")
 | 
			
		||||
            <ActionDialog Header="Delete Folder" Message="Are You Sure You Wish To Delete This Folder?" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFolder())" ResourceKey="DeleteFolder" />
 | 
			
		||||
        }
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
        {
 | 
			
		||||
            <AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
 | 
			
		||||
        }
 | 
			
		||||
    </form>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
    @if (!_isSystem)
 | 
			
		||||
    {
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveFolder">@SharedLocalizer["Save"]</button>
 | 
			
		||||
        @((MarkupString)" ")
 | 
			
		||||
    }
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    @if (!_isSystem && PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
    {
 | 
			
		||||
        @((MarkupString)" ")
 | 
			
		||||
        <ActionDialog Header="Delete Folder" Message="Are You Sure You Wish To Delete This Folder?" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFolder())" ResourceKey="DeleteFolder" />
 | 
			
		||||
    }
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
    {
 | 
			
		||||
        <AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private List<Folder> _folders;
 | 
			
		||||
    private int _folderId = -1;
 | 
			
		||||
    private int _parentId = -1;
 | 
			
		||||
@ -137,79 +133,70 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveFolder()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        if (_name == string.Empty || _parentId == -1)
 | 
			
		||||
        {
 | 
			
		||||
            if (_name == string.Empty || _parentId == -1)
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.FolderParent"], MessageType.Warning);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (!_name.IsPathOrFileValid())
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Folder.InvalidName"], MessageType.Warning);
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Folder folder;
 | 
			
		||||
            if (_folderId != -1)
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.FolderParent"], MessageType.Warning);
 | 
			
		||||
                return;
 | 
			
		||||
                folder = await FolderService.GetFolderAsync(_folderId);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                folder = new Folder();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (!_name.IsPathOrFileValid())
 | 
			
		||||
            folder.SiteId = PageState.Site.SiteId;
 | 
			
		||||
 | 
			
		||||
            if (_parentId == -1)
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Folder.InvalidName"], MessageType.Warning);
 | 
			
		||||
                return;
 | 
			
		||||
                folder.ParentId = null;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                folder.ParentId = _parentId;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            folder.Name = _name;
 | 
			
		||||
            folder.Type = _type;
 | 
			
		||||
            folder.IsSystem = _isSystem;
 | 
			
		||||
            folder.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
 | 
			
		||||
            if (_folderId != -1)
 | 
			
		||||
            {
 | 
			
		||||
                Folder folder;
 | 
			
		||||
                if (_folderId != -1)
 | 
			
		||||
                {
 | 
			
		||||
                    folder = await FolderService.GetFolderAsync(_folderId);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    folder = new Folder();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                folder.SiteId = PageState.Site.SiteId;
 | 
			
		||||
 | 
			
		||||
                if (_parentId == -1)
 | 
			
		||||
                {
 | 
			
		||||
                    folder.ParentId = null;
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    folder.ParentId = _parentId;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                folder.Name = _name;
 | 
			
		||||
                folder.Type = _type;
 | 
			
		||||
                folder.IsSystem = _isSystem;
 | 
			
		||||
                folder.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
 | 
			
		||||
                if (_folderId != -1)
 | 
			
		||||
                {
 | 
			
		||||
                    folder = await FolderService.UpdateFolderAsync(folder);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    folder = await FolderService.AddFolderAsync(folder);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (folder != null)
 | 
			
		||||
                {
 | 
			
		||||
                    await FolderService.UpdateFolderOrderAsync(folder.SiteId, folder.FolderId, folder.ParentId);
 | 
			
		||||
                    await logger.LogInformation("Folder Saved {Folder}", folder);
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Error.Folder.Save"], MessageType.Error);
 | 
			
		||||
                }
 | 
			
		||||
                folder = await FolderService.UpdateFolderAsync(folder);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                folder = await FolderService.AddFolderAsync(folder);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (folder != null)
 | 
			
		||||
            {
 | 
			
		||||
                await FolderService.UpdateFolderOrderAsync(folder.SiteId, folder.FolderId, folder.ParentId);
 | 
			
		||||
                await logger.LogInformation("Folder Saved {Folder}", folder);
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Folder.Save"], MessageType.Error);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Folder.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,77 +5,73 @@
 | 
			
		||||
@inject IStringLocalizer<Edit> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="name" HelpText="Enter the job name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="type" HelpText="The fully qualified job type name" ResourceKey="Type">Type: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="type" class="form-control" @bind="@_jobType" readonly />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="enabled" HelpText="Select whether you want the job enabled or not" ResourceKey="Enabled">Enabled? </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="enabled" class="form-select" @bind="@_isEnabled" required>
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="runs-every" HelpText="Select how often you want the job to run" ResourceKey="RunsEvery">Runs Every: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="runs-every" class="form-control" @bind="@_interval" required />
 | 
			
		||||
                <select id="runs-every" class="form-select" @bind="@_frequency" required>
 | 
			
		||||
                    <option value="m">@Localizer["Minute(s)"]</option>
 | 
			
		||||
                    <option value="H">@Localizer["Hour(s)"]</option>
 | 
			
		||||
                    <option value="d">@Localizer["Day(s)"]</option>
 | 
			
		||||
                    <option value="M">@Localizer["Month(s)"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="starting" HelpText="What time do you want the job to start" ResourceKey="Starting">Starting: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="starting" class="form-control" @bind="@_startDate" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="ending" HelpText="When do you want the job to end" ResourceKey="Ending">Ending: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="ending" class="form-control" @bind="@_endDate" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="retention" HelpText="Number of log entries to retain for this job" ResourceKey="RetentionLog">Retention Log (Items): </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="retention" class="form-control" @bind="@_retentionHistory" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="next" HelpText="Next execution for this job." ResourceKey="NextExecution">Next Execution: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="next" class="form-control" @bind="@_nextExecution" />
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="name" HelpText="Enter the job name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveJob">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
</form>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="type" HelpText="The fully qualified job type name" ResourceKey="Type">Type: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="type" class="form-control" @bind="@_jobType" readonly />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="enabled" HelpText="Select whether you want the job enabled or not" ResourceKey="Enabled">Enabled? </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="enabled" class="form-select" @bind="@_isEnabled">
 | 
			
		||||
                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="runs-every" HelpText="Select how often you want the job to run" ResourceKey="RunsEvery">Runs Every: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="runs-every" class="form-control" @bind="@_interval" />
 | 
			
		||||
            <select id="runs-every" class="form-select" @bind="@_frequency">
 | 
			
		||||
                <option value="m">@Localizer["Minute(s)"]</option>
 | 
			
		||||
                <option value="H">@Localizer["Hour(s)"]</option>
 | 
			
		||||
                <option value="d">@Localizer["Day(s)"]</option>
 | 
			
		||||
                <option value="M">@Localizer["Month(s)"]</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="starting" HelpText="What time do you want the job to start" ResourceKey="Starting">Starting: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="starting" class="form-control" @bind="@_startDate" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="ending" HelpText="When do you want the job to end" ResourceKey="Ending">Ending: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="ending" class="form-control" @bind="@_endDate" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="retention" HelpText="Number of log entries to retain for this job" ResourceKey="RetentionLog">Retention Log (Items): </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="retention" class="form-control" @bind="@_retentionHistory" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="next" HelpText="Next execution for this job." ResourceKey="NextExecution">Next Execution: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="next" class="form-control" @bind="@_nextExecution" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<br />
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveJob">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private int _jobId;
 | 
			
		||||
    private string _name = string.Empty;
 | 
			
		||||
    private string _jobType = string.Empty;
 | 
			
		||||
@ -125,9 +121,7 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveJob()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        if (_name != string.Empty && !string.IsNullOrEmpty(_jobType) && _frequency != string.Empty && _interval != string.Empty && _retentionHistory != string.Empty)
 | 
			
		||||
        {
 | 
			
		||||
            var job = await JobService.GetJobAsync(_jobId);
 | 
			
		||||
            job.Name = _name;
 | 
			
		||||
@ -182,4 +176,5 @@
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.JobInfo"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,31 +23,29 @@ else
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
                    <div class="container">
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="name" HelpText="Name Of The Language" ResourceKey="Name">Name:</Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="_code" class="form-select" @bind="@_code" required>
 | 
			
		||||
                                    @foreach (var culture in _availableCultures)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@culture.Name">@culture.DisplayName</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="default" HelpText="Indicates Whether Or Not This Language Is The Default For The Site" ResourceKey="IsDefault">Default?</Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="default" class="form-select" @bind="@_isDefault" required>
 | 
			
		||||
                                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="name" HelpText="Name Of The Language" ResourceKey="Name">Name:</Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="_code" class="form-select" @bind="@_code">
 | 
			
		||||
                                @foreach (var culture in _availableCultures)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@culture.Name">@culture.DisplayName</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <button type="button" class="btn btn-success" @onclick="SaveLanguage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
                </form>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="default" HelpText="Indicates Whether Or Not This Language Is The Default For The Site" ResourceKey="IsDefault">Default?</Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="default" class="form-select" @bind="@_isDefault">
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <button type="button" class="btn btn-success" @onclick="SaveLanguage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
            }
 | 
			
		||||
            <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
@ -109,9 +107,6 @@ else
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
 | 
			
		||||
    private string _code = string.Empty;
 | 
			
		||||
    private string _isDefault = "False";
 | 
			
		||||
    private string _message;
 | 
			
		||||
@ -174,40 +169,31 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task SaveLanguage()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        var language = new Language
 | 
			
		||||
        {
 | 
			
		||||
            var language = new Language
 | 
			
		||||
            SiteId = PageState.Page.SiteId,
 | 
			
		||||
            Name = CultureInfo.GetCultureInfo(_code).DisplayName,
 | 
			
		||||
            Code = _code,
 | 
			
		||||
            IsDefault = (_isDefault == null ? false : Boolean.Parse(_isDefault))
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            language = await LanguageService.AddLanguageAsync(language);
 | 
			
		||||
 | 
			
		||||
            if (language.IsDefault)
 | 
			
		||||
            {
 | 
			
		||||
                SiteId = PageState.Page.SiteId,
 | 
			
		||||
                Name = CultureInfo.GetCultureInfo(_code).DisplayName,
 | 
			
		||||
                Code = _code,
 | 
			
		||||
                IsDefault = (_isDefault == null ? false : Boolean.Parse(_isDefault))
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                language = await LanguageService.AddLanguageAsync(language);
 | 
			
		||||
 | 
			
		||||
                if (language.IsDefault)
 | 
			
		||||
                {
 | 
			
		||||
                    await SetCultureAsync(language.Code);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("Language Added {Language}", language);
 | 
			
		||||
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Adding Language {Language} {Error}", language, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Language.Add"], MessageType.Error);
 | 
			
		||||
                await SetCultureAsync(language.Code);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            await logger.LogInformation("Language Added {Language}", language);
 | 
			
		||||
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Adding Language {Language} {Error}", language, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Language.Add"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,75 +10,71 @@
 | 
			
		||||
 | 
			
		||||
@if (string.IsNullOrEmpty(_moduledefinitionname) && _templates != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="owner" class="form-control" @bind="@_owner" required />
 | 
			
		||||
                </div>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="owner" class="form-control" @bind="@_owner" />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation." ResourceKey="ModuleName">Module Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="module" class="form-control" @bind="@_module" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="description" HelpText="Enter a short description for the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <textarea id="description" class="form-control" @bind="@_description" rows="3" required></textarea>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="template" HelpText="Select a module template. Templates are located in the wwwroot/Modules/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                        @foreach (Template template in _templates)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="reference" class="form-select" @bind="@_reference" required>
 | 
			
		||||
                        @foreach (string version in _versions)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@(version)">@(version)</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            @if (!string.IsNullOrEmpty(_location))
 | 
			
		||||
            {
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="location" HelpText="Location where the module will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="CreateModule">@Localizer["Module.Create"]</button>
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation." ResourceKey="ModuleName">Module Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="module" class="form-control" @bind="@_module" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="description" HelpText="Enter a short description for the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <textarea id="description" class="form-control" @bind="@_description" rows="3"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="template" HelpText="Select a module template. Templates are located in the wwwroot/Modules/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))">
 | 
			
		||||
                    <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                    @foreach (Template template in _templates)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="reference" class="form-select" @bind="@_reference">
 | 
			
		||||
                    @foreach (string version in _versions)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(version)">@(version)</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        @if (!string.IsNullOrEmpty(_location))
 | 
			
		||||
        {
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="ActivateModule">@Localizer["Module.Activate"]</button>
 | 
			
		||||
    </form>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="location" HelpText="Location where the module will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        }
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="CreateModule">@Localizer["Module.Create"]</button>
 | 
			
		||||
}
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="ActivateModule">@Localizer["Module.Activate"]</button>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _moduledefinitionname = string.Empty;
 | 
			
		||||
    private string _owner = string.Empty;
 | 
			
		||||
    private string _module = string.Empty;
 | 
			
		||||
@ -117,11 +113,9 @@
 | 
			
		||||
 | 
			
		||||
    private async Task CreateModule()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (IsValid(_owner) && IsValid(_module) && _owner != _module && _template != "-")
 | 
			
		||||
            {
 | 
			
		||||
                var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference };
 | 
			
		||||
                moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
 | 
			
		||||
@ -134,14 +128,14 @@
 | 
			
		||||
 | 
			
		||||
                AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Creating Module");
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Require.ValidName"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Creating Module");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -10,71 +10,67 @@
 | 
			
		||||
 | 
			
		||||
@if (_templates != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="owner" class="form-control" @bind="@_owner" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="owner" class="form-control" @bind="@_owner" />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation." ResourceKey="ModuleName">Module Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="module" class="form-control" @bind="@_module" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="description" HelpText="Enter a short description for the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <textarea id="description" class="form-control" @bind="@_description" rows="3" required></textarea>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="template" HelpText="Select a module template. Templates are located in the wwwroot/Modules/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                        @foreach (Template template in _templates)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="reference" class="form-select" @bind="@_reference" required>
 | 
			
		||||
                        @foreach (string version in _versions)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@(version)">@(version)</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            @if (!string.IsNullOrEmpty(_location))
 | 
			
		||||
            {
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="location" HelpText="Location where the module will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </div>
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="CreateModule">@Localizer["CreateModule"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    </form>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation." ResourceKey="ModuleName">Module Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="module" class="form-control" @bind="@_module" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="description" HelpText="Enter a short description for the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <textarea id="description" class="form-control" @bind="@_description" rows="3"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="template" HelpText="Select a module template. Templates are located in the wwwroot/Modules/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))">
 | 
			
		||||
                    <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                    @foreach (Template template in _templates)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="reference" class="form-select" @bind="@_reference">
 | 
			
		||||
                    @foreach (string version in _versions)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(version)">@(version)</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        @if (!string.IsNullOrEmpty(_location))
 | 
			
		||||
        {
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="location" HelpText="Location where the module will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        }
 | 
			
		||||
    </div>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="CreateModule">@Localizer["CreateModule"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _owner = string.Empty;
 | 
			
		||||
    private string _module = string.Empty;
 | 
			
		||||
    private string _description = string.Empty;
 | 
			
		||||
@ -103,32 +99,23 @@
 | 
			
		||||
 | 
			
		||||
    private async Task CreateModule()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (IsValid(_owner) && IsValid(_module) && _owner != _module && _template != "-")
 | 
			
		||||
            {
 | 
			
		||||
                if (IsValid(_owner) && IsValid(_module) && _owner != _module && _template != "-")
 | 
			
		||||
                {
 | 
			
		||||
                    var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference };
 | 
			
		||||
                    moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
 | 
			
		||||
                    GetLocation();
 | 
			
		||||
                    AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Require.ValidName"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
                var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference };
 | 
			
		||||
                moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
 | 
			
		||||
                GetLocation();
 | 
			
		||||
                AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Creating Module");
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Require.ValidName"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Creating Module");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,94 +5,90 @@
 | 
			
		||||
@inject IStringLocalizer<Edit> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Definition" ResourceKey="Definition">
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Definition" ResourceKey="Definition">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="The name of the module" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="description" HelpText="The description of the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <textarea id="description" class="form-control" @bind="@_description" rows="2"></textarea>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="categories" HelpText="Comma delimited list of module categories" ResourceKey="Categories">Categories: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="categories" class="form-control" @bind="@_categories" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <Section Name="Information" ResourceKey="Information">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="name" HelpText="The name of the module" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="moduledefinitionname" HelpText="The internal name of the module" ResourceKey="InternalName">Internal Name: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
                        <input id="moduledefinitionname" class="form-control" @bind="@_moduledefinitionname" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="description" HelpText="The description of the module" ResourceKey="Description">Description: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="version" HelpText="The version of the module" ResourceKey="Version">Version: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <textarea id="description" class="form-control" @bind="@_description" rows="2" required></textarea>
 | 
			
		||||
                        <input id="version" class="form-control" @bind="@_version" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="categories" HelpText="Comma delimited list of module categories" ResourceKey="Categories">Categories: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="owner" HelpText="The owner or creator of the module" ResourceKey="Owner">Owner: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="categories" class="form-control" @bind="@_categories" required />
 | 
			
		||||
                        <input id="owner" class="form-control" @bind="@_owner" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="url" HelpText="The reference url of the module" ResourceKey="ReferenceUrl">Reference Url: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="url" class="form-control" @bind="@_url" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="contact" HelpText="The contact for the module" ResourceKey="Contact">Contact: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="contact" class="form-control" @bind="@_contact" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="license" HelpText="The module license terms" ResourceKey="License">License: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="runtimes" HelpText="The Blazor runtimes which this module supports" ResourceKey="Runtimes">Runtimes: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="runtimes" class="form-control" @bind="@_runtimes" disabled />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <Section Name="Information" ResourceKey="Information">
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="moduledefinitionname" HelpText="The internal name of the module" ResourceKey="InternalName">Internal Name: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="moduledefinitionname" class="form-control" @bind="@_moduledefinitionname" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="version" HelpText="The version of the module" ResourceKey="Version">Version: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="version" class="form-control" @bind="@_version" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="owner" HelpText="The owner or creator of the module" ResourceKey="Owner">Owner: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="owner" class="form-control" @bind="@_owner" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="url" HelpText="The reference url of the module" ResourceKey="ReferenceUrl">Reference Url: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="url" class="form-control" @bind="@_url" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="contact" HelpText="The contact for the module" ResourceKey="Contact">Contact: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="contact" class="form-control" @bind="@_contact" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="license" HelpText="The module license terms" ResourceKey="License">License: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="runtimes" HelpText="The Blazor runtimes which this module supports" ResourceKey="Runtimes">Runtimes: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="runtimes" class="form-control" @bind="@_runtimes" disabled />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </Section>
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <PermissionGrid EntityName="@EntityNames.ModuleDefinition" PermissionNames="@PermissionNames.Utilize" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
                </div>
 | 
			
		||||
        </Section>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <PermissionGrid EntityName="@EntityNames.ModuleDefinition" PermissionNames="@PermissionNames.Utilize" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
 | 
			
		||||
</form>
 | 
			
		||||
        </div>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
</TabStrip>
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private int _moduleDefinitionId;
 | 
			
		||||
    private string _name;
 | 
			
		||||
    private string _version;
 | 
			
		||||
@ -150,39 +146,30 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveModuleDefinition()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            var moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(_moduleDefinitionId, ModuleState.SiteId);
 | 
			
		||||
            if (moduledefinition.Name != _name)
 | 
			
		||||
            {
 | 
			
		||||
                var moduledefinition = await ModuleDefinitionService.GetModuleDefinitionAsync(_moduleDefinitionId, ModuleState.SiteId);
 | 
			
		||||
                if (moduledefinition.Name != _name)
 | 
			
		||||
                {
 | 
			
		||||
                    moduledefinition.Name = _name;
 | 
			
		||||
                }
 | 
			
		||||
                if (moduledefinition.Description != _description)
 | 
			
		||||
                {
 | 
			
		||||
                    moduledefinition.Description = _description;
 | 
			
		||||
                }
 | 
			
		||||
                if (moduledefinition.Categories != _categories)
 | 
			
		||||
                {
 | 
			
		||||
                    moduledefinition.Categories = _categories;
 | 
			
		||||
                }
 | 
			
		||||
                moduledefinition.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
 | 
			
		||||
                await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                moduledefinition.Name = _name;
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            if (moduledefinition.Description != _description)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Module.Save"], MessageType.Error);
 | 
			
		||||
                moduledefinition.Description = _description;
 | 
			
		||||
            }
 | 
			
		||||
            if (moduledefinition.Categories != _categories)
 | 
			
		||||
            {
 | 
			
		||||
                moduledefinition.Categories = _categories;
 | 
			
		||||
            }
 | 
			
		||||
            moduledefinition.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
            await ModuleDefinitionService.UpdateModuleDefinitionAsync(moduledefinition);
 | 
			
		||||
            await logger.LogInformation("ModuleDefinition Saved {ModuleDefinition}", moduledefinition);
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Module.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,39 +5,28 @@
 | 
			
		||||
@inject IStringLocalizer<Export> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="content" HelpText="Enter the module content" ResourceKey="Content">Content: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <textarea id="content" class="form-control" @bind="@_content" rows="5" required></textarea>
 | 
			
		||||
                <textarea id="content" class="form-control" @bind="@_content" rows="5"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="ExportModule">@Localizer["Export"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _content = string.Empty;
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
    public override string Title => "Export Content";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    private async Task ExportModule()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
    @code {
 | 
			
		||||
        private string _content = string.Empty;
 | 
			
		||||
 | 
			
		||||
        public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
        public override string Title => "Export Content";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        private async Task ExportModule()
 | 
			
		||||
        {
 | 
			
		||||
            _content = await ModuleService.ExportModuleAsync(ModuleState.ModuleId);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,6 @@
 | 
			
		||||
@inject IStringLocalizer<Import> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="content" HelpText="Enter the module content" ResourceKey="Content">Content: </Label>
 | 
			
		||||
@ -18,21 +17,15 @@
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="ImportModule">@Localizer["Import"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private string _content = string.Empty;
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
    public override string Title => "Import Content";
 | 
			
		||||
    @code {
 | 
			
		||||
        private string _content = string.Empty;
 | 
			
		||||
 | 
			
		||||
    private async Task ImportModule()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
        public override string Title => "Import Content";
 | 
			
		||||
 | 
			
		||||
        private async Task ImportModule()
 | 
			
		||||
        {
 | 
			
		||||
            if (_content != string.Empty)
 | 
			
		||||
            {
 | 
			
		||||
@ -59,9 +52,4 @@
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.ImportContent"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -8,92 +8,88 @@
 | 
			
		||||
@inject IStringLocalizer<Settings> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Settings" Heading="Settings" ResourceKey="Settings">
 | 
			
		||||
            @if (_containers != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="title" HelpText="Enter the title of the module" ResourceKey="Title">Title: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="title" type="text" name="Title" class="form-control" @bind="@_title" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="container" HelpText="Select the module's container" ResourceKey="Container">Container: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="container" class="form-select" @bind="@_containerType" required>
 | 
			
		||||
                                @foreach (var container in _containers)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="allpages" HelpText="Indicate if this module should be displayed on all pages" ResourceKey="DisplayOnAllPages">Display On All Pages? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="allpages" class="form-select" @bind="@_allPages" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="page" HelpText="The page that the module is located on" ResourceKey="Page">Page: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="page" class="form-select" @bind="@_pageId" required>
 | 
			
		||||
                                @foreach (Page p in PageState.Pages)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@p.PageId">@(new string('-', p.Level * 2))@(p.Name)</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Settings" Heading="Settings" ResourceKey="Settings">
 | 
			
		||||
        @if (_containers != null)
 | 
			
		||||
        {
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="title" HelpText="Enter the title of the module" ResourceKey="Title">Title: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="title" type="text" name="Title" class="form-control" @bind="@_title" />
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
            @if (_permissions != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <PermissionGrid EntityName="@EntityNames.Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
                    </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="container" HelpText="Select the module's container" ResourceKey="Container">Container: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="container" class="form-select" @bind="@_containerType">
 | 
			
		||||
                        @foreach (var container in _containers)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="allpages" HelpText="Indicate if this module should be displayed on all pages" ResourceKey="DisplayOnAllPages">Display On All Pages? </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="allpages" class="form-select" @bind="@_allPages">
 | 
			
		||||
                        <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                        <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="page" HelpText="The page that the module is located on" ResourceKey="Page">Page: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="page" class="form-select" @bind="@_pageId">
 | 
			
		||||
                        @foreach (Page p in PageState.Pages)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@p.PageId">@(new string('-', p.Level * 2))@(p.Name)</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
        @if (_permissions != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <PermissionGrid EntityName="@EntityNames.Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    @if (_moduleSettingsType != null)
 | 
			
		||||
    {
 | 
			
		||||
        <TabPanel Name="ModuleSettings" Heading="@_moduleSettingsTitle" ResourceKey="ModuleSettings">
 | 
			
		||||
            @ModuleSettingsComponent
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        @if (_moduleSettingsType != null)
 | 
			
		||||
        {
 | 
			
		||||
            <TabPanel Name="ModuleSettings" Heading="@_moduleSettingsTitle" ResourceKey="ModuleSettings">
 | 
			
		||||
                @ModuleSettingsComponent
 | 
			
		||||
            </TabPanel>
 | 
			
		||||
        }
 | 
			
		||||
        @if (_containerSettingsType != null)
 | 
			
		||||
        {
 | 
			
		||||
            <TabPanel Name="ContainerSettings" Heading="Container Settings" ResourceKey="ContainerSettings">
 | 
			
		||||
                @ContainerSettingsComponent
 | 
			
		||||
            </TabPanel>
 | 
			
		||||
        }
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveModule">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
</form>
 | 
			
		||||
    }
 | 
			
		||||
    @if (_containerSettingsType != null)
 | 
			
		||||
    {
 | 
			
		||||
        <TabPanel Name="ContainerSettings" Heading="Container Settings" ResourceKey="ContainerSettings">
 | 
			
		||||
            @ContainerSettingsComponent
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    }
 | 
			
		||||
</TabStrip>
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveModule">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
 | 
			
		||||
    public override string Title => "Module Settings";
 | 
			
		||||
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private List<Theme> _themes;
 | 
			
		||||
    private List<ThemeControl> _containers = new List<ThemeControl>();
 | 
			
		||||
    private string _title;
 | 
			
		||||
@ -174,61 +170,52 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveModule()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        if (!string.IsNullOrEmpty(_title))
 | 
			
		||||
        {
 | 
			
		||||
            if (!string.IsNullOrEmpty(_title))
 | 
			
		||||
            var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
 | 
			
		||||
            pagemodule.PageId = int.Parse(_pageId);
 | 
			
		||||
            pagemodule.Title = _title;
 | 
			
		||||
            pagemodule.ContainerType = (_containerType != "-") ? _containerType : string.Empty;
 | 
			
		||||
            if (!string.IsNullOrEmpty(pagemodule.ContainerType) && pagemodule.ContainerType == PageState.Page.DefaultContainerType)
 | 
			
		||||
            {
 | 
			
		||||
                var pagemodule = await PageModuleService.GetPageModuleAsync(ModuleState.PageModuleId);
 | 
			
		||||
                pagemodule.PageId = int.Parse(_pageId);
 | 
			
		||||
                pagemodule.Title = _title;
 | 
			
		||||
                pagemodule.ContainerType = (_containerType != "-") ? _containerType : string.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(pagemodule.ContainerType) && pagemodule.ContainerType == PageState.Page.DefaultContainerType)
 | 
			
		||||
                {
 | 
			
		||||
                    pagemodule.ContainerType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                if (!string.IsNullOrEmpty(pagemodule.ContainerType) && pagemodule.ContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
                {
 | 
			
		||||
                    pagemodule.ContainerType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                await PageModuleService.UpdatePageModuleAsync(pagemodule);
 | 
			
		||||
                await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
 | 
			
		||||
 | 
			
		||||
                var module = ModuleState;
 | 
			
		||||
                module.AllPages = bool.Parse(_allPages);
 | 
			
		||||
                module.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                await ModuleService.UpdateModuleAsync(module);
 | 
			
		||||
 | 
			
		||||
                if (_moduleSettingsType != null)
 | 
			
		||||
                {
 | 
			
		||||
                    if (_moduleSettings is ISettingsControl moduleSettingsControl)
 | 
			
		||||
                    {
 | 
			
		||||
                        // module settings updated using explicit interface
 | 
			
		||||
                        await moduleSettingsControl.UpdateSettings();
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        // legacy support - module settings updated by convention ( ie. by calling a public method named "UpdateSettings" in settings component )
 | 
			
		||||
                        _moduleSettings?.GetType().GetMethod("UpdateSettings")?.Invoke(_moduleSettings, null);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (_containerSettingsType != null && _containerSettings is ISettingsControl containerSettingsControl)
 | 
			
		||||
                {
 | 
			
		||||
                    await containerSettingsControl.UpdateSettings();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                pagemodule.ContainerType = string.Empty;
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            if (!string.IsNullOrEmpty(pagemodule.ContainerType) && pagemodule.ContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.Title"], MessageType.Warning);
 | 
			
		||||
                pagemodule.ContainerType = string.Empty;
 | 
			
		||||
            }
 | 
			
		||||
            await PageModuleService.UpdatePageModuleAsync(pagemodule);
 | 
			
		||||
            await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
 | 
			
		||||
 | 
			
		||||
            var module = ModuleState;
 | 
			
		||||
            module.AllPages = bool.Parse(_allPages);
 | 
			
		||||
            module.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
            await ModuleService.UpdateModuleAsync(module);
 | 
			
		||||
 | 
			
		||||
            if (_moduleSettingsType != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (_moduleSettings is ISettingsControl moduleSettingsControl)
 | 
			
		||||
                {
 | 
			
		||||
                    // module settings updated using explicit interface
 | 
			
		||||
                    await moduleSettingsControl.UpdateSettings();
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    // legacy support - module settings updated by convention ( ie. by calling a public method named "UpdateSettings" in settings component )
 | 
			
		||||
                    _moduleSettings?.GetType().GetMethod("UpdateSettings")?.Invoke(_moduleSettings, null);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (_containerSettingsType != null && _containerSettings is ISettingsControl containerSettingsControl)
 | 
			
		||||
            {
 | 
			
		||||
                await containerSettingsControl.UpdateSettings();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.Title"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -6,154 +6,151 @@
 | 
			
		||||
@inject IStringLocalizer<Add> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip Refresh="@_refresh">
 | 
			
		||||
        <TabPanel Name="Settings" ResourceKey="Settings">
 | 
			
		||||
            @if (_themeList != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Name" class="form-control" @bind="@_name" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Parent" class="form-select" @onchange="(e => ParentChanged(e))" required>
 | 
			
		||||
                                <option value="-1"><@Localizer["SiteRoot"]></option>
 | 
			
		||||
                                @foreach (Page page in _pageList)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages" ResourceKey="Insert">Insert: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Insert" class="form-select" @bind="@_insert" required>
 | 
			
		||||
                                <option value="<<">@Localizer["AtBeginning"]</option>
 | 
			
		||||
                                @if (_children != null && _children.Count > 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="<">@Localizer["Before"]</option>
 | 
			
		||||
                                    <option value=">">@Localizer["After"]</option>
 | 
			
		||||
                                }
 | 
			
		||||
                                <option value=">>">@Localizer["AtEnd"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                            @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
 | 
			
		||||
                            {
 | 
			
		||||
                                <select class="form-select" @bind="@_childid">
 | 
			
		||||
                                    <option value="-1"><@Localizer["Page.Select"]></option>
 | 
			
		||||
                                    @foreach (Page page in _children)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@(page.PageId)">@(page.Name)</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            }
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="navigation" class="form-select" @bind="@_isnavigation" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="clickable" HelpText="Select whether the link in the site navigation is enabled or disabled" ResourceKey="Clickable">Clickable? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="clickable" class="form-select" @bind="@_isclickable" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Path" class="form-control" @bind="@_path" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Url" class="form-control" @bind="@_url" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
                <Section Name="Appearance" ResourceKey="Appearance">
 | 
			
		||||
                    <div class="container">
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used." ResourceKey="Title">Title: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <input id="Title" class="form-control" @bind="@_title" />
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="Theme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))" required>
 | 
			
		||||
                                    @foreach (var theme in _themes)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="defaultContainer" class="form-select" @bind="@_containertype" required>
 | 
			
		||||
                                    <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                                    @foreach (var container in _containers)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <input id="Icon" class="form-control" @bind="@_icon" />
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="Personalizable" class="form-select" @bind="@_ispersonalizable" required>
 | 
			
		||||
                                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </Section>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
<TabStrip Refresh="@_refresh">
 | 
			
		||||
    <TabPanel Name="Settings" ResourceKey="Settings">
 | 
			
		||||
        @if (_themeList != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
                    <Label Class="col-sm-3" For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Name" class="form-control" @bind="@_name" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Parent" class="form-select" @onchange="(e => ParentChanged(e))">
 | 
			
		||||
                            <option value="-1"><@Localizer["SiteRoot"]></option>
 | 
			
		||||
                            @foreach (Page page in _pageList)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages" ResourceKey="Insert">Insert: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Insert" class="form-select" @bind="@_insert">
 | 
			
		||||
                            <option value="<<">@Localizer["AtBeginning"]</option>
 | 
			
		||||
                            @if (_children != null && _children.Count > 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="<">@Localizer["Before"]</option>
 | 
			
		||||
                                <option value=">">@Localizer["After"]</option>
 | 
			
		||||
                            }
 | 
			
		||||
                            <option value=">>">@Localizer["AtEnd"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                        @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
 | 
			
		||||
                        {
 | 
			
		||||
                            <select class="form-select" @bind="@_childid">
 | 
			
		||||
                                <option value="-1"><@Localizer["Page.Select"]></option>
 | 
			
		||||
                                @foreach (Page page in _children)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@(page.PageId)">@(page.Name)</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        }
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="navigation" class="form-select" @bind="@_isnavigation">
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="clickable" HelpText="Select whether the link in the site navigation is enabled or disabled" ResourceKey="Clickable">Clickable? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="clickable" class="form-select" @bind="@_isclickable">
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Path" class="form-control" @bind="@_path" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Url" class="form-control" @bind="@_url" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        @if (_themeSettingsType != null)
 | 
			
		||||
        {
 | 
			
		||||
            <TabPanel Name="ThemeSettings" Heading="Theme Settings" ResourceKey="ThemeSettings">
 | 
			
		||||
                @ThemeSettingsComponent
 | 
			
		||||
            </TabPanel>
 | 
			
		||||
 | 
			
		||||
            <Section Name="Appearance" ResourceKey="Appearance">
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used." ResourceKey="Title">Title: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Title" class="form-control" @bind="@_title" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Theme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                                @foreach (var theme in _themes)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="defaultContainer" class="form-select" @bind="@_containertype">
 | 
			
		||||
                                <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                                @foreach (var container in _containers)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Icon" class="form-control" @bind="@_icon" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Personalizable" class="form-select" @bind="@_ispersonalizable">
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </Section>
 | 
			
		||||
        }
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SavePage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
</form>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    @if (_themeSettingsType != null)
 | 
			
		||||
    {
 | 
			
		||||
        <TabPanel Name="ThemeSettings" Heading="Theme Settings" ResourceKey="ThemeSettings">
 | 
			
		||||
            @ThemeSettingsComponent
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    }
 | 
			
		||||
</TabStrip>
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SavePage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
@ -182,8 +179,6 @@
 | 
			
		||||
    private object _themeSettings;
 | 
			
		||||
    private RenderFragment ThemeSettingsComponent { get; set; }
 | 
			
		||||
    private bool _refresh = false;
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
 | 
			
		||||
    protected override async Task OnInitializedAsync()
 | 
			
		||||
    {
 | 
			
		||||
@ -280,119 +275,110 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SavePage()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        Page page = null;
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Page page = null;
 | 
			
		||||
            try
 | 
			
		||||
            if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
 | 
			
		||||
            {
 | 
			
		||||
                if (!string.IsNullOrEmpty(_name) && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
 | 
			
		||||
                page = new Page();
 | 
			
		||||
                page.SiteId = PageState.Page.SiteId;
 | 
			
		||||
                page.Name = _name;
 | 
			
		||||
                page.Title = _title;
 | 
			
		||||
                if (_path == "")
 | 
			
		||||
                {
 | 
			
		||||
                    page = new Page();
 | 
			
		||||
                    page.SiteId = PageState.Page.SiteId;
 | 
			
		||||
                    page.Name = _name;
 | 
			
		||||
                    page.Title = _title;
 | 
			
		||||
                    if (_path == "")
 | 
			
		||||
                    {
 | 
			
		||||
                        _path = _name;
 | 
			
		||||
                    }
 | 
			
		||||
                    _path = _name;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                    if (_path.Contains("/"))
 | 
			
		||||
                    {
 | 
			
		||||
                        _path = _path.Substring(_path.LastIndexOf("/") + 1);
 | 
			
		||||
                    }
 | 
			
		||||
                if (_path.Contains("/"))
 | 
			
		||||
                {
 | 
			
		||||
                    _path = _path.Substring(_path.LastIndexOf("/") + 1);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                    if (string.IsNullOrEmpty(_parentid))
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ParentId = null;
 | 
			
		||||
                        page.Path = Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ParentId = Int32.Parse(_parentid);
 | 
			
		||||
                        var parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault();
 | 
			
		||||
                        if (parent.Path == string.Empty)
 | 
			
		||||
                        {
 | 
			
		||||
                            page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (!PagePathIsUnique(page.Path, page.SiteId, _pageList))
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(string.Format(Localizer["Message.Page.Exists"], _path), MessageType.Warning);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    Page child;
 | 
			
		||||
                    switch (_insert)
 | 
			
		||||
                    {
 | 
			
		||||
                        case "<<":
 | 
			
		||||
                            page.Order = 0;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "<":
 | 
			
		||||
                            child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault();
 | 
			
		||||
                            page.Order = child.Order - 1;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case ">":
 | 
			
		||||
                            child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault();
 | 
			
		||||
                            page.Order = child.Order + 1;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case ">>":
 | 
			
		||||
                            page.Order = int.MaxValue;
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
 | 
			
		||||
                    page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
 | 
			
		||||
                    page.Url = _url;
 | 
			
		||||
                    page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
 | 
			
		||||
                    if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ThemeType = string.Empty;
 | 
			
		||||
                    }
 | 
			
		||||
                    page.DefaultContainerType = (_containertype != "-") ? _containertype : string.Empty;
 | 
			
		||||
                    if (!string.IsNullOrEmpty(page.DefaultContainerType) && page.DefaultContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.DefaultContainerType = string.Empty;
 | 
			
		||||
                    }
 | 
			
		||||
                    page.Icon = (_icon == null ? string.Empty : _icon);
 | 
			
		||||
                    page.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                    page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
 | 
			
		||||
                    page.UserId = null;
 | 
			
		||||
 | 
			
		||||
                    page = await PageService.AddPageAsync(page);
 | 
			
		||||
                    await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
 | 
			
		||||
 | 
			
		||||
                    await logger.LogInformation("Page Added {Page}", page);
 | 
			
		||||
                    if (PageState.QueryString.ContainsKey("cp"))
 | 
			
		||||
                    {
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl(page.Path));
 | 
			
		||||
                    }
 | 
			
		||||
                if (string.IsNullOrEmpty(_parentid))
 | 
			
		||||
                {
 | 
			
		||||
                    page.ParentId = null;
 | 
			
		||||
                    page.Path = Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
 | 
			
		||||
                    page.ParentId = Int32.Parse(_parentid);
 | 
			
		||||
                    var parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault();
 | 
			
		||||
                    if (parent.Path == string.Empty)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!PagePathIsUnique(page.Path, page.SiteId, _pageList))
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(string.Format(Localizer["Message.Page.Exists"], _path), MessageType.Warning);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                Page child;
 | 
			
		||||
                switch (_insert)
 | 
			
		||||
                {
 | 
			
		||||
                    case "<<":
 | 
			
		||||
                        page.Order = 0;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case "<":
 | 
			
		||||
                        child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault();
 | 
			
		||||
                        page.Order = child.Order - 1;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case ">":
 | 
			
		||||
                        child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault();
 | 
			
		||||
                        page.Order = child.Order + 1;
 | 
			
		||||
                        break;
 | 
			
		||||
                    case ">>":
 | 
			
		||||
                        page.Order = int.MaxValue;
 | 
			
		||||
                        break;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
 | 
			
		||||
                page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
 | 
			
		||||
                page.Url = _url;
 | 
			
		||||
                page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
 | 
			
		||||
                {
 | 
			
		||||
                    page.ThemeType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                page.DefaultContainerType = (_containertype != "-") ? _containertype : string.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(page.DefaultContainerType) && page.DefaultContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
                {
 | 
			
		||||
                    page.DefaultContainerType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                page.Icon = (_icon == null ? string.Empty : _icon);
 | 
			
		||||
                page.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable));
 | 
			
		||||
                page.UserId = null;
 | 
			
		||||
 | 
			
		||||
                page = await PageService.AddPageAsync(page);
 | 
			
		||||
                await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("Page Added {Page}", page);
 | 
			
		||||
                if (PageState.QueryString.ContainsKey("cp"))
 | 
			
		||||
                {
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl(page.Path));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,172 +7,168 @@
 | 
			
		||||
@inject IStringLocalizer<Edit> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip Refresh="@_refresh">
 | 
			
		||||
        <TabPanel Name="Settings" ResourceKey="Settings">
 | 
			
		||||
            @if (_themeList != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Name" class="form-control" @bind="@_name" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Parent" class="form-select" value="@_parentid" @onchange="(e => ParentChanged(e))" required>
 | 
			
		||||
                                <option value="-1"><@Localizer["SiteRoot"]></option>
 | 
			
		||||
                                @foreach (Page page in _pageList)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (page.PageId != _pageId)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Move" HelpText="Select the location where you would like the page to be moved in relation to other pages" ResourceKey="Move">Move: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Move" class="form-select" @bind="@_insert" required>
 | 
			
		||||
                                @if (_parentid == _currentparentid)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="="><@Localizer["ThisLocation.Keep"]></option>
 | 
			
		||||
                                }
 | 
			
		||||
                                <option value="<<">@Localizer["ToBeginning"]</option>
 | 
			
		||||
                                @if (_children != null && _children.Count > 0)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="<">@Localizer["Before"]</option>
 | 
			
		||||
                                    <option value=">">@Localizer["After"]</option>
 | 
			
		||||
                                }
 | 
			
		||||
                                <option value=">>">@Localizer["ToEnd"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                            @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
 | 
			
		||||
                            {
 | 
			
		||||
                                <select class="form-select" @bind="@_childid">
 | 
			
		||||
                                    <option value="-1"><@Localizer["Page.Select"]></option>
 | 
			
		||||
                                    @foreach (Page page in _children)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@(page.PageId)">@(page.Name)</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            }
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Navigation" class="form-select" @bind="@_isnavigation" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Clickablen" HelpText="Select whether the link in the site navigation is enabled or disabled" ResourceKey="Clickable">Clickable? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Navigation" class="form-select" @bind="@_isclickable" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Path" class="form-control" @bind="@_path" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Url" class="form-control" @bind="@_url" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <Section Name="Appearance" ResourceKey="Appearance">
 | 
			
		||||
                    <div class="container">
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used." ResourceKey="Title">Title: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <input id="Title" class="form-control" @bind="@_title" />
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="Theme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))" required>
 | 
			
		||||
                                    @foreach (var theme in _themes)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="defaultContainer" class="form-select" @bind="@_containertype" required>
 | 
			
		||||
                                    <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                                    @foreach (var container in _containers)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                                    }
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <input id="Icon" class="form-control" @bind="@_icon" />
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                <select id="Personalizable" class="form-select" @bind="@_ispersonalizable" required>
 | 
			
		||||
                                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                                </select>
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </Section>
 | 
			
		||||
                <br /><br />
 | 
			
		||||
                <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
            @if (_permissions != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        @if (_themeSettingsType != null)
 | 
			
		||||
<TabStrip Refresh="@_refresh">
 | 
			
		||||
    <TabPanel Name="Settings" ResourceKey="Settings">
 | 
			
		||||
        @if (_themeList != null)
 | 
			
		||||
        {
 | 
			
		||||
            <TabPanel Name="ThemeSettings" Heading="Theme Settings" ResourceKey="ThemeSettings">
 | 
			
		||||
                @ThemeSettingsComponent
 | 
			
		||||
            </TabPanel>
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Name" class="form-control" @bind="@_name" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Parent" class="form-select" value="@_parentid" @onchange="(e => ParentChanged(e))">
 | 
			
		||||
                            <option value="-1"><@Localizer["SiteRoot"]></option>
 | 
			
		||||
                            @foreach (Page page in _pageList)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (page.PageId != _pageId)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Move" HelpText="Select the location where you would like the page to be moved in relation to other pages" ResourceKey="Move">Move: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Move" class="form-select" @bind="@_insert">
 | 
			
		||||
                            @if (_parentid == _currentparentid)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="="><@Localizer["ThisLocation.Keep"]></option>
 | 
			
		||||
                            }
 | 
			
		||||
                            <option value="<<">@Localizer["ToBeginning"]</option>
 | 
			
		||||
                            @if (_children != null && _children.Count > 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="<">@Localizer["Before"]</option>
 | 
			
		||||
                                <option value=">">@Localizer["After"]</option>
 | 
			
		||||
                            }
 | 
			
		||||
                            <option value=">>">@Localizer["ToEnd"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                        @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
 | 
			
		||||
                        {
 | 
			
		||||
                            <select class="form-select" @bind="@_childid">
 | 
			
		||||
                                <option value="-1"><@Localizer["Page.Select"]></option>
 | 
			
		||||
                                @foreach (Page page in _children)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@(page.PageId)">@(page.Name)</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        }
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Navigation" class="form-select" @bind="@_isnavigation">
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Clickablen" HelpText="Select whether the link in the site navigation is enabled or disabled" ResourceKey="Clickable">Clickable? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="Navigation" class="form-select" @bind="@_isclickable">
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used." ResourceKey="UrlPath">Url Path: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Path" class="form-control" @bind="@_path" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="Url" class="form-control" @bind="@_url" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <Section Name="Appearance" ResourceKey="Appearance">
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used." ResourceKey="Title">Title: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Title" class="form-control" @bind="@_title" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Theme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                                @foreach (var theme in _themes)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="defaultContainer" class="form-select" @bind="@_containertype">
 | 
			
		||||
                                <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                                @foreach (var container in _containers)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="Icon" class="form-control" @bind="@_icon" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="Personalizable" class="form-select" @bind="@_ispersonalizable">
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </Section>
 | 
			
		||||
            <br /><br />
 | 
			
		||||
            <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
 | 
			
		||||
        }
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SavePage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
</form>
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Permissions" ResourceKey="Permissions">
 | 
			
		||||
        @if (_permissions != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
 | 
			
		||||
       
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    @if (_themeSettingsType != null)
 | 
			
		||||
    {
 | 
			
		||||
        <TabPanel Name="ThemeSettings" Heading="Theme Settings" ResourceKey="ThemeSettings">
 | 
			
		||||
            @ThemeSettingsComponent
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    }
 | 
			
		||||
</TabStrip>
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SavePage">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
 | 
			
		||||
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private List<Theme> _themeList;
 | 
			
		||||
    private List<ThemeControl> _themes = new List<ThemeControl>();
 | 
			
		||||
    private List<ThemeControl> _containers = new List<ThemeControl>();
 | 
			
		||||
@ -355,143 +351,134 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SavePage()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        Page page = null;
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            Page page = null;
 | 
			
		||||
            try
 | 
			
		||||
            if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
 | 
			
		||||
            {
 | 
			
		||||
                if (_name != string.Empty && !string.IsNullOrEmpty(_themetype) && _containertype != "-")
 | 
			
		||||
                page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
 | 
			
		||||
                string currentPath = page.Path;
 | 
			
		||||
 | 
			
		||||
                page.Name = _name;
 | 
			
		||||
                page.Title = _title;
 | 
			
		||||
                if (_path == "" && _name.ToLower() != "home")
 | 
			
		||||
                    if (_path == string.Empty && _name.ToLower() != "home")
 | 
			
		||||
                    {
 | 
			
		||||
                        _path = _name;
 | 
			
		||||
                    }
 | 
			
		||||
                if (_path.Contains("/"))
 | 
			
		||||
                {
 | 
			
		||||
                    page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId);
 | 
			
		||||
                    string currentPath = page.Path;
 | 
			
		||||
 | 
			
		||||
                    page.Name = _name;
 | 
			
		||||
                    page.Title = _title;
 | 
			
		||||
                    if (_path == "" && _name.ToLower() != "home")
 | 
			
		||||
                        if (_path == string.Empty && _name.ToLower() != "home")
 | 
			
		||||
                        {
 | 
			
		||||
                            _path = _name;
 | 
			
		||||
                        }
 | 
			
		||||
                    if (_path.Contains("/"))
 | 
			
		||||
                    {
 | 
			
		||||
                        _path = _path.Substring(_path.LastIndexOf("/") + 1);
 | 
			
		||||
                    }
 | 
			
		||||
                    if (string.IsNullOrEmpty(_parentid) || _parentid == "-1")
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ParentId = null;
 | 
			
		||||
                        page.Path = Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ParentId = Int32.Parse(_parentid);
 | 
			
		||||
                        Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
 | 
			
		||||
                        if (parent.Path == string.Empty)
 | 
			
		||||
                        {
 | 
			
		||||
                            page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (!PagePathIsUnique(page.Path, page.SiteId, page.PageId, _pageList))
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(string.Format(Localizer["Mesage.Page.PathExists"], _path), MessageType.Warning);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (_insert != "=")
 | 
			
		||||
                    {
 | 
			
		||||
                        Page child;
 | 
			
		||||
                        switch (_insert)
 | 
			
		||||
                        {
 | 
			
		||||
                            case "<<":
 | 
			
		||||
                                page.Order = 0;
 | 
			
		||||
                                break;
 | 
			
		||||
                            case "<":
 | 
			
		||||
                                child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid);
 | 
			
		||||
                                if (child != null) page.Order = child.Order - 1;
 | 
			
		||||
                                break;
 | 
			
		||||
                            case ">":
 | 
			
		||||
                                child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid);
 | 
			
		||||
                                if (child != null) page.Order = child.Order + 1;
 | 
			
		||||
                                break;
 | 
			
		||||
                            case ">>":
 | 
			
		||||
                                page.Order = int.MaxValue;
 | 
			
		||||
                                break;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
 | 
			
		||||
                    page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
 | 
			
		||||
                    page.Url = _url;
 | 
			
		||||
                    page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
 | 
			
		||||
                    if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.ThemeType = string.Empty;
 | 
			
		||||
                    }
 | 
			
		||||
                    page.DefaultContainerType = (_containertype != "-") ? _containertype : string.Empty;
 | 
			
		||||
                    if (!string.IsNullOrEmpty(page.DefaultContainerType) && page.DefaultContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.DefaultContainerType = string.Empty;
 | 
			
		||||
                    }
 | 
			
		||||
                    page.Icon = _icon ?? string.Empty;
 | 
			
		||||
                    page.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                    page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
 | 
			
		||||
                    page.UserId = null;
 | 
			
		||||
 | 
			
		||||
                    page = await PageService.UpdatePageAsync(page);
 | 
			
		||||
                    await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
 | 
			
		||||
                    if (_currentparentid == string.Empty)
 | 
			
		||||
                    {
 | 
			
		||||
                        await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, null);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, int.Parse(_currentparentid));
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    // update child paths
 | 
			
		||||
                    if (_parentid != _currentparentid)
 | 
			
		||||
                    {
 | 
			
		||||
                        foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath)))
 | 
			
		||||
                        {
 | 
			
		||||
                            p.Path = p.Path.Replace(currentPath, page.Path);
 | 
			
		||||
                            await PageService.UpdatePageAsync(p);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (_themeSettingsType != null && _themeSettings is ISettingsControl themeSettingsControl)
 | 
			
		||||
                    {
 | 
			
		||||
                        await themeSettingsControl.UpdateSettings();
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    await logger.LogInformation("Page Saved {Page}", page);
 | 
			
		||||
                    if (PageState.QueryString.ContainsKey("cp"))
 | 
			
		||||
                    {
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl(page.Path));
 | 
			
		||||
                    }
 | 
			
		||||
                    _path = _path.Substring(_path.LastIndexOf("/") + 1);
 | 
			
		||||
                }
 | 
			
		||||
                if (string.IsNullOrEmpty(_parentid) || _parentid == "-1")
 | 
			
		||||
                {
 | 
			
		||||
                    page.ParentId = null;
 | 
			
		||||
                    page.Path = Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
 | 
			
		||||
                    page.ParentId = Int32.Parse(_parentid);
 | 
			
		||||
                    Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId);
 | 
			
		||||
                    if (parent.Path == string.Empty)
 | 
			
		||||
                    {
 | 
			
		||||
                        page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!PagePathIsUnique(page.Path, page.SiteId, page.PageId, _pageList))
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(string.Format(Localizer["Mesage.Page.PathExists"], _path), MessageType.Warning);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (_insert != "=")
 | 
			
		||||
                {
 | 
			
		||||
                    Page child;
 | 
			
		||||
                    switch (_insert)
 | 
			
		||||
                    {
 | 
			
		||||
                        case "<<":
 | 
			
		||||
                            page.Order = 0;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case "<":
 | 
			
		||||
                            child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid);
 | 
			
		||||
                            if (child != null) page.Order = child.Order - 1;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case ">":
 | 
			
		||||
                            child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid);
 | 
			
		||||
                            if (child != null) page.Order = child.Order + 1;
 | 
			
		||||
                            break;
 | 
			
		||||
                        case ">>":
 | 
			
		||||
                            page.Order = int.MaxValue;
 | 
			
		||||
                            break;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
 | 
			
		||||
                page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
 | 
			
		||||
                page.Url = _url;
 | 
			
		||||
                page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
 | 
			
		||||
                {
 | 
			
		||||
                    page.ThemeType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                page.DefaultContainerType = (_containertype != "-") ? _containertype : string.Empty;
 | 
			
		||||
                if (!string.IsNullOrEmpty(page.DefaultContainerType) && page.DefaultContainerType == PageState.Site.DefaultContainerType)
 | 
			
		||||
                {
 | 
			
		||||
                    page.DefaultContainerType = string.Empty;
 | 
			
		||||
                }
 | 
			
		||||
                page.Icon = _icon ?? string.Empty;
 | 
			
		||||
                page.Permissions = _permissionGrid.GetPermissions();
 | 
			
		||||
                page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable));
 | 
			
		||||
                page.UserId = null;
 | 
			
		||||
 | 
			
		||||
                page = await PageService.UpdatePageAsync(page);
 | 
			
		||||
                await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
 | 
			
		||||
                if (_currentparentid == string.Empty)
 | 
			
		||||
                {
 | 
			
		||||
                    await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, null);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, int.Parse(_currentparentid));
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                // update child paths
 | 
			
		||||
                if (_parentid != _currentparentid)
 | 
			
		||||
                {
 | 
			
		||||
                    foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath)))
 | 
			
		||||
                    {
 | 
			
		||||
                        p.Path = p.Path.Replace(currentPath, page.Path);
 | 
			
		||||
                        await PageService.UpdatePageAsync(p);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (_themeSettingsType != null && _themeSettings is ISettingsControl themeSettingsControl)
 | 
			
		||||
                {
 | 
			
		||||
                    await themeSettingsControl.UpdateSettings();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("Page Saved {Page}", page);
 | 
			
		||||
                if (PageState.QueryString.ContainsKey("cp"))
 | 
			
		||||
                {
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl(page.Path));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,90 +5,86 @@
 | 
			
		||||
@inject IStringLocalizer<Edit> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="name" HelpText="The name of this profile item" ResourceKey="Name">Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="name" class="form-control" @bind="@_name" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="title" HelpText="The title of the profile item to display to the user" ResourceKey="Title">Title: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="title" class="form-control" @bind="@_title" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="description" HelpText="The help text displayed to the user for this profile item" ResourceKey="Description">Description: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <textarea id="description" class="form-control" @bind="@_description" rows="5" required></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="category" HelpText="The category of this profile item (for grouping)" ResourceKey="Category">Category: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="category" class="form-control" @bind="@_category" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="order" HelpText="The index order of where this profile item should be displayed" ResourceKey="Order">Order: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="order" class="form-control" @bind="@_vieworder" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)" ResourceKey="Length">Length: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="length" class="form-control" @bind="@_maxlength" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="defaultVal" HelpText="The default value for this profile item" ResourceKey="DefaultValue">Default Value: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="defaultVal" class="form-control" @bind="@_defaultvalue" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="options" HelpText="A comma delimited list of options the user can select from" ResourceKey="Options">Options: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="options" class="form-control" @bind="@_options" required />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="required" HelpText="Should a user be required to provide a value for this profile item?" ResourceKey="Required">Required? </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="required" class="form-select" @bind="@_isrequired" required>
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="private" HelpText="Should this profile item be visible to all users?" ResourceKey="Private">Private? </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="private" class="form-select" @bind="@_isprivate" required>
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="name" HelpText="The name of this profile item" ResourceKey="Name">Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="title" HelpText="The title of the profile item to display to the user" ResourceKey="Title">Title: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="title" class="form-control" @bind="@_title" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="description" HelpText="The help text displayed to the user for this profile item" ResourceKey="Description">Description: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="category" HelpText="The category of this profile item (for grouping)" ResourceKey="Category">Category: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="category" class="form-control" @bind="@_category" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="order" HelpText="The index order of where this profile item should be displayed" ResourceKey="Order">Order: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="order" class="form-control" @bind="@_vieworder" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)" ResourceKey="Length">Length: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="length" class="form-control" @bind="@_maxlength" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="defaultVal" HelpText="The default value for this profile item" ResourceKey="DefaultValue">Default Value: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="defaultVal" class="form-control" @bind="@_defaultvalue" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="options" HelpText="A comma delimited list of options the user can select from" ResourceKey="Options">Options: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="options" class="form-control" @bind="@_options" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="required" HelpText="Should a user be required to provide a value for this profile item?" ResourceKey="Required">Required? </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="required" class="form-select" @bind="@_isrequired">
 | 
			
		||||
                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="private" HelpText="Should this profile item be visible to all users?" ResourceKey="Private">Private? </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="private" class="form-select" @bind="@_isprivate">
 | 
			
		||||
                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<br />
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveProfile">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
@if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
{
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveProfile">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    @if (PageState.QueryString.ContainsKey("id"))
 | 
			
		||||
    {
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        <AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
    }
 | 
			
		||||
</form>
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private int _profileid = -1;
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _name = string.Empty;
 | 
			
		||||
    private string _title = string.Empty;
 | 
			
		||||
    private string _description = string.Empty;
 | 
			
		||||
@ -144,54 +140,45 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveProfile()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            Profile profile;
 | 
			
		||||
            if (_profileid != -1)
 | 
			
		||||
            {
 | 
			
		||||
                Profile profile;
 | 
			
		||||
                if (_profileid != -1)
 | 
			
		||||
                {
 | 
			
		||||
                    profile = await ProfileService.GetProfileAsync(_profileid);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    profile = new Profile();
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                profile.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                profile.Name = _name;
 | 
			
		||||
                profile.Title = _title;
 | 
			
		||||
                profile.Description = _description;
 | 
			
		||||
                profile.Category = _category;
 | 
			
		||||
                profile.ViewOrder = int.Parse(_vieworder);
 | 
			
		||||
                profile.MaxLength = int.Parse(_maxlength);
 | 
			
		||||
                profile.DefaultValue = _defaultvalue;
 | 
			
		||||
                profile.Options = _options;
 | 
			
		||||
                profile.IsRequired = (_isrequired == null ? false : Boolean.Parse(_isrequired));
 | 
			
		||||
                profile.IsPrivate = (_isprivate == null ? false : Boolean.Parse(_isprivate));
 | 
			
		||||
                if (_profileid != -1)
 | 
			
		||||
                {
 | 
			
		||||
                    profile = await ProfileService.UpdateProfileAsync(profile);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    profile = await ProfileService.AddProfileAsync(profile);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("Profile Saved {Profile}", profile);
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                profile = await ProfileService.GetProfileAsync(_profileid);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", _profileid, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
 | 
			
		||||
                profile = new Profile();
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            profile.SiteId = PageState.Site.SiteId;
 | 
			
		||||
            profile.Name = _name;
 | 
			
		||||
            profile.Title = _title;
 | 
			
		||||
            profile.Description = _description;
 | 
			
		||||
            profile.Category = _category;
 | 
			
		||||
            profile.ViewOrder = int.Parse(_vieworder);
 | 
			
		||||
            profile.MaxLength = int.Parse(_maxlength);
 | 
			
		||||
            profile.DefaultValue = _defaultvalue;
 | 
			
		||||
            profile.Options = _options;
 | 
			
		||||
            profile.IsRequired = (_isrequired == null ? false : Boolean.Parse(_isrequired));
 | 
			
		||||
            profile.IsPrivate = (_isprivate == null ? false : Boolean.Parse(_isprivate));
 | 
			
		||||
            if (_profileid != -1)
 | 
			
		||||
            {
 | 
			
		||||
                profile = await ProfileService.UpdateProfileAsync(profile);
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                profile = await ProfileService.AddProfileAsync(profile);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            await logger.LogInformation("Profile Saved {Profile}", profile);
 | 
			
		||||
            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", _profileid, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,54 +7,52 @@
 | 
			
		||||
 | 
			
		||||
@if (PageState.Site.AllowRegistration)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <AuthorizeView Roles="@RoleNames.Registered">
 | 
			
		||||
            <Authorizing>
 | 
			
		||||
                <text>...</text>
 | 
			
		||||
            </Authorizing>
 | 
			
		||||
            <Authorized>
 | 
			
		||||
                <ModuleMessage Message="@Localizer["Info.Registration.Exists"]" Type="MessageType.Info" />
 | 
			
		||||
            </Authorized>
 | 
			
		||||
            <NotAuthorized>
 | 
			
		||||
                <ModuleMessage Message="@Localizer["Info.Registration.InvalidEmail"]" Type="MessageType.Info" />
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="username" HelpText="Your username. Note that this field can not be modified once it is saved." ResourceKey="Username"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="username" class="form-control" @bind="@_username" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="password" HelpText="If you wish to change your password you can enter it here. Please choose a sufficiently secure password." ResourceKey="Password"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="password" type="password" class="form-control" @bind="@_password" autocomplete="new-password" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="confirm" HelpText="If you are changing your password you must enter it again to confirm it matches" ResourceKey="Confirm"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="confirm" type="password" class="form-control" @bind="@_confirm" autocomplete="new-password" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="email" HelpText="Your email address where you wish to receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="email" class="form-control" @bind="@_email" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="displayname" HelpText="Your full name" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="displayname" class="form-control" @bind="@_displayname" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
    <AuthorizeView Roles="@RoleNames.Registered">
 | 
			
		||||
        <Authorizing>
 | 
			
		||||
            <text>...</text>
 | 
			
		||||
        </Authorizing>
 | 
			
		||||
        <Authorized>
 | 
			
		||||
            <ModuleMessage Message="@Localizer["Info.Registration.Exists"]" Type="MessageType.Info" />
 | 
			
		||||
        </Authorized>
 | 
			
		||||
        <NotAuthorized>
 | 
			
		||||
            <ModuleMessage Message="@Localizer["Info.Registration.InvalidEmail"]" Type="MessageType.Info" />
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="username" HelpText="Your username. Note that this field can not be modified once it is saved." ResourceKey="Username"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="username" class="form-control" @bind="@_username"  />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <br />
 | 
			
		||||
                <button type="button" class="btn btn-primary" @onclick="Register">@Localizer["Register"]</button>
 | 
			
		||||
                <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
            </NotAuthorized>
 | 
			
		||||
        </AuthorizeView>
 | 
			
		||||
    </form>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="password" HelpText="If you wish to change your password you can enter it here. Please choose a sufficiently secure password." ResourceKey="Password"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="password" type="password" class="form-control" @bind="@_password" autocomplete="new-password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="confirm" HelpText="If you are changing your password you must enter it again to confirm it matches" ResourceKey="Confirm"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="confirm" type="password" class="form-control" @bind="@_confirm" autocomplete="new-password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="email" HelpText="Your email address where you wish to receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="email" class="form-control" @bind="@_email" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="displayname" HelpText="Your full name" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="displayname" class="form-control" @bind="@_displayname" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <br />
 | 
			
		||||
            <button type="button" class="btn btn-primary" @onclick="Register">@Localizer["Register"]</button>
 | 
			
		||||
            <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
        </NotAuthorized>
 | 
			
		||||
    </AuthorizeView>
 | 
			
		||||
}
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
@ -63,8 +61,6 @@ else
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private string _username = string.Empty;
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _password = string.Empty;
 | 
			
		||||
    private string _confirm = string.Empty;
 | 
			
		||||
    private string _email = string.Empty;
 | 
			
		||||
@ -74,58 +70,49 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task Register()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            bool _isEmailValid = Utilities.IsValidEmail(_email);
 | 
			
		||||
 | 
			
		||||
            if (_username != "" && _password != "" && _confirm != "" && _isEmailValid)
 | 
			
		||||
            {
 | 
			
		||||
                bool _isEmailValid = Utilities.IsValidEmail(_email);
 | 
			
		||||
 | 
			
		||||
                if (_username != "" && _password != "" && _confirm != "" && _isEmailValid)
 | 
			
		||||
                if (_password == _confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    if (_password == _confirm)
 | 
			
		||||
                    var user = new User
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = new User
 | 
			
		||||
                        {
 | 
			
		||||
                            SiteId = PageState.Site.SiteId,
 | 
			
		||||
                            Username = _username,
 | 
			
		||||
                            DisplayName = (_displayname == string.Empty ? _username : _displayname),
 | 
			
		||||
                            Email = _email,
 | 
			
		||||
                            Password = _password
 | 
			
		||||
                        };
 | 
			
		||||
                        user = await UserService.AddUserAsync(user);
 | 
			
		||||
                        SiteId = PageState.Site.SiteId,
 | 
			
		||||
                        Username = _username,
 | 
			
		||||
                        DisplayName = (_displayname == string.Empty ? _username : _displayname),
 | 
			
		||||
                        Email = _email,
 | 
			
		||||
                        Password = _password
 | 
			
		||||
                    };
 | 
			
		||||
                    user = await UserService.AddUserAsync(user);
 | 
			
		||||
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            await logger.LogInformation("User Created {Username} {Email}", _username, _email);
 | 
			
		||||
                            AddModuleMessage(Localizer["Info.User.AccountCreate"], MessageType.Info);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            await logger.LogError("Error Adding User {Username} {Email}", _username, _email);
 | 
			
		||||
                            AddModuleMessage(Localizer["Error.User.AddInfo"], MessageType.Error);
 | 
			
		||||
                        }
 | 
			
		||||
                    if (user != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await logger.LogInformation("User Created {Username} {Email}", _username, _email);
 | 
			
		||||
                        AddModuleMessage(Localizer["Info.User.AccountCreate"], MessageType.Info);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                        await logger.LogError("Error Adding User {Username} {Email}", _username, _email);
 | 
			
		||||
                        AddModuleMessage(Localizer["Error.User.AddInfo"], MessageType.Error);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -133,4 +120,4 @@ else
 | 
			
		||||
    {
 | 
			
		||||
        NavigationManager.NavigateTo(NavigateUrl(string.Empty));
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -5,28 +5,24 @@
 | 
			
		||||
@inject IStringLocalizer<Index> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="form-group">
 | 
			
		||||
            <label for="Username" class="control-label">@SharedLocalizer["Username"] </label>
 | 
			
		||||
            <input type="text" class="form-control" placeholder="Username" @bind="@_username" readonly id="Username" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="form-group">
 | 
			
		||||
            <label for="Password" class="control-label">@SharedLocalizer["Password"] </label>
 | 
			
		||||
            <input type="password" class="form-control" placeholder="Password" @bind="@_password" id="Password" maxlength="256" required />
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="form-group">
 | 
			
		||||
            <label for="Confirm" class="control-label">@Localizer["Password.Confirm"] </label>
 | 
			
		||||
            <input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm" maxlength="256" required />
 | 
			
		||||
        </div>
 | 
			
		||||
        <button type="button" class="btn btn-primary" @onclick="Reset">@Localizer["Password.Reset"]</button>
 | 
			
		||||
        <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Username" class="control-label">@SharedLocalizer["Username"] </label>
 | 
			
		||||
        <input type="text" class="form-control" placeholder="Username" @bind="@_username" readonly id="Username" />
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Password" class="control-label">@SharedLocalizer["Password"] </label>
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@_password" id="Password" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="form-group">
 | 
			
		||||
        <label for="Confirm" class="control-label">@Localizer["Password.Confirm"] </label>
 | 
			
		||||
        <input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm" />
 | 
			
		||||
    </div>
 | 
			
		||||
    <button type="button" class="btn btn-primary" @onclick="Reset">@Localizer["Password.Reset"]</button>
 | 
			
		||||
    <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _username = string.Empty;
 | 
			
		||||
    private string _password = string.Empty;
 | 
			
		||||
    private string _confirm = string.Empty;
 | 
			
		||||
@ -47,54 +43,45 @@
 | 
			
		||||
 | 
			
		||||
    private async Task Reset()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (_username != string.Empty && _password != string.Empty && _confirm != string.Empty)
 | 
			
		||||
            {
 | 
			
		||||
                if (_username != string.Empty && _password != string.Empty && _confirm != string.Empty)
 | 
			
		||||
                if (_password == _confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    if (_password == _confirm)
 | 
			
		||||
                    var user = new User
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = new User
 | 
			
		||||
                        {
 | 
			
		||||
                            SiteId = PageState.Site.SiteId,
 | 
			
		||||
                            Username = _username,
 | 
			
		||||
                            Password = _password
 | 
			
		||||
                        };
 | 
			
		||||
                        user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
 | 
			
		||||
                        SiteId = PageState.Site.SiteId,
 | 
			
		||||
                        Username = _username,
 | 
			
		||||
                        Password = _password
 | 
			
		||||
                    };
 | 
			
		||||
                    user = await UserService.ResetPasswordAsync(user, PageState.QueryString["token"]);
 | 
			
		||||
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            await logger.LogInformation("User Password Reset {Username}", _username);
 | 
			
		||||
                            NavigationManager.NavigateTo(NavigateUrl("login"));
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            await logger.LogError("Error Resetting User Password {Username}", _username);
 | 
			
		||||
                            AddModuleMessage(Localizer["Error.Password.ResetInfo"], MessageType.Error);
 | 
			
		||||
                        }
 | 
			
		||||
                    if (user != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        await logger.LogInformation("User Password Reset {Username}", _username);
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl("login"));
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                        await logger.LogError("Error Resetting User Password {Username}", _username);
 | 
			
		||||
                        AddModuleMessage(Localizer["Error.Password.ResetInfo"], MessageType.Error);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Password.Reset"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Password.Reset"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="isautoassigned" class="form-select" @bind="@_isautoassigned" required>
 | 
			
		||||
                <select id="isautoassigned" class="form-select" @bind="@_isautoassigned">
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
@ -72,7 +72,7 @@
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            AddModuleMessage(Localizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -22,7 +22,7 @@
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="isautoassigned" class="form-select" @bind="@_isautoassigned" required>
 | 
			
		||||
                <select id="isautoassigned" class="form-select" @bind="@_isautoassigned">
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
@ -101,7 +101,7 @@
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            AddModuleMessage(Localizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -12,70 +12,65 @@
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="role" HelpText="The role you are assigning users to" ResourceKey="Role">Role: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="role" class="form-control" @bind="@name" disabled />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="user" HelpText="Select a user" ResourceKey="User">User: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="user" class="form-select" @bind="@userid" required>
 | 
			
		||||
                        <option value="-1"><@Localizer["User.Select"]></option>
 | 
			
		||||
                        @foreach (UserRole userrole in users)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(userrole.UserId)">@userrole.User.DisplayName</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input type="date" id="effectiveDate" class="form-control" @bind="@effectivedate" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input type="date" id="expiryDate" class="form-control" @bind="@expirydate" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <br /><br />
 | 
			
		||||
            <button type="button" class="btn btn-success" @onclick="SaveUserRole">@SharedLocalizer["Save"]</button>
 | 
			
		||||
            <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
            <hr class="app-rule" />
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <p align="center">
 | 
			
		||||
                    <Pager Items="@userroles">
 | 
			
		||||
                        <Header>
 | 
			
		||||
                            <th>@Localizer["Users"]</th>
 | 
			
		||||
                            <th>@Localizer["Effective"]</th>
 | 
			
		||||
                            <th>@Localizer["Expiry"]</th>
 | 
			
		||||
                            <th> </th>
 | 
			
		||||
                        </Header>
 | 
			
		||||
                        <Row>
 | 
			
		||||
                            <td>@context.User.DisplayName</td>
 | 
			
		||||
                            <td>@context.EffectiveDate</td>
 | 
			
		||||
                            <td>@context.ExpiryDate</td>
 | 
			
		||||
                            <td>
 | 
			
		||||
                                <ActionDialog Header="Remove User" Message="@string.Format(Localizer["Confirm.User.DeleteRole"], context.User.DisplayName)" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || PageState.User.Username == UserNames.Host)" ResourceKey="DeleteUserRole" />
 | 
			
		||||
                            </td>
 | 
			
		||||
                        </Row>
 | 
			
		||||
                    </Pager>
 | 
			
		||||
                </p>
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="role" HelpText="The role you are assigning users to" ResourceKey="Role">Role: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="role" class="form-control" @bind="@name" disabled />
 | 
			
		||||
        </div>
 | 
			
		||||
    </form>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="user" HelpText="Select a user" ResourceKey="User">User: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="user" class="form-select" @bind="@userid">
 | 
			
		||||
                <option value="-1"><@Localizer["User.Select"]></option>
 | 
			
		||||
                @foreach (UserRole userrole in users)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@(userrole.UserId)">@userrole.User.DisplayName</option>
 | 
			
		||||
                }
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input type="date" id="effectiveDate" class="form-control" @bind="@effectivedate" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input type="date" id="expiryDate" class="form-control" @bind="@expirydate" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <br /><br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveUserRole">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <hr class="app-rule" />
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <p align="center">
 | 
			
		||||
            <Pager Items="@userroles">
 | 
			
		||||
                <Header>
 | 
			
		||||
                <th>@Localizer["Users"]</th>
 | 
			
		||||
                <th>@Localizer["Effective"]</th>
 | 
			
		||||
                <th>@Localizer["Expiry"]</th>
 | 
			
		||||
                <th> </th>
 | 
			
		||||
                </Header>
 | 
			
		||||
                <Row>
 | 
			
		||||
                    <td>@context.User.DisplayName</td>
 | 
			
		||||
                    <td>@context.EffectiveDate</td>
 | 
			
		||||
                    <td>@context.ExpiryDate</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ActionDialog Header="Remove User" Message="@string.Format(Localizer["Confirm.User.DeleteRole"], context.User.DisplayName)" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || PageState.User.Username == UserNames.Host)" ResourceKey="DeleteUserRole" />
 | 
			
		||||
                    </td>
 | 
			
		||||
                </Row>
 | 
			
		||||
            </Pager>
 | 
			
		||||
        </p>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
 | 
			
		||||
    private int roleid;
 | 
			
		||||
    private string name = string.Empty;
 | 
			
		||||
    private List<UserRole> users;
 | 
			
		||||
@ -123,78 +118,59 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task SaveUserRole()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (userid != -1)
 | 
			
		||||
            {
 | 
			
		||||
                if (userid != -1)
 | 
			
		||||
                var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
 | 
			
		||||
                if (userrole != null)
 | 
			
		||||
                {
 | 
			
		||||
                    var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
 | 
			
		||||
                    if (userrole != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.EffectiveDate = effectivedate;
 | 
			
		||||
                        userrole.ExpiryDate = expirydate;
 | 
			
		||||
                        await UserRoleService.UpdateUserRoleAsync(userrole);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole = new UserRole();
 | 
			
		||||
                        userrole.UserId = userid;
 | 
			
		||||
                        userrole.RoleId = roleid;
 | 
			
		||||
                        userrole.EffectiveDate = effectivedate;
 | 
			
		||||
                        userrole.ExpiryDate = expirydate;
 | 
			
		||||
 | 
			
		||||
                        await UserRoleService.AddUserRoleAsync(userrole);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
 | 
			
		||||
                    AddModuleMessage(Localizer["Success.User.AssignedRole"], MessageType.Success);
 | 
			
		||||
                    await GetUserRoles();
 | 
			
		||||
                    StateHasChanged();
 | 
			
		||||
                    userrole.EffectiveDate = effectivedate;
 | 
			
		||||
                    userrole.ExpiryDate = expirydate;
 | 
			
		||||
                    await UserRoleService.UpdateUserRoleAsync(userrole);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.UserSelect"], MessageType.Warning);
 | 
			
		||||
                    userrole = new UserRole();
 | 
			
		||||
                    userrole.UserId = userid;
 | 
			
		||||
                    userrole.RoleId = roleid;
 | 
			
		||||
                    userrole.EffectiveDate = effectivedate;
 | 
			
		||||
                    userrole.ExpiryDate = expirydate;
 | 
			
		||||
 | 
			
		||||
                    await UserRoleService.AddUserRoleAsync(userrole);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
 | 
			
		||||
                AddModuleMessage(Localizer["Success.User.AssignedRole"], MessageType.Success);
 | 
			
		||||
                await GetUserRoles();
 | 
			
		||||
                StateHasChanged();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving User Roles {RoleId} {Error}", roleid, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.UserSelect"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving User Roles {RoleId} {Error}", roleid, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private async Task DeleteUserRole(int UserRoleId)
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                await UserRoleService.DeleteUserRoleAsync(UserRoleId);
 | 
			
		||||
                await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
 | 
			
		||||
                AddModuleMessage(Localizer["Confirm.User.RoleRemoved"], MessageType.Success);
 | 
			
		||||
                await GetUserRoles();
 | 
			
		||||
                StateHasChanged();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.RemoveRole"], MessageType.Error);
 | 
			
		||||
            }
 | 
			
		||||
            await UserRoleService.DeleteUserRoleAsync(UserRoleId);
 | 
			
		||||
            await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
 | 
			
		||||
            AddModuleMessage(Localizer["Confirm.User.RoleRemoved"], MessageType.Success);
 | 
			
		||||
            await GetUserRoles();
 | 
			
		||||
            StateHasChanged();
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.RemoveRole"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -13,217 +13,213 @@
 | 
			
		||||
 | 
			
		||||
@if (_initialized)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="name" HelpText="Enter the site name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="alias" HelpText="The aliases for the site. An alias can be a domain name (www.site.com) or a virtual folder (ie. www.site.com/folder). If a site has multiple aliases they should be separated by commas." ResourceKey="Aliases">Aliases: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                {
 | 
			
		||||
                    <textarea id="alias" class="form-control" @bind="@_urls" rows="3"></textarea>
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    <textarea id="alias" class="form-control" @bind="@_urls" rows="3" readonly></textarea>
 | 
			
		||||
                }
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="allowRegister" HelpText="Do you want the users to be able to register for an account on the site" ResourceKey="AllowRegistration">Allow User Registration? </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="allowRegister" class="form-select" @bind="@_allowregistration">
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="isDeleted" HelpText="Is this site deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="isDeleted" class="form-select" @bind="@_isdeleted">
 | 
			
		||||
                    <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                    <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <Section Name="Appearance" Heading="Appearance" ResourceKey="Appearance">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="Enter the site name" ResourceKey="Name">Name: </Label>
 | 
			
		||||
                <Label Class="col-sm-3" For="logo" HelpText="Specify a logo for the site" ResourceKey="Logo">Logo: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
                    <FileManager FileId="@_logofileid" Filter="@Constants.ImageFiles" @ref="_logofilemanager" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="alias" HelpText="The aliases for the site. An alias can be a domain name (www.site.com) or a virtual folder (ie. www.site.com/folder). If a site has multiple aliases they should be separated by commas." ResourceKey="Aliases">Aliases: </Label>
 | 
			
		||||
                <Label Class="col-sm-3" For="favicon" HelpText="Specify a Favicon" ResourceKey="FavoriteIcon">Favicon: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                    {
 | 
			
		||||
                        <textarea id="alias" class="form-control" @bind="@_urls" rows="3" required></textarea>
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        <textarea id="alias" class="form-control" @bind="@_urls" rows="3" readonly></textarea>
 | 
			
		||||
                    }
 | 
			
		||||
                    <FileManager FileId="@_faviconfileid" Filter="ico" @ref="_faviconfilemanager" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="allowRegister" HelpText="Do you want the users to be able to register for an account on the site" ResourceKey="AllowRegistration">Allow User Registration? </Label>
 | 
			
		||||
                <Label Class="col-sm-3" For="defaultTheme" HelpText="Select the sites default theme" ResourceKey="DefaultTheme">Default Theme: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="allowRegister" class="form-select" @bind="@_allowregistration" required>
 | 
			
		||||
                    <select id="defaultTheme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                        <option value="-"><@Localizer["Theme.Select"]></option>
 | 
			
		||||
                        @foreach (var theme in _themes)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="defaultContainer" class="form-select" @bind="@_containertype">
 | 
			
		||||
                        <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                        @foreach (var container in _containers)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="defaultAdminContainer" class="form-select" @bind="@_admincontainertype">
 | 
			
		||||
                        <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                        <option value="@Constants.DefaultAdminContainer"><@Localizer["DefaultAdminContainer"]></option>
 | 
			
		||||
                        @foreach (var container in _containers)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
        </div>
 | 
			
		||||
    </Section>
 | 
			
		||||
    <Section Name="SMTP" Heading="SMTP Settings" ResourceKey="SMTPSettings">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <div class="col-sm-3">
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <strong>@Localizer["Smtp.Required.EnableNotificationJob"]</strong><br />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="host" HelpText="Enter the host name of the SMTP server" ResourceKey="Host">Host: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="host" class="form-control" @bind="@_smtphost" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="port" HelpText="Enter the port number for the SMTP server. Please note this field is required if you provide a host name." ResourceKey="Port">Port: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="port" class="form-control" @bind="@_smtpport" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="enabledSSl" HelpText="Specify if SSL is required for your SMTP server" ResourceKey="UseSsl">SSL Enabled: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="enabledSSl" class="form-select" @bind="@_smtpssl">
 | 
			
		||||
                        <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                        <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="isDeleted" HelpText="Is this site deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
 | 
			
		||||
                <Label Class="col-sm-3" For="username" HelpText="Enter the username for your SMTP account" ResourceKey="SmptUsername">Username: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="isDeleted" class="form-select" @bind="@_isdeleted" required>
 | 
			
		||||
                    <input id="username" class="form-control" @bind="@_smtpusername" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="password" HelpText="Enter the password for your SMTP account" ResourceKey="SmtpPassword">Password: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="password" type="password" class="form-control" @bind="@_smtppassword" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="sender" HelpText="Enter the email which emails will be sent from. Please note that this email address may need to be authorized with the SMTP server." ResourceKey="SmptSender">Email Sender: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="sender" class="form-control" @bind="@_smtpsender" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <button type="button" class="btn btn-secondary" @onclick="SendEmail">@Localizer["Smtp.TestConfig"]</button>
 | 
			
		||||
            <br /><br />
 | 
			
		||||
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    </Section>
 | 
			
		||||
    <Section Name="PWA" Heading="Progressive Web Application Settings" ResourceKey="PWASettings">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)" ResourceKey="EnablePWA">Is Enabled? </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="isEnabled" class="form-select" @bind="@_pwaisenabled">
 | 
			
		||||
                        <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                        <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="appIcon" HelpText="Include an application icon for your PWA. It should be a PNG which is 192 X 192 pixels in dimension." ResourceKey="PwaApplicationIcon">App Icon: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <FileManager FileId="@_pwaappiconfileid" Filter="png" @ref="_pwaappiconfilemanager" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="splashIcon" HelpText="Include a splash icon for your PWA. It should be a PNG which is 512 X 512 pixels in dimension." ResourceKey="PwaSplashIcon">Splash Icon: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <FileManager FileId="@_pwasplashiconfileid" Filter="png" @ref="_pwasplashiconfilemanager" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <Section Name="Appearance" Heading="Appearance" ResourceKey="Appearance">
 | 
			
		||||
    </Section>
 | 
			
		||||
    @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
    {
 | 
			
		||||
        <Section Name="TenantInformation" Heading="Tenant Information" ResourceKey="TenantInformation">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="logo" HelpText="Specify a logo for the site" ResourceKey="Logo">Logo: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="tenant" HelpText="The tenant for the site" ResourceKey="Tenant">Tenant: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@_logofileid" Filter="@Constants.ImageFiles" @ref="_logofilemanager" />
 | 
			
		||||
                        <input id="tenant" class="form-control" @bind="@_tenant" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="favicon" HelpText="Specify a Favicon" ResourceKey="FavoriteIcon">Favicon: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="database" HelpText="The database for the tenant" ResourceKey="Database">Database: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@_faviconfileid" Filter="ico" @ref="_faviconfilemanager" />
 | 
			
		||||
                        <input id="database" class="form-control" @bind="@_database" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="defaultTheme" HelpText="Select the sites default theme" ResourceKey="DefaultTheme">Default Theme: </Label>
 | 
			
		||||
                    <Label Class="col-sm-3" For="connectionstring" HelpText="The connection information for the database" ResourceKey="ConnectionString">Connection: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="defaultTheme" class="form-select" value="@_themetype" @onchange="(e => ThemeChanged(e))" required>
 | 
			
		||||
                            <option value="-"><@Localizer["Theme.Select"]></option>
 | 
			
		||||
                            @foreach (var theme in _themes)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="defaultContainer" class="form-select" @bind="@_containertype" required>
 | 
			
		||||
                            <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                            @foreach (var container in _containers)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="defaultAdminContainer" class="form-select" @bind="@_admincontainertype" required>
 | 
			
		||||
                            <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                            <option value="@Constants.DefaultAdminContainer"><@Localizer["DefaultAdminContainer"]></option>
 | 
			
		||||
                            @foreach (var container in _containers)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
 | 
			
		||||
            </div>
 | 
			
		||||
        </Section>
 | 
			
		||||
        <Section Name="SMTP" Heading="SMTP Settings" ResourceKey="SMTPSettings">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <div class="col-sm-3">
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <strong>@Localizer["Smtp.Required.EnableNotificationJob"]</strong><br />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="host" HelpText="Enter the host name of the SMTP server" ResourceKey="Host">Host: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="host" class="form-control" @bind="@_smtphost" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="port" HelpText="Enter the port number for the SMTP server. Please note this field is required if you provide a host name." ResourceKey="Port">Port: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="port" class="form-control" @bind="@_smtpport" required />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="enabledSSl" HelpText="Specify if SSL is required for your SMTP server" ResourceKey="UseSsl">SSL Enabled: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="enabledSSl" class="form-select" @bind="@_smtpssl" required>
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="username" HelpText="Enter the username for your SMTP account" ResourceKey="SmptUsername">Username: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="username" class="form-control" @bind="@_smtpusername" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="password" HelpText="Enter the password for your SMTP account" ResourceKey="SmtpPassword">Password: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="password" type="password" class="form-control" @bind="@_smtppassword" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="sender" HelpText="Enter the email which emails will be sent from. Please note that this email address may need to be authorized with the SMTP server." ResourceKey="SmptSender">Email Sender: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="sender" class="form-control" @bind="@_smtpsender" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <button type="button" class="btn btn-secondary" @onclick="SendEmail">@Localizer["Smtp.TestConfig"]</button>
 | 
			
		||||
                <br /><br />
 | 
			
		||||
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        </Section>
 | 
			
		||||
        <Section Name="PWA" Heading="Progressive Web Application Settings" ResourceKey="PWASettings">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)" ResourceKey="EnablePWA">Is Enabled? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="isEnabled" class="form-select" @bind="@_pwaisenabled" required>
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="appIcon" HelpText="Include an application icon for your PWA. It should be a PNG which is 192 X 192 pixels in dimension." ResourceKey="PwaApplicationIcon">App Icon: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@_pwaappiconfileid" Filter="png" @ref="_pwaappiconfilemanager" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="splashIcon" HelpText="Include a splash icon for your PWA. It should be a PNG which is 512 X 512 pixels in dimension." ResourceKey="PwaSplashIcon">Splash Icon: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@_pwasplashiconfileid" Filter="png" @ref="_pwasplashiconfilemanager" />
 | 
			
		||||
                        <textarea id="connectionstring" class="form-control" @bind="@_connectionstring" rows="2" readonly></textarea>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </Section>
 | 
			
		||||
        @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
        {
 | 
			
		||||
            <Section Name="TenantInformation" Heading="Tenant Information" ResourceKey="TenantInformation">
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="tenant" HelpText="The tenant for the site" ResourceKey="Tenant">Tenant: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="tenant" class="form-control" @bind="@_tenant" readonly />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="database" HelpText="The database for the tenant" ResourceKey="Database">Database: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="database" class="form-control" @bind="@_database" readonly />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="connectionstring" HelpText="The connection information for the database" ResourceKey="ConnectionString">Connection: </Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <textarea id="connectionstring" class="form-control" @bind="@_connectionstring" rows="2" readonly></textarea>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </Section>
 | 
			
		||||
        }
 | 
			
		||||
        <br />
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
 | 
			
		||||
        <ActionDialog Header="Delete Site" Message="@Localizer["Confirm.DeleteSite"]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite())" ResourceKey="DeleteSite" />
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
 | 
			
		||||
    </form>
 | 
			
		||||
    }
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <ActionDialog Header="Delete Site" Message="@Localizer["Confirm.DeleteSite"]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite())" ResourceKey="DeleteSite" />
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private bool _initialized = false;
 | 
			
		||||
    private List<Theme> _themeList;
 | 
			
		||||
    private List<ThemeControl> _themes = new List<ThemeControl>();
 | 
			
		||||
@ -388,130 +384,121 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveSite()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && _containertype != "-")
 | 
			
		||||
            {
 | 
			
		||||
                if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && _containertype != "-")
 | 
			
		||||
                var unique = true;
 | 
			
		||||
                if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                {
 | 
			
		||||
                    var unique = true;
 | 
			
		||||
                    if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                    foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
                    {
 | 
			
		||||
                        foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
                        if (_aliasList.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId))
 | 
			
		||||
                        {
 | 
			
		||||
                            if (_aliasList.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId))
 | 
			
		||||
                            {
 | 
			
		||||
                                unique = false;
 | 
			
		||||
                            }
 | 
			
		||||
                            unique = false;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                    if (unique)
 | 
			
		||||
                if (unique)
 | 
			
		||||
                {
 | 
			
		||||
                    var site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
 | 
			
		||||
                    if (site != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        var site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
 | 
			
		||||
                        if (site != null)
 | 
			
		||||
                        bool refresh = (site.DefaultThemeType != _themetype || site.DefaultContainerType != _containertype);
 | 
			
		||||
 | 
			
		||||
                        site.Name = _name;
 | 
			
		||||
                        site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
 | 
			
		||||
                        site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
 | 
			
		||||
 | 
			
		||||
                        site.LogoFileId = null;
 | 
			
		||||
                        var logofileid = _logofilemanager.GetFileId();
 | 
			
		||||
                        if (logofileid != -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            bool refresh = (site.DefaultThemeType != _themetype || site.DefaultContainerType != _containertype);
 | 
			
		||||
                            site.LogoFileId = logofileid;
 | 
			
		||||
                        }
 | 
			
		||||
                        var faviconFieldId = _faviconfilemanager.GetFileId();
 | 
			
		||||
                        if (faviconFieldId != -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            site.FaviconFileId = faviconFieldId;
 | 
			
		||||
                        }
 | 
			
		||||
                        site.DefaultThemeType = _themetype;
 | 
			
		||||
                        site.DefaultContainerType = _containertype;
 | 
			
		||||
                        site.AdminContainerType = _admincontainertype;
 | 
			
		||||
 | 
			
		||||
                            site.Name = _name;
 | 
			
		||||
                            site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
 | 
			
		||||
                            site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
 | 
			
		||||
                        site.PwaIsEnabled = (_pwaisenabled == null ? true : Boolean.Parse(_pwaisenabled));
 | 
			
		||||
                        var pwaappiconfileid = _pwaappiconfilemanager.GetFileId();
 | 
			
		||||
                        if (pwaappiconfileid != -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            site.PwaAppIconFileId = pwaappiconfileid;
 | 
			
		||||
                        }
 | 
			
		||||
                        var pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId();
 | 
			
		||||
                        if (pwasplashiconfileid != -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            site.PwaSplashIconFileId = pwasplashiconfileid;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                            site.LogoFileId = null;
 | 
			
		||||
                            var logofileid = _logofilemanager.GetFileId();
 | 
			
		||||
                            if (logofileid != -1)
 | 
			
		||||
                        site = await SiteService.UpdateSiteAsync(site);
 | 
			
		||||
 | 
			
		||||
                        var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPHost", _smtphost);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPPort", _smtpport);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPSSL", _smtpssl);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPUsername", _smtpusername);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPPassword", _smtppassword);
 | 
			
		||||
                        SettingService.SetSetting(settings, "SMTPSender", _smtpsender);
 | 
			
		||||
                        await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
 | 
			
		||||
 | 
			
		||||
                        if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                        {
 | 
			
		||||
                            var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
 | 
			
		||||
                            foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
 | 
			
		||||
                            {
 | 
			
		||||
                                site.LogoFileId = logofileid;
 | 
			
		||||
                            }
 | 
			
		||||
                            var faviconFieldId = _faviconfilemanager.GetFileId();
 | 
			
		||||
                            if (faviconFieldId != -1)
 | 
			
		||||
                            {
 | 
			
		||||
                                site.FaviconFileId = faviconFieldId;
 | 
			
		||||
                            }
 | 
			
		||||
                            site.DefaultThemeType = _themetype;
 | 
			
		||||
                            site.DefaultContainerType = _containertype;
 | 
			
		||||
                            site.AdminContainerType = _admincontainertype;
 | 
			
		||||
 | 
			
		||||
                            site.PwaIsEnabled = (_pwaisenabled == null ? true : Boolean.Parse(_pwaisenabled));
 | 
			
		||||
                            var pwaappiconfileid = _pwaappiconfilemanager.GetFileId();
 | 
			
		||||
                            if (pwaappiconfileid != -1)
 | 
			
		||||
                            {
 | 
			
		||||
                                site.PwaAppIconFileId = pwaappiconfileid;
 | 
			
		||||
                            }
 | 
			
		||||
                            var pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId();
 | 
			
		||||
                            if (pwasplashiconfileid != -1)
 | 
			
		||||
                            {
 | 
			
		||||
                                site.PwaSplashIconFileId = pwasplashiconfileid;
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            site = await SiteService.UpdateSiteAsync(site);
 | 
			
		||||
 | 
			
		||||
                            var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPHost", _smtphost);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPPort", _smtpport);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPSSL", _smtpssl);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPUsername", _smtpusername);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPPassword", _smtppassword);
 | 
			
		||||
                            SettingService.SetSetting(settings, "SMTPSender", _smtpsender);
 | 
			
		||||
                            await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
 | 
			
		||||
 | 
			
		||||
                            if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
 | 
			
		||||
                            {
 | 
			
		||||
                                var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
 | 
			
		||||
                                foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
 | 
			
		||||
                                if (!names.Contains(alias.Name))
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (!names.Contains(alias.Name))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        await AliasService.DeleteAliasAsync(alias.AliasId);
 | 
			
		||||
                                    }
 | 
			
		||||
                                }
 | 
			
		||||
 | 
			
		||||
                                foreach (string name in names)
 | 
			
		||||
                                {
 | 
			
		||||
                                    if (!_aliasList.Exists(item => item.Name == name))
 | 
			
		||||
                                    {
 | 
			
		||||
                                        Alias alias = new Alias();
 | 
			
		||||
                                        alias.Name = name;
 | 
			
		||||
                                        alias.TenantId = site.TenantId;
 | 
			
		||||
                                        alias.SiteId = site.SiteId;
 | 
			
		||||
                                        await AliasService.AddAliasAsync(alias);
 | 
			
		||||
                                    }
 | 
			
		||||
                                    await AliasService.DeleteAliasAsync(alias.AliasId);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
 | 
			
		||||
                            await logger.LogInformation("Site Settings Saved {Site}", site);
 | 
			
		||||
 | 
			
		||||
                            if (refresh)
 | 
			
		||||
                            foreach (string name in names)
 | 
			
		||||
                            {
 | 
			
		||||
                                NavigationManager.NavigateTo(NavigateUrl()); // refresh to show new theme or container
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success);
 | 
			
		||||
                                if (!_aliasList.Exists(item => item.Name == name))
 | 
			
		||||
                                {
 | 
			
		||||
                                    Alias alias = new Alias();
 | 
			
		||||
                                    alias.Name = name;
 | 
			
		||||
                                    alias.TenantId = site.TenantId;
 | 
			
		||||
                                    alias.SiteId = site.SiteId;
 | 
			
		||||
                                    await AliasService.AddAliasAsync(alias);
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Aliases.Taken"], MessageType.Warning);
 | 
			
		||||
 | 
			
		||||
                        await logger.LogInformation("Site Settings Saved {Site}", site);
 | 
			
		||||
 | 
			
		||||
                        if (refresh)
 | 
			
		||||
                        {
 | 
			
		||||
                            NavigationManager.NavigateTo(NavigateUrl()); // refresh to show new theme or container
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.SiteName"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Aliases.Taken"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Site {SiteId} {Error}", PageState.Site.SiteId, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.SaveSite"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.SiteName"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Site {SiteId} {Error}", PageState.Site.SiteId, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.SaveSite"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -19,140 +19,136 @@
 | 
			
		||||
}
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="Enter the name of the site" ResourceKey="Name">Site Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_name" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="name" HelpText="Enter the name of the site" ResourceKey="Name">Site Name: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="name" class="form-control" @bind="@_name" />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="alias" HelpText="Enter the aliases for the site. An alias can be a domain name (www.site.com) or a virtual folder (ie. www.site.com/folder). If a site has multiple aliases they can be separated by commas." ResourceKey="Aliases">Aliases: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <textarea id="alias" class="form-control" @bind="@_urls" rows="3" required></textarea>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="defaultTheme" HelpText="Select the default theme for the website" ResourceKey="DefaultTheme">Default Theme: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="defaultTheme" class="form-select" @onchange="(e => ThemeChanged(e))" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Theme.Select"]></option>
 | 
			
		||||
                        @foreach (var theme in _themes)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="defaultContainer" class="form-select" @bind="@_containertype" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                        @foreach (var container in _containers)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="adminContainer" HelpText="Select the admin container for the site" ResourceKey="AdminContainer">Admin Container: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="adminContainer" class="form-select" @bind="@_admincontainertype" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                        <option value=""><@Localizer["DefaultContainer.Admin"]></option>
 | 
			
		||||
                        @foreach (var container in _containers)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="siteTemplate" HelpText="Select the site template" ResourceKey="SiteTemplate">Site Template: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="siteTemplate" class="form-select" @bind="@_sitetemplatetype" required>
 | 
			
		||||
                        <option value="-"><@Localizer["SiteTemplate.Select"]></option>
 | 
			
		||||
                        @foreach (SiteTemplate siteTemplate in _siteTemplates)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@siteTemplate.TypeName">@siteTemplate.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="tenant" HelpText="Select the tenant for the site" ResourceKey="Tenant">Tenant: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="tenant" class="form-select" @onchange="(e => TenantChanged(e))" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Tenant.Select"]></option>
 | 
			
		||||
                        <option value="+"><@Localizer["Tenant.Add"]></option>
 | 
			
		||||
                        @foreach (Tenant tenant in _tenants)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@tenant.TenantId">@tenant.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            @if (_tenantid == "+")
 | 
			
		||||
            {
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <hr class="app-rule" />
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="name" HelpText="Enter the name for the tenant" ResourceKey="TenantName">Tenant Name: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="name" class="form-control" @bind="@_tenantName" maxlength="256" required />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="databaseType" class="form-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))" required>
 | 
			
		||||
                            @foreach (var database in _databases)
 | 
			
		||||
                            {
 | 
			
		||||
                                if (database.IsDefault)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@database.Name" selected>@Localizer[@database.Name]</option>
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    <option value="@database.Name">@Localizer[@database.Name]</option>
 | 
			
		||||
                                }
 | 
			
		||||
                            }
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                if (_databaseConfigType != null)
 | 
			
		||||
                {
 | 
			
		||||
                    @DatabaseConfigComponent;
 | 
			
		||||
                }
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="hostUsername" HelpText="Enter the username of the host for this site" ResourceKey="HostUsername">Host Username:</Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="hostUsername" class="form-control" @bind="@_hostUserName" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="hostPassword" HelpText="Enter the password for the host of this site" ResourceKey="HostPassword">Host Password:</Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="hostPassword" type="password" class="form-control" @bind="@_hostpassword" maxlength="256" required />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </div>
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    </form>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="alias" HelpText="Enter the aliases for the site. An alias can be a domain name (www.site.com) or a virtual folder (ie. www.site.com/folder). If a site has multiple aliases they can be separated by commas." ResourceKey="Aliases">Aliases: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <textarea id="alias" class="form-control" @bind="@_urls" rows="3"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="defaultTheme" HelpText="Select the default theme for the website" ResourceKey="DefaultTheme">Default Theme: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="defaultTheme" class="form-select" @onchange="(e => ThemeChanged(e))">
 | 
			
		||||
                    <option value="-"><@Localizer["Theme.Select"]></option>
 | 
			
		||||
                    @foreach (var theme in _themes)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@theme.TypeName">@theme.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="defaultContainer" class="form-select" @bind="@_containertype">
 | 
			
		||||
                    <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                    @foreach (var container in _containers)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="adminContainer" HelpText="Select the admin container for the site" ResourceKey="AdminContainer">Admin Container: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="adminContainer" class="form-select" @bind="@_admincontainertype">
 | 
			
		||||
                    <option value="-"><@Localizer["Container.Select"]></option>
 | 
			
		||||
                    <option value=""><@Localizer["DefaultContainer.Admin"]></option>
 | 
			
		||||
                    @foreach (var container in _containers)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@container.TypeName">@container.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="siteTemplate" HelpText="Select the site template" ResourceKey="SiteTemplate">Site Template: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="siteTemplate" class="form-select" @bind="@_sitetemplatetype">
 | 
			
		||||
                    <option value="-"><@Localizer["SiteTemplate.Select"]></option>
 | 
			
		||||
                    @foreach (SiteTemplate siteTemplate in _siteTemplates)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@siteTemplate.TypeName">@siteTemplate.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="tenant" HelpText="Select the tenant for the site" ResourceKey="Tenant">Tenant: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="tenant" class="form-select" @onchange="(e => TenantChanged(e))">
 | 
			
		||||
                    <option value="-"><@Localizer["Tenant.Select"]></option>
 | 
			
		||||
                    <option value="+"><@Localizer["Tenant.Add"]></option>
 | 
			
		||||
                    @foreach (Tenant tenant in _tenants)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@tenant.TenantId">@tenant.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        @if (_tenantid == "+")
 | 
			
		||||
        {
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <hr class="app-rule" />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="name" HelpText="Enter the name for the tenant" ResourceKey="TenantName">Tenant Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="name" class="form-control" @bind="@_tenantName" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="databaseType" class="form-select" value="@_databaseName" @onchange="(e => DatabaseChanged(e))">
 | 
			
		||||
                        @foreach (var database in _databases)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (database.IsDefault)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@database.Name" selected>@Localizer[@database.Name]</option>
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@database.Name">@Localizer[@database.Name]</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            if (_databaseConfigType != null)
 | 
			
		||||
            {
 | 
			
		||||
                @DatabaseConfigComponent;
 | 
			
		||||
            }
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="hostUsername" HelpText="Enter the username of the host for this site" ResourceKey="HostUsername">Host Username:</Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="hostUsername" class="form-control" @bind="@_hostUserName" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="hostPassword" HelpText="Enter the password for the host of this site" ResourceKey="HostPassword">Host Password:</Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="hostPassword" type="password" class="form-control" @bind="@_hostpassword" />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        }
 | 
			
		||||
    </div>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveSite">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private List<Database> _databases;
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _databaseName = "LocalDB";
 | 
			
		||||
    private Type _databaseConfigType;
 | 
			
		||||
    private object _databaseConfig;
 | 
			
		||||
@ -256,120 +252,111 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task SaveSite()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && _containertype != "-" && _sitetemplatetype != "-")
 | 
			
		||||
        {
 | 
			
		||||
            if (_tenantid != "-" && _name != string.Empty && _urls != string.Empty && _themetype != "-" && _containertype != "-" && _sitetemplatetype != "-")
 | 
			
		||||
            var duplicates = new List<string>();
 | 
			
		||||
            var aliases = await AliasService.GetAliasesAsync();
 | 
			
		||||
            foreach (string name in _urls.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
            {
 | 
			
		||||
                var duplicates = new List<string>();
 | 
			
		||||
                var aliases = await AliasService.GetAliasesAsync();
 | 
			
		||||
                foreach (string name in _urls.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
 | 
			
		||||
                if (aliases.Exists(item => item.Name == name))
 | 
			
		||||
                {
 | 
			
		||||
                    if (aliases.Exists(item => item.Name == name))
 | 
			
		||||
                    {
 | 
			
		||||
                        duplicates.Add(name);
 | 
			
		||||
                    }
 | 
			
		||||
                    duplicates.Add(name);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
                if (duplicates.Count == 0)
 | 
			
		||||
            if (duplicates.Count == 0)
 | 
			
		||||
            {
 | 
			
		||||
                InstallConfig config = new InstallConfig();
 | 
			
		||||
 | 
			
		||||
                if (_tenantid == "+")
 | 
			
		||||
                {
 | 
			
		||||
                    InstallConfig config = new InstallConfig();
 | 
			
		||||
 | 
			
		||||
                    if (_tenantid == "+")
 | 
			
		||||
                    if (!string.IsNullOrEmpty(_tenantName) && _tenants.FirstOrDefault(item => item.Name == _tenantName) == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        if (!string.IsNullOrEmpty(_tenantName) && _tenants.FirstOrDefault(item => item.Name == _tenantName) == null)
 | 
			
		||||
                        // validate host credentials
 | 
			
		||||
                        var user = new User();
 | 
			
		||||
                        user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                        user.Username = UserNames.Host;
 | 
			
		||||
                        user.Password = _hostpassword;
 | 
			
		||||
                        user = await UserService.LoginUserAsync(user, false, false);
 | 
			
		||||
                        if (user.IsAuthenticated)
 | 
			
		||||
                        {
 | 
			
		||||
                            // validate host credentials
 | 
			
		||||
                            var user = new User();
 | 
			
		||||
                            user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                            user.Username = UserNames.Host;
 | 
			
		||||
                            user.Password = _hostpassword;
 | 
			
		||||
                            user = await UserService.LoginUserAsync(user, false, false);
 | 
			
		||||
                            if (user.IsAuthenticated)
 | 
			
		||||
                            var connectionString = String.Empty;
 | 
			
		||||
                            if (_databaseConfig is IDatabaseConfigControl databaseConfigControl)
 | 
			
		||||
                            {
 | 
			
		||||
                                var connectionString = String.Empty;
 | 
			
		||||
                                if (_databaseConfig is IDatabaseConfigControl databaseConfigControl)
 | 
			
		||||
                                {
 | 
			
		||||
                                    connectionString = databaseConfigControl.GetConnectionString();
 | 
			
		||||
                                }
 | 
			
		||||
                                var database = _databases.SingleOrDefault(d => d.Name == _databaseName);
 | 
			
		||||
                                connectionString = databaseConfigControl.GetConnectionString();
 | 
			
		||||
                            }
 | 
			
		||||
                            var database = _databases.SingleOrDefault(d => d.Name == _databaseName);
 | 
			
		||||
 | 
			
		||||
                                if (connectionString != "")
 | 
			
		||||
                                {
 | 
			
		||||
                                    config.TenantName = _tenantName;
 | 
			
		||||
                                    config.DatabaseType = database.DBType;
 | 
			
		||||
                                    config.ConnectionString = connectionString;
 | 
			
		||||
                                    config.HostEmail = user.Email;
 | 
			
		||||
                                    config.HostPassword = _hostpassword;
 | 
			
		||||
                                    config.HostName = user.DisplayName;
 | 
			
		||||
                                    config.IsNewTenant = true;
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    AddModuleMessage(Localizer["Error.Required.ServerDatabase"], MessageType.Error);
 | 
			
		||||
                                }
 | 
			
		||||
                            if (connectionString != "")
 | 
			
		||||
                            {
 | 
			
		||||
                                config.TenantName = _tenantName;
 | 
			
		||||
                                config.DatabaseType = database.DBType;
 | 
			
		||||
                                config.ConnectionString = connectionString;
 | 
			
		||||
                                config.HostEmail = user.Email;
 | 
			
		||||
                                config.HostPassword = _hostpassword;
 | 
			
		||||
                                config.HostName = user.DisplayName;
 | 
			
		||||
                                config.IsNewTenant = true;
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                AddModuleMessage(Localizer["Error.InvalidPassword"], MessageType.Error);
 | 
			
		||||
                                AddModuleMessage(Localizer["Error.Required.ServerDatabase"], MessageType.Error);
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            AddModuleMessage(Localizer["Error.TenantName.Exists"], MessageType.Error);
 | 
			
		||||
                            AddModuleMessage(Localizer["Error.InvalidPassword"], MessageType.Error);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        var tenant = _tenants.FirstOrDefault(item => item.TenantId == int.Parse(_tenantid));
 | 
			
		||||
                        if (tenant != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            config.TenantName = tenant.Name;
 | 
			
		||||
                            config.DatabaseType = tenant.DBType;
 | 
			
		||||
                            config.ConnectionString = tenant.DBConnectionString;
 | 
			
		||||
                            config.IsNewTenant = false;
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (!string.IsNullOrEmpty(config.TenantName))
 | 
			
		||||
                    {
 | 
			
		||||
                        config.SiteName = _name;
 | 
			
		||||
                        config.Aliases = _urls;
 | 
			
		||||
                        config.DefaultTheme = _themetype;
 | 
			
		||||
                        config.DefaultContainer = _containertype;
 | 
			
		||||
                        config.DefaultAdminContainer = _admincontainertype;
 | 
			
		||||
                        config.SiteTemplate = _sitetemplatetype;
 | 
			
		||||
 | 
			
		||||
                        ShowProgressIndicator();
 | 
			
		||||
 | 
			
		||||
                        var installation = await InstallationService.Install(config);
 | 
			
		||||
                        if (installation.Success)
 | 
			
		||||
                        {
 | 
			
		||||
                            var aliasname = config.Aliases.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0];
 | 
			
		||||
                            var uri = new Uri(NavigationManager.Uri);
 | 
			
		||||
                            NavigationManager.NavigateTo(uri.Scheme + "://" + aliasname, true);
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            await logger.LogError("Error Creating Site {Error}", installation.Message);
 | 
			
		||||
                            AddModuleMessage(installation.Message, MessageType.Error);
 | 
			
		||||
                        }
 | 
			
		||||
                        AddModuleMessage(Localizer["Error.TenantName.Exists"], MessageType.Error);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(string.Format(Localizer["Message.SiteName.InUse"], string.Join(", ", duplicates.ToArray())), MessageType.Warning);
 | 
			
		||||
                    var tenant = _tenants.FirstOrDefault(item => item.TenantId == int.Parse(_tenantid));
 | 
			
		||||
                    if (tenant != null)
 | 
			
		||||
                    {
 | 
			
		||||
                        config.TenantName = tenant.Name;
 | 
			
		||||
                        config.DatabaseType = tenant.DBType;
 | 
			
		||||
                        config.ConnectionString = tenant.DBConnectionString;
 | 
			
		||||
                        config.IsNewTenant = false;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (!string.IsNullOrEmpty(config.TenantName))
 | 
			
		||||
                {
 | 
			
		||||
                    config.SiteName = _name;
 | 
			
		||||
                    config.Aliases = _urls;
 | 
			
		||||
                    config.DefaultTheme = _themetype;
 | 
			
		||||
                    config.DefaultContainer = _containertype;
 | 
			
		||||
                    config.DefaultAdminContainer = _admincontainertype;
 | 
			
		||||
                    config.SiteTemplate = _sitetemplatetype;
 | 
			
		||||
 | 
			
		||||
                    ShowProgressIndicator();
 | 
			
		||||
 | 
			
		||||
                    var installation = await InstallationService.Install(config);
 | 
			
		||||
                    if (installation.Success)
 | 
			
		||||
                    {
 | 
			
		||||
                        var aliasname = config.Aliases.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)[0];
 | 
			
		||||
                        var uri = new Uri(NavigationManager.Uri);
 | 
			
		||||
                        NavigationManager.NavigateTo(uri.Scheme + "://" + aliasname, true);
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        await logger.LogError("Error Creating Site {Error}", installation.Message);
 | 
			
		||||
                        AddModuleMessage(installation.Message, MessageType.Error);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.Tenant"], MessageType.Warning);
 | 
			
		||||
                AddModuleMessage(string.Format(Localizer["Message.SiteName.InUse"], string.Join(", ", duplicates.ToArray())), MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            AddModuleMessage(Localizer["Message.Required.Tenant"], MessageType.Warning);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,130 +5,126 @@
 | 
			
		||||
@inject IStringLocalizer<Index> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Info" Heading="Info" ResourceKey="Info">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="version" HelpText="Framework Version" ResourceKey="FrameworkVersion">Framework Version: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="version" class="form-control" @bind="@_version" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="clrversion" HelpText="Common Language Runtime Version" ResourceKey="CLRVersion">CLR Version: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="clrversion" class="form-control" @bind="@_clrversion" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="osversion" HelpText="Operating System Version" ResourceKey="OSVersion">OS Version: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="osversion" class="form-control" @bind="@_osversion" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="serverpath" HelpText="Server Path" ResourceKey="ServerPath">Server Path: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="serverpath" class="form-control" @bind="@_serverpath" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="servertime" HelpText="Server Time" ResourceKey="ServerTime">Server Time: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="servertime" class="form-control" @bind="@_servertime" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="installationid" HelpText="The Unique Identifier For Your Installation" ResourceKey="InstallationId">Installation ID: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="installationid" class="form-control" @bind="@_installationid" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <div class="col-sm-3"></div>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <br /><input type="checkbox" @onchange="(e => RegisterChecked(e))" /> @Localizer["Register"]
 | 
			
		||||
                    </div>
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Info" Heading="Info" ResourceKey="Info">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="version" HelpText="Framework Version" ResourceKey="FrameworkVersion">Framework Version: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="version" class="form-control" @bind="@_version" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <br /><br />
 | 
			
		||||
            <ActionDialog Header="Restart Application" Message="Are You Sure You Wish To Restart The Application?" Action="Restart Application" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await RestartApplication())" ResourceKey="RestartApplication" />
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Options" Heading="Options" ResourceKey="Options">
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="runtime" HelpText="Blazor Runtime (Server or WebAssembly)" ResourceKey="BlazorRuntime">Blazor Runtime: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="runtime" class="form-select" @bind="@_runtime" required>
 | 
			
		||||
                            <option value="Server">@Localizer["Server"]</option>
 | 
			
		||||
                            <option value="WebAssembly">@Localizer["WebAssembly"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="rendermode" HelpText="Blazor Server Render Mode" ResourceKey="RenderMode">Render Mode: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="rendermode" class="form-select" @bind="@_rendermode" required>
 | 
			
		||||
                            <option value="Server">@Localizer["Server"]</option>
 | 
			
		||||
                            <option value="ServerPrerendered">@Localizer["ServerPrerendered"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="detailederrors" HelpText="Specify If Detailed Errors Are Enabled For Blazor. This Option Should Not Not Be Enabled In Production." ResourceKey="DetailedErrors">Detailed Errors? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="detailederrors" class="form-select" @bind="@_detailederrors" required>
 | 
			
		||||
                            <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                            <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="logginglevel" HelpText="The Minimum Logging Level For The Event Log. This Option Can Be Used To Control The Volume Of Items Stored In Your Event Log." ResourceKey="LoggingLevel">Logging Level: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="logginglevel" class="form-select" @bind="@_logginglevel" required>
 | 
			
		||||
                            <option value="Trace">@Localizer["Trace"]</option>
 | 
			
		||||
                            <option value="Debug">@Localizer["Debug"]</option>
 | 
			
		||||
                            <option value="Information">@Localizer["Information"]</option>
 | 
			
		||||
                            <option value="Warning">@Localizer["Warning"]</option>
 | 
			
		||||
                            <option value="Error">@Localizer["Error"]</option>
 | 
			
		||||
                            <option value="Critical">@Localizer["Critical"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="swagger" HelpText="Specify If Swagger Is Enabled For Your Server API" ResourceKey="Swagger">Swagger Enabled? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="swagger" class="form-select" @bind="@_swagger" required>
 | 
			
		||||
                            <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                            <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="packageservice" HelpText="Specify If The Package Service Is Enabled For Installing Modules, Themes, And Translations" ResourceKey="PackageService">Enable Package Service? </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="packageservice" class="form-select" @bind="@_packageservice" required>
 | 
			
		||||
                            <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                            <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="clrversion" HelpText="Common Language Runtime Version" ResourceKey="CLRVersion">CLR Version: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="clrversion" class="form-control" @bind="@_clrversion" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <br /><br />
 | 
			
		||||
            <button type="button" class="btn btn-success" @onclick="SaveConfig">@SharedLocalizer["Save"]</button> 
 | 
			
		||||
            <a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access.ApiFramework"]</a> 
 | 
			
		||||
            <ActionDialog Header="Restart Application" Message="Are You Sure You Wish To Restart The Application?" Action="Restart Application" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await RestartApplication())" ResourceKey="RestartApplication" />
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
</form>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="osversion" HelpText="Operating System Version" ResourceKey="OSVersion">OS Version: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="osversion" class="form-control" @bind="@_osversion" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="serverpath" HelpText="Server Path" ResourceKey="ServerPath">Server Path: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="serverpath" class="form-control" @bind="@_serverpath" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="servertime" HelpText="Server Time" ResourceKey="ServerTime">Server Time: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="servertime" class="form-control" @bind="@_servertime" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="installationid" HelpText="The Unique Identifier For Your Installation" ResourceKey="InstallationId">Installation ID: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="installationid" class="form-control" @bind="@_installationid" readonly />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <div class="col-sm-3"></div>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <br /><input type="checkbox" @onchange="(e => RegisterChecked(e))" /> @Localizer["Register"]
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <br /><br />
 | 
			
		||||
        <ActionDialog Header="Restart Application" Message="Are You Sure You Wish To Restart The Application?" Action="Restart Application" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await RestartApplication())" ResourceKey="RestartApplication" />
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Options" Heading="Options" ResourceKey="Options">
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="runtime" HelpText="Blazor Runtime (Server or WebAssembly)" ResourceKey="BlazorRuntime">Blazor Runtime: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="runtime" class="form-select" @bind="@_runtime">
 | 
			
		||||
                        <option value="Server">@Localizer["Server"]</option>
 | 
			
		||||
                        <option value="WebAssembly">@Localizer["WebAssembly"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="rendermode" HelpText="Blazor Server Render Mode" ResourceKey="RenderMode">Render Mode: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="rendermode" class="form-select" @bind="@_rendermode">
 | 
			
		||||
                        <option value="Server">@Localizer["Server"]</option>
 | 
			
		||||
                        <option value="ServerPrerendered">@Localizer["ServerPrerendered"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="detailederrors" HelpText="Specify If Detailed Errors Are Enabled For Blazor. This Option Should Not Not Be Enabled In Production." ResourceKey="DetailedErrors">Detailed Errors? </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="detailederrors" class="form-select" @bind="@_detailederrors">
 | 
			
		||||
                        <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                        <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="logginglevel" HelpText="The Minimum Logging Level For The Event Log. This Option Can Be Used To Control The Volume Of Items Stored In Your Event Log." ResourceKey="LoggingLevel">Logging Level: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="logginglevel" class="form-select" @bind="@_logginglevel">
 | 
			
		||||
                        <option value="Trace">@Localizer["Trace"]</option>
 | 
			
		||||
                        <option value="Debug">@Localizer["Debug"]</option>
 | 
			
		||||
                        <option value="Information">@Localizer["Information"]</option>
 | 
			
		||||
                        <option value="Warning">@Localizer["Warning"]</option>
 | 
			
		||||
                        <option value="Error">@Localizer["Error"]</option>
 | 
			
		||||
                        <option value="Critical">@Localizer["Critical"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="swagger" HelpText="Specify If Swagger Is Enabled For Your Server API" ResourceKey="Swagger">Swagger Enabled? </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="swagger" class="form-select" @bind="@_swagger">
 | 
			
		||||
                        <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                        <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="packageservice" HelpText="Specify If The Package Service Is Enabled For Installing Modules, Themes, And Translations" ResourceKey="PackageService">Enable Package Service? </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="packageservice" class="form-select" @bind="@_packageservice">
 | 
			
		||||
                        <option value="true">@SharedLocalizer["True"]</option>
 | 
			
		||||
                        <option value="false">@SharedLocalizer["False"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <br /><br />
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveConfig">@SharedLocalizer["Save"]</button> 
 | 
			
		||||
        <a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access.ApiFramework"]</a> 
 | 
			
		||||
        <ActionDialog Header="Restart Application" Message="Are You Sure You Wish To Restart The Application?" Action="Restart Application" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await RestartApplication())" ResourceKey="RestartApplication" />
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
</TabStrip>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
 | 
			
		||||
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _version = string.Empty;
 | 
			
		||||
    private string _clrversion = string.Empty;
 | 
			
		||||
    private string _osversion = string.Empty;
 | 
			
		||||
@ -167,31 +163,22 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveConfig()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                var settings = new Dictionary<string, string>();
 | 
			
		||||
                settings.Add("runtime", _runtime);
 | 
			
		||||
                settings.Add("rendermode", _rendermode);
 | 
			
		||||
                settings.Add("detailederrors", _detailederrors);
 | 
			
		||||
                settings.Add("logginglevel", _logginglevel);
 | 
			
		||||
                settings.Add("swagger", _swagger);
 | 
			
		||||
                settings.Add("packageservice", _packageservice);
 | 
			
		||||
                await SystemService.UpdateSystemInfoAsync(settings);
 | 
			
		||||
                AddModuleMessage(Localizer["Success.UpdateConfig.Restart"], MessageType.Success);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving Configuration");
 | 
			
		||||
                AddModuleMessage(Localizer["Error.UpdateConfig"], MessageType.Error);
 | 
			
		||||
            }
 | 
			
		||||
            var settings = new Dictionary<string, string>();
 | 
			
		||||
            settings.Add("runtime", _runtime);
 | 
			
		||||
            settings.Add("rendermode", _rendermode);
 | 
			
		||||
            settings.Add("detailederrors", _detailederrors);
 | 
			
		||||
            settings.Add("logginglevel", _logginglevel);
 | 
			
		||||
            settings.Add("swagger", _swagger);
 | 
			
		||||
            settings.Add("packageservice", _packageservice);
 | 
			
		||||
            await SystemService.UpdateSystemInfoAsync(settings);
 | 
			
		||||
            AddModuleMessage(Localizer["Success.UpdateConfig.Restart"], MessageType.Success);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving Configuration");
 | 
			
		||||
            AddModuleMessage(Localizer["Error.UpdateConfig"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -225,4 +212,4 @@
 | 
			
		||||
            await logger.LogError(ex, "Error On Register");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
@ -11,66 +11,61 @@
 | 
			
		||||
 | 
			
		||||
@if (_templates != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this theme. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="owner" class="form-control" @bind="@_owner" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="module" HelpText="Enter a name for this theme. It should not contain spaces or punctuation." ResourceKey="ThemeName">Theme Name: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="module" class="form-control" @bind="@_theme" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="template" HelpText="Select a theme template. Templates are located in the wwwroot/Themes/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))" required>
 | 
			
		||||
                        <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                        @foreach (Template template in _templates)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="reference" class="form-select" @bind="@_reference" required>
 | 
			
		||||
                        @foreach (string version in _versions)
 | 
			
		||||
                        {
 | 
			
		||||
                            if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                            {
 | 
			
		||||
                                <option value="@(version)">@(version)</option>
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                        <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            @if (!string.IsNullOrEmpty(_location))
 | 
			
		||||
            {
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="location" HelpText="Location where the theme will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="owner" HelpText="Enter the name of the organization who is developing this theme. It should not contain spaces or punctuation." ResourceKey="OwnerName">Owner Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="owner" class="form-control" @bind="@_owner" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <br />
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="CreateTheme">@Localizer["Theme.Create"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    </form>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="module" HelpText="Enter a name for this theme. It should not contain spaces or punctuation." ResourceKey="ThemeName">Theme Name: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="module" class="form-control" @bind="@_theme" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="template" HelpText="Select a theme template. Templates are located in the wwwroot/Themes/Templates folder on the server." ResourceKey="Template">Template: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="template" class="form-select" @onchange="(e => TemplateChanged(e))">
 | 
			
		||||
                <option value="-"><@Localizer["Template.Select"]></option>
 | 
			
		||||
                @foreach (Template template in _templates)
 | 
			
		||||
                {
 | 
			
		||||
                    <option value="@template.Name">@template.Title</option>
 | 
			
		||||
                }
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <select id="reference" class="form-select" @bind="@_reference">
 | 
			
		||||
                @foreach (string version in _versions)
 | 
			
		||||
                {
 | 
			
		||||
                    if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@(version)">@(version)</option>
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                <option value="local">@SharedLocalizer["LocalVersion"]</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    @if (!string.IsNullOrEmpty(_location)) {
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="location" HelpText="Location where the theme will be created" ResourceKey="Location">Location: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="module" class="form-control" @bind="@_location" readonly />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
    }
 | 
			
		||||
</div>
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="CreateTheme">@Localizer["Theme.Create"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string _owner = string.Empty;
 | 
			
		||||
    private string _theme = string.Empty;
 | 
			
		||||
    private List<Template> _templates;
 | 
			
		||||
@ -98,32 +93,23 @@
 | 
			
		||||
 | 
			
		||||
    private async Task CreateTheme()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (IsValid(_owner) && IsValid(_theme) && _owner != _theme && _template != "-")
 | 
			
		||||
            {
 | 
			
		||||
                if (IsValid(_owner) && IsValid(_theme) && _owner != _theme && _template != "-")
 | 
			
		||||
                {
 | 
			
		||||
                    var theme = new Theme { Owner = _owner, Name = _theme, Template = _template, Version = _reference };
 | 
			
		||||
                    theme = await ThemeService.CreateThemeAsync(theme);
 | 
			
		||||
                    GetLocation();
 | 
			
		||||
                    AddModuleMessage(string.Format(Localizer["Success.Theme.Create"], NavigateUrl("admin/system")), MessageType.Success);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.ValidName"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
                var theme = new Theme { Owner = _owner, Name = _theme, Template = _template, Version = _reference };
 | 
			
		||||
                theme = await ThemeService.CreateThemeAsync(theme);
 | 
			
		||||
                GetLocation();
 | 
			
		||||
                AddModuleMessage(string.Format(Localizer["Success.Theme.Create"], NavigateUrl("admin/system")), MessageType.Success);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Creating Theme");
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.ValidName"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Creating Theme");
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -8,36 +8,32 @@
 | 
			
		||||
 | 
			
		||||
@if (PageState.User != null)
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="to" HelpText="Enter the username you wish to send a message to" ResourceKey="To">To: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="to" class="form-control" @bind="@username" maxlength="256" required />
 | 
			
		||||
                </div> >
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="subject" HelpText="Enter the subject of the message" ResourceKey="Subject">Subject: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="subject" class="form-control" @bind="@subject" maxlength="256" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="message" HelpText="Enter the message" ResourceKey="Message">Message: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <textarea id="message" class="form-control" @bind="@body" rows="5" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
<div class="container">
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="to" HelpText="Enter the username you wish to send a message to" ResourceKey="To">To: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="to" class="form-control" @bind="@username" />
 | 
			
		||||
        </div> >
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="subject" HelpText="Enter the subject of the message" ResourceKey="Subject">Subject: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <input id="subject" class="form-control" @bind="@subject" />
 | 
			
		||||
        </div>
 | 
			
		||||
        <br />
 | 
			
		||||
        <button type="button" class="btn btn-primary" @onclick="Send">@SharedLocalizer["Send"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    </form>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="row mb-1 align-items-center">
 | 
			
		||||
        <Label Class="col-sm-3" For="message" HelpText="Enter the message" ResourceKey="Message">Message: </Label>
 | 
			
		||||
        <div class="col-sm-9">
 | 
			
		||||
            <textarea id="message" class="form-control" @bind="@body" rows="5" />
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
<br/>
 | 
			
		||||
    <button type="button" class="btn btn-primary" @onclick="Send">@SharedLocalizer["Send"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string username = "";
 | 
			
		||||
    private string subject = "";
 | 
			
		||||
    private string body = "";
 | 
			
		||||
@ -48,34 +44,25 @@
 | 
			
		||||
 | 
			
		||||
    private async Task Send()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
 | 
			
		||||
            if (user != null)
 | 
			
		||||
            {
 | 
			
		||||
                var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
 | 
			
		||||
                if (user != null)
 | 
			
		||||
                {
 | 
			
		||||
                    var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, null);
 | 
			
		||||
                    notification = await NotificationService.AddNotificationAsync(notification);
 | 
			
		||||
                    await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.User.Invalid"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
                var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, null);
 | 
			
		||||
                notification = await NotificationService.AddNotificationAsync(notification);
 | 
			
		||||
                await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
 | 
			
		||||
                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Notification.Add"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.User.Invalid"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Notification.Add"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,49 +21,47 @@ else
 | 
			
		||||
    <TabPanel Name="Identity" ResourceKey="Identity">
 | 
			
		||||
        @if (PageState.User != null)
 | 
			
		||||
        {
 | 
			
		||||
            <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="username" HelpText="Your username. Note that this field can not be modified." ResourceKey="Username"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="username" class="form-control" @bind="@username" readonly />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="password" HelpText="If you wish to change your password you can enter it here. Please choose a sufficiently secure password." ResourceKey="Password"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="password" type="password" class="form-control" @bind="@password" autocomplete="new-password" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="confirm" HelpText="If you are changing your password you must enter it again to confirm it matches" ResourceKey="Confirm"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="confirm" type="password" class="form-control" @bind="@confirm" autocomplete="new-password" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="email" HelpText="Your email address where you wish to receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="email" class="form-control" @bind="@email" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="displayname" HelpText="Your full name" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="displayname" class="form-control" @bind="@displayname" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="@photofileid.ToString()" HelpText="A photo of yourself" ResourceKey="Photo"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <FileManager FileId="@photofileid" @ref="filemanager" />
 | 
			
		||||
                        </div>
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="username" HelpText="Your username. Note that this field can not be modified." ResourceKey="Username"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="username" class="form-control" @bind="@username" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <br />
 | 
			
		||||
                <button type="button" class="btn btn-success" @onclick="Save">@SharedLocalizer["Save"]</button>
 | 
			
		||||
                <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
            </form>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="password" HelpText="If you wish to change your password you can enter it here. Please choose a sufficiently secure password." ResourceKey="Password"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="password" type="password" class="form-control" @bind="@password" autocomplete="new-password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="confirm" HelpText="If you are changing your password you must enter it again to confirm it matches" ResourceKey="Confirm"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="confirm" type="password" class="form-control" @bind="@confirm" autocomplete="new-password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="email" HelpText="Your email address where you wish to receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="email" class="form-control" @bind="@email" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="displayname" HelpText="Your full name" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="displayname" class="form-control" @bind="@displayname" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="@photofileid.ToString()" HelpText="A photo of yourself" ResourceKey="Photo"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@photofileid" @ref="filemanager" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <br />
 | 
			
		||||
            <button type="button" class="btn btn-success" @onclick="Save">@SharedLocalizer["Save"]</button>
 | 
			
		||||
            <button type="button" class="btn btn-secondary" @onclick="Cancel">@SharedLocalizer["Cancel"]</button>
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Profile" ResourceKey="Profile">
 | 
			
		||||
@ -134,11 +132,11 @@ else
 | 
			
		||||
            {
 | 
			
		||||
                <Pager Items="@notifications">
 | 
			
		||||
                    <Header>
 | 
			
		||||
                        <th style="width: 1px;"> </th>
 | 
			
		||||
                        <th style="width: 1px;"> </th>
 | 
			
		||||
                        <th>@Localizer["From"]</th>
 | 
			
		||||
                        <th>@Localizer["Subject"]</th>
 | 
			
		||||
                        <th>@Localizer["Received"]</th>
 | 
			
		||||
                    <th style="width: 1px;"> </th>
 | 
			
		||||
                    <th style="width: 1px;"> </th>
 | 
			
		||||
                    <th>@Localizer["From"]</th>
 | 
			
		||||
                    <th>@Localizer["Subject"]</th>
 | 
			
		||||
                    <th>@Localizer["Received"]</th>
 | 
			
		||||
                    </Header>
 | 
			
		||||
                    <Row>
 | 
			
		||||
                        <td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" ResourceKey="ViewNotification" /></td>
 | 
			
		||||
@ -167,11 +165,11 @@ else
 | 
			
		||||
            {
 | 
			
		||||
                <Pager Items="@notifications">
 | 
			
		||||
                    <Header>
 | 
			
		||||
                        <th> </th>
 | 
			
		||||
                        <th> </th>
 | 
			
		||||
                        <th>@Localizer["To"]</th>
 | 
			
		||||
                        <th>@Localizer["Subject"]</th>
 | 
			
		||||
                        <th>@Localizer["Sent"]</th>
 | 
			
		||||
                    <th> </th>
 | 
			
		||||
                    <th> </th>
 | 
			
		||||
                    <th>@Localizer["To"]</th>
 | 
			
		||||
                    <th>@Localizer["Subject"]</th>
 | 
			
		||||
                    <th>@Localizer["Sent"]</th>
 | 
			
		||||
                    </Header>
 | 
			
		||||
                    <Row>
 | 
			
		||||
                        <td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" ResourceKey="ViewNotification" /></td>
 | 
			
		||||
@ -206,8 +204,6 @@ else
 | 
			
		||||
</TabStrip>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string username = string.Empty;
 | 
			
		||||
    private string password = string.Empty;
 | 
			
		||||
    private string confirm = string.Empty;
 | 
			
		||||
@ -273,52 +269,43 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task Save()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (username != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
            {
 | 
			
		||||
                if (username != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
                if (password == confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    if (password == confirm)
 | 
			
		||||
                    var user = PageState.User;
 | 
			
		||||
                    user.Username = username;
 | 
			
		||||
                    user.Password = password;
 | 
			
		||||
                    user.Email = email;
 | 
			
		||||
                    user.DisplayName = (displayname == string.Empty ? username : displayname);
 | 
			
		||||
                    user.PhotoFileId = filemanager.GetFileId();
 | 
			
		||||
                    if (user.PhotoFileId == -1)
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = PageState.User;
 | 
			
		||||
                        user.Username = username;
 | 
			
		||||
                        user.Password = password;
 | 
			
		||||
                        user.Email = email;
 | 
			
		||||
                        user.DisplayName = (displayname == string.Empty ? username : displayname);
 | 
			
		||||
                        user.PhotoFileId = filemanager.GetFileId();
 | 
			
		||||
                        if (user.PhotoFileId == -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            user.PhotoFileId = null;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        await UserService.UpdateUserAsync(user);
 | 
			
		||||
                        await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
 | 
			
		||||
                        await logger.LogInformation("User Profile Saved");
 | 
			
		||||
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Password.Invalid"], MessageType.Warning);
 | 
			
		||||
                        user.PhotoFileId = null;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    await UserService.UpdateUserAsync(user);
 | 
			
		||||
                    await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
 | 
			
		||||
                    await logger.LogInformation("User Profile Saved");
 | 
			
		||||
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Password.Invalid"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving User Profile {Error}", ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving User Profile {Error}", ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,91 +7,86 @@
 | 
			
		||||
@inject IStringLocalizer<Add> Localizer
 | 
			
		||||
@inject IStringLocalizer<SharedResources> SharedLocalizer
 | 
			
		||||
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Identity" ResourceKey="Identity">
 | 
			
		||||
            @if (profiles != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="username" HelpText="A unique username for a user. Note that this field can not be modified once it is saved." ResourceKey="Username"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="username" class="form-control" @bind="@username" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="password" HelpText="The user's password. Please choose a password which is sufficiently secure." ResourceKey="Password"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="password" type="password" class="form-control" @bind="@password" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="confirm" HelpText="Please enter the password again to confirm it matches with the value above" ResourceKey="Confirm"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="confirm" type="password" class="form-control" @bind="@confirm" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="email" HelpText="The email address where the user will receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="email" class="form-control" @bind="@email" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="displayname" HelpText="The full name of the user" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="displayname" class="form-control" @bind="@displayname" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Identity" ResourceKey="Identity">
 | 
			
		||||
        @if (profiles != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="username" HelpText="A unique username for a user. Note that this field can not be modified once it is saved." ResourceKey="Username"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="username" class="form-control" @bind="@username" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="password" HelpText="The user's password. Please choose a password which is sufficiently secure." ResourceKey="Password"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="password" type="password" class="form-control" @bind="@password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="confirm" HelpText="Please enter the password again to confirm it matches with the value above" ResourceKey="Confirm"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="confirm" type="password" class="form-control" @bind="@confirm" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="email" HelpText="The email address where the user will receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="email" class="form-control" @bind="@email" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="displayname" HelpText="The full name of the user" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="displayname" class="form-control" @bind="@displayname" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Profile" ResourceKey="Profile">
 | 
			
		||||
            @if (profiles != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        @foreach (Profile profile in profiles)
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Profile" ResourceKey="Profile">
 | 
			
		||||
        @if (profiles != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    @foreach (Profile profile in profiles)
 | 
			
		||||
                    {
 | 
			
		||||
                        var p = profile;
 | 
			
		||||
                        if (p.Category != category)
 | 
			
		||||
                        {
 | 
			
		||||
                            var p = profile;
 | 
			
		||||
                            if (p.Category != category)
 | 
			
		||||
                            {
 | 
			
		||||
                                <div class="col text-center pb-2">
 | 
			
		||||
                                    <strong>@p.Category</strong>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                category = p.Category;
 | 
			
		||||
                            }
 | 
			
		||||
                            <div class="row mb-1 align-items-center">
 | 
			
		||||
                                <Label Class="col-sm-3" For="@p.Name" HelpText="@p.Description">@p.Title</Label>
 | 
			
		||||
                                <div class="col-sm-9">
 | 
			
		||||
                                    @if (p.IsRequired)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                    }
 | 
			
		||||
                                </div>
 | 
			
		||||
                            <div class="col text-center pb-2">
 | 
			
		||||
                                <strong>@p.Category</strong>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            category = p.Category;
 | 
			
		||||
                        }
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="@p.Name" HelpText="@p.Description">@p.Title</Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                @if (p.IsRequired)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                }
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveUser">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
</form>
 | 
			
		||||
            </div>
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
</TabStrip>
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveUser">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private string username = string.Empty;
 | 
			
		||||
    private string password = string.Empty;
 | 
			
		||||
    private string confirm = string.Empty;
 | 
			
		||||
@ -122,65 +117,56 @@
 | 
			
		||||
 | 
			
		||||
    private async Task SaveUser()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (username != string.Empty && password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
            {
 | 
			
		||||
                if (username != string.Empty && password != string.Empty && confirm != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
                if (password == confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    if (password == confirm)
 | 
			
		||||
                    var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
 | 
			
		||||
                    if (user == null)
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
 | 
			
		||||
                        if (user == null)
 | 
			
		||||
                        user = new User();
 | 
			
		||||
                        user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                        user.Username = username;
 | 
			
		||||
                        user.Password = password;
 | 
			
		||||
                        user.Email = email;
 | 
			
		||||
                        user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
 | 
			
		||||
                        user.PhotoFileId = null;
 | 
			
		||||
 | 
			
		||||
                        user = await UserService.AddUserAsync(user);
 | 
			
		||||
 | 
			
		||||
                        if (user != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            user = new User();
 | 
			
		||||
                            user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                            user.Username = username;
 | 
			
		||||
                            user.Password = password;
 | 
			
		||||
                            user.Email = email;
 | 
			
		||||
                            user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
 | 
			
		||||
                            user.PhotoFileId = null;
 | 
			
		||||
 | 
			
		||||
                            user = await UserService.AddUserAsync(user);
 | 
			
		||||
 | 
			
		||||
                            if (user != null)
 | 
			
		||||
                            {
 | 
			
		||||
                                await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
 | 
			
		||||
                                await logger.LogInformation("User Created {User}", user);
 | 
			
		||||
                                NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                            }
 | 
			
		||||
                            else
 | 
			
		||||
                            {
 | 
			
		||||
                                await logger.LogError("Error Adding User {Username} {Email}", username, email);
 | 
			
		||||
                                AddModuleMessage(Localizer["Error.User.AddCheckPass"], MessageType.Error);
 | 
			
		||||
                            }
 | 
			
		||||
                            await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
 | 
			
		||||
                            await logger.LogInformation("User Created {User}", user);
 | 
			
		||||
                            NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            AddModuleMessage(Localizer["Message.Username.Exists"], MessageType.Warning);
 | 
			
		||||
                            await logger.LogError("Error Adding User {Username} {Email}", username, email);
 | 
			
		||||
                            AddModuleMessage(Localizer["Error.User.AddCheckPass"], MessageType.Error);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Username.Exists"], MessageType.Warning);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", username, email, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", username, email, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -16,106 +16,102 @@ else
 | 
			
		||||
{
 | 
			
		||||
    <br />
 | 
			
		||||
}
 | 
			
		||||
<form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
    <TabStrip>
 | 
			
		||||
        <TabPanel Name="Identity" ResourceKey="Identity">
 | 
			
		||||
            @if (profiles != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="username" HelpText="The unique username for a user. Note that this field can not be modified." ResourceKey="Username"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="username" class="form-control" @bind="@username" readonly />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="password" HelpText="The user's password. Please choose a password which is sufficiently secure." ResourceKey="Password"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="password" type="password" class="form-control" @bind="@password" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="confirm" HelpText="Please enter the password again to confirm it matches with the value above" ResourceKey="Confirm"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="confirm" type="password" class="form-control" @bind="@confirm" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="email" HelpText="The email address where the user will receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="email" class="form-control" @bind="@email" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="displayname" HelpText="The full name of the user" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <input id="displayname" class="form-control" @bind="@displayname" maxlength="256" required />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="@photofileid.ToString()" HelpText="A photo of the user" ResourceKey="Photo"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <FileManager FileId="@photofileid" @ref="filemanager" />
 | 
			
		||||
                        </div>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        <Label Class="col-sm-3" For="isdeleted" HelpText="Indicate if the user is active" ResourceKey="IsDeleted"></Label>
 | 
			
		||||
                        <div class="col-sm-9">
 | 
			
		||||
                            <select id="isdeleted" class="form-select" @bind="@isdeleted" required>
 | 
			
		||||
                                <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                                <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                            </select>
 | 
			
		||||
                        </div>
 | 
			
		||||
<TabStrip>
 | 
			
		||||
    <TabPanel Name="Identity" ResourceKey="Identity">
 | 
			
		||||
        @if (profiles != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="username" HelpText="The unique username for a user. Note that this field can not be modified." ResourceKey="Username"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="username" class="form-control" @bind="@username" readonly />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="password" HelpText="The user's password. Please choose a password which is sufficiently secure." ResourceKey="Password"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="password" type="password" class="form-control" @bind="@password" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="confirm" HelpText="Please enter the password again to confirm it matches with the value above" ResourceKey="Confirm"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="confirm" type="password" class="form-control" @bind="@confirm" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="email" HelpText="The email address where the user will receive notifications" ResourceKey="Email"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="email" class="form-control" @bind="@email" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="displayname" HelpText="The full name of the user" ResourceKey="DisplayName"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <input id="displayname" class="form-control" @bind="@displayname" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="@photofileid.ToString()" HelpText="A photo of the user" ResourceKey="Photo"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <FileManager FileId="@photofileid" @ref="filemanager" />
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    <Label Class="col-sm-3" For="isdeleted" HelpText="Indicate if the user is active" ResourceKey="IsDeleted"></Label>
 | 
			
		||||
                    <div class="col-sm-9">
 | 
			
		||||
                        <select id="isdeleted" class="form-select" @bind="@isdeleted">
 | 
			
		||||
                            <option value="True">@SharedLocalizer["Yes"]</option>
 | 
			
		||||
                            <option value="False">@SharedLocalizer["No"]</option>
 | 
			
		||||
                        </select>
 | 
			
		||||
                    </div>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
        <TabPanel Name="Profile" ResourceKey="Profile">
 | 
			
		||||
            @if (profiles != null)
 | 
			
		||||
            {
 | 
			
		||||
                <div class="container">
 | 
			
		||||
                    <div class="row mb-1 align-items-center">
 | 
			
		||||
                        @foreach (Profile profile in profiles)
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
    <TabPanel Name="Profile" ResourceKey="Profile">
 | 
			
		||||
        @if (profiles != null)
 | 
			
		||||
        {
 | 
			
		||||
            <div class="container">
 | 
			
		||||
                <div class="row mb-1 align-items-center">
 | 
			
		||||
                    @foreach (Profile profile in profiles)
 | 
			
		||||
                    {
 | 
			
		||||
                        var p = profile;
 | 
			
		||||
                        if (p.Category != category)
 | 
			
		||||
                        {
 | 
			
		||||
                            var p = profile;
 | 
			
		||||
                            if (p.Category != category)
 | 
			
		||||
                            {
 | 
			
		||||
                                <div class="col text-center pb-2">
 | 
			
		||||
                                    <strong>@p.Category</strong>
 | 
			
		||||
                                </div>
 | 
			
		||||
                                category = p.Category;
 | 
			
		||||
                            }
 | 
			
		||||
                            <div class="row mb-1 align-items-center">
 | 
			
		||||
                                <Label Class="col-sm-3" For="@p.Name" HelpText="@p.Description">@p.Title</Label>
 | 
			
		||||
                                <div class="col-sm-9">
 | 
			
		||||
                                    @if (p.IsRequired)
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                    }
 | 
			
		||||
                                    else
 | 
			
		||||
                                    {
 | 
			
		||||
                                        <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                    }
 | 
			
		||||
                                </div>
 | 
			
		||||
                            <div class="col text-center pb-2">
 | 
			
		||||
                                <strong>@p.Category</strong>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            category = p.Category;
 | 
			
		||||
                        }
 | 
			
		||||
                    </div>
 | 
			
		||||
                        <div class="row mb-1 align-items-center">
 | 
			
		||||
                            <Label Class="col-sm-3" For="@p.Name" HelpText="@p.Description">@p.Title</Label>
 | 
			
		||||
                            <div class="col-sm-9">
 | 
			
		||||
                                @if (p.IsRequired)
 | 
			
		||||
                                {
 | 
			
		||||
                                    <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" required @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                }
 | 
			
		||||
                                else
 | 
			
		||||
                                {
 | 
			
		||||
                                    <input id="@p.Name" class="form-control" maxlength="@p.MaxLength" value="@GetProfileValue(p.Name, p.DefaultValue)" @onchange="@(e => ProfileChanged(e, p.Name))" />
 | 
			
		||||
                                }
 | 
			
		||||
                            </div>
 | 
			
		||||
                        </div>
 | 
			
		||||
                    }
 | 
			
		||||
                </div>
 | 
			
		||||
            }
 | 
			
		||||
        </TabPanel>
 | 
			
		||||
    </TabStrip>
 | 
			
		||||
            </div>
 | 
			
		||||
        }
 | 
			
		||||
    </TabPanel>
 | 
			
		||||
</TabStrip>
 | 
			
		||||
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveUser">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
 | 
			
		||||
</form>
 | 
			
		||||
<button type="button" class="btn btn-success" @onclick="SaveUser">@SharedLocalizer["Save"]</button>
 | 
			
		||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
<br />
 | 
			
		||||
<br />
 | 
			
		||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private int userid;
 | 
			
		||||
    private string username = string.Empty;
 | 
			
		||||
    private string password = string.Empty;
 | 
			
		||||
@ -186,56 +182,47 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task SaveUser()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (username != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
            {
 | 
			
		||||
                if (username != string.Empty && email != string.Empty && ValidateProfiles())
 | 
			
		||||
                if (password == confirm)
 | 
			
		||||
                {
 | 
			
		||||
                    if (password == confirm)
 | 
			
		||||
                    var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
 | 
			
		||||
                    user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                    user.Username = username;
 | 
			
		||||
                    user.Password = password;
 | 
			
		||||
                    user.Email = email;
 | 
			
		||||
                    user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
 | 
			
		||||
                    user.PhotoFileId = null;
 | 
			
		||||
                    user.PhotoFileId = filemanager.GetFileId();
 | 
			
		||||
                    if (user.PhotoFileId == -1)
 | 
			
		||||
                    {
 | 
			
		||||
                        var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
 | 
			
		||||
                        user.SiteId = PageState.Site.SiteId;
 | 
			
		||||
                        user.Username = username;
 | 
			
		||||
                        user.Password = password;
 | 
			
		||||
                        user.Email = email;
 | 
			
		||||
                        user.DisplayName = string.IsNullOrWhiteSpace(displayname) ? username : displayname;
 | 
			
		||||
                        user.PhotoFileId = null;
 | 
			
		||||
                        user.PhotoFileId = filemanager.GetFileId();
 | 
			
		||||
                        if (user.PhotoFileId == -1)
 | 
			
		||||
                        {
 | 
			
		||||
                            user.PhotoFileId = null;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        user.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
 | 
			
		||||
 | 
			
		||||
                        user = await UserService.UpdateUserAsync(user);
 | 
			
		||||
                        await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
 | 
			
		||||
                        await logger.LogInformation("User Saved {User}", user);
 | 
			
		||||
 | 
			
		||||
                        NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    user.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
 | 
			
		||||
 | 
			
		||||
                    user = await UserService.UpdateUserAsync(user);
 | 
			
		||||
                    await SettingService.UpdateUserSettingsAsync(settings, user.UserId);
 | 
			
		||||
                    await logger.LogInformation("User Saved {User}", user);
 | 
			
		||||
 | 
			
		||||
                    NavigationManager.NavigateTo(NavigateUrl());
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving User {Username} {Email} {Error}", username, email, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.Save"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving User {Username} {Email} {Error}", username, email, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.Save"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,69 +12,65 @@
 | 
			
		||||
}
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
    <form @ref="form" class="@(validated ? "was-validated" : "needs-validation")" novalidate>
 | 
			
		||||
        <div class="container">
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="user" HelpText="The user you are assigning roles to" ResourceKey="User">User: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="user" class="form-control" @bind="@name" disabled />
 | 
			
		||||
                </div>
 | 
			
		||||
    <div class="container">
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="user" HelpText="The user you are assigning roles to" ResourceKey="User">User: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="user" class="form-control" @bind="@name" disabled />
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="role" HelpText="Select a role" ResourceKey="Role">Role: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <select id="role" class="form-select" @bind="@roleid" required>
 | 
			
		||||
                        <option value="-1"><@Localizer["Role.Select"]></option>
 | 
			
		||||
                        @foreach (Role role in roles)
 | 
			
		||||
                        {
 | 
			
		||||
                            <option value="@(role.RoleId)">@role.Name</option>
 | 
			
		||||
                        }
 | 
			
		||||
                    </select>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="effectiveDate" class="form-control" @bind="@effectivedate" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="row mb-1 align-items-center">
 | 
			
		||||
                <Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
 | 
			
		||||
                <div class="col-sm-9">
 | 
			
		||||
                    <input id="expiryDate" class="form-control" @bind="@expirydate" required />
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 | 
			
		||||
        </div>
 | 
			
		||||
        <br />
 | 
			
		||||
        <br />
 | 
			
		||||
        <button type="button" class="btn btn-success" @onclick="SaveUserRole">@SharedLocalizer["Save"]</button>
 | 
			
		||||
        <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
        <hr class="app-rule" />
 | 
			
		||||
        <p align="center">
 | 
			
		||||
            <Pager Items="@userroles">
 | 
			
		||||
                <Header>
 | 
			
		||||
                    <th>@Localizer["Roles"]</th>
 | 
			
		||||
                    <th>@Localizer["Effective"]</th>
 | 
			
		||||
                    <th>@Localizer["Expiry"]</th>
 | 
			
		||||
                    <th> </th>
 | 
			
		||||
                </Header>
 | 
			
		||||
                <Row>
 | 
			
		||||
                    <td>@context.Role.Name</td>
 | 
			
		||||
                    <td>@context.EffectiveDate</td>
 | 
			
		||||
                    <td>@context.ExpiryDate</td>
 | 
			
		||||
                    <td>
 | 
			
		||||
                        <ActionDialog Header="Remove Role" Message="@string.Format(Localizer["Confirm.User.RemoveRole"], context.Role.Name)" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || (context.Role.Name == RoleNames.Host && userid == PageState.User.UserId))" ResourceKey="DeleteUserRole" />
 | 
			
		||||
                    </td>
 | 
			
		||||
                </Row>
 | 
			
		||||
            </Pager>
 | 
			
		||||
        </p>
 | 
			
		||||
    </form>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="role" HelpText="Select a role" ResourceKey="Role">Role: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <select id="role" class="form-select" @bind="@roleid">
 | 
			
		||||
                    <option value="-1"><@Localizer["Role.Select"]></option>
 | 
			
		||||
                    @foreach (Role role in roles)
 | 
			
		||||
                    {
 | 
			
		||||
                        <option value="@(role.RoleId)">@role.Name</option>
 | 
			
		||||
                    }
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="effectiveDate" class="form-control" @bind="@effectivedate" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="row mb-1 align-items-center">
 | 
			
		||||
            <Label Class="col-sm-3" For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
 | 
			
		||||
            <div class="col-sm-9">
 | 
			
		||||
                <input id="expiryDate" class="form-control" @bind="@expirydate" />
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <br />
 | 
			
		||||
    <br />
 | 
			
		||||
    <button type="button" class="btn btn-success" @onclick="SaveUserRole">@SharedLocalizer["Save"]</button>
 | 
			
		||||
    <NavLink class="btn btn-secondary" href="@NavigateUrl()">@SharedLocalizer["Cancel"]</NavLink>
 | 
			
		||||
    <hr class="app-rule" />
 | 
			
		||||
    <p align="center">
 | 
			
		||||
        <Pager Items="@userroles">
 | 
			
		||||
            <Header>
 | 
			
		||||
            <th>@Localizer["Roles"]</th>
 | 
			
		||||
            <th>@Localizer["Effective"]</th>
 | 
			
		||||
            <th>@Localizer["Expiry"]</th>
 | 
			
		||||
            <th> </th>
 | 
			
		||||
            </Header>
 | 
			
		||||
            <Row>
 | 
			
		||||
                <td>@context.Role.Name</td>
 | 
			
		||||
                <td>@context.EffectiveDate</td>
 | 
			
		||||
                <td>@context.ExpiryDate</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <ActionDialog Header="Remove Role" Message="@string.Format(Localizer["Confirm.User.RemoveRole"], context.Role.Name)" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUserRole(context.UserRoleId))" Disabled="@(context.Role.IsAutoAssigned || (context.Role.Name == RoleNames.Host && userid == PageState.User.UserId))" ResourceKey="DeleteUserRole" />
 | 
			
		||||
                </td>
 | 
			
		||||
            </Row>
 | 
			
		||||
        </Pager>
 | 
			
		||||
    </p>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@code {
 | 
			
		||||
    private ElementReference form;
 | 
			
		||||
    private bool validated = false;
 | 
			
		||||
    private int userid;
 | 
			
		||||
    private string name = string.Empty;
 | 
			
		||||
    private List<Role> roles;
 | 
			
		||||
@ -126,82 +122,73 @@ else
 | 
			
		||||
 | 
			
		||||
    private async Task SaveUserRole()
 | 
			
		||||
    {
 | 
			
		||||
        validated = true;
 | 
			
		||||
        var interop = new Interop(JSRuntime);
 | 
			
		||||
        if (await interop.FormValid(form))
 | 
			
		||||
        try
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            if (roleid != -1)
 | 
			
		||||
            {
 | 
			
		||||
                if (roleid != -1)
 | 
			
		||||
                var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
 | 
			
		||||
                if (userrole != null)
 | 
			
		||||
                {
 | 
			
		||||
                    var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
 | 
			
		||||
                    if (userrole != null)
 | 
			
		||||
                    if (string.IsNullOrEmpty(effectivedate))
 | 
			
		||||
                    {
 | 
			
		||||
                        if (string.IsNullOrEmpty(effectivedate))
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.EffectiveDate = null;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.EffectiveDate = DateTime.Parse(effectivedate);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (string.IsNullOrEmpty(expirydate))
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.ExpiryDate = null;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.ExpiryDate = DateTime.Parse(expirydate);
 | 
			
		||||
                        }
 | 
			
		||||
                        await UserRoleService.UpdateUserRoleAsync(userrole);
 | 
			
		||||
                        userrole.EffectiveDate = null;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole = new UserRole();
 | 
			
		||||
                        userrole.UserId = userid;
 | 
			
		||||
                        userrole.RoleId = roleid;
 | 
			
		||||
 | 
			
		||||
                        if (string.IsNullOrEmpty(effectivedate))
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.EffectiveDate = null;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.EffectiveDate = DateTime.Parse(effectivedate);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (string.IsNullOrEmpty(expirydate))
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.ExpiryDate = null;
 | 
			
		||||
                        }
 | 
			
		||||
                        else
 | 
			
		||||
                        {
 | 
			
		||||
                            userrole.ExpiryDate = DateTime.Parse(expirydate);
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        await UserRoleService.AddUserRoleAsync(userrole);
 | 
			
		||||
                        userrole.EffectiveDate = DateTime.Parse(effectivedate);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
 | 
			
		||||
                    AddModuleMessage(Localizer["Success.User.AssignRole"], MessageType.Success);
 | 
			
		||||
                    await GetUserRoles();
 | 
			
		||||
                    StateHasChanged();
 | 
			
		||||
                    if (string.IsNullOrEmpty(expirydate))
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.ExpiryDate = null;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.ExpiryDate = DateTime.Parse(expirydate);
 | 
			
		||||
                    }
 | 
			
		||||
                    await UserRoleService.UpdateUserRoleAsync(userrole);
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    AddModuleMessage(Localizer["Message.Required.Role"], MessageType.Warning);
 | 
			
		||||
                    userrole = new UserRole();
 | 
			
		||||
                    userrole.UserId = userid;
 | 
			
		||||
                    userrole.RoleId = roleid;
 | 
			
		||||
 | 
			
		||||
                    if (string.IsNullOrEmpty(effectivedate))
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.EffectiveDate = null;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.EffectiveDate = DateTime.Parse(effectivedate);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    if (string.IsNullOrEmpty(expirydate))
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.ExpiryDate = null;
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
                        userrole.ExpiryDate = DateTime.Parse(expirydate);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    await UserRoleService.AddUserRoleAsync(userrole);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
 | 
			
		||||
                AddModuleMessage(Localizer["Success.User.AssignRole"], MessageType.Success);
 | 
			
		||||
                await GetUserRoles();
 | 
			
		||||
                StateHasChanged();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                await logger.LogError(ex, "Error Saving User Roles {UserId} {Error}", userid, ex.Message);
 | 
			
		||||
                AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
 | 
			
		||||
                AddModuleMessage(Localizer["Message.Required.Role"], MessageType.Warning);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        catch (Exception ex)
 | 
			
		||||
        {
 | 
			
		||||
            AddModuleMessage(SharedLocalizer["Message.InfoRequired"], MessageType.Warning);
 | 
			
		||||
            await logger.LogError(ex, "Error Saving User Roles {UserId} {Error}", userid, ex.Message);
 | 
			
		||||
            AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user