Merge pull request #1142 from oqtane/dev
merge dev with master for 2.0.1 release
This commit is contained in:
commit
0d6413e8a5
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ Oqtane.Server/Data/*.mdf
|
|||
Oqtane.Server/Data/*.ldf
|
||||
|
||||
/Oqtane.Server/Properties/PublishProfiles/FolderProfile.pubxml
|
||||
Oqtane.Server/Content
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Modules.Admin.Dashboard
|
||||
@namespace Oqtane.Modules.Admin.Dashboard
|
||||
@inherits ModuleBase
|
||||
@inject IPageService PageService
|
||||
@inject IUserService UserService
|
||||
|
@ -11,7 +11,7 @@
|
|||
string url = NavigateUrl(p.Path);
|
||||
<div class="col-md-2 mx-auto text-center">
|
||||
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
||||
<h2><span class="oi oi-@p.Icon" aria-hidden="true"></span></h2>@p.Name
|
||||
<h2><span class="@p.Icon" aria-hidden="true"></span></h2>@p.Name
|
||||
</NavLink>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
@namespace Oqtane.Modules.Admin.Error
|
||||
@namespace Oqtane.Modules.Admin.Error
|
||||
@inherits ModuleBase
|
||||
@inject IModuleService ModuleService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous;
|
||||
|
@ -10,10 +11,10 @@
|
|||
Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId);
|
||||
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||
{
|
||||
string message = "A Problem Was Encountered Loading Module " + module.ModuleDefinitionName;
|
||||
string message = Localizer["A Problem Was Encountered Loading Module {0}", module.ModuleDefinitionName];
|
||||
AddModuleMessage(message, MessageType.Error);
|
||||
}
|
||||
|
||||
|
||||
await logger.LogCritical("Error Loading Module {Module}", module);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
@namespace Oqtane.Modules.Admin.Files
|
||||
@namespace Oqtane.Modules.Admin.Files
|
||||
@using System.IO
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IFileService FileService
|
||||
@inject IFolderService FolderService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Upload" Heading="Upload Files">
|
||||
<TabPanel Name="Upload" Heading="Upload Files" ResourceKey="UploadFiles">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="upload" HelpText="Upload the file you want">Upload: </Label>
|
||||
<Label For="upload" HelpText="Upload the file you want" ResourceKey="Upload">Upload: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager UploadMultiple="true" ShowFiles="false" FolderId="@_folderId" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Download" Heading="Download Files">
|
||||
<TabPanel Name="Download" Heading="Download Files" ResourceKey="DownloadFiles">
|
||||
@if (_folders != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="url" HelpText="Enter the url of the file you wish to download">Url: </Label>
|
||||
<Label For="url" HelpText="Enter the url of the file you wish to download" ResourceKey="Url">Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@url" />
|
||||
|
@ -33,11 +34,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="folder" HelpText="Select the folder to save the file in">Folder: </Label>
|
||||
<Label For="folder" HelpText="Select the folder to save the file in" ResourceKey="Folder">Folder: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="folder" class="form-control" @bind="@_folderId">
|
||||
<option value="-1"><Select Folder></option>
|
||||
<option value="-1"><@Localizer["Select Folder"]></option>
|
||||
@foreach (Folder folder in _folders)
|
||||
{
|
||||
<option value="@(folder.FolderId)">@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||
|
@ -46,8 +47,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Download">Download</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="Download">@Localizer["Download"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
|
@ -73,7 +74,7 @@
|
|||
{
|
||||
if (url == string.Empty || _folderId == -1)
|
||||
{
|
||||
AddModuleMessage("You Must Enter A Url And Select A Folder", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Enter A Url And Select A Folder"], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -81,14 +82,14 @@
|
|||
|
||||
if (!Constants.UploadableFiles.Split(',')
|
||||
.Contains(Path.GetExtension(filename).ToLower().Replace(".", "")))
|
||||
{
|
||||
AddModuleMessage("File Could Not Be Downloaded From Url Due To Its File Extension", MessageType.Warning);
|
||||
return ;
|
||||
}
|
||||
{
|
||||
AddModuleMessage(Localizer["File Could Not Be Downloaded From Url Due To Its File Extension"], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filename.IsPathOrFileValid())
|
||||
{
|
||||
AddModuleMessage("You Must Enter A Url With A Valid File Name", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Enter A Url With A Valid File Name"], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -96,12 +97,12 @@
|
|||
{
|
||||
await FileService.UploadFileAsync(url, _folderId);
|
||||
await logger.LogInformation("File Downloaded Successfully From Url {Url}", url);
|
||||
AddModuleMessage("File Downloaded Successfully From Url", MessageType.Success);
|
||||
AddModuleMessage(Localizer["File Downloaded Successfully From Url"], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading File From Url {Url} {Error}", url, ex.Message);
|
||||
AddModuleMessage("Error Downloading File From Url. Please Verify That The Url Is Valid.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading File From Url. Please Verify That The Url Is Valid."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
@namespace Oqtane.Modules.Admin.Files
|
||||
@namespace Oqtane.Modules.Admin.Files
|
||||
@inherits ModuleBase
|
||||
@inject IFileService FileService
|
||||
@inject IFolderService FolderService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Details> Localizer
|
||||
|
||||
@if (_folders != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label for="name" HelpText="The name of the file">Name: </Label>
|
||||
<Label for="name" HelpText="The name of the file" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -17,7 +18,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="parent" HelpText="The folder where the file is located">Folder: </Label>
|
||||
<Label For="parent" HelpText="The folder where the file is located" ResourceKey="Folder">Folder: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="parent" class="form-control" @bind="@_folderId">
|
||||
|
@ -30,15 +31,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label for="size" HelpText="The size of the file (in bytes)">Size: </Label>
|
||||
<Label for="size" HelpText="The size of the file (in bytes)" ResourceKey="Size">Size: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="size" class="form-control" @bind="@_size" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveFile">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveFile">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@_createdBy" CreatedOn="@_createdOn" ModifiedBy="@_modifiedBy" ModifiedOn="@_modifiedOn"></AuditInfo>
|
||||
|
@ -80,7 +81,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading File {FileId} {Error}", _fileId, ex.Message);
|
||||
AddModuleMessage("Error Loading File", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading File"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,13 +100,13 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("File Name Not Valid", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["File Name Not Valid"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving File {FileId} {Error}", _fileId, ex.Message);
|
||||
AddModuleMessage("Error Saving File", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving File"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
@namespace Oqtane.Modules.Admin.Files
|
||||
@namespace Oqtane.Modules.Admin.Files
|
||||
@inherits ModuleBase
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
@if (_folders != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="parent" HelpText="Select the parent folder">Parent: </Label>
|
||||
<Label For="parent" HelpText="Select the parent folder" ResourceKey="Parent">Parent: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="parent" class="form-control" @bind="@_parentId">
|
||||
@if (PageState.QueryString.ContainsKey("id"))
|
||||
{
|
||||
<option value="-1"><No Parent></option>
|
||||
<option value="-1"><@Localizer["No Parent"]></option>
|
||||
}
|
||||
@foreach (Folder folder in _folders)
|
||||
{
|
||||
|
@ -26,7 +27,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label for="name" HelpText="Enter the folder name">Name: </Label>
|
||||
<Label for="name" HelpText="Enter the folder name" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -34,19 +35,19 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="center">
|
||||
<Label For="permissions" HelpText="Select the permissions you want for the folder">Permissions: </Label>
|
||||
<Label For="permissions" HelpText="Select the permissions you want for the folder" ResourceKey="Permissions">Permissions: </Label>
|
||||
<PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@if (!_isSystem)
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick="SaveFolder">Save</button>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveFolder">@Localizer["Save"]</button>
|
||||
}
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
@if (!_isSystem && PageState.QueryString.ContainsKey("id"))
|
||||
{
|
||||
<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())" />
|
||||
<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 />
|
||||
|
@ -107,7 +108,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Folder {FolderId} {Error}", _folderId, ex.Message);
|
||||
AddModuleMessage("Error Loading Folder", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Folder"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,13 +116,13 @@
|
|||
{
|
||||
if (_name == string.Empty || _parentId == -1)
|
||||
{
|
||||
AddModuleMessage("Folders Must Have A Parent And A Name", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Folders Must Have A Parent And A Name"], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_name.IsPathOrFileValid())
|
||||
{
|
||||
AddModuleMessage("Folder Name Not Valid.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Folder Name Not Valid."], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -169,13 +170,13 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("An Error Was Encountered Saving The Folder", MessageType.Error);
|
||||
AddModuleMessage(Localizer["An Error Was Encountered Saving The Folder"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message);
|
||||
AddModuleMessage("Error Saving Folder", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Folder"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -203,18 +204,18 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Folder Has Files And Cannot Be Deleted", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Folder Has Files And Cannot Be Deleted"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Folder Has Subfolders And Cannot Be Deleted", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Folder Has Subfolders And Cannot Be Deleted"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Folder {Folder} {Error}", _folderId, ex.Message);
|
||||
AddModuleMessage("Error Deleting Folder", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Folder"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
@namespace Oqtane.Modules.Admin.Files
|
||||
@namespace Oqtane.Modules.Admin.Files
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_files != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Folder: </label>
|
||||
<label class="control-label">@Localizer["Folder:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
||||
|
@ -20,9 +21,9 @@
|
|||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<ActionLink Action="Edit" Text="Edit Folder" Class="btn btn-secondary" Parameters="@($"id=" + _folderId.ToString())" />
|
||||
<ActionLink Action="Edit" Text="Add Folder" Class="btn btn-secondary" />
|
||||
<ActionLink Action="Add" Text="Upload Files" Parameters="@($"id=" + _folderId.ToString())" />
|
||||
<ActionLink Action="Edit" Text="Edit Folder" Class="btn btn-secondary" Parameters="@($"id=" + _folderId.ToString())" ResourceKey="EditFolder" />
|
||||
<ActionLink Action="Edit" Text="Add Folder" Class="btn btn-secondary" ResourceKey="AddFolder" />
|
||||
<ActionLink Action="Add" Text="Upload Files" Parameters="@($"id=" + _folderId.ToString())" ResourceKey="UploadFiles" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -30,23 +31,23 @@
|
|||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>Modified</th>
|
||||
<th>Type</th>
|
||||
<th>Size</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Modified"]</th>
|
||||
<th>@Localizer["Type"]</th>
|
||||
<th>@Localizer["Size"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Details" Text="Edit" Parameters="@($"id=" + context.FileId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete File" Message="@("Are You Sure You Wish To Delete " + context.Name + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFile(context))" /></td>
|
||||
<td><ActionLink Action="Details" Text="Edit" Parameters="@($"id=" + context.FileId.ToString())" ResourceKey="Details" /></td>
|
||||
<td><ActionDialog Header="Delete File" Message="@Localizer["Are You Sure You Wish To Delete {0}?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteFile(context))" ResourceKey="DeleteFile" /></td>
|
||||
<td><a href="@(ContentUrl(context.FileId))" target="_new">@context.Name</a></td>
|
||||
<td>@context.ModifiedOn</td>
|
||||
<td>@context.Extension.ToUpper() File</td>
|
||||
<td>@(context.Size / 1000) KB</td>
|
||||
<td>@context.Extension.ToUpper() @Localizer["File"]</td>
|
||||
<td>@string.Format("{0:0.00}", ((decimal)context.Size / 1000)) KB</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
@if (_files.Count == 0)
|
||||
{
|
||||
<div class="text-center">No Files Exist In Selected Folder</div>
|
||||
<div class="text-center">@Localizer["No Files Exist In Selected Folder"]</div>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +73,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Files", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Files"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +93,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Files", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Files"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,14 +103,14 @@
|
|||
{
|
||||
await FileService.DeleteFileAsync(file.FileId);
|
||||
await logger.LogInformation("File Deleted {File}", file.Name);
|
||||
AddModuleMessage("File " + file.Name + " Deleted", MessageType.Success);
|
||||
AddModuleMessage(Localizer["File {0} Deleted", file.Name], MessageType.Success);
|
||||
await GetFiles();
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting File {File} {Error}", file.Name, ex.Message);
|
||||
AddModuleMessage("Error Deleting File " + file.Name, MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting File {0}", file.Name], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,140 +0,0 @@
|
|||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IJobService JobService
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the job name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="type" HelpText="Enter the job type">Type: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="type" class="form-control" @bind="@_jobType" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="enabled" class="form-control" @bind="@_isEnabled">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="runs-every" class="form-control" @bind="@_interval" />
|
||||
<select id="runs-every" class="form-control" @bind="@_frequency">
|
||||
<option value="m">Minute(s)</option>
|
||||
<option value="H">Hour(s)</option>
|
||||
<option value="d">Day(s)</option>
|
||||
<option value="M">Month(s)</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="starting" class="form-control" @bind="@_startDate" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="ending" class="form-control" @bind="@_endDate" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="retention-log" HelpText="What items do you want in the retention log">Retention Log (Items): </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="retention-log" class="form-control" @bind="@_retentionHistory" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@code {
|
||||
private string _name = string.Empty;
|
||||
private string _jobType = string.Empty;
|
||||
private string _isEnabled = "True";
|
||||
private string _interval = string.Empty;
|
||||
private string _frequency = string.Empty;
|
||||
private string _startDate = string.Empty;
|
||||
private string _endDate = string.Empty;
|
||||
private string _retentionHistory = "10";
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
private async Task SaveJob()
|
||||
{
|
||||
if (_name != string.Empty && !string.IsNullOrEmpty(_jobType) && _frequency != string.Empty && _interval != string.Empty && _retentionHistory != string.Empty)
|
||||
{
|
||||
var job = new Job();
|
||||
job.Name = _name;
|
||||
job.JobType = _jobType;
|
||||
job.IsEnabled = Boolean.Parse(_isEnabled);
|
||||
job.Frequency = _frequency;
|
||||
job.Interval = int.Parse(_interval);
|
||||
|
||||
if (_startDate == string.Empty)
|
||||
{
|
||||
job.StartDate = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
job.StartDate = DateTime.Parse(_startDate);
|
||||
}
|
||||
|
||||
if (_endDate == string.Empty)
|
||||
{
|
||||
job.EndDate = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
job.EndDate = DateTime.Parse(_endDate);
|
||||
}
|
||||
|
||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||
job.IsStarted = false;
|
||||
job.IsExecuting = false;
|
||||
job.NextExecution = null;
|
||||
|
||||
try
|
||||
{
|
||||
job = await JobService.AddJobAsync(job);
|
||||
await logger.LogInformation("Job Added {Job}", job);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding Job {Job} {Error}", job, ex.Message);
|
||||
AddModuleMessage("Error Adding Job", MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide The Job Name, Type, Frequency, and Retention", MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,12 +1,13 @@
|
|||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IJobService JobService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the job name">Name: </Label>
|
||||
<Label For="name" HelpText="Enter the job name" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -14,40 +15,40 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="type" HelpText="Enter the job type">Type: </Label>
|
||||
<Label For="type" HelpText="The fully qualified job type name" ResourceKey="Type">Type: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="type" class="form-control" @bind="@_jobType" />
|
||||
<input id="type" class="form-control" @bind="@_jobType" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="enabled" HelpText="Select whether you want the job enabled or not">Enabled? </Label>
|
||||
<Label For="enabled" HelpText="Select whether you want the job enabled or not" ResourceKey="Enabled">Enabled? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="enabled" class="form-control" @bind="@_isEnabled">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="runs-every" HelpText="Select how often you want the job to run">Runs Every: </Label>
|
||||
<Label For="runs-every" HelpText="Select how often you want the job to run" ResourceKey="RunsEvery">Runs Every: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="runs-every" class="form-control" @bind="@_interval" />
|
||||
<select id="runs-every" class="form-control" @bind="@_frequency">
|
||||
<option value="m">Minute(s)</option>
|
||||
<option value="H">Hour(s)</option>
|
||||
<option value="d">Day(s)</option>
|
||||
<option value="M">Month(s)</option>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="starting" HelpText="What time do you want the job to start">Starting: </Label>
|
||||
<Label For="starting" HelpText="What time do you want the job to start" ResourceKey="Starting">Starting: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="starting" class="form-control" @bind="@_startDate" />
|
||||
|
@ -55,7 +56,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="ending" HelpText="When do you want the job to end">Ending: </Label>
|
||||
<Label For="ending" HelpText="When do you want the job to end" ResourceKey="Ending">Ending: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="ending" class="form-control" @bind="@_endDate" />
|
||||
|
@ -63,7 +64,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="retention" HelpText="Number of log entries to retain for this job">Retention Log (Items): </Label>
|
||||
<Label For="retention" HelpText="Number of log entries to retain for this job" ResourceKey="RetentionLog">Retention Log (Items): </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="retention" class="form-control" @bind="@_retentionHistory" />
|
||||
|
@ -71,15 +72,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="next" HelpText="Next execution for this job.">Next Execution: </Label>
|
||||
<Label For="next" HelpText="Next execution for this job." ResourceKey="NextExecution">Next Execution: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="next" class="form-control" @bind="@_nextExecution" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveJob">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveJob">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private int _jobId;
|
||||
|
@ -117,7 +118,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", _jobId, ex.Message);
|
||||
AddModuleMessage("Error Loading Job", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Job"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +159,7 @@
|
|||
{
|
||||
job.NextExecution = DateTime.Parse(_nextExecution);
|
||||
}
|
||||
|
||||
|
||||
job.RetentionHistory = int.Parse(_retentionHistory);
|
||||
|
||||
try
|
||||
|
@ -170,12 +171,12 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Udate Job {Job} {Error}", job, ex.Message);
|
||||
AddModuleMessage("Error Updating Job", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Updating Job"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide The Job Name, Type, Frequency, and Retention", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide The Job Name, Type, Frequency, and Retention"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +1,47 @@
|
|||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@inherits ModuleBase
|
||||
@inject IJobService JobService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_jobs == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Job" />
|
||||
<ActionLink Action="Log" Class="btn btn-secondary" Text="View Logs" />
|
||||
<ActionLink Action="Log" Class="btn btn-secondary" Text="View Logs" ResourceKey="ViewJobs" />
|
||||
<button type="button" class="btn btn-secondary" @onclick="(async () => await Refresh())">Refresh</button>
|
||||
<br /><br />
|
||||
<br />
|
||||
<br />
|
||||
|
||||
<Pager Items="@_jobs">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Frequency</th>
|
||||
<th>Next Execution</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Status"]</th>
|
||||
<th>@Localizer["Frequency"]</th>
|
||||
<th>@Localizer["Next Execution"]</th>
|
||||
<th style="width: 1px;"> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Job" Message="@("Are You Sure You Wish To Delete This Job?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteJob(context))" /></td>
|
||||
<td><ActionLink Action="Log" Class="btn btn-secondary" Parameters="@($"id=" + context.JobId.ToString())" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.JobId.ToString())" ResourceKey="EditJob" /></td>
|
||||
<td><ActionDialog Header="Delete Job" Message="Are You Sure You Wish To Delete This Job?" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteJob(context))" ResourceKey="DeleteJob" /></td>
|
||||
<td><ActionLink Action="Log" Class="btn btn-secondary" Parameters="@($"id=" + context.JobId.ToString())" ResourceKey="JobLog" /></td>
|
||||
<td>@context.Name</td>
|
||||
<td>@DisplayStatus(context.IsEnabled, context.IsExecuting)</td>
|
||||
<td>@DisplayFrequency(context.Interval, context.Frequency)</td>
|
||||
<td>@context.NextExecution</td>
|
||||
<td>
|
||||
@if (context.IsStarted)
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick="(async () => await StopJob(context.JobId))">Stop</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick="(async () => await StartJob(context.JobId))">Start</button>
|
||||
}
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick="(async () => await StopJob(context.JobId))">@Localizer["Stop"]</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick="(async () => await StartJob(context.JobId))">@Localizer["Start"]</button>
|
||||
}
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -48,7 +49,7 @@ else
|
|||
|
||||
@code {
|
||||
private List<Job> _jobs;
|
||||
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
|
@ -61,17 +62,17 @@ else
|
|||
var status = string.Empty;
|
||||
if (!isEnabled)
|
||||
{
|
||||
status = "Disabled";
|
||||
status = Localizer["Disabled"];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isExecuting)
|
||||
{
|
||||
status = "Executing";
|
||||
status = Localizer["Executing"];
|
||||
}
|
||||
else
|
||||
{
|
||||
status = "Idle";
|
||||
status = Localizer["Idle"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,28 +82,28 @@ else
|
|||
|
||||
private string DisplayFrequency(int interval, string frequency)
|
||||
{
|
||||
var result = "Every " + interval.ToString() + " ";
|
||||
var result = $"{Localizer["Every"]} {interval.ToString()} ";
|
||||
switch (frequency)
|
||||
{
|
||||
case "m":
|
||||
result += "Minute";
|
||||
result += Localizer["Minute"];
|
||||
break;
|
||||
case "H":
|
||||
result += "Hour";
|
||||
result += Localizer["Hour"];
|
||||
break;
|
||||
case "d":
|
||||
result += "Day";
|
||||
result += Localizer["Day"];
|
||||
break;
|
||||
case "M":
|
||||
result += "Month";
|
||||
result += Localizer["Month"];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (interval > 1)
|
||||
{
|
||||
result += "s";
|
||||
result += Localizer["s"];
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -117,7 +118,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", job, ex.Message);
|
||||
AddModuleMessage("Error Deleting Job", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Job"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@namespace Oqtane.Modules.Admin.Jobs
|
||||
@inherits ModuleBase
|
||||
@inject IJobLogService JobLogService
|
||||
@inject IStringLocalizer<Log> Localizer
|
||||
|
||||
@if (_jobLogs == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Pager Items="@_jobLogs">
|
||||
<Header>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Started</th>
|
||||
<th>Finished</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Status"]</th>
|
||||
<th>@Localizer["Started"]</th>
|
||||
<th>@Localizer["Finished"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.Job.Name</td>
|
||||
|
@ -49,17 +50,17 @@ else
|
|||
var status = string.Empty;
|
||||
if (isExecuting)
|
||||
{
|
||||
status = "Executing";
|
||||
status = Localizer["Executing"];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (succeeded != null && succeeded.Value)
|
||||
{
|
||||
status = "Succeeded";
|
||||
status = Localizer["Succeeded"];
|
||||
}
|
||||
else
|
||||
{
|
||||
status = "Failed";
|
||||
status = Localizer["Failed"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
107
Oqtane.Client/Modules/Admin/Languages/Add.razor
Normal file
107
Oqtane.Client/Modules/Admin/Languages/Add.razor
Normal file
|
@ -0,0 +1,107 @@
|
|||
@namespace Oqtane.Modules.Admin.Languages
|
||||
@inherits ModuleBase
|
||||
@using System.Globalization
|
||||
@using Microsoft.AspNetCore.Localization
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ILocalizationService LocalizationService
|
||||
@inject ILanguageService LanguageService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
@if (_supportedCultures == null)
|
||||
{
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (_supportedCultures?.Count() > 1)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Name Of The Langauage" ResourceKey="Name">Name:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="_code" class="form-control" @bind="@_code">
|
||||
@foreach (var culture in _supportedCultures)
|
||||
{
|
||||
<option value="@culture.Name">@culture.DisplayName</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="default" HelpText="Indicates Whether Or Not This Language Is The Default For The Site" ResourceKey="IsDefault">Default?</Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="default" class="form-control" @bind="@_isDefault">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveLanguage">@Localizer["Save"]</button>
|
||||
}
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
|
||||
@code {
|
||||
private string _code = string.Empty;
|
||||
private string _isDefault = "False";
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||
|
||||
private IEnumerable<Culture> _supportedCultures;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_supportedCultures = await LocalizationService.GetCulturesAsync();
|
||||
if (_supportedCultures.Count() <= 1)
|
||||
{
|
||||
AddModuleMessage(Localizer["The Only Supported Culture That Has Been Defined Is English"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveLanguage()
|
||||
{
|
||||
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)
|
||||
{
|
||||
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 Adding Language"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetCultureAsync(string culture)
|
||||
{
|
||||
if (culture != CultureInfo.CurrentUICulture.Name)
|
||||
{
|
||||
var interop = new Interop(JSRuntime);
|
||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
|
||||
|
||||
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
|
||||
}
|
||||
}
|
||||
}
|
56
Oqtane.Client/Modules/Admin/Languages/Index.razor
Normal file
56
Oqtane.Client/Modules/Admin/Languages/Index.razor
Normal file
|
@ -0,0 +1,56 @@
|
|||
@namespace Oqtane.Modules.Admin.Languages
|
||||
@inherits ModuleBase
|
||||
@inject ILanguageService LanguageService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_languages == null)
|
||||
{
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Language" ResourceKey="AddLanguage" />
|
||||
|
||||
<Pager Items="@_languages">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Code"]</th>
|
||||
<th>@Localizer["Default?"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionDialog Header="Delete Langauge" Message="@Localizer["Are You Sure You Wish To Delete The {0} Language?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteLanguage(context))" Disabled="@(context.IsDefault)" ResourceKey="DeleteLanguage" /></td>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.Code</td>
|
||||
<td><TriStateCheckBox Value="@(context.IsDefault)" Disabled="true"></TriStateCheckBox></td>
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<Language> _languages;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_languages = await LanguageService.GetLanguagesAsync(PageState.Site.SiteId);
|
||||
}
|
||||
|
||||
private async Task DeleteLanguage(Language language)
|
||||
{
|
||||
try
|
||||
{
|
||||
await LanguageService.DeleteLanguageAsync(language.LanguageId);
|
||||
await logger.LogInformation("Language Deleted {Language}", language);
|
||||
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Language {Language} {Error}", language, ex.Message);
|
||||
|
||||
AddModuleMessage(Localizer["Error Deleting Language"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,38 +3,33 @@
|
|||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IServiceProvider ServiceProvider
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_message != string.Empty)
|
||||
{
|
||||
<ModuleMessage Message="@_message" Type="@_type" />
|
||||
}
|
||||
<AuthorizeView>
|
||||
<Authorizing>
|
||||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<ModuleMessage Message="You Are Already Logged In" Type="MessageType.Info" />
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<div class="container Oqtane-Modules-Admin-Login">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<label for="Username" class="control-label">@Localizer["Username:"] </label>
|
||||
<input type="text" name="Username" class="form-control username" placeholder="Username" @bind="@_username" id="Username" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Password: </label>
|
||||
<label for="Password" class="control-label">@Localizer["Password:"] </label>
|
||||
<input type="password" name="Password" class="form-control password" placeholder="Password" @bind="@_password" id="Password" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-check form-check-inline">
|
||||
<label class="form-check-label" for="Remember">Remember Me?</label>
|
||||
<label class="form-check-label" for="Remember">@Localizer["Remember Me?"]</label>
|
||||
<input type="checkbox" class="form-check-input" name="Remember" @bind="@_remember" id="Remember" />
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="Login">Login</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="Login">@Localizer["Login"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
<br /><br />
|
||||
<button type="button" class="btn btn-secondary" @onclick="Forgot">Forgot Password</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Forgot">@Localizer["Forgot Password"]</button>
|
||||
</div>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
@ -75,11 +70,11 @@
|
|||
|
||||
if (user != null)
|
||||
{
|
||||
_message = "User Account Verified Successfully. You Can Now Login With Your Username And Password Below.";
|
||||
_message = Localizer["User Account Verified Successfully. You Can Now Login With Your Username And Password Below."];
|
||||
}
|
||||
else
|
||||
{
|
||||
_message = "User Account Could Not Be Verified. Please Contact Your Administrator For Further Instructions.";
|
||||
_message = Localizer["User Account Could Not Be Verified. Please Contact Your Administrator For Further Instructions."];
|
||||
_type = MessageType.Warning;
|
||||
}
|
||||
}
|
||||
|
@ -87,7 +82,7 @@
|
|||
|
||||
private async Task Login()
|
||||
{
|
||||
if (PageState.Runtime == Runtime.Server)
|
||||
if (PageState.Runtime == Oqtane.Shared.Runtime.Server)
|
||||
{
|
||||
// server-side Blazor
|
||||
var user = new User();
|
||||
|
@ -108,7 +103,7 @@
|
|||
else
|
||||
{
|
||||
await logger.LogInformation("Login Failed For Username {Username}", _username);
|
||||
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Email Verification When They Initially Created.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Email Verification When They Initially Created."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -129,7 +124,7 @@
|
|||
else
|
||||
{
|
||||
await logger.LogInformation("Login Failed For Username {Username}", _username);
|
||||
AddModuleMessage("Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Modules.Admin.Logs
|
||||
@namespace Oqtane.Modules.Admin.Logs
|
||||
@using System.Globalization
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
|
@ -6,134 +6,135 @@
|
|||
@inject IPageService PageService
|
||||
@inject IPageModuleService PageModuleService
|
||||
@inject IUserService UserService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="dateTime" HelpText="The date and time of this log" ResourceKey="DateTime">Date/Time: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="dateTime" class="form-control" @bind="@_logDate" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="level" HelpText="The level of this log" ResourceKey="Level">Level: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="level" class="form-control" @bind="@_level" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="feature" HelpText="The feature that was affected" ResourceKey="Feature">Feature: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="feature" class="form-control" @bind="@_feature" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="function" HelpText="The function that was performed" ResourceKey="Function">Function: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="function" class="form-control" @bind="@_function" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="category" HelpText="The categories that were affected" ResourceKey="Category">Category: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="category" class="form-control" @bind="@_category" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
@if (_pageName != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="dateTime" HelpText="The date and time of this log">Date/Time: </Label>
|
||||
<Label For="page" HelpText="The page that was affected" ResourceKey="Page">Page: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="dateTime" class="form-control" @bind="@_logDate" readonly />
|
||||
<input id="page" class="form-control" @bind="@_pageName" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (_moduleTitle != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="level" HelpText="The level of this log">Level: </Label>
|
||||
<Label For="module" HelpText="The module that was affected" ResourceKey="Module">Module: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="level" class="form-control" @bind="@_level" readonly />
|
||||
<input id="module" class="form-control" @bind="@_moduleTitle" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (_username != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="feature" HelpText="The feature that was affected">Feature: </Label>
|
||||
<Label For="user" HelpText="The user that caused this log" ResourceKey="User">User: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="feature" class="form-control" @bind="@_feature" readonly />
|
||||
<input id="user" class="form-control" @bind="@_username" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="url" HelpText="The url the log comes from" ResourceKey="Url">Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@_url" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="template" HelpText="What the log is about" ResourceKey="Template">Template: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="template" class="form-control" @bind="@_template" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="message" HelpText="The message that the system generated" class="control-label" ResourceKey="Message">Message: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="message" class="form-control" @bind="@_message" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
@if (!string.IsNullOrEmpty(_exception))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="function" HelpText="The function that was performed">Function: </Label>
|
||||
<Label For="exception" HelpText="The exceptions generated by the system" ResourceKey="Exception">Exception: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="function" class="form-control" @bind="@_function" readonly />
|
||||
<textarea id="exception" class="form-control" @bind="@_exception" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="category" HelpText="The categories that were affected">Category: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="category" class="form-control" @bind="@_category" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
@if (_pageName != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="page" HelpText="The page that was affected">Page: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="page" class="form-control" @bind="@_pageName" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (_moduleTitle != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="module" HelpText="The module that was affected">Module: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="module" class="form-control" @bind="@_moduleTitle" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@if (_username != string.Empty)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="user" HelpText="The user that caused this log">User: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="user" class="form-control" @bind="@_username" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="url" HelpText="The url the log comes from">Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@_url" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="template" HelpText="What the log is about">Template: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="template" class="form-control" @bind="@_template" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="message" HelpText="The message that the system generated"class="control-label">Message: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="message" class="form-control" @bind="@_message" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
@if (!string.IsNullOrEmpty(_exception))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="exception" HelpText="The exceptions generated by the system">Exception: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="exception" class="form-control" @bind="@_exception" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="properties" HelpText="The properties that were affected">Properties: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="properties" class="form-control" @bind="@_properties" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="server" HelpText="The server that was affected">Server: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="server" class="form-control" @bind="@_server" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="properties" HelpText="The properties that were affected" ResourceKey="Properties">Properties: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="properties" class="form-control" @bind="@_properties" rows="5" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="server" HelpText="The server that was affected" ResourceKey="Server">Server: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="server" class="form-control" @bind="@_server" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private int _logId;
|
||||
|
@ -167,7 +168,7 @@
|
|||
_feature = log.Feature;
|
||||
_function = log.Function;
|
||||
_category = log.Category;
|
||||
|
||||
|
||||
if (log.PageId != null)
|
||||
{
|
||||
var page = await PageService.GetPageAsync(log.PageId.Value);
|
||||
|
@ -176,7 +177,7 @@
|
|||
_pageName = page.Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (log.PageId != null && log.ModuleId != null)
|
||||
{
|
||||
var pagemodule = await PageModuleService.GetPageModuleAsync(log.PageId.Value, log.ModuleId.Value);
|
||||
|
@ -185,7 +186,7 @@
|
|||
_moduleTitle = pagemodule.Title;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (log.UserId != null)
|
||||
{
|
||||
var user = await UserService.GetUserAsync(log.UserId.Value, PageState.Site.SiteId);
|
||||
|
@ -194,7 +195,7 @@
|
|||
_username = user.Username;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_url = log.Url;
|
||||
_template = log.MessageTemplate;
|
||||
_message = log.Message;
|
||||
|
@ -206,7 +207,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Log {LogId} {Error}", _logId, ex.Message);
|
||||
AddModuleMessage("Error Loading Log", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Log"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,41 +1,42 @@
|
|||
@namespace Oqtane.Modules.Admin.Logs
|
||||
@namespace Oqtane.Modules.Admin.Logs
|
||||
@inherits ModuleBase
|
||||
@inject ILogService LogService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_logs == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label>Level: </label>
|
||||
<label>@Localizer["Level:"] </label>
|
||||
<select class="form-control" @onchange="(e => LevelChanged(e))">
|
||||
<option value="-"><All Levels></option>
|
||||
<option value="Trace">Trace</option>
|
||||
<option value="Debug">Debug</option>
|
||||
<option value="Information">Information</option>
|
||||
<option value="Warning">Warning</option>
|
||||
<option value="Error">Error</option>
|
||||
<option value="Critical">Critical</option>
|
||||
<option value="-"><@Localizer["All Levels"]></option>
|
||||
<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>
|
||||
</td>
|
||||
<td>
|
||||
<label>Function: </label>
|
||||
<label>@Localizer["Function:"] </label>
|
||||
<select class="form-control" @onchange="(e => FunctionChanged(e))">
|
||||
<option value="-"><All Functions></option>
|
||||
<option value="Create">Create</option>
|
||||
<option value="Read">Read</option>
|
||||
<option value="Update">Update</option>
|
||||
<option value="Delete">Delete</option>
|
||||
<option value="Security">Security</option>
|
||||
<option value="Other">Other</option>
|
||||
<option value="-"><@Localizer["All Functions"]></option>
|
||||
<option value="Create">@Localizer["Create"]</option>
|
||||
<option value="Read">@Localizer["Read"]</option>
|
||||
<option value="Update">@Localizer["Update"]</option>
|
||||
<option value="Delete">@Localizer["Delete"]</option>
|
||||
<option value="Security">@Localizer["Security"]</option>
|
||||
<option value="Other">@Localizer["Other"]</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label>Rows: </label>
|
||||
<label>@Localizer["Rows:"] </label>
|
||||
<select class="form-control" @onchange="(e => RowsChanged(e))">
|
||||
<option value="10">10</option>
|
||||
<option value="50">50</option>
|
||||
|
@ -50,13 +51,13 @@ else
|
|||
<Pager Items="@_logs">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Date</th>
|
||||
<th>Level</th>
|
||||
<th>Feature</th>
|
||||
<th>Function</th>
|
||||
<th>@Localizer["Date"]</th>
|
||||
<th>@Localizer["Level"]</th>
|
||||
<th>@Localizer["Feature"]</th>
|
||||
<th>@Localizer["Function"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" /></td>
|
||||
<td class="@GetClass(context.Function)"><ActionLink Action="Detail" Parameters="@($"id=" + context.LogId.ToString())" ResourceKey="LogDetails" /></td>
|
||||
<td class="@GetClass(context.Function)">@context.LogDate</td>
|
||||
<td class="@GetClass(context.Function)">@context.Level</td>
|
||||
<td class="@GetClass(context.Function)">@context.Feature</td>
|
||||
|
@ -66,7 +67,7 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
<p><em>No Logs Match The Criteria Specified</em></p>
|
||||
<p><em>@Localizer["No Logs Match The Criteria Specified"]</em></p>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,7 +88,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Logs", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Logs", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +118,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Logs", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +134,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Logs", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,11 +4,17 @@
|
|||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject IModuleService ModuleService
|
||||
@inject ISystemService SystemService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
@using System.Text.RegularExpressions
|
||||
@using System.IO;
|
||||
|
||||
@if (string.IsNullOrEmpty(_moduledefinitionname))
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="owner" HelpText="Enter the name of the organization who is developing this module. It should not contain spaces or punctuation.">Owner Name: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="owner" class="form-control" @bind="@_owner" />
|
||||
|
@ -16,7 +22,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation.">Module Name: </Label>
|
||||
<Label For="module" HelpText="Enter a name for this module. It should not contain spaces or punctuation." ResourceKey="ModuleName">Module Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="module" class="form-control" @bind="@_module" />
|
||||
|
@ -24,7 +30,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="Enter s short description for the module">Description: </Label>
|
||||
<Label For="description" HelpText="Enter a short description for the module" ResourceKey="Description">Description: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="3"></textarea>
|
||||
|
@ -32,19 +38,19 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="template" HelpText="Select a module template. Internal modules are created inside of the Oqtane solution. External modules are created outside of the Oqtane solution.">Template: </Label>
|
||||
<Label For="template" HelpText="Select a module template. Internal modules are created inside of the framework solution. External modules are created outside of the framework solution." ResourceKey="Template">Template: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="template" class="form-control" @onchange="(e => TemplateChanged(e))">
|
||||
<option value="-"><Select Template></option>
|
||||
<option value="internal">Internal</option>
|
||||
<option value="external">External</option>
|
||||
<option value="-"><@Localizer["Select Template"]></option>
|
||||
<option value="internal">@Localizer["Internal"]</option>
|
||||
<option value="external">@Localizer["External"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="reference" HelpText="Select a framework reference version">Framework Reference: </Label>
|
||||
<Label For="reference" HelpText="Select a framework reference version" ResourceKey="FrameworkReference">Framework Reference: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="reference" class="form-control" @bind="@_reference">
|
||||
|
@ -55,7 +61,7 @@
|
|||
<option value="@(version)">@(version)</option>
|
||||
}
|
||||
}
|
||||
<option value="local">Local Version</option>
|
||||
<option value="local">@Localizer["Local Version"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -63,7 +69,7 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="location" HelpText="Location where the module will be created">Location: </Label>
|
||||
<Label For="location" HelpText="Location where the module will be created" ResourceKey="Location">Location: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="module" class="form-control" @bind="@_location" readonly />
|
||||
|
@ -71,10 +77,15 @@
|
|||
</tr>
|
||||
}
|
||||
</table>
|
||||
|
||||
<button type="button" class="btn btn-success" @onclick="CreateModule">Create Module</button>
|
||||
<button type="button" class="btn btn-success" @onclick="CreateModule">@Localizer["Create Module"]</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick="ActivateModule">@Localizer["Activate Module"]</button>
|
||||
}
|
||||
|
||||
@code {
|
||||
private string _moduledefinitionname = "";
|
||||
private string _owner = string.Empty;
|
||||
private string _module = string.Empty;
|
||||
private string _description = string.Empty;
|
||||
|
@ -86,25 +97,37 @@
|
|||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AddModuleMessage("Please Note That Once You Select The Create Module Button The Application Must Restart In Order To Complete The Process. If You Create An External Module You Will Need To Compile The Source Code And Then Relaunch Your Site In Order To Make It Functional.", MessageType.Info);
|
||||
_moduledefinitionname = SettingService.GetSetting(ModuleState.Settings, "ModuleDefinitionName", "");
|
||||
if (string.IsNullOrEmpty(_moduledefinitionname))
|
||||
{
|
||||
_owner = ModuleState.Title;
|
||||
_module = ModuleState.Title;
|
||||
_description = ModuleState.Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage(Localizer["Once You Have Compiled The Module And Restarted The Application You Can Activate The Module Below"], MessageType.Info);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task CreateModule()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_owner) && !string.IsNullOrEmpty(_module) && _template != "-")
|
||||
if (IsValid(_owner) && IsValid(_module) && _owner != _module && _template != "-")
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 5);
|
||||
var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference };
|
||||
moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
|
||||
|
||||
var moduleDefinition = new ModuleDefinition { Owner = _owner.Replace(" ", ""), Name = _module.Replace(" ", ""), Description = _description, Template = _template, Version = _reference };
|
||||
await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition, ModuleState.ModuleId);
|
||||
var settings = ModuleState.Settings;
|
||||
SettingService.SetSetting(settings, "ModuleDefinitionName", moduleDefinition.ModuleDefinitionName);
|
||||
await SettingService.UpdateModuleSettingsAsync(settings, ModuleState.ModuleId);
|
||||
|
||||
AddModuleMessage(Localizer["The Source Code For Your Module Has Been Created At The Location Specified Below And Must Be Compiled In Order To Make It Functional. Once It Has Been Compiled You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide An Owner, Module Name, And Template", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Valid Owner Name And Module Name ( ie. No Punctuation Or Spaces And The Values Cannot Be The Same ) And Choose A Template"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -113,6 +136,31 @@
|
|||
}
|
||||
}
|
||||
|
||||
private async Task ActivateModule()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_moduledefinitionname))
|
||||
{
|
||||
Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId);
|
||||
module.ModuleDefinitionName = _moduledefinitionname;
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
ClearModuleMessage();
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Activating Module");
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsValid(string name)
|
||||
{
|
||||
// must contain letters, underscores and digits and first character must be letter or underscore
|
||||
return !string.IsNullOrEmpty(name) && Regex.IsMatch(name, "^[A-Za-z_][A-Za-z0-9_]*$");
|
||||
}
|
||||
|
||||
private async void TemplateChanged(ChangeEventArgs e)
|
||||
{
|
||||
try
|
||||
|
@ -124,14 +172,18 @@
|
|||
Dictionary<string, string> systeminfo = await SystemService.GetSystemInfoAsync();
|
||||
if (systeminfo != null)
|
||||
{
|
||||
string[] path = systeminfo["serverpath"].Split('\\');
|
||||
string[] path = systeminfo["serverpath"].Split(Path.DirectorySeparatorChar);
|
||||
if (_template == "internal")
|
||||
{
|
||||
_location = string.Join("\\", path, 0, path.Length - 1) + "\\Oqtane.Client\\Modules\\" + _owner + "." + _module;
|
||||
_location = string.Join(Path.DirectorySeparatorChar, path, 0, path.Length - 1) +
|
||||
Path.DirectorySeparatorChar + "Oqtane.Client" +
|
||||
Path.DirectorySeparatorChar + "Modules" +
|
||||
Path.DirectorySeparatorChar + _owner + "." + _module;
|
||||
}
|
||||
else
|
||||
{
|
||||
_location = string.Join("\\", path, 0, path.Length - 2) + "\\" + _owner + "." + _module;
|
||||
_location = string.Join(Path.DirectorySeparatorChar, path, 0, path.Length - 2) +
|
||||
Path.DirectorySeparatorChar + _owner + "." + _module;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +192,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Getting System Info {Error}", ex.Message);
|
||||
AddModuleMessage("Error Getting System Info", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Getting System Info"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,39 @@
|
|||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IFileService FileService
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject IPackageService PackageService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
@if (_packages != null)
|
||||
{
|
||||
<TabStrip>
|
||||
@if (_packages.Count > 0)
|
||||
{
|
||||
<TabPanel Name="Download">
|
||||
<TabPanel Name="Download" ResourceKey="Download">
|
||||
<ModuleMessage Type="MessageType.Info" Message="Download one or more modules from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||
<Pager Items="@_packages">
|
||||
<Header>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Version"]</th>
|
||||
<th style="width: 1px"></th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.Version</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadModule(context.PackageId, context.Version))>Download</button>
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadModule(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
</TabPanel>
|
||||
}
|
||||
<TabPanel Name="Upload">
|
||||
<TabPanel Name="Upload" ResourceKey="Upload">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label HelpText="Upload one or more module packages. Once they are uploaded click Install to complete the installation.">Module: </Label>
|
||||
<Label HelpText="Upload one or more module packages. Once they are uploaded click Install to complete the installation." ResourceKey="Module">Module: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Modules" UploadMultiple="true" />
|
||||
|
@ -42,8 +43,8 @@
|
|||
</TabPanel>
|
||||
</TabStrip>
|
||||
|
||||
<button type="button" class="btn btn-success" @onclick="InstallModules">Install</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="InstallModules">@Localizer["Install"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
@ -69,7 +70,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Packages", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Packages"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,14 +78,12 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
||||
AddModuleMessage(Localizer["Module Installed Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Installating Module");
|
||||
await logger.LogError(ex, "Error Installing Module");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,13 +93,13 @@
|
|||
{
|
||||
await PackageService.DownloadPackageAsync(packageid, version, "Modules");
|
||||
await logger.LogInformation("Module {ModuleDefinitionName} {Version} Downloaded Successfully", packageid, version);
|
||||
AddModuleMessage("Modules Downloaded Successfully. Click Install To Complete Installation.", MessageType.Success);
|
||||
AddModuleMessage(Localizer["Modules Downloaded Successfully. Click Install To Complete Installation."], MessageType.Success);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading Module {ModuleDefinitionName} {Version}", packageid, version);
|
||||
AddModuleMessage("Error Downloading Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@inherits ModuleBase
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Definition">
|
||||
<TabPanel Name="Definition" ResourceKey="Definition">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="The name of the module">Name: </Label>
|
||||
<Label For="name" HelpText="The name of the module" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -16,7 +17,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="The description of the module">Description: </Label>
|
||||
<Label For="description" HelpText="The description of the module" ResourceKey="Description">Description: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="2"></textarea>
|
||||
|
@ -24,18 +25,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="categories" HelpText="Comma delimited list of module categories">Categories: </Label>
|
||||
<Label For="categories" HelpText="Comma delimited list of module categories" ResourceKey="Categories">Categories: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="categories" class="form-control" @bind="@_categories" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<Section Name="Information">
|
||||
<Section Name="Information" ResourceKey="Information">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="moduledefinitionname" HelpText="The internal name of the module">Internal Name: </Label>
|
||||
<Label For="moduledefinitionname" HelpText="The internal name of the module" ResourceKey="InternalName">Internal Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="moduledefinitionname" class="form-control" @bind="@_moduledefinitionname" disabled />
|
||||
|
@ -43,7 +44,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="version" HelpText="The version of the module">Version: </Label>
|
||||
<Label For="version" HelpText="The version of the module" ResourceKey="Version">Version: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="version" class="form-control" @bind="@_version" disabled />
|
||||
|
@ -51,7 +52,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="owner" HelpText="The owner or creator of the module">Owner: </Label>
|
||||
<Label For="owner" HelpText="The owner or creator of the module" ResourceKey="Owner">Owner: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="owner" class="form-control" @bind="@_owner" disabled />
|
||||
|
@ -59,7 +60,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="url" HelpText="The reference url of the module">Reference Url: </Label>
|
||||
<Label For="url" HelpText="The reference url of the module" ResourceKey="ReferenceUrl">Reference Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||
|
@ -67,7 +68,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="contact" HelpText="The contact for the module">Contact: </Label>
|
||||
<Label For="contact" HelpText="The contact for the module" ResourceKey="Contact">Contact: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="contact" class="form-control" @bind="@_contact" disabled />
|
||||
|
@ -75,7 +76,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="license" HelpText="The module license terms">License: </Label>
|
||||
<Label For="license" HelpText="The module license terms" ResourceKey="License">License: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
|
||||
|
@ -83,7 +84,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="runtimes" HelpText="The Blazor runtimes which this module supports">Runtimes: </Label>
|
||||
<Label For="runtimes" HelpText="The Blazor runtimes which this module supports" ResourceKey="Runtimes">Runtimes: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="runtimes" class="form-control" @bind="@_runtimes" disabled />
|
||||
|
@ -92,7 +93,7 @@
|
|||
</table>
|
||||
</Section>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Permissions">
|
||||
<TabPanel Name="Permissions" ResourceKey="Permissions">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -102,9 +103,10 @@
|
|||
</table>
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br /><br />
|
||||
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
|
||||
|
||||
@code {
|
||||
|
@ -159,7 +161,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
|
||||
AddModuleMessage("Error Loading Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -188,7 +190,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
|
||||
AddModuleMessage("Error Saving Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,40 +1,41 @@
|
|||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@namespace Oqtane.Modules.Admin.ModuleDefinitions
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
@inject IPackageService PackageService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_moduleDefinitions == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Install Module" />
|
||||
<ActionLink Action="Add" Text="Install Module" ResourceKey="InstallModule" />
|
||||
|
||||
<Pager Items="@_moduleDefinitions">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Version"]</th>
|
||||
<th style="width: 1px;"> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ModuleDefinitionId.ToString())" ResourceKey="EditModule" /></td>
|
||||
<td>
|
||||
@if (context.AssemblyName != "Oqtane.Client")
|
||||
{
|
||||
<ActionDialog Header="Delete Module" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Module?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteModule(context))" />
|
||||
}
|
||||
{
|
||||
<ActionDialog Header="Delete Module" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Module?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteModule(context))" ResourceKey="DeleteModule" />
|
||||
}
|
||||
</td>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.Version</td>
|
||||
<td>
|
||||
@if (UpgradeAvailable(context.ModuleDefinitionName, context.Version))
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadModule(context.ModuleDefinitionName, context.Version))>Upgrade</button>
|
||||
}
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadModule(context.ModuleDefinitionName, context.Version))>@Localizer["Upgrade"]</button>
|
||||
}
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -46,7 +47,7 @@ else
|
|||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -58,7 +59,7 @@ else
|
|||
if (_moduleDefinitions == null)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Modules", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Modules"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,15 +85,13 @@ else
|
|||
{
|
||||
await PackageService.DownloadPackageAsync(moduledefinitionname, version, "Modules");
|
||||
await logger.LogInformation("Module Downloaded {ModuleDefinitionName} {Version}", moduledefinitionname, version);
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
|
||||
AddModuleMessage(Localizer["Module Installed Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading Module {ModuleDefinitionName} {Version} {Error}", moduledefinitionname, version, ex.Message);
|
||||
AddModuleMessage("Error Downloading Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,15 +99,14 @@ else
|
|||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
|
||||
AddModuleMessage(Localizer["Module Deleted Successfully"], MessageType.Success);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Module {ModuleDefinition} {Error}", moduleDefinition, ex.Message);
|
||||
AddModuleMessage("Error Deleting Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IModuleService ModuleService
|
||||
@inject IStringLocalizer<Export> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="content" HelpText="Enter the module content">Content: </Label>
|
||||
<Label For="content" HelpText="Enter the module content" ResourceKey="Content">Content: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="content" class="form-control" @bind="@_content" rows="5"></textarea>
|
||||
|
@ -15,15 +16,15 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="ExportModule">Export</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="ExportModule">@Localizer["Export"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
|
||||
@code {
|
||||
private string _content = string.Empty;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||
public override string Title => "Export Module";
|
||||
public override string Title => "Export Content";
|
||||
|
||||
|
||||
private async Task ExportModule()
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IModuleService ModuleService
|
||||
@inject IStringLocalizer<Import> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="content" HelpText="Enter the module content">Content: </Label>
|
||||
<Label For="content" HelpText="Enter the module content" ResourceKey="Content">Content: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="content" class="form-control" @bind="@_content" rows="5"></textarea>
|
||||
|
@ -15,15 +16,15 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="ImportModule">Import</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="ImportModule">@Localizer["Import"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
|
||||
@code {
|
||||
private string _content = string.Empty;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||
public override string Title => "Import Module";
|
||||
public override string Title => "Import Content";
|
||||
|
||||
private async Task ImportModule()
|
||||
{
|
||||
|
@ -34,22 +35,22 @@
|
|||
bool success = await ModuleService.ImportModuleAsync(ModuleState.ModuleId, _content);
|
||||
if (success)
|
||||
{
|
||||
AddModuleMessage("Content Imported Successfully", MessageType.Success);
|
||||
AddModuleMessage(Localizer["Content Imported Successfully"], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("A Problem Was Encountered Importing Content. Please Ensure The Content Is Formatted Correctly For The Module.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["A Problem Was Encountered Importing Content. Please Ensure The Content Is Formatted Correctly For The Module."], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Importing Module {ModuleId} {Error}", ModuleState.ModuleId, ex.Message);
|
||||
AddModuleMessage("Error Importing Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Importing Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Enter Some Content To Import", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Enter Some Content To Import"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@namespace Oqtane.Modules.Admin.Modules
|
||||
@using Oqtane.Interfaces
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IThemeService ThemeService
|
||||
@inject IModuleService ModuleService
|
||||
@inject IPageModuleService PageModuleService
|
||||
@inject IStringLocalizer<Settings> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Settings" Heading="Module Settings">
|
||||
<TabPanel Name="Settings" Heading="Module Settings" ResourceKey="ModuleSettings">
|
||||
@if (_containers != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="title" HelpText="Enter the title of the module">Title: </Label>
|
||||
<Label For="title" HelpText="Enter the title of the module" ResourceKey="Title">Title: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="title" type="text" name="Title" class="form-control" @bind="@_title" />
|
||||
|
@ -20,11 +22,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="container" HelpText="Select the module's container">Container: </Label>
|
||||
<Label For="container" HelpText="Select the module's container" ResourceKey="Container">Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="container" class="form-control" @bind="@_containerType">
|
||||
<option value="-"><Inherit From Page Or Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Page Or Site"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
|
@ -34,18 +36,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="allpages" HelpText="Indicate if this module should be displayed on all pages">Display On All Pages? </Label>
|
||||
<Label For="allpages" HelpText="Indicate if this module should be displayed on all pages" ResourceKey="DisplayOnAllPages">Display On All Pages? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="allpages" class="form-control" @bind="@_allPages">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="page" HelpText="The page that the module is on">Page: </Label>
|
||||
<Label For="page" HelpText="The page that the module is on" ResourceKey="Page">Page: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="page" class="form-control" @bind="@_pageId">
|
||||
|
@ -62,7 +64,7 @@
|
|||
</table>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Permissions">
|
||||
<TabPanel Name="Permissions" ResourceKey="Permissions">
|
||||
@if (_permissions != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
|
@ -76,13 +78,13 @@
|
|||
</TabPanel>
|
||||
@if (_settingsModuleType != null)
|
||||
{
|
||||
<TabPanel Name="ModuleSettings" Heading="@_settingstitle">
|
||||
<TabPanel Name="ModuleSettings" Heading="@_settingstitle" ResourceKey="Module Settings">
|
||||
@DynamicComponent
|
||||
</TabPanel>
|
||||
}
|
||||
</TabStrip>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveModule">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveModule">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||
|
@ -120,7 +122,7 @@
|
|||
_permissionNames = ModuleState.ModuleDefinition.PermissionNames;
|
||||
_pageId = ModuleState.PageId.ToString();
|
||||
|
||||
_settingsModuleType = Type.GetType(ModuleState.ModuleType);
|
||||
_settingsModuleType = Type.GetType(ModuleState.ModuleDefinition.ControlTypeTemplate.Replace(Constants.ActionToken, PageState.Action), false, true);
|
||||
if (_settingsModuleType != null)
|
||||
{
|
||||
var moduleobject = Activator.CreateInstance(_settingsModuleType) as IModuleControl;
|
||||
|
@ -136,7 +138,7 @@
|
|||
builder.AddComponentReferenceCapture(1, inst => { _settings = Convert.ChangeType(inst, _settingsModuleType); });
|
||||
builder.CloseComponent();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveModule()
|
||||
|
@ -161,15 +163,16 @@
|
|||
module.Permissions = _permissionGrid.GetPermissions();
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
|
||||
if (_settingsModuleType != null)
|
||||
|
||||
if (_settings is ISettingsControl control)
|
||||
{
|
||||
var moduleType = Type.GetType(ModuleState.ModuleType);
|
||||
if (moduleType != null)
|
||||
{
|
||||
moduleType.GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
||||
}
|
||||
await control.UpdateSettings();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Compatibility 2.0 fallback
|
||||
_settings?.GetType().GetMethod("UpdateSettings")?.Invoke(_settings, null); // method must be public in settings component
|
||||
}
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IPageService PageService
|
||||
@inject IThemeService ThemeService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Settings">
|
||||
<TabPanel Name="Settings" ResourceKey="Settings">
|
||||
@if (_themeList != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Name" HelpText="Enter the page name">Name: </Label>
|
||||
<Label For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Name" class="form-control" @bind="@_name" />
|
||||
|
@ -19,11 +20,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Parent" HelpText="Select the parent for the page in the site hierarchy">Parent: </Label>
|
||||
<Label For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
<option value="-1"><@Localizer["Site Root"]></option>
|
||||
@foreach (Page page in _pageList)
|
||||
{
|
||||
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
|
@ -33,22 +34,22 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages">Insert: </Label>
|
||||
<Label For="Insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages" ResourceKey="Insert">Insert: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Insert" class="form-control" @bind="@_insert">
|
||||
<option value="<<">At Beginning</option>
|
||||
<option value="<<">@Localizer["At Beginning"]</option>
|
||||
@if (_children != null && _children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
<option value="<">@Localizer["Before"]</option>
|
||||
<option value=">">@Localizer["After"]</option>
|
||||
}
|
||||
<option value=">>">At End</option>
|
||||
<option value=">>">@Localizer["At End"]</option>
|
||||
</select>
|
||||
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
|
||||
{
|
||||
<select class="form-control" @bind="@_childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
<option value="-1"><@Localizer["Select Page"]></option>
|
||||
@foreach (Page page in _children)
|
||||
{
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
|
@ -59,18 +60,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden">Navigation? </Label>
|
||||
<Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Navigation" class="form-control" @bind="@_isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label 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.">Url Path: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Path" class="form-control" @bind="@_path" />
|
||||
|
@ -78,18 +79,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it">Redirect: </Label>
|
||||
<Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Url" class="form-control" @bind="@_url" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<Section Name="Appearance">
|
||||
<Section Name="Appearance" ResourceKey="Appearance">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used.">Title: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Title" class="form-control" @bind="@_title" />
|
||||
|
@ -97,11 +98,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Theme" HelpText="Select the theme for this page">Theme: </Label>
|
||||
<Label For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value="-"><Inherit From Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Site"]></option>
|
||||
@foreach (var theme in _themes)
|
||||
{
|
||||
if (theme.TypeName == _themetype)
|
||||
|
@ -120,11 +121,11 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)" ResourceKey="Layout">Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><Inherit From Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Site"]></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
if (layout.TypeName == _layouttype)
|
||||
|
@ -142,11 +143,11 @@
|
|||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><Inherit From Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Site"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
|
@ -156,7 +157,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation">Icon: </Label>
|
||||
<Label For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Icon" class="form-control" @bind="@_icon" />
|
||||
|
@ -164,12 +165,12 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -177,7 +178,7 @@
|
|||
</Section>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Permissions">
|
||||
<TabPanel Name="Permissions" ResourceKey="Permissions">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -187,8 +188,8 @@
|
|||
</table>
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SavePage">@Localizer["Save"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
|
||||
@code {
|
||||
private List<Theme> _themeList;
|
||||
|
@ -229,7 +230,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Initializing Page {Error}", ex.Message);
|
||||
AddModuleMessage("Error Initializing Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Initializing Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +265,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message);
|
||||
AddModuleMessage("Error Loading Child Pages For Parent", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Child Pages For Parent"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +291,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
|
||||
AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -336,7 +337,7 @@
|
|||
|
||||
if (!PagePathIsUnique(page.Path, page.SiteId, _pageList))
|
||||
{
|
||||
AddModuleMessage($"A page with path {_path} already exists for the selected parent page. The page path needs to be unique for the selected parent.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["A page with path {0} already exists for the selected parent page. The page path needs to be unique for the selected parent.", _path], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -385,18 +386,37 @@
|
|||
await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
|
||||
|
||||
await logger.LogInformation("Page Added {Page}", page);
|
||||
NavigationManager.NavigateTo(NavigateUrl(page.Path));
|
||||
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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide Page Name And Theme/Layout", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide Page Name And Theme/Layout"], MessageType.Warning);
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
|
||||
AddModuleMessage("Error Saving Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
if (PageState.QueryString.ContainsKey("cp"))
|
||||
{
|
||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IPageService PageService
|
||||
@inject IThemeService ThemeService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Settings">
|
||||
<TabPanel Name="Settings" ResourceKey="Settings">
|
||||
@if (_themeList != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Name" HelpText="Enter the page name">Name: </Label>
|
||||
<Label For="Name" HelpText="Enter the page name" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Name" class="form-control" @bind="@_name" />
|
||||
|
@ -19,11 +20,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Parent" HelpText="Select the parent for the page in the site hierarchy">Parent: </Label>
|
||||
<Label For="Parent" HelpText="Select the parent for the page in the site hierarchy" ResourceKey="Parent">Parent: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
<option value="-1"><@Localizer["Site Root"]></option>
|
||||
@foreach (Page page in _pageList)
|
||||
{
|
||||
if (page.PageId.ToString() == _parentid)
|
||||
|
@ -40,26 +41,26 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Move" HelpText="Select the location where you would like the page to be moved in relation to other pages">Move: </Label>
|
||||
<Label For="Move" HelpText="Select the location where you would like the page to be moved in relation to other pages" ResourceKey="Move">Move: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Move" class="form-control" @bind="@_insert">
|
||||
@if (_parentid == _currentparentid)
|
||||
{
|
||||
<option value="="><Maintain Current Location></option>
|
||||
<option value="="><@Localizer["Maintain Current Location"]></option>
|
||||
}
|
||||
<option value="<<">To Beginning</option>
|
||||
<option value="<<">@Localizer["To Beginning"]</option>
|
||||
@if (_children != null && _children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
<option value="<">@Localizer["Before"]</option>
|
||||
<option value=">">@Localizer["After"]</option>
|
||||
}
|
||||
<option value=">>">To End</option>
|
||||
<option value=">>">@Localizer["To End"]</option>
|
||||
</select>
|
||||
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
|
||||
{
|
||||
<select class="form-control" @bind="@_childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
<option value="-1"><@Localizer["Select Page"]></option>
|
||||
@foreach (Page page in _children)
|
||||
{
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
|
@ -70,18 +71,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden">Navigation? </Label>
|
||||
<Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden" ResourceKey="Navigation">Navigation? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Navigation" class="form-control" @bind="@_isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label 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.">Url Path: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Path" class="form-control" @bind="@_path" />
|
||||
|
@ -89,18 +90,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it">Redirect: </Label>
|
||||
<Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it" ResourceKey="Redirect">Redirect: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Url" class="form-control" @bind="@_url" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<Section Name="Appearance">
|
||||
<Section Name="Appearance" ResourceKey="Appearance">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used.">Title: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Title" class="form-control" @bind="@_title" />
|
||||
|
@ -108,7 +109,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Theme" HelpText="Select the theme for this page">Theme: </Label>
|
||||
<Label For="Theme" HelpText="Select the theme for this page" ResourceKey="Theme">Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
|
@ -131,11 +132,11 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
|
||||
<Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)" ResourceKey="Layout">Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Layout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><Inherit From Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Site"]></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
if (layout.TypeName == _layouttype)
|
||||
|
@ -153,11 +154,11 @@
|
|||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the page">Default Container: </Label>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the page" ResourceKey="DefaultContainer">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><Inherit From Site></option>
|
||||
<option value="-"><@Localizer["Inherit From Site"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
|
@ -167,7 +168,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation">Icon: </Label>
|
||||
<Label For="Icon" HelpText="Optionally provide an icon class name for this page which will be displayed in the site navigation" ResourceKey="Icon">Icon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="Icon" class="form-control" @bind="@_icon" />
|
||||
|
@ -175,12 +176,12 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
|
||||
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content" ResourceKey="Personalizable">Personalizable? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -190,7 +191,7 @@
|
|||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Permissions">
|
||||
<TabPanel Name="Permissions" ResourceKey="Permissions">
|
||||
@if (_permissions != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
|
@ -203,8 +204,8 @@
|
|||
}
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SavePage">@Localizer["Save"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
|
||||
@code {
|
||||
private List<Theme> _themeList;
|
||||
|
@ -308,7 +309,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Page {PageId} {Error}", _pageId, ex.Message);
|
||||
AddModuleMessage("Error Loading Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +352,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message);
|
||||
AddModuleMessage("Error Loading Child Pages For Parent", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Child Pages For Parent"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -377,7 +378,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
|
||||
AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -423,7 +424,7 @@
|
|||
|
||||
if (!PagePathIsUnique(page.Path, page.SiteId, page.PageId, _pageList))
|
||||
{
|
||||
AddModuleMessage($"A page with path {_path} already exists for the selected parent page. The page path needs to be unique for the selected parent.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["A page with path {0} already exists for the selected parent page. The page path needs to be unique for the selected parent.", _path], MessageType.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -492,17 +493,36 @@
|
|||
}
|
||||
|
||||
await logger.LogInformation("Page Saved {Page}", page);
|
||||
NavigationManager.NavigateTo(NavigateUrl(page.Path));
|
||||
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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide Page Name", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide Page Name"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
|
||||
AddModuleMessage("Error Saving Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void Cancel()
|
||||
{
|
||||
if (PageState.QueryString.ContainsKey("cp"))
|
||||
{
|
||||
NavigationManager.NavigateTo(NavigateUrl(PageState.Pages.First(item => item.PageId == int.Parse(PageState.QueryString["cp"])).Path));
|
||||
}
|
||||
else
|
||||
{
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@namespace Oqtane.Modules.Admin.Pages
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IPageService PageService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (PageState.Pages != null)
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Page" />
|
||||
<ActionLink Action="Add" Text="Add Page" ResourceKey="AddPage" />
|
||||
|
||||
<Pager Items="@PageState.Pages.Where(item => !item.IsDeleted)">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Page" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Page?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeletePage(context))" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.PageId.ToString())" ResourceKey="EditPage" /></td>
|
||||
<td><ActionDialog Header="Delete Page" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Page?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeletePage(context))" ResourceKey="DeletePage" /></td>
|
||||
<td>@(new string('-', context.Level * 2))@(context.Name)</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -37,7 +38,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Page {Page} {Error}", page, ex.Message);
|
||||
AddModuleMessage("Error Deleting Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,97 +2,98 @@
|
|||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IProfileService ProfileService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="The name of this profile item">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="title" HelpText="The title of the profile item to display to the user">Title: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="title" class="form-control" @bind="@_title" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="The help text displayed to the user for this profile item">Description: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="category" HelpText="The category of this profile item (for grouping)">Category: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="category" class="form-control" @bind="@_category" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="order" HelpText="The index order of where this profile item should be displayed">Order: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="order" class="form-control" @bind="@_vieworder" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)">Length: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="length" class="form-control" @bind="@_maxlength" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultVal" HelpText="The default value for this profile item">Default Value: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="defaultVal" class="form-control" @bind="@_defaultvalue" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="options" HelpText="A comma delimited list of options the user can select from">Options: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="options" class="form-control" @bind="@_options" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="required" HelpText="Should a user be required to provide a value for this profile item?">Required? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="required" class="form-control" @bind="@_isrequired">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="private" HelpText="Should this profile item be visible to all users?">Private? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="private" class="form-control" @bind="@_isprivate">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveProfile">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="The name of this profile item" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="title" HelpText="The title of the profile item to display to the user" ResourceKey="Title">Title: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="title" class="form-control" @bind="@_title" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="The help text displayed to the user for this profile item" ResourceKey="Description">Description: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="category" HelpText="The category of this profile item (for grouping)" ResourceKey="Category">Category: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="category" class="form-control" @bind="@_category" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="order" HelpText="The index order of where this profile item should be displayed" ResourceKey="Order">Order: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="order" class="form-control" @bind="@_vieworder" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="length" HelpText="The max number of characters this profile item should accept (enter zero for unlimited)" ResourceKey="Length">Length: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="length" class="form-control" @bind="@_maxlength" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultVal" HelpText="The default value for this profile item" ResourceKey="DefaultValue">Default Value: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="defaultVal" class="form-control" @bind="@_defaultvalue" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="options" HelpText="A comma delimited list of options the user can select from" ResourceKey="Options">Options: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="options" class="form-control" @bind="@_options" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="required" HelpText="Should a user be required to provide a value for this profile item?" ResourceKey="Required">Required? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="required" class="form-control" @bind="@_isrequired">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="private" HelpText="Should this profile item be visible to all users?" ResourceKey="Private">Private? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="private" class="form-control" @bind="@_isprivate">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveProfile">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private int _profileid = -1;
|
||||
|
@ -137,7 +138,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Profile {ProfileId} {Error}", _profileid, ex.Message);
|
||||
AddModuleMessage("Error Loading Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -169,7 +170,8 @@
|
|||
if (_profileid != -1)
|
||||
{
|
||||
profile = await ProfileService.UpdateProfileAsync(profile);
|
||||
}else
|
||||
}
|
||||
else
|
||||
{
|
||||
profile = await ProfileService.AddProfileAsync(profile);
|
||||
}
|
||||
|
@ -180,7 +182,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", _profileid, ex.Message);
|
||||
AddModuleMessage("Error Saving Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,24 +1,25 @@
|
|||
@namespace Oqtane.Modules.Admin.Profiles
|
||||
@namespace Oqtane.Modules.Admin.Profiles
|
||||
@inherits ModuleBase
|
||||
@inject IProfileService ProfileService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_profiles == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Security="SecurityAccessLevel.Admin" Text="Add Profile" />
|
||||
<ActionLink Action="Add" Security="SecurityAccessLevel.Admin" Text="Add Profile" ResourceKey="AddProfile" />
|
||||
|
||||
<Pager Items="@_profiles">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ProfileId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Profile" Message="@("Are You Sure You Wish To Delete " + context.Name + "?")" Action="Delete" Class="btn btn-danger" OnClick="@(async () => await DeleteProfile(context.ProfileId))" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.ProfileId.ToString())" ResourceKey="EditProfile" /></td>
|
||||
<td><ActionDialog Header="Delete Profile" Message="@("Are You Sure You Wish To Delete " + context.Name + "?")" Action="Delete" Class="btn btn-danger" OnClick="@(async () => await DeleteProfile(context.ProfileId))" ResourceKey="DeleteProfile" /></td>
|
||||
<td>@context.Name</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -40,12 +41,12 @@ else
|
|||
{
|
||||
await ProfileService.DeleteProfileAsync(profileId);
|
||||
await logger.LogInformation("Profile Deleted {ProfileId}", profileId);
|
||||
AddModuleMessage("Profile Deleted", MessageType.Success);
|
||||
AddModuleMessage(Localizer["Profile Deleted"], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Profile {ProfileId} {Error}", profileId, ex.Message);
|
||||
AddModuleMessage("Error Deleting Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
@namespace Oqtane.Modules.Admin.RecycleBin
|
||||
@namespace Oqtane.Modules.Admin.RecycleBin
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IPageModuleService PageModuleService
|
||||
@inject IModuleService ModuleService
|
||||
@inject IPageService PageService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Pages">
|
||||
<TabPanel Name="Pages" ResourceKey="Pages">
|
||||
@if (_pages == null)
|
||||
{
|
||||
<br />
|
||||
<p>No Deleted Pages</p>
|
||||
<p>@Localizer["No Deleted Pages"]</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -18,13 +19,13 @@
|
|||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>Deleted By</th>
|
||||
<th>Deleted On</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Deleted By"]</th>
|
||||
<th>@Localizer["Deleted On"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><button @onclick="@(() => RestorePage(context))" class="btn btn-info" title="Restore">Restore</button></td>
|
||||
<td><ActionDialog Header="Delete Page" Message="@("Are You Sure You Wish To Permanently Delete The " + context.Name + " Page?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeletePage(context))" /></td>
|
||||
<td><ActionDialog Header="Delete Page" Message="@Localizer["Are You Sure You Wish To Permanently Delete The {0} Page?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeletePage(context))" ResourceKey="DeletePage" /></td>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.DeletedBy</td>
|
||||
<td>@context.DeletedOn</td>
|
||||
|
@ -32,11 +33,11 @@
|
|||
</Pager>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Modules">
|
||||
<TabPanel Name="Modules" ResourceKey="Modules">
|
||||
@if (_modules == null)
|
||||
{
|
||||
<br />
|
||||
<p>No Deleted Modules</p>
|
||||
<p>@Localizer["No Deleted Modules"]</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -44,14 +45,14 @@
|
|||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Page</th>
|
||||
<th>Module</th>
|
||||
<th>Deleted By</th>
|
||||
<th>Deleted On</th>
|
||||
<th>@Localizer["Page"]</th>
|
||||
<th>@Localizer["Module"]</th>
|
||||
<th>@Localizer["Deleted By"]</th>
|
||||
<th>@Localizer["Deleted On"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><button @onclick="@(() => RestoreModule(context))" class="btn btn-info" title="Restore">Restore</button></td>
|
||||
<td><ActionDialog Header="Delete Module" Message="@("Are You Sure You Wish To Permanently Delete The " + context.Title + " Module?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteModule(context))" /></td>
|
||||
<td><button @onclick="@(() => RestoreModule(context))" class="btn btn-info" title="Restore">@Localizer["Restore"]</button></td>
|
||||
<td><ActionDialog Header="Delete Module" Message="@Localizer["Are You Sure You Wish To Permanently Delete The {0} Module?", context.Title]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteModule(context))" ResourceKey="DeleteModule" /></td>
|
||||
<td>@PageState.Pages.Find(item => item.PageId == context.PageId).Name</td>
|
||||
<td>@context.Title</td>
|
||||
<td>@context.DeletedBy</td>
|
||||
|
@ -77,7 +78,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Deleted Pages Or Modules {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Deleted Pages Or Modules", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Deleted Pages Or Modules"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,7 +105,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Restoring Deleted Page {Page} {Error}", page, ex.Message);
|
||||
AddModuleMessage("Error Restoring Deleted Page", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Restoring Deleted Page"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Restoring Deleted Module {Module} {Error}", module, ex.Message);
|
||||
AddModuleMessage("Error Restoring Deleted Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Restoring Deleted Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -150,12 +151,12 @@
|
|||
await PageModuleService.DeletePageModuleAsync(module.PageModuleId);
|
||||
// check if there are any remaining module instances in the site
|
||||
_modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId);
|
||||
|
||||
|
||||
if (!_modules.Exists(item => item.ModuleId == module.ModuleId))
|
||||
{
|
||||
await ModuleService.DeleteModuleAsync(module.ModuleId);
|
||||
}
|
||||
|
||||
|
||||
await logger.LogInformation("Module Permanently Deleted {Module}", module);
|
||||
await Load();
|
||||
StateHasChanged();
|
||||
|
@ -163,7 +164,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Permanently Deleting Module {Module} {Error}", module, ex.Message);
|
||||
AddModuleMessage("Error Permanently Deleting Module", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Permanently Deleting Module"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
@namespace Oqtane.Modules.Admin.Register
|
||||
@namespace Oqtane.Modules.Admin.Register
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (PageState.Site.AllowRegistration)
|
||||
{
|
||||
|
@ -10,41 +11,41 @@
|
|||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<ModuleMessage Message="You Are Already Registered" Type="MessageType.Info" />
|
||||
<ModuleMessage Message="@Localizer["You Are Already Registered"]" Type="MessageType.Info" />
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<ModuleMessage Message="Please Note That Registration Requires A Valid Email Address In Order To Verify Your Identity" Type="MessageType.Info" />
|
||||
<ModuleMessage Message="@Localizer["Please Note That Registration Requires A Valid Email Address In Order To Verify Your Identity"]" Type="MessageType.Info" />
|
||||
|
||||
<div class="container">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<label for="Username" class="control-label">@Localizer["Username:"] </label>
|
||||
<input type="text" class="form-control" placeholder="Username" @bind="@_username" id="Username" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Password: </label>
|
||||
<label for="Password" class="control-label">@Localizer["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">Confirm Password: </label>
|
||||
<label for="Confirm" class="control-label">@Localizer["Confirm Password:"] </label>
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Email" class="control-label">Email: </label>
|
||||
<label for="Email" class="control-label">@Localizer["Email:"] </label>
|
||||
<input type="text" class="form-control" placeholder="Email" @bind="@_email" id="Email" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="DisplayName" class="control-label">Full Name: </label>
|
||||
<label for="DisplayName" class="control-label">@Localizer["Full Name:"] </label>
|
||||
<input type="text" class="form-control" placeholder="Full Name" @bind="@_displayName" id="DisplayName" />
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="Register">Register</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="Register">@Localizer["Register"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
</div>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ModuleMessage Message="Registration is Disabled For This Site" Type="MessageType.Info" />
|
||||
<ModuleMessage Message="@Localizer["Registration is Disabled For This Site"]" Type="MessageType.Info" />
|
||||
}
|
||||
|
||||
@code {
|
||||
|
@ -79,28 +80,28 @@ else
|
|||
if (user != null)
|
||||
{
|
||||
await logger.LogInformation("User Created {Username} {Email}", _username, _email);
|
||||
AddModuleMessage("User Account Created. Please Check Your Email For Verification Instructions.", MessageType.Info);
|
||||
AddModuleMessage(Localizer["User Account Created. Please Check Your Email For Verification Instructions."], MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
await logger.LogError("Error Adding User {Username} {Email}", _username, _email);
|
||||
AddModuleMessage("Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Passwords Entered Do Not Match", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Username, Password, and Email Address", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Username, Password, and Email Address"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message);
|
||||
AddModuleMessage("Error Adding User", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Adding User"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,23 +1,24 @@
|
|||
@namespace Oqtane.Modules.Admin.Reset
|
||||
@namespace Oqtane.Modules.Admin.Reset
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
<div class="container">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<label for="Username" class="control-label">@Localizer["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">Password: </label>
|
||||
<label for="Password" class="control-label">@Localizer["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">Confirm Password: </label>
|
||||
<label for="Confirm" class="control-label">@Localizer["Confirm Password:"] </label>
|
||||
<input type="password" class="form-control" placeholder="Password" @bind="@_confirm" id="Confirm"/>
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" @onclick="Reset">Reset Password</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="Reset">@Localizer["Reset Password"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
@ -63,23 +64,23 @@
|
|||
else
|
||||
{
|
||||
await logger.LogError("Error Resetting User Password {Username}", _username);
|
||||
AddModuleMessage("Error Resetting User Password. Please Ensure Password Meets Complexity Requirements.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Resetting User Password. Please Ensure Password Meets Complexity Requirements."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Passwords Entered Do Not Match", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Username, Password, and Email Address", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Username, Password, and Email Address"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
|
||||
AddModuleMessage("Error Resetting User Password", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Resetting User Password"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IRoleService RoleService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Name Of The Role">Name:</Label>
|
||||
<Label For="name" HelpText="Name Of The Role" ResourceKey="Name">Name:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -14,7 +15,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose">Description:</Label>
|
||||
<Label For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose" ResourceKey="Description">Description:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
|
||||
|
@ -22,20 +23,20 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role">Auto Assigned?</Label>
|
||||
<Label For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isautoassigned" class="form-control" @bind="@_isautoassigned">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveRole">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveRole">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
@code {
|
||||
private string _name = string.Empty;
|
||||
private string _description = string.Empty;
|
||||
private string _isautoassigned = "False";
|
||||
|
@ -61,7 +62,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding Role {Role} {Error}", role, ex.Message);
|
||||
AddModuleMessage("Error Adding Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Adding Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IRoleService RoleService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Name Of The Role">Name:</Label>
|
||||
<Label For="name" HelpText="Name Of The Role" ResourceKey="Name">Name:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -14,7 +15,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose">Description:</Label>
|
||||
<Label For="description" HelpText="A Short Description Of The Role Which Describes Its Purpose" ResourceKey="Description">Description:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="description" class="form-control" @bind="@_description" rows="5"></textarea>
|
||||
|
@ -22,18 +23,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role">Auto Assigned?</Label>
|
||||
<Label For="isautoassigned" HelpText="Indicates Whether Or Not New Users Are Automatically Assigned To This Role" ResourceKey="AutoAssigned">Auto Assigned?</Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isautoassigned" class="form-control" @bind="@_isautoassigned">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveRole">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveRole">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private int _roleid;
|
||||
|
@ -59,7 +60,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Role {RoleId} {Error}", _roleid, ex.Message);
|
||||
AddModuleMessage("Error Loading Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Role {Role} {Error}", role, ex.Message);
|
||||
AddModuleMessage("Error Saving Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,27 @@
|
|||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@inherits ModuleBase
|
||||
@inject IRoleService RoleService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_roles == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Role" />
|
||||
<ActionLink Action="Add" Text="Add Role" ResourceKey="AddRole" />
|
||||
|
||||
<Pager Items="@_roles">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.RoleId.ToString())" Disabled="@(context.IsSystem)" /></td>
|
||||
<td><ActionDialog Header="Delete Role" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Role?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteRole(context))" Disabled="@(context.IsSystem)" /></td>
|
||||
<td><ActionLink Action="Users" Parameters="@($"id=" + context.RoleId.ToString())" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.RoleId.ToString())" Disabled="@(context.IsSystem)" ResourceKey="Edit" /></td>
|
||||
<td><ActionDialog Header="Delete Role" Message="@Localizer["Are You Sure You Wish To Delete The {0} Role?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteRole(context))" Disabled="@(context.IsSystem)" ResourceKey="DeleteRole" /></td>
|
||||
<td><ActionLink Action="Users" Parameters="@($"id=" + context.RoleId.ToString())" ResourceKey="Users" /></td>
|
||||
<td>@context.Name</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -47,7 +48,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Role {Role} {Error}", role, ex.Message);
|
||||
AddModuleMessage("Error Deleting Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@namespace Oqtane.Modules.Admin.Roles
|
||||
@inherits ModuleBase
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserRoleService UserRoleService
|
||||
@inject IStringLocalizer<Users> Localizer
|
||||
|
||||
@if (userroles == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="role" HelpText="The role you are assigning users to">Role: </Label>
|
||||
<Label For="role" HelpText="The role you are assigning users to" ResourceKey="Role">Role: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="role" class="form-control" @bind="@name" disabled />
|
||||
|
@ -20,11 +21,11 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="user" HelpText="Select a user">User: </Label>
|
||||
<Label For="user" HelpText="Select a user" ResourceKey="User">User: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="user" class="form-control" @bind="@userid">
|
||||
<option value="-1"><Select User></option>
|
||||
<option value="-1"><@Localizer["Select User"]></option>
|
||||
@foreach (UserRole userrole in users)
|
||||
{
|
||||
<option value="@(userrole.UserId)">@userrole.User.DisplayName</option>
|
||||
|
@ -34,35 +35,35 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="effectiveDate" HelpText="The date that this role assignment is active">Effective Date: </Label>
|
||||
<Label For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="effectiveDate" class="form-control" @bind="@effectivedate" />
|
||||
<input type="date" id="effectiveDate" class="form-control" @bind="@effectivedate" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="expiryDate" HelpText="The date that this role assignment expires">Expiry Date: </Label>
|
||||
<Label For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="expiryDate" class="form-control" @bind="@expirydate" />
|
||||
<input type="date" id="expiryDate" class="form-control" @bind="@expirydate" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveUserRole">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveUserRole">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
<hr class="app-rule" />
|
||||
<p align="center">
|
||||
<Pager Items="@userroles">
|
||||
<Header>
|
||||
<th>Users</th>
|
||||
<th>@Localizer["Users"]</th>
|
||||
<th> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.User.DisplayName</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>Delete</button>
|
||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]</button>
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -74,8 +75,8 @@ else
|
|||
private string name = string.Empty;
|
||||
private List<UserRole> users;
|
||||
private int userid = -1;
|
||||
private string effectivedate = string.Empty;
|
||||
private string expirydate = string.Empty;
|
||||
private DateTime? effectivedate = null;
|
||||
private DateTime? expirydate = null;
|
||||
private List<UserRole> userroles;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
|
||||
|
@ -88,13 +89,16 @@ else
|
|||
Role role = await RoleService.GetRoleAsync(roleid);
|
||||
name = role.Name;
|
||||
users = await UserRoleService.GetUserRolesAsync(PageState.Site.SiteId);
|
||||
users = users.Where(item => item.Role.Name == RoleNames.Registered).ToList();
|
||||
users = users
|
||||
.Where(u => u.Role.Name == RoleNames.Registered)
|
||||
.OrderBy(u => u.User.DisplayName)
|
||||
.ToList();
|
||||
await GetUserRoles();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Users", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Users"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +112,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading User Roles {RoleId} {Error}", roleid, ex.Message);
|
||||
AddModuleMessage("Error Loading User Roles", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading User Roles"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,23 +125,8 @@ else
|
|||
var userrole = userroles.Where(item => item.UserId == userid && item.RoleId == roleid).FirstOrDefault();
|
||||
if (userrole != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
userrole.EffectiveDate = effectivedate;
|
||||
userrole.ExpiryDate = expirydate;
|
||||
await UserRoleService.UpdateUserRoleAsync(userrole);
|
||||
}
|
||||
else
|
||||
|
@ -145,41 +134,25 @@ 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);
|
||||
}
|
||||
userrole.EffectiveDate = effectivedate;
|
||||
userrole.ExpiryDate = expirydate;
|
||||
|
||||
await UserRoleService.AddUserRoleAsync(userrole);
|
||||
}
|
||||
|
||||
await GetUserRoles();
|
||||
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
||||
AddModuleMessage("User Assigned To Role", MessageType.Success);
|
||||
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Select A User", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Select A User"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving User Roles {RoleId} {Error}", roleid, ex.Message);
|
||||
AddModuleMessage("Error Saving User Roles", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving User Roles"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -190,12 +163,12 @@ else
|
|||
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
||||
await GetUserRoles();
|
||||
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
||||
AddModuleMessage("User Removed From Role", MessageType.Success);
|
||||
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
|
||||
AddModuleMessage("Error Removing User From Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Removing User From Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Modules.Admin.Site
|
||||
@namespace Oqtane.Modules.Admin.Site
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ISiteService SiteService
|
||||
|
@ -6,131 +6,152 @@
|
|||
@inject IAliasService AliasService
|
||||
@inject IThemeService ThemeService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_initialized)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the site name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="Enter the tenant for the site">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="alias" HelpText="Enter the alias for the server">Aliases: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="alias" class="form-control" @bind="@_urls" rows="3"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="logo" HelpText="Upload a logo for the site">Logo: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_logofileid" Filter="@Constants.ImageFiles" @ref="_logofilemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="favicon" HelpText="Select Your default icon">Favicon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_faviconfileid" Filter="ico" @ref="_faviconfilemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultTheme" HelpText="Select the sites default theme">Default Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value="-"><Select Theme></option>
|
||||
@foreach (var theme in _themes)
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the site name" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="Enter the tenant for the site" ResourceKey="Tenant">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="alias" HelpText="Enter the alias for the server" ResourceKey="Aliases">Aliases: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="alias" class="form-control" @bind="@_urls" rows="3"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="logo" HelpText="Upload a logo for the site" ResourceKey="Logo">Logo: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_logofileid" Filter="@Constants.ImageFiles" @ref="_logofilemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="favicon" HelpText="Select Your default icon" ResourceKey="FavoriteIcon">Favicon: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_faviconfileid" Filter="ico" @ref="_faviconfilemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultTheme" HelpText="Select the sites default theme" ResourceKey="DefaultTheme">Default Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value="-"><@Localizer["Select Theme"]></option>
|
||||
@foreach (var theme in _themes)
|
||||
{
|
||||
if (theme.TypeName == _themetype)
|
||||
{
|
||||
if (theme.TypeName == _themetype)
|
||||
{
|
||||
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@theme.TypeName">@theme.Name</option>
|
||||
}
|
||||
<option value="@theme.TypeName" selected>@theme.Name</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@theme.TypeName">@theme.Name</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@if (_layouts.Count > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultLayout" HelpText="Select the sites default layout" ResourceKey="DefaultLayout">Default Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><@Localizer["Select Layout"]></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@if (_layouts.Count > 0)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultLayout" HelpText="Select the sites default layout">Default Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><Select Layout></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><Select Container></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="allowRegister" HelpText="Do you want the users to be able to register for an account on the site">Allow User Registration? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="allowRegister" class="form-control" @bind="@_allowregistration">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isDeleted" HelpText="Is this site deleted?">Is Deleted? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isDeleted" class="form-control" @bind="@_isdeleted">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultAdminContainer" class="form-control" @bind="@_admincontainertype">
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<select id="allowRegister" class="form-control" @bind="@_allowregistration">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isDeleted" HelpText="Is this site deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isDeleted" class="form-control" @bind="@_isdeleted">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<Section Name="SMTP" Heading="SMTP Settings">
|
||||
<Section Name="SMTP" Heading="SMTP Settings" ResourceKey="SMTPSettings">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
@Localizer["Please Note That SMTP Requires The Notification Job To Be Enabled In the Scheduled Jobs"]
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="host" HelpText="Enter the host name of the server">Host: </Label>
|
||||
<Label For="host" HelpText="Enter the host name of the SMTP server" ResourceKey="Host">Host: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="host" class="form-control" @bind="@_smtphost" />
|
||||
|
@ -138,7 +159,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="port" HelpText="Enter the port number for the server">Port: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="port" class="form-control" @bind="@_smtpport" />
|
||||
|
@ -146,15 +167,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="enabledSSl" HelpText="Specifiy if SSL is enabled for your server">SSL Enabled: </Label>
|
||||
<Label For="enabledSSl" HelpText="Specify if SSL is required for your SMTP server" ResourceKey="UseSsl">SSL Enabled: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="enabledSSl" class="form-control" @bind="@_smtpssl" />
|
||||
<select id="enabledSSl" class="form-control" @bind="@_smtpssl">
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="username" HelpText="Enter the username for the server">Username: </Label>
|
||||
<Label For="username" HelpText="Enter the username for your SMTP account" ResourceKey="SmptUsername">Username: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="username" class="form-control" @bind="@_smtpusername" />
|
||||
|
@ -162,30 +186,38 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="password" HelpText="Enter the password for the server">Password: </Label>
|
||||
<Label For="password" HelpText="Enter the password for your SMTP account" ResourceKey="SmtpPassword">Password: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="password" type="password" class="form-control" @bind="@_smtppassword" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<input id="sender" class="form-control" @bind="@_smtpsender" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</Section>
|
||||
<Section Name="PWA" Heading="Progressive Web Application Settings">
|
||||
<Section Name="PWA" Heading="Progressive Web Application Settings" ResourceKey="PWASettings">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)">Is Enabled? </Label>
|
||||
<Label For="isEnabled" HelpText="Select whether you would like this site to be available as a Progressive Web Application (PWA)" ResourceKey="EnablePWA">Is Enabled? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isEnabled" class="form-control" @bind="@_pwaisenabled">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="appIcon" HelpText="Include an application icon for your PWA. It should be a PNG which is 192 X 192 pixels in dimension.">App Icon: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_pwaappiconfileid" Filter="png" @ref="_pwaappiconfilemanager" />
|
||||
|
@ -193,7 +225,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="splashIcon" HelpText="Include a splash icon for your PWA. It should be a PNG which is 512 X 512 pixels in dimension.">Splash Icon: </Label>
|
||||
<Label 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>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@_pwasplashiconfileid" Filter="png" @ref="_pwasplashiconfilemanager" />
|
||||
|
@ -203,8 +235,7 @@
|
|||
</Section>
|
||||
|
||||
<br />
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">@Localizer["Save"]</button>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
|
@ -228,12 +259,14 @@
|
|||
private string _themetype = "-";
|
||||
private string _layouttype = "-";
|
||||
private string _containertype = "-";
|
||||
private string _admincontainertype = "-";
|
||||
private string _allowregistration;
|
||||
private string _smtphost = string.Empty;
|
||||
private string _smtpport = string.Empty;
|
||||
private string _smtpssl = string.Empty;
|
||||
private string _smtpssl = "False";
|
||||
private string _smtpusername = string.Empty;
|
||||
private string _smtppassword = string.Empty;
|
||||
private string _smtpsender = string.Empty;
|
||||
private string _pwaisenabled;
|
||||
private int _pwaappiconfileid = -1;
|
||||
private FileManager _pwaappiconfilemanager;
|
||||
|
@ -281,14 +314,16 @@
|
|||
_layouttype = site.DefaultLayoutType;
|
||||
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||
_containertype = site.DefaultContainerType;
|
||||
_admincontainertype = site.AdminContainerType;
|
||||
_allowregistration = site.AllowRegistration.ToString();
|
||||
|
||||
var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
|
||||
_smtphost = SettingService.GetSetting(settings, "SMTPHost", string.Empty);
|
||||
_smtpport = SettingService.GetSetting(settings, "SMTPPort", string.Empty);
|
||||
_smtpssl = SettingService.GetSetting(settings, "SMTPSSL", string.Empty);
|
||||
_smtpssl = SettingService.GetSetting(settings, "SMTPSSL", "False");
|
||||
_smtpusername = SettingService.GetSetting(settings, "SMTPUsername", string.Empty);
|
||||
_smtppassword = SettingService.GetSetting(settings, "SMTPPassword", string.Empty);
|
||||
_smtpsender = SettingService.GetSetting(settings, "SMTPSender", string.Empty);
|
||||
|
||||
_pwaisenabled = site.PwaIsEnabled.ToString();
|
||||
|
||||
|
@ -347,12 +382,13 @@
|
|||
}
|
||||
_layouttype = "-";
|
||||
_containertype = "-";
|
||||
_admincontainertype = "";
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
|
||||
AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,9 +420,17 @@
|
|||
site.LogoFileId = logofileid;
|
||||
}
|
||||
|
||||
|
||||
var faviconFieldId = _faviconfilemanager.GetFileId();
|
||||
if (faviconFieldId != -1)
|
||||
{
|
||||
site.FaviconFileId = faviconFieldId;
|
||||
}
|
||||
|
||||
site.DefaultThemeType = _themetype;
|
||||
site.DefaultLayoutType = (_layouttype == "-" ? string.Empty : _layouttype);
|
||||
site.DefaultContainerType = _containertype;
|
||||
site.AdminContainerType = _admincontainertype;
|
||||
site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
|
||||
site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
|
||||
|
||||
|
@ -434,27 +478,28 @@
|
|||
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);
|
||||
|
||||
await logger.LogInformation("Site Saved {Site}", site);
|
||||
await logger.LogInformation("Site Settings Saved {Site}", site);
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
AddModuleMessage(Localizer["Site Settings Saved"], MessageType.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("An Alias Specified Has Already Been Used For Another Site", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["An Alias Specified Has Already Been Used For Another Site"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme/Layout/Container", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Site Name, Alias, And Default Theme/Layout/Container"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Site {SiteId} {Error}", PageState.Site.SiteId, ex.Message);
|
||||
AddModuleMessage("Error Saving Site", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Site"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ITenantService TenantService
|
||||
|
@ -8,17 +8,18 @@
|
|||
@inject ISiteTemplateService SiteTemplateService
|
||||
@inject IUserService UserService
|
||||
@inject IInstallationService InstallationService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
@if (_tenants == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the name of the site">Site Name: </Label>
|
||||
<Label For="name" HelpText="Enter the name of the site" ResourceKey="Name">Site Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -26,7 +27,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="alias" HelpText="Enter the alias for the server">Aliases: </Label>
|
||||
<Label For="alias" HelpText="Enter the alias for the server" ResourceKey="Aliases">Aliases: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="alias" class="form-control" @bind="@_urls" rows="3"></textarea>
|
||||
|
@ -34,11 +35,11 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultTheme" HelpText="Select the default theme for the website">Default Theme: </Label>
|
||||
<Label For="defaultTheme" HelpText="Select the default theme for the website" ResourceKey="DefaultTheme">Default Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value="-"><Select Theme></option>
|
||||
<option value="-"><@Localizer["Select Theme"]></option>
|
||||
@foreach (var theme in _themes)
|
||||
{
|
||||
<option value="@theme.TypeName">@theme.Name</option>
|
||||
|
@ -50,11 +51,11 @@ else
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
||||
<Label For="defaultLayout" HelpText="Select the default layout for the site" ResourceKey="DefaultLayout">Default Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><Select Layout></option>
|
||||
<option value="-"><@Localizer["Select Layout"]></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||
|
@ -65,11 +66,11 @@ else
|
|||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultContainer" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><Select Container></option>
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
|
@ -79,11 +80,26 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="siteTemplate" HelpText="Select the site template">Site Template: </Label>
|
||||
<Label For="adminContainer" HelpText="Select the admin container for the site" ResourceKey="AdminContainer">Admin Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="adminContainer" class="form-control" @bind="@_admincontainertype">
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="siteTemplate" HelpText="Select the site template" ResourceKey="SiteTemplate">Site Template: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="siteTemplate" class="form-control" @bind="@_sitetemplatetype">
|
||||
<option value="-"><Select Site Template></option>
|
||||
<option value="-"><@Localizer["Select Site Template"]></option>
|
||||
@foreach (SiteTemplate siteTemplate in _siteTemplates)
|
||||
{
|
||||
<option value="@siteTemplate.TypeName">@siteTemplate.Name</option>
|
||||
|
@ -93,12 +109,12 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="Select the tenant for the site">Tenant: </Label>
|
||||
<Label For="tenant" HelpText="Select the tenant for the site" ResourceKey="Tenant">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="tenant" class="form-control" @onchange="(e => TenantChanged(e))">
|
||||
<option value="-"><Select Tenant></option>
|
||||
<option value="+"><Create New Tenant></option>
|
||||
<option value="-"><@Localizer["Select Tenant"]></option>
|
||||
<option value="+"><@Localizer["Create New Tenant"]></option>
|
||||
@foreach (Tenant tenant in _tenants)
|
||||
{
|
||||
<option value="@tenant.TenantId">@tenant.Name</option>
|
||||
|
@ -115,7 +131,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the name for the tenant">Tenant Name: </Label>
|
||||
<Label For="name" HelpText="Enter the name for the tenant" ResourceKey="TenantName">Tenant Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_tenantname" />
|
||||
|
@ -123,18 +139,18 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="databaseType" HelpText="Select the database type for the tenant">Database Type: </Label>
|
||||
<Label For="databaseType" HelpText="Select the database type for the tenant" ResourceKey="DatabaseType">Database Type: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="databaseType" class="custom-select" @bind="@_databasetype">
|
||||
<option value="LocalDB">Local Database</option>
|
||||
<option value="SQLServer">SQL Server</option>
|
||||
<option value="LocalDB">@Localizer["Local Database"]</option>
|
||||
<option value="SQLServer">@Localizer["SQL Server"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="server" HelpText="Enter the server for the tenant">Server: </Label>
|
||||
<Label For="server" HelpText="Enter the server for the tenant" ResourceKey="DatabaseServer">Server: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="server" type="text" class="form-control" @bind="@_server" />
|
||||
|
@ -142,7 +158,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="database" HelpText="Enter the database for the tenant">Database: </Label>
|
||||
<Label For="database" HelpText="Enter the database for the tenant" ResourceKey="Database">Database: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="database" type="text" class="form-control" @bind="@_database" />
|
||||
|
@ -150,12 +166,12 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="integratedSecurity" HelpText="Select if you want integrated security or not">Integrated Security: </Label>
|
||||
<Label For="integratedSecurity" HelpText="Select if you want integrated security or not" ResourceKey="IntegratedSecurity">Integrated Security: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="integratedSecurity" class="custom-select" @onchange="SetIntegratedSecurity">
|
||||
<option value="true" selected>True</option>
|
||||
<option value="false">False</option>
|
||||
<option value="true" selected>@Localizer["True"]</option>
|
||||
<option value="false">@Localizer["False"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -163,7 +179,7 @@ else
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="username" HelpText="Enter the username for the integrated security">Database Username: </Label>
|
||||
<Label For="username" HelpText="Enter the username for the integrated security" ResourceKey="DatabaseUsername">Database Username: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="username" type="text" class="form-control" @bind="@_username" />
|
||||
|
@ -171,7 +187,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="password" HelpText="Enter the password for the integrated security">Database Password: </Label>
|
||||
<Label For="password" HelpText="Enter the password for the integrated security" ResourceKey="DatabasePassword">Database Password: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="password" type="password" class="form-control" @bind="@_password" />
|
||||
|
@ -180,7 +196,7 @@ else
|
|||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="hostUsername" HelpText="Enter the username of the host for this site">Host Username:</Label>
|
||||
<Label For="hostUsername" HelpText="Enter the username of the host for this site" ResourceKey="HostUsername">Host Username:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="hostUsername" class="form-control" @bind="@_hostusername" readonly />
|
||||
|
@ -188,7 +204,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="hostPassword" HelpText="Enter the password for the host of this site">Host Password:</Label>
|
||||
<Label For="hostPassword" HelpText="Enter the password for the host of this site" ResourceKey="HostPassword">Host Password:</Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="hostPassword" type="password" class="form-control" @bind="@_hostpassword" />
|
||||
|
@ -196,8 +212,8 @@ else
|
|||
</tr>
|
||||
}
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
@ -224,6 +240,7 @@ else
|
|||
private string _themetype = "-";
|
||||
private string _layouttype = "-";
|
||||
private string _containertype = "-";
|
||||
private string _admincontainertype = "";
|
||||
private string _sitetemplatetype = "-";
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
@ -277,12 +294,13 @@ else
|
|||
}
|
||||
_layouttype = "-";
|
||||
_containertype = "-";
|
||||
_admincontainertype = "";
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
|
||||
AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -346,17 +364,17 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Specify A Server And Database", MessageType.Error);
|
||||
AddModuleMessage(Localizer["You Must Specify A Server And Database"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Invalid Host Password", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Invalid Host Password"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Tenant Name Is Missing Or Already Exists", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Tenant Name Is Missing Or Already Exists"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -377,6 +395,7 @@ else
|
|||
config.DefaultTheme = _themetype;
|
||||
config.DefaultLayout = _layouttype;
|
||||
config.DefaultContainer = _containertype;
|
||||
config.DefaultAdminContainer = _admincontainertype;
|
||||
config.SiteTemplate = _sitetemplatetype;
|
||||
|
||||
ShowProgressIndicator();
|
||||
|
@ -397,12 +416,12 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage(string.Join(", ", duplicates.ToArray()) + " Already Used For Another Site", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["{0} Already Used For Another Site", string.Join(", ", duplicates.ToArray())], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, Default Theme/Layout/Container, And Site Template", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Tenant, Site Name, Alias, Default Theme/Layout/Container, And Site Template"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ISiteService SiteService
|
||||
@inject ITenantService TenantService
|
||||
@inject IAliasService AliasService
|
||||
@inject IThemeService ThemeService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
@if (_initialized)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="Enter the name of the site">Name: </Label>
|
||||
<Label For="name" HelpText="Enter the name of the site" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" />
|
||||
|
@ -19,15 +20,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="Enter the tenant for the site">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="alias" HelpText="Enter the alias for the server">Aliases: </Label>
|
||||
<Label For="alias" HelpText="Enter the alias for the server" ResourceKey="Aliases">Aliases: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="alias" class="form-control" @bind="@_urls" rows="3" />
|
||||
|
@ -35,11 +28,11 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultTheme" HelpText="Select the default theme for the website">Default Theme: </Label>
|
||||
<Label For="defaultTheme" HelpText="Select the default theme for the website" ResourceKey="DefaultTheme">Default Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultTheme" class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value="-"><Select Theme></option>
|
||||
<option value="-"><@Localizer["Select Theme"]></option>
|
||||
@foreach (var theme in _themes)
|
||||
{
|
||||
if (theme.TypeName == _themetype)
|
||||
|
@ -58,11 +51,11 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultLayout" HelpText="Select the default layout for the site">Default Layout: </Label>
|
||||
<Label For="defaultLayout" HelpText="Select the default layout for the site" ResourceKey="DefaultLayout">Default Layout: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultLayout" class="form-control" @bind="@_layouttype">
|
||||
<option value="-"><Select Layout></option>
|
||||
<option value="-"><@Localizer["Select Layout"]></option>
|
||||
@foreach (var layout in _layouts)
|
||||
{
|
||||
<option value="@(layout.TypeName)">@(layout.Name)</option>
|
||||
|
@ -73,11 +66,11 @@
|
|||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site">Default Container: </Label>
|
||||
<Label For="defaultContainer" HelpText="Select the default container for the site" ResourceKey="DefaultContainer">Default Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultIdea" class="form-control" @bind="@_containertype">
|
||||
<option value="-"><Select Container></option>
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
|
@ -87,19 +80,51 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isDeleted" HelpText="Has this site been deleted?">Is Deleted? </Label>
|
||||
<Label For="defaultAdminContainer" HelpText="Select the default admin container for the site" ResourceKey="DefaultAdminContainer">Default Admin Container: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="defaultAdminContainer" class="form-control" @bind="@_admincontainertype">
|
||||
<option value="-"><@Localizer["Select Container"]></option>
|
||||
<option value=""><@Localizer["Default Admin Container"]></option>
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
<option value="@container.TypeName">@container.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="isDeleted" HelpText="Has this site been deleted?" ResourceKey="IsDeleted">Is Deleted? </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="isDeleted" class="form-control" @bind="@_isdeleted">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="The tenant for the site" ResourceKey="Tenant">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="tenant" class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="connectionstring" HelpText="The database connection string" ResourceKey="ConnectionString">Connection String: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="connectionstring" class="form-control" @bind="@_connectionstring" rows="3" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveSite">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
|
@ -113,13 +138,12 @@
|
|||
private List<ThemeControl> _containers = new List<ThemeControl>();
|
||||
private Alias _alias;
|
||||
private string _name = string.Empty;
|
||||
private List<Tenant> _tenantList;
|
||||
private string _tenant = string.Empty;
|
||||
private List<Alias> _aliasList;
|
||||
private string _urls = string.Empty;
|
||||
private string _themetype;
|
||||
private string _layouttype;
|
||||
private string _containertype;
|
||||
private string _containertype = "-";
|
||||
private string _admincontainertype = "-";
|
||||
private string _createdby;
|
||||
private DateTime _createdon;
|
||||
private string _modifiedby;
|
||||
|
@ -127,6 +151,8 @@
|
|||
private string _deletedby;
|
||||
private DateTime? _deletedon;
|
||||
private string _isdeleted;
|
||||
private string _tenant = string.Empty;
|
||||
private string _connectionstring = string.Empty;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
|
@ -143,8 +169,6 @@
|
|||
if (site != null)
|
||||
{
|
||||
_name = site.Name;
|
||||
_tenantList = await TenantService.GetTenantsAsync();
|
||||
_tenant = _tenantList.Find(item => item.TenantId == site.TenantId).Name;
|
||||
|
||||
foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
|
||||
{
|
||||
|
@ -157,6 +181,7 @@
|
|||
_layouttype = site.DefaultLayoutType;
|
||||
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
|
||||
_containertype = site.DefaultContainerType;
|
||||
_admincontainertype = site.AdminContainerType;
|
||||
_createdby = site.CreatedBy;
|
||||
_createdon = site.CreatedOn;
|
||||
_modifiedby = site.ModifiedBy;
|
||||
|
@ -165,6 +190,14 @@
|
|||
_deletedon = site.DeletedOn;
|
||||
_isdeleted = site.IsDeleted.ToString();
|
||||
|
||||
List<Tenant> tenants = await TenantService.GetTenantsAsync();
|
||||
Tenant tenant = tenants.Find(item => item.TenantId == site.TenantId);
|
||||
if (tenant != null)
|
||||
{
|
||||
_tenant = tenant.Name;
|
||||
_connectionstring = tenant.DBConnectionString;
|
||||
}
|
||||
|
||||
_initialized = true;
|
||||
}
|
||||
}
|
||||
|
@ -192,12 +225,13 @@
|
|||
}
|
||||
_layouttype = "-";
|
||||
_containertype = "-";
|
||||
_admincontainertype = "";
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
|
||||
AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -227,6 +261,7 @@
|
|||
site.DefaultThemeType = _themetype;
|
||||
site.DefaultLayoutType = _layouttype ?? string.Empty;
|
||||
site.DefaultContainerType = _containertype;
|
||||
site.AdminContainerType = _admincontainertype;
|
||||
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
|
||||
|
||||
site = await SiteService.UpdateSiteAsync(site);
|
||||
|
@ -256,25 +291,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
await Log(_alias, LogLevel.Information,PermissionNames.Edit, null, "Site Saved {Site}", site);
|
||||
await Log(_alias, LogLevel.Information, PermissionNames.Edit, null, "Site Saved {Site}", site);
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("An Alias Specified Has Already Been Used For Another Site", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["An Alias Specified Has Already Been Used For Another Site"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme/Container", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Site Name, Alias, And Default Theme/Container"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Log(_alias, LogLevel.Error, string.Empty, ex, "Error Saving Site {SiteId} {Error}", _alias.SiteId, ex.Message);
|
||||
AddModuleMessage("Error Saving Site", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Site"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@namespace Oqtane.Modules.Admin.Sites
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IAliasService AliasService
|
||||
@inject ISiteService SiteService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_sites == null)
|
||||
{
|
||||
|
@ -10,17 +11,17 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Site" />
|
||||
<ActionLink Action="Add" Text="Add Site" ResourceKey="AddSite" />
|
||||
|
||||
<Pager Items="@_sites">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.AliasId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Site" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Site?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteSite(context))" /></td>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.AliasId.ToString())" ResourceKey="EditSite" /></td>
|
||||
<td><ActionDialog Header="Delete Site" Message="@Localizer["Are You Sure You Wish To Delete The {0} Site?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteSite(context))" ResourceKey="DeleteSite" /></td>
|
||||
<td><a href="@(_scheme + context.Name)">@context.Name</a></td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -57,24 +58,24 @@ else
|
|||
SiteService.SetAlias(alias);
|
||||
await SiteService.DeleteSiteAsync(alias.SiteId);
|
||||
await Log(alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", alias.SiteId);
|
||||
|
||||
|
||||
var aliases = await AliasService.GetAliasesAsync();
|
||||
foreach (Alias a in aliases.Where(item => item.SiteId == alias.SiteId && item.TenantId == alias.TenantId))
|
||||
{
|
||||
await AliasService.DeleteAliasAsync(a.AliasId);
|
||||
}
|
||||
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Can Not Delete The Current Site", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Can Not Delete The Current Site"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Log(alias, LogLevel.Error, "", ex, "Error Deleting Site {SiteId} {Error}", alias.SiteId, ex.Message);
|
||||
AddModuleMessage("Error Deleting Site", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Site"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
@namespace Oqtane.Modules.Admin.Sql
|
||||
@namespace Oqtane.Modules.Admin.Sql
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ITenantService TenantService
|
||||
@inject ISqlService SqlService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_tenants == null)
|
||||
{
|
||||
|
@ -13,11 +14,11 @@ else
|
|||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="tenant" HelpText="Select the tenant for the SQL server">Tenant: </Label>
|
||||
<Label For="tenant" HelpText="Select the tenant for the SQL server" ResourceKey="Tenant">Tenant: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="teneant" class="form-control" @bind="_tenantid">
|
||||
<option value="-1"><Select Tenant></option>
|
||||
<option value="-1"><@Localizer["Select Tenant"]></option>
|
||||
@foreach (Tenant tenant in _tenants)
|
||||
{
|
||||
<option value="@tenant.TenantId">@tenant.Name</option>
|
||||
|
@ -27,15 +28,16 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="sqlQeury" HelpText="Enter the query for the SQL server">SQL Query: </Label>
|
||||
<Label For="sqlQeury" HelpText="Enter the query for the SQL server" ResourceKey="SqlQuery">SQL Query: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="sqlQeury" class="form-control" @bind="@_sql" rows="5"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Execute">Execute</button>
|
||||
<br /><br />
|
||||
<button type="button" class="btn btn-success" @onclick="Execute">@Localizer["Execute"]</button>
|
||||
<br />
|
||||
<br />
|
||||
@if (!string.IsNullOrEmpty(_results))
|
||||
{
|
||||
@((MarkupString)_results)
|
||||
|
@ -65,7 +67,7 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Select A Tenant And Provide A SQL Query", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Select A Tenant And Provide A SQL Query"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,34 +80,34 @@ else
|
|||
{
|
||||
table = "<div class=\"table-responsive\">";
|
||||
table += "<table class=\"table table-bordered\"><thead><tr>";
|
||||
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in item)
|
||||
{
|
||||
table += "<th scope=\"col\">" + kvp.Key + "</th>";
|
||||
}
|
||||
|
||||
|
||||
table += "</tr></thead><tbody>";
|
||||
}
|
||||
|
||||
|
||||
table += "<tr>";
|
||||
|
||||
|
||||
foreach (KeyValuePair<string, string> kvp in item)
|
||||
{
|
||||
table += "<td>" + kvp.Value + "</td>";
|
||||
}
|
||||
|
||||
|
||||
table += "</tr>";
|
||||
}
|
||||
|
||||
|
||||
if (table != string.Empty)
|
||||
{
|
||||
table += "</tbody></table></div>";
|
||||
}
|
||||
else
|
||||
{
|
||||
table = "No Results Returned";
|
||||
table = Localizer["No Results Returned"];
|
||||
}
|
||||
|
||||
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
@namespace Oqtane.Modules.Admin.SystemInfo
|
||||
@namespace Oqtane.Modules.Admin.SystemInfo
|
||||
@inherits ModuleBase
|
||||
@inject ISystemService SystemService
|
||||
@inject IInstallationService InstallationService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="version" HelpText="Framework Version">Framework Version: </Label>
|
||||
<Label For="version" HelpText="Framework Version" ResourceKey="FrameworkVersion">Framework Version: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="version" class="form-control" @bind="@_version" readonly />
|
||||
|
@ -13,7 +15,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="runtime" HelpText="Blazor Runtime (Server or WebAssembly)">Blazor Runtime: </Label>
|
||||
<Label For="runtime" HelpText="Blazor Runtime (Server or WebAssembly)" ResourceKey="BlazorRunime">Blazor Runtime: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="runtime" class="form-control" @bind="@_runtime" readonly />
|
||||
|
@ -21,7 +23,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="clrversion" HelpText="Common Language Runtime Version">CLR Version: </Label>
|
||||
<Label For="clrversion" HelpText="Common Language Runtime Version" ResourceKey="ClrVerion">CLR Version: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="clrversion" class="form-control" @bind="@_clrversion" readonly />
|
||||
|
@ -29,7 +31,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="osversion" HelpText="Operating System Version">OS Version: </Label>
|
||||
<Label For="osversion" HelpText="Operating System Version" ResourceKey="OsVersion">OS Version: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="osversion" class="form-control" @bind="@_osversion" readonly />
|
||||
|
@ -37,7 +39,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="serverpath" HelpText="Server Path">Server Path: </Label>
|
||||
<Label For="serverpath" HelpText="Server Path" ResourceKey="ServerPath">Server Path: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="serverpath" class="form-control" @bind="@_serverpath" readonly />
|
||||
|
@ -45,14 +47,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="servertime" HelpText="Server Time">Server Time: </Label>
|
||||
<Label For="servertime" HelpText="Server Time" ResourceKey="ServerTime">Server Time: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="servertime" class="form-control" @bind="@_servertime" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a class="btn btn-primary" href="swagger/index.html" target="_new">Access Framework API</a>
|
||||
<a class="btn btn-primary" href="swagger/index.html" target="_new">@Localizer["Access Framework API"]</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" />
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
@ -78,4 +81,19 @@
|
|||
_servertime = systeminfo["servertime"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RestartApplication()
|
||||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(""), 10);
|
||||
await InstallationService.RestartAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Restarting Application");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
@namespace Oqtane.Modules.Admin.Tenants
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ITenantService TenantService
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="The name of the tenant">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
@if (name == TenantNames.Master)
|
||||
{
|
||||
<input id="name" class="form-control" @bind="@name" readonly />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input id="name" class="form-control" @bind="@name" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="connectionstring" HelpText="The database connection string">Connection String: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="connectionstring" class="form-control" @bind="@connectionstring" rows="3" readonly></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveTenant">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@code {
|
||||
private int tenantid;
|
||||
private string name = string.Empty;
|
||||
private string connectionstring = string.Empty;
|
||||
private string schema = string.Empty;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
tenantid = Int32.Parse(PageState.QueryString["id"]);
|
||||
var tenant = await TenantService.GetTenantAsync(tenantid);
|
||||
if (tenant != null)
|
||||
{
|
||||
name = tenant.Name;
|
||||
connectionstring = tenant.DBConnectionString;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Tenant {TenantId} {Error}", tenantid, ex.Message);
|
||||
AddModuleMessage("Error Loading Tenant", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SaveTenant()
|
||||
{
|
||||
try
|
||||
{
|
||||
connectionstring = connectionstring.Replace("\\\\", "\\");
|
||||
var tenant = await TenantService.GetTenantAsync(tenantid);
|
||||
if (tenant != null)
|
||||
{
|
||||
tenant.Name = name;
|
||||
tenant.DBConnectionString = connectionstring;
|
||||
|
||||
await TenantService.UpdateTenantAsync(tenant);
|
||||
await logger.LogInformation("Tenant Saved {TenantId}", tenantid);
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Tenant {TenantId} {Error}", tenantid, ex.Message);
|
||||
AddModuleMessage("Error Saving Tenant", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
@namespace Oqtane.Modules.Admin.Tenants
|
||||
@inherits ModuleBase
|
||||
@inject ITenantService TenantService
|
||||
@inject IAliasService AliasService
|
||||
|
||||
@if (tenants == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<Pager Items="@tenants">
|
||||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.TenantId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Tenant" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Tenant?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTenant(context))" Disabled="@(context.Name == TenantNames.Master)" /></td>
|
||||
<td>@context.Name</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
||||
}
|
||||
|
||||
@code {
|
||||
private List<Tenant> tenants;
|
||||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
tenants = await TenantService.GetTenantsAsync();
|
||||
}
|
||||
|
||||
private async Task DeleteTenant(Tenant Tenant)
|
||||
{
|
||||
try
|
||||
{
|
||||
string message = string.Empty;
|
||||
var aliases = await AliasService.GetAliasesAsync();
|
||||
foreach (var alias in aliases)
|
||||
{
|
||||
if (alias.TenantId == Tenant.TenantId)
|
||||
{
|
||||
message += ", " + alias.Name;
|
||||
}
|
||||
}
|
||||
if (string.IsNullOrEmpty(message))
|
||||
{
|
||||
await TenantService.DeleteTenantAsync(Tenant.TenantId);
|
||||
await logger.LogInformation("Tenant Deleted {Tenant}", Tenant);
|
||||
StateHasChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Tenant Cannot Be Deleted Until The Following Sites Are Deleted: " + message.Substring(2), MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Tenant {Tenant} {Error}", Tenant, ex.Message);
|
||||
AddModuleMessage("Error Deleting Tenant", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +1,39 @@
|
|||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IFileService FileService
|
||||
@inject IThemeService ThemeService
|
||||
@inject IPackageService PackageService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
@if (_packages != null)
|
||||
{
|
||||
<TabStrip>
|
||||
@if (_packages.Count > 0)
|
||||
{
|
||||
<TabPanel Name="Download">
|
||||
<TabPanel Name="Download" ResourceKey="Download">
|
||||
<ModuleMessage Type="MessageType.Info" Message="Download one or more themes from the list below. Once you are ready click Install to complete the installation."></ModuleMessage>
|
||||
<Pager Items="@_packages">
|
||||
<Header>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
<th>@Localizer["Version"]</th>
|
||||
<th style="width: 1px;"></th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.Version</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadTheme(context.PackageId, context.Version))>Download</button>
|
||||
<button type="button" class="btn btn-primary" @onclick=@(async () => await DownloadTheme(context.PackageId, context.Version))>@Localizer["Download"]</button>
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
</TabPanel>
|
||||
}
|
||||
<TabPanel Name="Upload">
|
||||
<TabPanel Name="Upload" ResourceKey="Upload">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label HelpText="Upload one or more theme packages. Once they are uploaded click Install to complete the installation.">Theme: </Label>
|
||||
<Label HelpText="Upload one or more theme packages. Once they are uploaded click Install to complete the installation." ResourceKey="Theme">Theme: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Themes" UploadMultiple="@true" />
|
||||
|
@ -42,8 +43,8 @@
|
|||
</TabPanel>
|
||||
</TabStrip>
|
||||
|
||||
<button type="button" class="btn btn-success" @onclick="InstallThemes">Install</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="InstallThemes">@Localizer["Install"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
@ -69,7 +70,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Packages", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Packages"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,14 +78,12 @@
|
|||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ThemeService.InstallThemesAsync();
|
||||
AddModuleMessage(Localizer["Theme Installed Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Installating Theme");
|
||||
await logger.LogError(ex, "Error Installing Theme");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,13 +93,13 @@
|
|||
{
|
||||
await PackageService.DownloadPackageAsync(packageid, version, "Themes");
|
||||
await logger.LogInformation("Theme {ThemeName} {Version} Downloaded Successfully", packageid, version);
|
||||
AddModuleMessage("Themes Downloaded Successfully. Click Install To Complete Installation.", MessageType.Success);
|
||||
AddModuleMessage(Localizer["Themes Downloaded Successfully. Click Install To Complete Installation."], MessageType.Success);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading Module {ThemeName} {Version}", packageid, version);
|
||||
AddModuleMessage("Error Downloading Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@using System.Net
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IThemeService ThemeService
|
||||
@inject IPackageService PackageService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_themes == null)
|
||||
{
|
||||
|
@ -17,25 +18,25 @@ else
|
|||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col">Version</th>
|
||||
<th scope="col">@Localizer["Name"]</th>
|
||||
<th scope="col">@Localizer["Version"]</th>
|
||||
<th> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td><ActionLink Action="View" Parameters="@($"name=" + WebUtility.UrlEncode(context.ThemeName))" /></td>
|
||||
<td><ActionLink Action="View" Parameters="@($"name=" + WebUtility.UrlEncode(context.ThemeName))" ResourceKey="ViewTheme" /></td>
|
||||
<td>
|
||||
@if (context.AssemblyName != "Oqtane.Client")
|
||||
{
|
||||
<ActionDialog Header="Delete Theme" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Theme?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTheme(context))" />
|
||||
}
|
||||
{
|
||||
<ActionDialog Header="Delete Theme" Message="@Localizer["Are You Sure You Wish To Delete The {0} Theme?", context.Name]" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteTheme(context))" ResourceKey="DeleteTheme" />
|
||||
}
|
||||
</td>
|
||||
<td>@context.Name</td>
|
||||
<td>@context.Version</td>
|
||||
<td>
|
||||
@if (UpgradeAvailable(context.ThemeName, context.Version))
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadTheme(context.ThemeName, context.Version))>Upgrade</button>
|
||||
}
|
||||
{
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await DownloadTheme(context.ThemeName, context.Version))>@Localizer["Upgrade"]</button>
|
||||
}
|
||||
</td>
|
||||
<td></td>
|
||||
</Row>
|
||||
|
@ -48,7 +49,7 @@ else
|
|||
|
||||
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -60,7 +61,7 @@ else
|
|||
if (_themes == null)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Themes {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Themes", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Themes"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,15 +86,13 @@ else
|
|||
{
|
||||
await PackageService.DownloadPackageAsync(themename, version, "Themes");
|
||||
await logger.LogInformation("Theme Downloaded {ThemeName} {Version}", themename, version);
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ThemeService.InstallThemesAsync();
|
||||
AddModuleMessage(Localizer["Theme Installed Successfully. You Must <a href=\"{0}\">Restart</a> Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading Theme {ThemeName} {Version} {Error}", themename, version, ex.Message);
|
||||
AddModuleMessage("Error Downloading Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,15 +100,14 @@ else
|
|||
{
|
||||
try
|
||||
{
|
||||
ShowProgressIndicator();
|
||||
var interop = new Interop(JSRuntime);
|
||||
await interop.RedirectBrowser(NavigateUrl(), 10);
|
||||
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
|
||||
AddModuleMessage(Localizer["Theme Deleted Successfully"], MessageType.Success);
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting Theme {Theme} {Error}", Theme, ex.Message);
|
||||
AddModuleMessage("Error Deleting Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Deleting Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@namespace Oqtane.Modules.Admin.Themes
|
||||
@using System.Net
|
||||
@inherits ModuleBase
|
||||
@inject IThemeService ThemeService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<View> Localizer
|
||||
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="name" HelpText="The name of the theme">Name: </Label>
|
||||
<Label For="name" HelpText="The name of the theme" ResourceKey="Name">Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="name" class="form-control" @bind="@_name" disabled />
|
||||
|
@ -15,7 +16,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="themename" HelpText="The internal name of the module">Internal Name: </Label>
|
||||
<Label For="themename" HelpText="The internal name of the module" ResourceKey="InternalName">Internal Name: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="themename" class="form-control" @bind="@_themeName" disabled />
|
||||
|
@ -23,7 +24,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="version" HelpText="The version of the thene">Version: </Label>
|
||||
<Label For="version" HelpText="The version of the thene" ResourceKey="Version">Version: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="version" class="form-control" @bind="@_version" disabled />
|
||||
|
@ -31,7 +32,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="owner" HelpText="The owner or creator of the theme">Owner: </Label>
|
||||
<Label For="owner" HelpText="The owner or creator of the theme" ResourceKey="Owner">Owner: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="owner" class="form-control" @bind="@_owner" disabled />
|
||||
|
@ -39,7 +40,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="url" HelpText="The reference url of the theme">Reference Url: </Label>
|
||||
<Label For="url" HelpText="The reference url of the theme" ResourceKey="ReferenceUrl">Reference Url: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="url" class="form-control" @bind="@_url" disabled />
|
||||
|
@ -47,7 +48,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="contact" HelpText="The contact for the theme">Contact: </Label>
|
||||
<Label For="contact" HelpText="The contact for the theme" ResourceKey="Contact">Contact: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="contact" class="form-control" @bind="@_contact" disabled />
|
||||
|
@ -55,14 +56,14 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="license" HelpText="The license of the theme">License: </Label>
|
||||
<Label For="license" HelpText="The license of the theme" ResourceKey="License">License: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private string _themeName = "";
|
||||
|
@ -95,7 +96,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Theme {ThemeName} {Error}", _themeName, ex.Message);
|
||||
AddModuleMessage("Error Loading Theme", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Theme"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,36 +1,37 @@
|
|||
@namespace Oqtane.Modules.Admin.Upgrade
|
||||
@namespace Oqtane.Modules.Admin.Upgrade
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IFileService FileService
|
||||
@inject IPackageService PackageService
|
||||
@inject IInstallationService InstallationService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (_package != null)
|
||||
{
|
||||
<TabStrip>
|
||||
<TabPanel Name="Download">
|
||||
<TabPanel Name="Download" ResourceKey="Download">
|
||||
@if (_upgradeavailable)
|
||||
{
|
||||
<ModuleMessage Type="MessageType.Info" Message="Select The Upgrade Button To Install a New Framework Version"></ModuleMessage>
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, @_package.Version))>Upgrade To @_package.Version</button>
|
||||
<button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, @_package.Version))>@Localizer["Upgrade To"] @_package.Version</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ModuleMessage Type="MessageType.Info" Message="Framework Is Already Up To Date"></ModuleMessage>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Upload">
|
||||
<TabPanel Name="Upload" ResourceKey="Upload">
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label HelpText="Upload a framework package and select Install to complete the installation">Framework: </Label>
|
||||
<Label HelpText="Upload a framework package and select Install to complete the installation" ResourceKey="Framework">Framework: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager Filter="nupkg" ShowFiles="false" Folder="Framework" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="Upgrade">Install</button>
|
||||
<button type="button" class="btn btn-success" @onclick="Upgrade">@Localizer["Install"]</button>
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
}
|
||||
|
@ -77,7 +78,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Executing Upgrade {Error}", ex.Message);
|
||||
AddModuleMessage("Error Executing Upgrade", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Executing Upgrade"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +95,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Downloading Framework {Error}", ex.Message);
|
||||
AddModuleMessage("Error Downloading Framework", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Downloading Framework"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
@namespace Oqtane.Modules.Admin.UserProfile
|
||||
@namespace Oqtane.Modules.Admin.UserProfile
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject INotificationService NotificationService
|
||||
@inject INotificationService NotificationService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
@if (PageState.User != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="to" HelpText="Enter the username you wish to send a message to">To: </Label>
|
||||
<Label For="to" HelpText="Enter the username you wish to send a message to" ResourceKey="To">To: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="to" class="form-control" @bind="@username" />
|
||||
|
@ -17,7 +18,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="subject" HelpText="Enter the subject of the message">Subject: </Label>
|
||||
<Label For="subject" HelpText="Enter the subject of the message" ResourceKey="Subject">Subject: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="subject" class="form-control" @bind="@subject" />
|
||||
|
@ -25,15 +26,15 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="message" HelpText="Enter the message">Message: </Label>
|
||||
<Label For="message" HelpText="Enter the message" ResourceKey="Message">Message: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="message" class="form-control" @bind="@body" rows="5" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary" @onclick="Send">Send</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-primary" @onclick="Send">@Localizer["Send"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
@ -47,39 +48,25 @@
|
|||
|
||||
private async Task Send()
|
||||
{
|
||||
var notification = new Notification();
|
||||
try
|
||||
{
|
||||
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
|
||||
if (user != null)
|
||||
{
|
||||
notification.SiteId = PageState.Site.SiteId;
|
||||
notification.FromUserId = PageState.User.UserId;
|
||||
notification.FromDisplayName = PageState.User.DisplayName;
|
||||
notification.FromEmail = PageState.User.Email;
|
||||
notification.ToUserId = user.UserId;
|
||||
notification.ToDisplayName = user.DisplayName;
|
||||
notification.ToEmail = user.Email;
|
||||
notification.Subject = subject;
|
||||
notification.Body = body;
|
||||
notification.ParentId = null;
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
{
|
||||
var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, null);
|
||||
notification = await NotificationService.AddNotificationAsync(notification);
|
||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("User Does Not Exist. Please Verify That The Username Provided Is Correct.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["User Does Not Exist. Please Verify That The Username Provided Is Correct."], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
||||
AddModuleMessage("Error Adding Notification", MessageType.Error);
|
||||
await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
|
||||
AddModuleMessage(Localizer["Error Adding Notification"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
@inject IProfileService ProfileService
|
||||
@inject ISettingService SettingService
|
||||
@inject INotificationService NotificationService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (PageState.User != null && photofileid != -1)
|
||||
{
|
||||
|
@ -15,13 +16,13 @@ else
|
|||
<br />
|
||||
}
|
||||
<TabStrip>
|
||||
<TabPanel Name="Identity">
|
||||
<TabPanel Name="Identity" ResourceKey="Identity">
|
||||
@if (PageState.User != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Username: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Username:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@username" readonly />
|
||||
|
@ -29,7 +30,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Password: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@password" autocomplete="new-password" />
|
||||
|
@ -37,7 +38,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Confirm Password: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Confirm Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@confirm" autocomplete="new-password" />
|
||||
|
@ -45,7 +46,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Email: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Email:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@email" />
|
||||
|
@ -53,7 +54,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Full Name: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Full Name:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@displayname" />
|
||||
|
@ -61,18 +62,18 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Photo: </label>
|
||||
<label for="Name" class="control-label">@Localizer["Photo:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@photofileid" @ref="filemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="Save">@Localizer["Save"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Profile">
|
||||
<TabPanel Name="Profile" ResourceKey="Profile">
|
||||
@if (profiles != null && settings != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
|
@ -127,14 +128,14 @@ else
|
|||
}
|
||||
}
|
||||
</table>
|
||||
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="Save">@Localizer["Save"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="Cancel">@Localizer["Cancel"]</button>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Notifications">
|
||||
<TabPanel Name="Notifications" ResourceKey="Notifications">
|
||||
@if (notifications != null)
|
||||
{
|
||||
<ActionLink Action="Add" Text="Send Notification" Security="SecurityAccessLevel.View" EditMode="false" />
|
||||
<ActionLink Action="Add" Text="Send Notification" Security="SecurityAccessLevel.View" EditMode="false" ResourceKey="SendNotification" />
|
||||
<br /><br />
|
||||
@if (filter == "to")
|
||||
{
|
||||
|
@ -142,13 +143,13 @@ else
|
|||
<Header>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>From</th>
|
||||
<th>Subject</th>
|
||||
<th>Received</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" /></td>
|
||||
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
||||
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" ResourceKey="ViewNotification" /></td>
|
||||
<td><ActionDialog Header="Delete Notification" Message="Are You Sure You Wish To Delete This Notification?" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" ResourceKey="DeleteNotification" /></td>
|
||||
<td>@context.FromDisplayName</td>
|
||||
<td>@context.Subject</td>
|
||||
<td>@context.CreatedOn</td>
|
||||
|
@ -174,13 +175,13 @@ else
|
|||
<Header>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
<th>To</th>
|
||||
<th>Subject</th>
|
||||
<th>Sent</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" /></td>
|
||||
<td><ActionDialog Header="Delete Notification" Message="@("Are You Sure You Wish To Delete This Notification?")" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" /></td>
|
||||
<td><ActionLink Action="View" Parameters="@($"id=" + context.NotificationId.ToString())" Security="SecurityAccessLevel.View" EditMode="false" ResourceKey="ViewNotification" /></td>
|
||||
<td><ActionDialog Header="Delete Notification" Message="Are You Sure You Wish To Delete This Notification?" Action="Delete" Security="SecurityAccessLevel.View" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" EditMode="false" ResourceKey="DeleteNotification" /></td>
|
||||
<td>@context.ToDisplayName</td>
|
||||
<td>@context.Subject</td>
|
||||
<td>@context.CreatedOn</td>
|
||||
|
@ -202,8 +203,8 @@ else
|
|||
}
|
||||
<br /><hr />
|
||||
<select class="form-control" @onchange="(e => FilterChanged(e))">
|
||||
<option value="to">Inbox</option>
|
||||
<option value="from">Sent Items</option>
|
||||
<option value="to">@Localizer["Inbox"]</option>
|
||||
<option value="from">@Localizer["Sent Items"]</option>
|
||||
</select>
|
||||
}
|
||||
</TabPanel>
|
||||
|
@ -247,13 +248,13 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Current User Is Not Logged In", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Current User Is Not Logged In"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading User Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading User Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,22 +291,22 @@ else
|
|||
await UserService.UpdateUserAsync(user);
|
||||
await SettingService.UpdateUserSettingsAsync(settings, PageState.User.UserId);
|
||||
await logger.LogInformation("User Profile Saved");
|
||||
AddModuleMessage("User Profile Updated Successfully", MessageType.Success);
|
||||
AddModuleMessage(Localizer["User Profile Updated Successfully"], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Passwords Entered Do Not Match", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Username and Email Address As Well As All Required Profile Information", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Username and Email Address As Well As All Required Profile Information"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving User Profile {Error}", ex.Message);
|
||||
AddModuleMessage("Error Saving User Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving User Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
@namespace Oqtane.Modules.Admin.UserProfile
|
||||
@namespace Oqtane.Modules.Admin.UserProfile
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject INotificationService NotificationService
|
||||
@inject INotificationService NotificationService
|
||||
@inject IStringLocalizer<View> Localizer
|
||||
|
||||
@if (PageState.User != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">@title: </label>
|
||||
<label class="control-label">@Localizer["Title:"] </label>
|
||||
</td>
|
||||
@if (title == "From")
|
||||
{
|
||||
|
@ -26,7 +27,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Subject: </label>
|
||||
<label class="control-label">@Localizer["Subject:"] </label>
|
||||
</td>
|
||||
@if (title == "From")
|
||||
{
|
||||
|
@ -45,7 +46,7 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Date: </label>
|
||||
<label class="control-label">@Localizer["Date:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@createdon" readonly />
|
||||
|
@ -56,7 +57,7 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Message: </label>
|
||||
<label class="control-label">@Localizer["Message:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="form-control" @bind="@body" rows="5" readonly />
|
||||
|
@ -67,7 +68,7 @@
|
|||
{
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Message: </label>
|
||||
<label class="control-label">@Localizer["Message:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="form-control" @bind="@body" rows="5" />
|
||||
|
@ -79,24 +80,26 @@
|
|||
|
||||
@if (reply != string.Empty)
|
||||
{
|
||||
<button type="button" class="btn btn-primary" @onclick="Send">Send</button> }
|
||||
<button type="button" class="btn btn-primary" @onclick="Send">@Localizer["Send"]</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
if (title == "From")
|
||||
{
|
||||
<button type="button" class="btn btn-primary" @onclick="Reply">Reply</button>}
|
||||
<button type="button" class="btn btn-primary" @onclick="Reply">@Localizer["Reply"]</button>
|
||||
}
|
||||
}
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
@if (title == "To")
|
||||
{
|
||||
<div class="control-group">
|
||||
<label class="control-label">Original Message </label>
|
||||
<label class="control-label">@Localizer["Original Message"] </label>
|
||||
<textarea class="form-control" @bind="@reply" rows="5" readonly />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@code {
|
||||
private int notificationid;
|
||||
|
@ -155,7 +158,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Users", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Users"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,39 +176,25 @@
|
|||
|
||||
private async Task Send()
|
||||
{
|
||||
var notification = new Notification();
|
||||
try
|
||||
{
|
||||
var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
|
||||
if (user != null)
|
||||
{
|
||||
notification.SiteId = PageState.Site.SiteId;
|
||||
notification.FromUserId = PageState.User.UserId;
|
||||
notification.FromDisplayName = PageState.User.DisplayName;
|
||||
notification.FromEmail = PageState.User.Email;
|
||||
notification.ToUserId = user.UserId;
|
||||
notification.ToDisplayName = user.DisplayName;
|
||||
notification.ToEmail = user.Email;
|
||||
notification.Subject = subject;
|
||||
notification.Body = body;
|
||||
notification.ParentId = notificationid;
|
||||
notification.CreatedOn = DateTime.UtcNow;
|
||||
notification.IsDelivered = false;
|
||||
notification.DeliveredOn = null;
|
||||
notification.SendOn = DateTime.UtcNow;
|
||||
{
|
||||
var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, notificationid);
|
||||
notification = await NotificationService.AddNotificationAsync(notification);
|
||||
await logger.LogInformation("Notification Created {Notification}", notification);
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("User Does Not Exist. Please Verify That The Username Provided Is Correct.", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["User Does Not Exist. Please Verify That The Username Provided Is Correct."], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding Notification {Notification} {Error}", notification, ex.Message);
|
||||
AddModuleMessage("Error Adding Notification", MessageType.Error);
|
||||
await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
|
||||
AddModuleMessage(Localizer["Error Adding Notification"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
@namespace Oqtane.Modules.Admin.Users
|
||||
@namespace Oqtane.Modules.Admin.Users
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IProfileService ProfileService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Add> Localizer
|
||||
|
||||
<TabStrip>
|
||||
<TabPanel Name="Identity">
|
||||
<TabPanel Name="Identity" ResourceKey="Identity">
|
||||
@if (profiles != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Username: </label>
|
||||
<label class="control-label">@Localizer["Username:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@username" />
|
||||
|
@ -20,7 +21,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Password: </label>
|
||||
<label class="control-label">@Localizer["Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@password" />
|
||||
|
@ -28,7 +29,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Confirm Password: </label>
|
||||
<label class="control-label">@Localizer["Confirm Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@confirm" />
|
||||
|
@ -36,7 +37,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Email: </label>
|
||||
<label class="control-label">@Localizer["Email:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@email" />
|
||||
|
@ -44,7 +45,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Full Name: </label>
|
||||
<label class="control-label">@Localizer["Full Name:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@displayname" />
|
||||
|
@ -53,45 +54,45 @@
|
|||
</table>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Profile">
|
||||
<TabPanel Name="Profile" ResourceKey="Profile">
|
||||
@if (profiles != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
@foreach (Profile profile in profiles)
|
||||
{
|
||||
var p = profile;
|
||||
if (p.Category != category)
|
||||
<table class="table table-borderless">
|
||||
@foreach (Profile profile in profiles)
|
||||
{
|
||||
var p = profile;
|
||||
if (p.Category != category)
|
||||
{
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center;">
|
||||
@p.Category
|
||||
</th>
|
||||
</tr>
|
||||
category = p.Category;
|
||||
}
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center;">
|
||||
@p.Category
|
||||
</th>
|
||||
<td>
|
||||
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||
</td>
|
||||
<td>
|
||||
@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))" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
category = p.Category;
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||
</td>
|
||||
<td>
|
||||
@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))" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</table>
|
||||
}
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
|
||||
<button type="button" class="btn btn-primary" @onclick="SaveUser">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-primary" @onclick="SaveUser">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
@code {
|
||||
private string username = string.Empty;
|
||||
|
@ -115,7 +116,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading User Profile", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading User Profile"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,23 +150,23 @@
|
|||
else
|
||||
{
|
||||
await logger.LogError("Error Adding User {Username} {Email}", username, email);
|
||||
AddModuleMessage("Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use.", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use."], MessageType.Error);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Passwords Entered Do Not Match", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Username, Password, Email Address And All Required Profile Information", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Username, Password, Email Address And All Required Profile Information"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", username, email, ex.Message);
|
||||
AddModuleMessage("Error Adding User", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Adding User"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,7 +186,7 @@
|
|||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||
{
|
||||
var value = (string)e.Value;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
@namespace Oqtane.Modules.Admin.Users
|
||||
@namespace Oqtane.Modules.Admin.Users
|
||||
@inherits ModuleBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
@inject IProfileService ProfileService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
@if (PageState.User != null && photofileid != -1)
|
||||
{
|
||||
|
@ -14,13 +15,13 @@ else
|
|||
<br />
|
||||
}
|
||||
<TabStrip>
|
||||
<TabPanel Name="Identity">
|
||||
<TabPanel Name="Identity" ResourceKey="Identity">
|
||||
@if (profiles != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Username: </label>
|
||||
<label class="control-label">@Localizer["Username:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@username" readonly />
|
||||
|
@ -28,7 +29,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Password: </label>
|
||||
<label class="control-label">@Localizer["Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@password" />
|
||||
|
@ -36,7 +37,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Confirm Password: </label>
|
||||
<label class="control-label">@Localizer["Confirm Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@confirm" />
|
||||
|
@ -44,7 +45,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Email: </label>
|
||||
<label class="control-label">@Localizer["Email:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@email" />
|
||||
|
@ -52,7 +53,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Full Name: </label>
|
||||
<label class="control-label">@Localizer["Full Name:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@displayname" />
|
||||
|
@ -60,7 +61,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Photo: </label>
|
||||
<label class="control-label">@Localizer["Photo:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@photofileid" @ref="filemanager" />
|
||||
|
@ -68,58 +69,59 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label">Is Deleted? </label>
|
||||
<label class="control-label">@Localizer["Is Deleted?"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isdeleted">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
<option value="True">@Localizer["Yes"]</option>
|
||||
<option value="False">@Localizer["No"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
}
|
||||
</TabPanel>
|
||||
<TabPanel Name="Profile">
|
||||
<TabPanel Name="Profile" ResourceKey="Profile">
|
||||
@if (profiles != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
@foreach (Profile profile in profiles)
|
||||
{
|
||||
var p = profile;
|
||||
if (p.Category != category)
|
||||
<table class="table table-borderless">
|
||||
@foreach (Profile profile in profiles)
|
||||
{
|
||||
var p = profile;
|
||||
if (p.Category != category)
|
||||
{
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center;">
|
||||
@p.Category
|
||||
</th>
|
||||
</tr>
|
||||
category = p.Category;
|
||||
}
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center;">
|
||||
@p.Category
|
||||
</th>
|
||||
<td>
|
||||
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||
</td>
|
||||
<td>
|
||||
@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))" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
category = p.Category;
|
||||
}
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="@p.Name" HelpText="@p.Description">@p.Title</Label>
|
||||
</td>
|
||||
<td>
|
||||
@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))" />
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</table>
|
||||
}
|
||||
</TabPanel>
|
||||
</TabStrip>
|
||||
|
||||
<button type="button" class="btn btn-primary" @onclick="SaveUser">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br /><br />
|
||||
<button type="button" class="btn btn-primary" @onclick="SaveUser">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
||||
|
||||
@code {
|
||||
|
@ -176,7 +178,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading User {UserId} {Error}", userid, ex.Message);
|
||||
AddModuleMessage("Error Loading User", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading User"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,18 +217,18 @@ else
|
|||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("Passwords Entered Do Not Match", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Provide A Username, Password, Email Address, And All Required Profile Information", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Provide A Username, Password, Email Address, And All Required Profile Information"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving User {Username} {Email} {Error}", username, email, ex.Message);
|
||||
AddModuleMessage("Error Saving User", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving User"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -246,7 +248,7 @@ else
|
|||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
private void ProfileChanged(ChangeEventArgs e, string SettingName)
|
||||
{
|
||||
var value = (string)e.Value;
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
@namespace Oqtane.Modules.Admin.Users
|
||||
@namespace Oqtane.Modules.Admin.Users
|
||||
@inherits ModuleBase
|
||||
@inject IUserRoleService UserRoleService
|
||||
@inject IUserService UserService
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<Index> Localizer
|
||||
|
||||
@if (userroles == null)
|
||||
{
|
||||
<p>
|
||||
<em>Loading...</em>
|
||||
<em>@Localizer["Loading..."]</em>
|
||||
</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add User"/>
|
||||
<ActionLink Action="Add" Text="Add User" ResourceKey="AddUser" />
|
||||
|
||||
<div class="d-flex p-1">
|
||||
<input class="form-control mr-4" @bind="@_search"/><button class="btn btn-outline-primary ml-1" @onclick="OnSearch">Search</button>
|
||||
<input class="form-control mr-4" @bind="@_search" /><button class="btn btn-outline-primary ml-1" @onclick="OnSearch">@Localizer["Search"]</button>
|
||||
</div>
|
||||
|
||||
<Pager Items="@userroles">
|
||||
|
@ -23,17 +24,17 @@ else
|
|||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th style="width: 1px;"> </th>
|
||||
<th>Name</th>
|
||||
<th>@Localizer["Name"]</th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>
|
||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())"/>
|
||||
<ActionLink Action="Edit" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="EditUser" />
|
||||
</td>
|
||||
<td>
|
||||
<ActionDialog Header="Delete User" Message="@("Are You Sure You Wish To Delete " + context.User.DisplayName + "?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))"/>
|
||||
<ActionDialog Header="Delete User" Message="@Localizer["Are You Sure You Wish To Delete {0}?", context.User.DisplayName]" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteUser(context))" ResourceKey="DeleteUser" />
|
||||
</td>
|
||||
<td>
|
||||
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())"/>
|
||||
<ActionLink Action="Roles" Parameters="@($"id=" + context.UserId.ToString())" ResourceKey="Roles" />
|
||||
</td>
|
||||
<td>@context.User.DisplayName</td>
|
||||
</Row>
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
@namespace Oqtane.Modules.Admin.Users
|
||||
@namespace Oqtane.Modules.Admin.Users
|
||||
@inherits ModuleBase
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserService UserService
|
||||
@inject IUserRoleService UserRoleService
|
||||
@inject IStringLocalizer<Roles> Localizer
|
||||
|
||||
@if (userroles == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
<p><em>@Localizer["Loading..."]</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="user" HelpText="The user you are assigning roles to">User: </Label>
|
||||
<Label For="user" HelpText="The user you are assigning roles to" ResourceKey="User">User: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="user" class="form-control" @bind="@name" disabled />
|
||||
|
@ -21,11 +22,11 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="role" HelpText="Select a role">Role: </Label>
|
||||
<Label For="role" HelpText="Select a role" ResourceKey="Role">Role: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<select id="role" class="form-control" @bind="@roleid">
|
||||
<option value="-1"><Select Role></option>
|
||||
<option value="-1"><@Localizer["Select Role"]></option>
|
||||
@foreach (Role role in roles)
|
||||
{
|
||||
<option value="@(role.RoleId)">@role.Name</option>
|
||||
|
@ -35,7 +36,7 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="effectiveDate" HelpText="The date that this role assignment is active">Effective Date: </Label>
|
||||
<Label For="effectiveDate" HelpText="The date that this role assignment is active" ResourceKey="EffectiveDate">Effective Date: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="effectiveDate" class="form-control" @bind="@effectivedate" />
|
||||
|
@ -43,30 +44,30 @@ else
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<Label For="expiryDate" HelpText="The date that this role assignment expires">Expiry Date: </Label>
|
||||
<Label For="expiryDate" HelpText="The date that this role assignment expires" ResourceKey="ExpiryDate">Expiry Date: </Label>
|
||||
</td>
|
||||
<td>
|
||||
<input id="expiryDate" class="form-control" @bind="@expirydate" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveUserRole">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveUserRole">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
|
||||
<hr class="app-rule" />
|
||||
<p align="center">
|
||||
<Pager Items="@userroles">
|
||||
<Header>
|
||||
<th>Roles</th>
|
||||
<th>@Localizer["Roles"]</th>
|
||||
<th> </th>
|
||||
</Header>
|
||||
<Row>
|
||||
<td>@context.Role.Name</td>
|
||||
<td>
|
||||
@if (context.Role.Name != RoleNames.Registered)
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>Delete</button>
|
||||
}
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick=@(async () => await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]</button>
|
||||
}
|
||||
</td>
|
||||
</Row>
|
||||
</Pager>
|
||||
|
@ -97,7 +98,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Roles {Error}", ex.Message);
|
||||
AddModuleMessage("Error Loading Roles", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading Roles"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +112,7 @@ else
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading User Roles {UserId} {Error}", userid, ex.Message);
|
||||
AddModuleMessage("Error Loading User Roles", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Loading User Roles"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,17 +173,17 @@ else
|
|||
|
||||
await GetUserRoles();
|
||||
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
|
||||
AddModuleMessage("User Assigned To Role", MessageType.Success);
|
||||
AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddModuleMessage("You Must Select A Role", MessageType.Warning);
|
||||
AddModuleMessage(Localizer["You Must Select A Role"], MessageType.Warning);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving User Roles {UserId} {Error}", userid, ex.Message);
|
||||
AddModuleMessage("Error Saving User Roles", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving User Roles"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,12 +194,12 @@ else
|
|||
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
|
||||
await GetUserRoles();
|
||||
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
|
||||
AddModuleMessage("User Removed From Role", MessageType.Success);
|
||||
AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
|
||||
AddModuleMessage("Error Removing User From Role", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Removing User From Role"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,14 +94,16 @@
|
|||
|
||||
if (!string.IsNullOrEmpty(IconName))
|
||||
{
|
||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span> ";
|
||||
if (!IconName.Contains(" "))
|
||||
{
|
||||
IconName = "oi oi-" + IconName;
|
||||
}
|
||||
_iconSpan = $"<span class=\"{IconName}\"></span> ";
|
||||
}
|
||||
|
||||
if (IsLocalizable)
|
||||
{
|
||||
Header = Localize(nameof(Header));
|
||||
Message = Localize(nameof(Message));
|
||||
}
|
||||
Text = Localize(nameof(Text), Text);
|
||||
Header = Localize(nameof(Header), Header);
|
||||
Message = Localize(nameof(Message), Message);
|
||||
|
||||
_authorized = IsAuthorized();
|
||||
}
|
||||
|
|
|
@ -91,15 +91,15 @@
|
|||
|
||||
if (!string.IsNullOrEmpty(IconName))
|
||||
{
|
||||
_iconSpan = $"<span class=\"oi oi-{IconName}\"></span>{(IconOnly ? "" : " ")}";
|
||||
if (!IconName.Contains(" "))
|
||||
{
|
||||
IconName = "oi oi-" + IconName;
|
||||
}
|
||||
_iconSpan = $"<span class=\"{IconName}\"></span>{(IconOnly ? "" : " ")}";
|
||||
|
||||
}
|
||||
|
||||
if (IsLocalizable)
|
||||
{
|
||||
_text = Localize(nameof(Text));
|
||||
}
|
||||
|
||||
_text = Localize(nameof(Text), _text);
|
||||
_url = EditUrl(Action, _parameters);
|
||||
_authorized = IsAuthorized();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
@inject IStringLocalizer<AuditInfo> Localizer
|
||||
|
||||
@if (_text != string.Empty)
|
||||
{
|
||||
|
@ -39,16 +40,16 @@
|
|||
_text = string.Empty;
|
||||
if (!String.IsNullOrEmpty(CreatedBy) || CreatedOn.HasValue)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Created ";
|
||||
_text += $"<p style=\"{Style}\">{Localizer["Created"]} ";
|
||||
|
||||
if (!String.IsNullOrEmpty(CreatedBy))
|
||||
{
|
||||
_text += " by <b>" + CreatedBy + "</b>";
|
||||
_text += $" {Localizer["by"]} <b>{CreatedBy}</b>";
|
||||
}
|
||||
|
||||
if (CreatedOn != null)
|
||||
{
|
||||
_text += " on <b>" + CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += $" {Localizer["on"]} <b>{CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss")}</b>";
|
||||
}
|
||||
|
||||
_text += "</p>";
|
||||
|
@ -56,16 +57,16 @@
|
|||
|
||||
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn.HasValue)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Last modified ";
|
||||
_text += $"<p style=\"{Style}\">{Localizer["Last modified"]} ";
|
||||
|
||||
if (!String.IsNullOrEmpty(ModifiedBy))
|
||||
{
|
||||
_text += " by <b>" + ModifiedBy + "</b>";
|
||||
_text += $" {Localizer["by"]} <b>{ModifiedBy}</b>";
|
||||
}
|
||||
|
||||
if (ModifiedOn != null)
|
||||
{
|
||||
_text += " on <b>" + ModifiedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += $" {Localizer["on"]} <b>{ModifiedOn.Value.ToString("MMM dd yyyy HH:mm:ss")}</b>";
|
||||
}
|
||||
|
||||
_text += "</p>";
|
||||
|
@ -73,16 +74,16 @@
|
|||
|
||||
if (!String.IsNullOrEmpty(DeletedBy) || DeletedOn.HasValue)
|
||||
{
|
||||
_text += "<p style=\"" + Style + "\">Deleted ";
|
||||
_text += $"<p style=\"{Style}\">{Localizer["Deleted"]} ";
|
||||
|
||||
if (!String.IsNullOrEmpty(DeletedBy))
|
||||
{
|
||||
_text += " by <b>" + DeletedBy + "</b>";
|
||||
_text += $" {Localizer["by"]} <b>{DeletedBy}</b>";
|
||||
}
|
||||
|
||||
if (DeletedOn != null)
|
||||
{
|
||||
_text += " on <b>" + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += $" {Localizer["on"]} <b>{DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss")}</b>";
|
||||
}
|
||||
|
||||
_text += "</p>";
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
@inject IStringLocalizer<FileManager> Localizer
|
||||
|
||||
@if (_folders != null)
|
||||
{
|
||||
|
@ -14,7 +15,7 @@
|
|||
<select class="form-control" @onchange="(e => FolderChanged(e))">
|
||||
@if (string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
<option value="-1"><Select Folder></option>
|
||||
<option value="-1"><@Localizer["Select Folder"]></option>
|
||||
}
|
||||
@foreach (Folder folder in _folders)
|
||||
{
|
||||
|
@ -34,7 +35,7 @@
|
|||
{
|
||||
<div>
|
||||
<select class="form-control" @onchange="(e => FileChanged(e))">
|
||||
<option value="-1"><Select File></option>
|
||||
<option value="-1"><@Localizer["Select File"]></option>
|
||||
@foreach (File file in _files)
|
||||
{
|
||||
if (file.FileId == FileId)
|
||||
|
@ -62,10 +63,10 @@
|
|||
}
|
||||
<span id="@_progressinfoid"></span><progress id="@_progressbarid" style="width: 150px; visibility: hidden;"></progress>
|
||||
<span class="float-right">
|
||||
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
|
||||
<button type="button" class="btn btn-success" @onclick="UploadFile">@Localizer["Upload"]</button>
|
||||
@if (ShowFiles && GetFileId() != -1)
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick="DeleteFile">Delete</button>
|
||||
<button type="button" class="btn btn-danger" @onclick="DeleteFile">@Localizer["Delete"]</button>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
|
@ -219,7 +220,7 @@
|
|||
{
|
||||
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
|
||||
|
||||
_message = "Error Loading Files";
|
||||
_message = Localizer["Error Loading Files"];
|
||||
_messagetype = MessageType.Error;
|
||||
}
|
||||
}
|
||||
|
@ -278,7 +279,7 @@
|
|||
{
|
||||
await logger.LogInformation("File Upload Succeeded {Files}", upload);
|
||||
|
||||
_message = "File Upload Succeeded";
|
||||
_message = Localizer["File Upload Succeeded"];
|
||||
_messagetype = MessageType.Success;
|
||||
|
||||
await GetFiles();
|
||||
|
@ -298,7 +299,7 @@
|
|||
{
|
||||
await logger.LogError("File Upload Failed For {Files}", result.Replace(",", ", "));
|
||||
|
||||
_message = "File Upload Failed";
|
||||
_message = Localizer["File Upload Failed"];
|
||||
_messagetype = MessageType.Error;
|
||||
}
|
||||
}
|
||||
|
@ -306,13 +307,13 @@
|
|||
{
|
||||
await logger.LogError(ex, "File Upload Failed {Error}", ex.Message);
|
||||
|
||||
_message = "File Upload Failed";
|
||||
_message = Localizer["File Upload Failed"];
|
||||
_messagetype = MessageType.Error;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_message = "You Have Not Selected A File To Upload";
|
||||
_message = Localizer["You Have Not Selected A File To Upload"];
|
||||
_messagetype = MessageType.Warning;
|
||||
}
|
||||
}
|
||||
|
@ -325,7 +326,7 @@
|
|||
await FileService.DeleteFileAsync(FileId);
|
||||
await logger.LogInformation("File Deleted {File}", FileId);
|
||||
|
||||
_message = "File Deleted";
|
||||
_message = Localizer["File Deleted"];
|
||||
_messagetype = MessageType.Success;
|
||||
|
||||
await GetFiles();
|
||||
|
@ -337,7 +338,7 @@
|
|||
{
|
||||
await logger.LogError(ex, "Error Deleting File {File} {Error}", FileId, ex.Message);
|
||||
|
||||
_message = "Error Deleting File";
|
||||
_message = Localizer["Error Deleting File"];
|
||||
_messagetype = MessageType.Error;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,10 +43,12 @@ else
|
|||
|
||||
_openLabel += ">";
|
||||
|
||||
if (IsLocalizable)
|
||||
var text = Localize("Text", String.Empty);
|
||||
if (text != String.Empty)
|
||||
{
|
||||
ChildContent =@<text>@Localize("Text")</text>;
|
||||
HelpText = Localize(nameof(HelpText));
|
||||
ChildContent =@<text>@text</text>;
|
||||
}
|
||||
|
||||
HelpText = Localize(nameof(HelpText), HelpText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,41 +15,54 @@ namespace Oqtane.Modules.Controls
|
|||
|
||||
protected bool IsLocalizable { get; private set; }
|
||||
|
||||
protected string Localize(string name)
|
||||
{
|
||||
var key = $"{ResourceKey}.{name}";
|
||||
protected string Localize(string name) => _localizer?[name] ?? name;
|
||||
|
||||
// TODO: we should have a ShowMissingResourceKeys option which developers/translators can enable to find missing translations which would display the key rather than the name
|
||||
protected string Localize(string propertyName, string propertyValue)
|
||||
{
|
||||
if (!IsLocalizable)
|
||||
{
|
||||
return name;
|
||||
return propertyValue;
|
||||
}
|
||||
|
||||
var key = $"{ResourceKey}.{propertyName}";
|
||||
var value = Localize(key);
|
||||
|
||||
if (value == key)
|
||||
{
|
||||
// Returns default property value (English version) instead of ResourceKey.PropertyName
|
||||
return propertyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value == String.Empty)
|
||||
{
|
||||
// Returns default property value (English version)
|
||||
return propertyValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
return _localizer?[key] ?? name;
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
if (!String.IsNullOrEmpty(ResourceKey))
|
||||
IsLocalizable = false;
|
||||
|
||||
if (!String.IsNullOrEmpty(ResourceKey) && ModuleState?.ModuleType != null)
|
||||
{
|
||||
if (ModuleState?.ModuleType != null)
|
||||
var moduleType = Type.GetType(ModuleState.ModuleType);
|
||||
if (moduleType != null)
|
||||
{
|
||||
var moduleType = Type.GetType(ModuleState.ModuleType);
|
||||
if (moduleType != null)
|
||||
using (var scope = ServiceActivator.GetScope())
|
||||
{
|
||||
using (var scope = ServiceActivator.GetScope())
|
||||
{
|
||||
var localizerFactory = scope.ServiceProvider.GetService<IStringLocalizerFactory>();
|
||||
_localizer = localizerFactory.Create(moduleType);
|
||||
}
|
||||
var localizerFactory = scope.ServiceProvider.GetService<IStringLocalizerFactory>();
|
||||
_localizer = localizerFactory.Create(moduleType);
|
||||
|
||||
IsLocalizable = true;
|
||||
}
|
||||
}
|
||||
|
||||
IsLocalizable = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
IsLocalizable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
@if (!string.IsNullOrEmpty(_message))
|
||||
{
|
||||
<div class="@_classname" role="alert">
|
||||
@_message
|
||||
@((MarkupString)_message)
|
||||
@if (Type == MessageType.Error && PageState != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
|
||||
{
|
||||
@((MarkupString)" ")<NavLink href="@NavigateUrl("admin/log")">View Details</NavLink>
|
||||
|
|
|
@ -3,6 +3,43 @@
|
|||
@typeparam TableItem
|
||||
|
||||
<p>
|
||||
@if (Toolbar == "Top")
|
||||
{
|
||||
<div class="mx-auto text-center">
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(1))><span class="oi oi-media-step-backward" title="first" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_page > _maxPages)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
@for (int i = _startPage; i <= _endPage; i++)
|
||||
{
|
||||
var pager = i;
|
||||
<button class="btn @((pager == _page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||
@pager
|
||||
</button>
|
||||
}
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage < _pages)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(_pages))><span class="oi oi-media-step-forward" title="last" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@if (Format == "Table")
|
||||
{
|
||||
<table class="@Class">
|
||||
|
@ -35,32 +72,43 @@
|
|||
}
|
||||
</div>
|
||||
}
|
||||
<div class="mx-auto text-center">
|
||||
@if (_page > _maxPages)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
@for (int i = _startPage; i <= _endPage; i++)
|
||||
@if (Toolbar == "Bottom")
|
||||
{
|
||||
<div class="mx-auto text-center">
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
var pager = i;
|
||||
<button class="btn @((pager == _page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||
@pager
|
||||
</button>
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(1))><span class="oi oi-media-step-backward" title="first" aria-hidden="true"></span></button>
|
||||
}
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage < _pages)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||
}
|
||||
</div>
|
||||
@if (_page > _maxPages)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
@for (int i = _startPage; i <= _endPage; i++)
|
||||
{
|
||||
var pager = i;
|
||||
<button class="btn @((pager == _page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||
@pager
|
||||
</button>
|
||||
}
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage < _pages)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary mr-1" @onclick=@(async () => UpdateList(_pages))><span class="oi oi-media-step-forward" title="last" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</p>
|
||||
|
||||
@code {
|
||||
|
@ -74,6 +122,9 @@
|
|||
[Parameter]
|
||||
public string Format { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Toolbar { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment Header { get; set; }
|
||||
|
||||
|
@ -104,6 +155,11 @@
|
|||
Format = "Table";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Toolbar))
|
||||
{
|
||||
Toolbar = "Top";
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Class))
|
||||
{
|
||||
if (Format == "Table")
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserService UserService
|
||||
@inject IStringLocalizer<PermissionGrid> Localizer
|
||||
|
||||
@if (_permissions != null)
|
||||
{
|
||||
|
@ -9,10 +10,10 @@
|
|||
<table class="table" style="width: 50%; min-width: 250px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="col">Role</th>
|
||||
<th scope="col">@Localizer["Role"]</th>
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||
<th style="text-align: center; width: 1px;">@Localizer[permission.PermissionName]</th>
|
||||
}
|
||||
</tr>
|
||||
@foreach (Role role in _roles)
|
||||
|
@ -35,10 +36,10 @@
|
|||
<table class="table" style="width: 50%; min-width: 250px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">User</th>
|
||||
<th scope="col">@Localizer["User"]</th>
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
<th style="text-align: center; width: 1px;">@permission.PermissionName</th>
|
||||
<th style="text-align: center; width: 1px;">@Localizer[permission.PermissionName]</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
|
@ -64,8 +65,8 @@
|
|||
<tbody>
|
||||
<tr>
|
||||
<td class="input-group">
|
||||
<input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@_username" />
|
||||
<button type="button" class="btn btn-primary" @onclick="AddUser">Add</button>
|
||||
<input type="text" name="Username" class="form-control" placeholder="@Localizer["Enter Username"]" @bind="@_username" />
|
||||
<button type="button" class="btn btn-primary" @onclick="AddUser">@Localizer["Add"]</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -179,7 +180,7 @@
|
|||
}
|
||||
catch
|
||||
{
|
||||
_message = "Username Does Not Exist";
|
||||
_message = Localizer["Username Does Not Exist"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
@inject IStringLocalizer<RichTextEditor> Localizer
|
||||
|
||||
<div class="row" style="margin-bottom: 50px;">
|
||||
<div class="col">
|
||||
|
@ -12,12 +13,12 @@
|
|||
<br />
|
||||
}
|
||||
<div class="row justify-content-center" style="margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRichText">Synchronize Content</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="InsertImage">Insert Image</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRichText">@Localizer["Synchronize Content"]</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="InsertImage">@Localizer["Insert Image"]</button>
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
@((MarkupString)" ")
|
||||
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">@Localizer["Close"]</button>
|
||||
}
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -61,9 +62,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</TabPanel>
|
||||
<TabPanel Name="Raw" Heading="Raw HTML Editor">
|
||||
<TabPanel Name="Raw" Heading="Raw HTML Editor" ResourceKey="HtmlEditor">
|
||||
<div class="row justify-content-center" style="margin-bottom: 20px;">
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRawHtml">Synchronize Content</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="RefreshRawHtml">@Localizer["Synchronize Content"]</button>
|
||||
</div>
|
||||
@if (ReadOnly)
|
||||
{
|
||||
|
@ -193,7 +194,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
_message = "You Must Select An Image To Insert";
|
||||
_message = Localizer["You Must Select An Image To Insert"];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
<div class="d-flex">
|
||||
<hr class="app-rule" />
|
||||
</div>
|
||||
<div class="collapse" id="@Name">
|
||||
<div class="collapse @_show" id="@Name">
|
||||
@ChildContent
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string _heading = string.Empty;
|
||||
private string _expanded = string.Empty;
|
||||
private string _show = string.Empty;
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
@ -40,17 +41,15 @@
|
|||
{
|
||||
_heading = (!string.IsNullOrEmpty(Heading)) ? Heading : Name;
|
||||
_expanded = (!string.IsNullOrEmpty(Expanded)) ? Expanded : "false";
|
||||
if (_expanded == "true") { _show = "show"; }
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
|
||||
if (IsLocalizable)
|
||||
{
|
||||
_heading = !string.IsNullOrEmpty(Heading)
|
||||
? Localize(nameof(Heading))
|
||||
: Localize(nameof(Name));
|
||||
}
|
||||
_heading = !string.IsNullOrEmpty(Heading)
|
||||
? Localize(nameof(Heading), Heading)
|
||||
: Localize(nameof(Name), Name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,16 +40,13 @@ else
|
|||
{
|
||||
base.OnParametersSet();
|
||||
|
||||
if (IsLocalizable)
|
||||
if (string.IsNullOrEmpty(Heading))
|
||||
{
|
||||
if (string.IsNullOrEmpty(Heading))
|
||||
{
|
||||
Name = Localize(nameof(Name));
|
||||
}
|
||||
else
|
||||
{
|
||||
Heading = Localize(nameof(Heading));
|
||||
}
|
||||
Name = Localize(nameof(Name), Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
Heading = Localize(nameof(Heading), Heading);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<CascadingValue Value="this" IsFixed="true">
|
||||
<div class="container-fluid">
|
||||
<div class="form-group">
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@namespace Oqtane.Modules.Controls
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleControlBase
|
||||
@inject IStringLocalizer<TriStateCheckBox> Localizer
|
||||
|
||||
<img src="@_src" title="@_title" @onclick="SetValue" />
|
||||
|
||||
|
@ -51,11 +52,11 @@
|
|||
{
|
||||
case true:
|
||||
_src = "images/checked.png";
|
||||
_title = "Permission Granted";
|
||||
_title = Localizer["Permission Granted"];
|
||||
break;
|
||||
case false:
|
||||
_src = "images/unchecked.png";
|
||||
_title = "Permission Denied";
|
||||
_title = Localizer["Permission Denied"];
|
||||
break;
|
||||
case null:
|
||||
_src = "images/null.png";
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
@using Oqtane.Modules.HtmlText.Services
|
||||
@using Oqtane.Modules.HtmlText.Services
|
||||
@using Oqtane.Modules.HtmlText.Models
|
||||
@using Oqtane.Modules.Controls
|
||||
@namespace Oqtane.Modules.HtmlText
|
||||
@inherits ModuleBase
|
||||
@inject IHtmlTextService HtmlTextService
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IStringLocalizer<Edit> Localizer
|
||||
|
||||
@if (_content != null)
|
||||
{
|
||||
<RichTextEditor Content="@_content" @ref="@RichTextEditorHtml"></RichTextEditor>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveContent">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<button type="button" class="btn btn-success" @onclick="SaveContent">@Localizer["Save"]</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">@Localizer["Cancel"]</NavLink>
|
||||
@if (!string.IsNullOrEmpty(_content))
|
||||
{
|
||||
<br />
|
||||
|
@ -91,7 +92,7 @@
|
|||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Saving Content {Error}", ex.Message);
|
||||
AddModuleMessage("Error Saving Content", MessageType.Error);
|
||||
AddModuleMessage(Localizer["Error Saving Content"], MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@using Oqtane.Modules.HtmlText.Services
|
||||
@using Oqtane.Modules.HtmlText.Services
|
||||
@namespace Oqtane.Modules.HtmlText
|
||||
@inherits ModuleBase
|
||||
@inject IHtmlTextService HtmlTextService
|
||||
|
@ -7,7 +7,7 @@
|
|||
|
||||
@if (PageState.EditMode)
|
||||
{
|
||||
<br /><ActionLink Action="Edit" EditMode="true" /><br /><br />
|
||||
<br /><ActionLink Action="Edit" EditMode="true" ResourceKey="Edit" /><br /><br />
|
||||
}
|
||||
|
||||
@code {
|
||||
|
|
|
@ -116,7 +116,12 @@ namespace Oqtane.Modules
|
|||
|
||||
public string ContentUrl(int fileid)
|
||||
{
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||
return ContentUrl(fileid, false);
|
||||
}
|
||||
|
||||
public string ContentUrl(int fileid, bool asAttachment)
|
||||
{
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid, asAttachment);
|
||||
}
|
||||
|
||||
public virtual Dictionary<string, string> GetUrlParameters(string parametersTemplate = "")
|
||||
|
@ -173,6 +178,11 @@ namespace Oqtane.Modules
|
|||
ModuleInstance.AddModuleMessage(message, type);
|
||||
}
|
||||
|
||||
public void ClearModuleMessage()
|
||||
{
|
||||
ModuleInstance.AddModuleMessage("", MessageType.Undefined);
|
||||
}
|
||||
|
||||
public void ShowProgressIndicator()
|
||||
{
|
||||
ModuleInstance.ShowProgressIndicator();
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<OutputType>Exe</OutputType>
|
||||
<RazorLangVersion>3.0</RazorLangVersion>
|
||||
<Configurations>Debug;Release</Configurations>
|
||||
<Version>2.0.0</Version>
|
||||
<Version>2.0.1</Version>
|
||||
<Product>Oqtane</Product>
|
||||
<Authors>Shaun Walker</Authors>
|
||||
<Company>.NET Foundation</Company>
|
||||
|
@ -14,9 +14,10 @@
|
|||
<PackageProjectUrl>https://www.oqtane.org</PackageProjectUrl>
|
||||
<RepositoryUrl>https://github.com/oqtane</RepositoryUrl>
|
||||
<RepositoryType>Git</RepositoryType>
|
||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.0</PackageReleaseNotes>
|
||||
<PackageReleaseNotes>https://github.com/oqtane/oqtane.framework/releases/tag/v2.0.1</PackageReleaseNotes>
|
||||
<RootNamespace>Oqtane</RootNamespace>
|
||||
<IsPackable>true</IsPackable>
|
||||
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -30,6 +31,7 @@
|
|||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="5.0.0" />
|
||||
<PackageReference Include="System.Net.Http.Json" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,19 +1,23 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Runtime.Loader;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
|
||||
using Microsoft.AspNetCore.Localization;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.JSInterop;
|
||||
using Oqtane.Modules;
|
||||
using Oqtane.Providers;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Services;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.UI;
|
||||
|
||||
namespace Oqtane.Client
|
||||
{
|
||||
|
@ -62,6 +66,8 @@ namespace Oqtane.Client
|
|||
builder.Services.AddScoped<ISiteTemplateService, SiteTemplateService>();
|
||||
builder.Services.AddScoped<ISqlService, SqlService>();
|
||||
builder.Services.AddScoped<ISystemService, SystemService>();
|
||||
builder.Services.AddScoped<ILocalizationService, LocalizationService>();
|
||||
builder.Services.AddScoped<ILanguageService, LanguageService>();
|
||||
|
||||
await LoadClientAssemblies(httpClient);
|
||||
|
||||
|
@ -88,6 +94,19 @@ namespace Oqtane.Client
|
|||
}
|
||||
|
||||
var host = builder.Build();
|
||||
var jsRuntime = host.Services.GetRequiredService<IJSRuntime>();
|
||||
var interop = new Interop(jsRuntime);
|
||||
var localizationCookie = await interop.GetCookie(CookieRequestCultureProvider.DefaultCookieName);
|
||||
var culture = CookieRequestCultureProvider.ParseCookieValue(localizationCookie).UICultures[0].Value;
|
||||
var localizationService = host.Services.GetRequiredService<ILocalizationService>();
|
||||
var cultures = await localizationService.GetCulturesAsync();
|
||||
|
||||
if (culture == null || !cultures.Any(c => c.Name.Equals(culture, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
culture = cultures.Single(c => c.IsDefault).Name;
|
||||
}
|
||||
|
||||
SetCulture(culture);
|
||||
|
||||
ServiceActivator.Configure(host.Services);
|
||||
|
||||
|
@ -142,5 +161,12 @@ namespace Oqtane.Client
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetCulture(string culture)
|
||||
{
|
||||
var cultureInfo = CultureInfo.GetCultureInfo(culture);
|
||||
CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
|
||||
CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
|
@ -37,11 +37,11 @@ namespace Oqtane.Services
|
|||
{
|
||||
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
|
||||
{
|
||||
folderPath = Utilities.PathCombine(folderPath,"\\");
|
||||
folderPath = Utilities.PathCombine(folderPath, System.IO.Path.DirectorySeparatorChar.ToString());
|
||||
}
|
||||
|
||||
|
||||
var path = WebUtility.UrlEncode(folderPath);
|
||||
|
||||
|
||||
return await GetJsonAsync<List<File>>($"{Apiurl}/{siteId}/{path}");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Oqtane.Models;
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
|
@ -37,11 +37,11 @@ namespace Oqtane.Services
|
|||
{
|
||||
if (!(folderPath.EndsWith(System.IO.Path.DirectorySeparatorChar) || folderPath.EndsWith(System.IO.Path.AltDirectorySeparatorChar)))
|
||||
{
|
||||
folderPath = Utilities.PathCombine(folderPath, "\\");
|
||||
folderPath = Utilities.PathCombine(folderPath, System.IO.Path.DirectorySeparatorChar.ToString());
|
||||
}
|
||||
|
||||
|
||||
var path = WebUtility.UrlEncode(folderPath);
|
||||
|
||||
|
||||
return await GetJsonAsync<Folder>($"{ApiUrl}/{siteId}/{path}");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Oqtane.Models;
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net.Http;
|
||||
using Oqtane.Shared;
|
||||
|
@ -25,5 +25,10 @@ namespace Oqtane.Services
|
|||
{
|
||||
return await GetJsonAsync<Installation>($"{ApiUrl}/upgrade");
|
||||
}
|
||||
|
||||
public async Task RestartAsync()
|
||||
{
|
||||
await PostAsync($"{ApiUrl}/restart");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using Oqtane.Models;
|
||||
using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Shared;
|
||||
|
||||
|
@ -9,5 +9,6 @@ namespace Oqtane.Services
|
|||
Task<Installation> IsInstalled();
|
||||
Task<Installation> Install(InstallConfig config);
|
||||
Task<Installation> Upgrade();
|
||||
Task RestartAsync();
|
||||
}
|
||||
}
|
||||
|
|
17
Oqtane.Client/Services/Interfaces/ILanguageService.cs
Normal file
17
Oqtane.Client/Services/Interfaces/ILanguageService.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface ILanguageService
|
||||
{
|
||||
Task<List<Language>> GetLanguagesAsync(int siteId);
|
||||
|
||||
Task<Language> GetLanguageAsync(int languageId);
|
||||
|
||||
Task<Language> AddLanguageAsync(Language language);
|
||||
|
||||
Task DeleteLanguageAsync(int languageId);
|
||||
}
|
||||
}
|
11
Oqtane.Client/Services/Interfaces/ILocalizationService.cs
Normal file
11
Oqtane.Client/Services/Interfaces/ILocalizationService.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public interface ILocalizationService
|
||||
{
|
||||
Task<IEnumerable<Culture>> GetCulturesAsync();
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using Oqtane.Models;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -12,6 +12,6 @@ namespace Oqtane.Services
|
|||
Task UpdateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
Task InstallModuleDefinitionsAsync();
|
||||
Task DeleteModuleDefinitionAsync(int moduleDefinitionId, int siteId);
|
||||
Task CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition, int moduleId);
|
||||
Task<ModuleDefinition> CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition);
|
||||
}
|
||||
}
|
||||
|
|
38
Oqtane.Client/Services/LanguageService.cs
Normal file
38
Oqtane.Client/Services/LanguageService.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class LanguageService : ServiceBase, ILanguageService
|
||||
{
|
||||
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public LanguageService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
}
|
||||
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Language");
|
||||
|
||||
public async Task<List<Language>> GetLanguagesAsync(int siteId)
|
||||
{
|
||||
var languages = await GetJsonAsync<List<Language>>($"{Apiurl}?siteid={siteId}");
|
||||
|
||||
return languages?.OrderBy(l => l.Name).ToList() ?? Enumerable.Empty<Language>().ToList();
|
||||
}
|
||||
|
||||
public async Task<Language> GetLanguageAsync(int languageId)
|
||||
=> await GetJsonAsync<Language>($"{Apiurl}/{languageId}");
|
||||
|
||||
public async Task<Language> AddLanguageAsync(Language language)
|
||||
=> await PostJsonAsync<Language>(Apiurl, language);
|
||||
|
||||
public async Task DeleteLanguageAsync(int languageId)
|
||||
=> await DeleteAsync($"{Apiurl}/{languageId}");
|
||||
}
|
||||
}
|
22
Oqtane.Client/Services/LocalizationService.cs
Normal file
22
Oqtane.Client/Services/LocalizationService.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Models;
|
||||
using Oqtane.Shared;
|
||||
|
||||
namespace Oqtane.Services
|
||||
{
|
||||
public class LocalizationService : ServiceBase, ILocalizationService
|
||||
{
|
||||
private readonly SiteState _siteState;
|
||||
|
||||
public LocalizationService(HttpClient http, SiteState siteState) : base(http)
|
||||
{
|
||||
_siteState = siteState;
|
||||
}
|
||||
|
||||
private string Apiurl => CreateApiUrl(_siteState.Alias, "Localization");
|
||||
|
||||
public async Task<IEnumerable<Culture>> GetCulturesAsync() => await GetJsonAsync<IEnumerable<Culture>>(Apiurl);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using Oqtane.Models;
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
|
@ -49,9 +49,9 @@ namespace Oqtane.Services
|
|||
await DeleteAsync($"{Apiurl}/{moduleDefinitionId}?siteid={siteId}");
|
||||
}
|
||||
|
||||
public async Task CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition, int moduleId)
|
||||
public async Task<ModuleDefinition> CreateModuleDefinitionAsync(ModuleDefinition moduleDefinition)
|
||||
{
|
||||
await PostJsonAsync($"{Apiurl}?moduleid={moduleId}", moduleDefinition);
|
||||
return await PostJsonAsync($"{Apiurl}", moduleDefinition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IUserService UserService
|
||||
|
@ -9,6 +9,7 @@
|
|||
@inject IPageModuleService PageModuleService
|
||||
@inject ILogService logger
|
||||
@inject ISettingService SettingService
|
||||
@inject IStringLocalizer<ControlPanel> Localizer
|
||||
|
||||
@if (_moduleDefinitions != null && UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||
{
|
||||
|
@ -16,7 +17,7 @@
|
|||
|
||||
<div class="@CardClass">
|
||||
<div class="@HeaderClass">
|
||||
<span class="font-weight-bold">Control Panel</span>
|
||||
<span class="font-weight-bold">@Localizer["Control Panel"]</span>
|
||||
<button type="button" class="close" @onclick="HideControlPanel" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
|
@ -27,7 +28,7 @@
|
|||
{
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Admin"))>Admin Dashboard</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Admin"))>@Localizer["Admin Dashboard"]</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -35,18 +36,18 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<label class="control-label">Page Management: </label>
|
||||
<label class="control-label">@Localizer["Page Management:"] </label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Add"))>Add</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Add"))>@Localizer["Add"]</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Edit"))>Edit</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Edit"))>@Localizer["Edit"]</button>
|
||||
</div>
|
||||
<div class="col">
|
||||
<button class="btn btn-danger btn-block mx-auto" @onclick="ConfirmDelete">Delete</button>
|
||||
<button class="btn btn-danger btn-block mx-auto" @onclick="ConfirmDelete">@Localizer["Delete"]</button>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
@ -54,13 +55,13 @@
|
|||
@if (UserSecurity.GetPermissionStrings(PageState.Page.Permissions).FirstOrDefault(item => item.PermissionName == PermissionNames.View).Permissions.Split(';').Contains(RoleNames.Everyone))
|
||||
{
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("unpublish"))>Unpublish Page</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("unpublish"))>@Localizer["Unpublish Page"]</button>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col">
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("publish"))>Publish Page</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Publish("publish"))>@Localizer["Publish Page"]</button>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
@ -73,15 +74,15 @@
|
|||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Delete Page</h5>
|
||||
<h5 class="modal-title">@Localizer["Delete Page"]</h5>
|
||||
<button type="button" class="close" @onclick="ConfirmDelete" aria-label="Close">×</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>Are You Sure You Want To Delete This Page?</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" @onclick="DeletePage">Delete</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="ConfirmDelete">Cancel</button>
|
||||
<button type="button" class="btn btn-danger" @onclick="DeletePage">@Localizer["Delete"]</button>
|
||||
<button type="button" class="btn btn-secondary" @onclick="ConfirmDelete">@Localizer["Cancel"]</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -92,10 +93,10 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<label for="Module" class="control-label">Module Management: </label>
|
||||
<label for="Module" class="control-label">@Localizer["Module Management:"] </label>
|
||||
<select class="form-control" @bind="@ModuleType">
|
||||
<option value="new">Add New Module</option>
|
||||
<option value="existing">Add Existing Module</option>
|
||||
<option value="new">@Localizer["Add New Module"]</option>
|
||||
<option value="existing">@Localizer["Add Existing Module"]</option>
|
||||
</select>
|
||||
@if (ModuleType == "new")
|
||||
{
|
||||
|
@ -106,22 +107,22 @@
|
|||
{
|
||||
if (category == Category)
|
||||
{
|
||||
<option value="@category" selected>@category Modules</option>
|
||||
<option value="@category" selected>@category @Localizer["Modules"]</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@category">@category Modules</option>
|
||||
<option value="@category">@category @Localizer["Modules"]</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<select class="form-control" @onchange="(e => ModuleChanged(e))">
|
||||
@if (ModuleDefinitionName == "-")
|
||||
{
|
||||
<option value="-" selected><Select Module></option>
|
||||
<option value="-" selected><@Localizer["Select Module"]></option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="-"><Select Module></option>
|
||||
<option value="-"><@Localizer["Select Module"]></option>
|
||||
}
|
||||
@foreach (var moduledefinition in _moduleDefinitions)
|
||||
{
|
||||
|
@ -140,14 +141,14 @@
|
|||
else
|
||||
{
|
||||
<select class="form-control" @onchange="(e => PageChanged(e))">
|
||||
<option value="-"><Select Page></option>
|
||||
<option value="-"><@Localizer["Select Page"]></option>
|
||||
@foreach (Page p in _pages)
|
||||
{
|
||||
<option value="@p.PageId">@p.Name</option>
|
||||
}
|
||||
</select>
|
||||
<select class="form-control" @bind="@ModuleId">
|
||||
<option value="-"><Select Module></option>
|
||||
<option value="-"><@Localizer["Select Module"]></option>
|
||||
@foreach (Module module in _modules)
|
||||
{
|
||||
<option value="@module.ModuleId">@module.Title</option>
|
||||
|
@ -158,7 +159,7 @@
|
|||
</div>
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<label for="Title" class="control-label">Title: </label>
|
||||
<label for="Title" class="control-label">@Localizer["Title:"] </label>
|
||||
<input type="text" name="Title" class="form-control" @bind="@Title" />
|
||||
</div>
|
||||
</div>
|
||||
|
@ -166,7 +167,7 @@
|
|||
{
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<label for="Pane" class="control-label">Pane: </label>
|
||||
<label for="Pane" class="control-label">@Localizer["Pane:"] </label>
|
||||
<select class="form-control" @bind="@Pane">
|
||||
@foreach (string pane in PageState.Page.Panes)
|
||||
{
|
||||
|
@ -178,7 +179,7 @@
|
|||
}
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<label for="Container" class="control-label">Container: </label>
|
||||
<label for="Container" class="control-label">@Localizer["Container:"] </label>
|
||||
<select class="form-control" @bind="@ContainerType">
|
||||
@foreach (var container in _containers)
|
||||
{
|
||||
|
@ -190,13 +191,18 @@
|
|||
|
||||
<br />
|
||||
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
|
||||
<button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">@Localizer["Add Module To Page"]</button>
|
||||
@((MarkupString) Message)
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (ShowLanguageSwitcher)
|
||||
{
|
||||
<LanguageSwitcher />
|
||||
}
|
||||
|
||||
@if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions) || (PageState.Page.IsPersonalizable && PageState.User != null))
|
||||
{
|
||||
if (PageState.EditMode)
|
||||
|
@ -286,8 +292,11 @@
|
|||
[Parameter]
|
||||
public string BodyClass { get; set; } = "card-body";
|
||||
|
||||
[Parameter]
|
||||
public bool ShowLanguageSwitcher { get; set; } = true;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.Edit, PageState.Page.Permissions))
|
||||
{
|
||||
|
@ -313,12 +322,12 @@
|
|||
|
||||
private void CategoryChanged(ChangeEventArgs e)
|
||||
{
|
||||
Category = (string) e.Value;
|
||||
Category = (string)e.Value;
|
||||
}
|
||||
|
||||
private void ModuleChanged(ChangeEventArgs e)
|
||||
{
|
||||
ModuleDefinitionName = (string) e.Value;
|
||||
ModuleDefinitionName = (string)e.Value;
|
||||
if (ModuleDefinitionName != "-")
|
||||
{
|
||||
var moduleDefinition = _moduleDefinitions.FirstOrDefault(item => item.ModuleDefinitionName == ModuleDefinitionName);
|
||||
|
@ -334,7 +343,7 @@
|
|||
|
||||
private void PageChanged(ChangeEventArgs e)
|
||||
{
|
||||
PageId = (string) e.Value;
|
||||
PageId = (string)e.Value;
|
||||
if (PageId != "-")
|
||||
{
|
||||
_modules = PageState.Modules
|
||||
|
@ -395,17 +404,17 @@
|
|||
await PageModuleService.AddPageModuleAsync(pageModule);
|
||||
await PageModuleService.UpdatePageModuleOrderAsync(pageModule.PageId, pageModule.Pane);
|
||||
|
||||
Message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
|
||||
Message = $"<br /><div class=\"alert alert-success\" role=\"alert\">{Localizer["Module Added To Page"]}</div>";
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select A Module</div>";
|
||||
Message = $"<br /><div class=\"alert alert-warning\" role=\"alert\">{Localizer["You Must Select A Module"]}</div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = "<br /><div class=\"alert alert-error\" role=\"alert\">Not Authorized</div>";
|
||||
Message = $"<br /><div class=\"alert alert-error\" role=\"alert\">{Localizer["Not Authorized"]}</div>";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,10 +485,10 @@
|
|||
switch (location)
|
||||
{
|
||||
case "Add":
|
||||
url = EditUrl(PageState.Page.Path, module.ModuleId, location, "");
|
||||
url = EditUrl(PageState.Page.Path, module.ModuleId, location, "cp=" + PageState.Page.PageId);
|
||||
break;
|
||||
case "Edit":
|
||||
url = EditUrl(PageState.Page.Path, module.ModuleId, location, "id=" + PageState.Page.PageId.ToString());
|
||||
url = EditUrl(PageState.Page.Path, module.ModuleId, location, "id=" + PageState.Page.PageId.ToString() + "&cp=" + PageState.Page.PageId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
12
Oqtane.Client/Themes/Controls/FontIcon.razor
Normal file
12
Oqtane.Client/Themes/Controls/FontIcon.razor
Normal file
|
@ -0,0 +1,12 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(Value))
|
||||
{
|
||||
<span class="@Value" aria-hidden="true"></span>
|
||||
}
|
||||
|
||||
@code {
|
||||
[Parameter()]
|
||||
public string Value { get; set; }
|
||||
}
|
44
Oqtane.Client/Themes/Controls/LanguageSwitcher.razor
Normal file
44
Oqtane.Client/Themes/Controls/LanguageSwitcher.razor
Normal file
|
@ -0,0 +1,44 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@using System.Globalization
|
||||
@using Microsoft.AspNetCore.Localization
|
||||
@using Oqtane.Models
|
||||
@inject ILanguageService LanguageService
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@if (_supportedCultures?.Count() > 1)
|
||||
{
|
||||
<div class="btn-group" role="group">
|
||||
<button id="btnCultures" type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<span class="oi oi-globe"></span>
|
||||
</button>
|
||||
<div class="dropdown-menu" aria-labelledby="btnCultures">
|
||||
@foreach (var culture in _supportedCultures)
|
||||
{
|
||||
<a class="dropdown-item @(CultureInfo.CurrentUICulture.Name == culture.Name ? "active" : String.Empty)" href="#" @onclick="@(async e => await SetCultureAsync(culture.Name))">@culture.DisplayName</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code{
|
||||
private IEnumerable<Culture> _supportedCultures;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
var languages = await LanguageService.GetLanguagesAsync(PageState.Site.SiteId);
|
||||
_supportedCultures = languages.Select(l => new Culture { Name = l.Code, DisplayName = l.Name });
|
||||
}
|
||||
|
||||
private async Task SetCultureAsync(string culture)
|
||||
{
|
||||
if (culture != CultureInfo.CurrentUICulture.Name)
|
||||
{
|
||||
var interop = new Interop(JSRuntime);
|
||||
var localizationCookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture));
|
||||
await interop.SetCookie(CookieRequestCultureProvider.DefaultCookieName, localizationCookieValue, 360);
|
||||
|
||||
NavigationManager.NavigateTo(NavigationManager.Uri, forceLoad: true);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits LoginBase
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits LoginBase
|
||||
@inject IStringLocalizer<Login> Localizer
|
||||
|
||||
<span class="app-login">
|
||||
<AuthorizeView>
|
||||
|
@ -7,10 +8,10 @@
|
|||
<text>...</text>
|
||||
</Authorizing>
|
||||
<Authorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LogoutUser">Logout</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="LogoutUser">@Localizer["Logout"]</button>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<button type="button" class="btn btn-primary" @onclick="LoginUser">Login</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="LoginUser">@Localizer["Login"]</button>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</span>
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
@ -22,14 +22,15 @@ namespace Oqtane.Themes.Controls
|
|||
{
|
||||
returnurl += "/" + PageState.Page.Path;
|
||||
}
|
||||
NavigationManager.NavigateTo(NavigateUrl("login", "returnurl=" + returnurl));
|
||||
NavigationManager.NavigateTo(NavigateUrl("login", "?returnurl=" + returnurl));
|
||||
}
|
||||
|
||||
protected async Task LogoutUser()
|
||||
{
|
||||
await UserService.LogoutUserAsync(PageState.User);
|
||||
PageState.User = null;
|
||||
|
||||
if (PageState.Runtime == Runtime.Server)
|
||||
if (PageState.Runtime == Oqtane.Shared.Runtime.Server)
|
||||
{
|
||||
// server-side Blazor
|
||||
var interop = new Interop(jsRuntime);
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@namespace Oqtane.Themes.Controls
|
||||
|
||||
@inherits MenuBase
|
||||
|
||||
@if (MenuPages.Any())
|
||||
|
@ -10,35 +11,7 @@
|
|||
</span>
|
||||
<div class="app-menu">
|
||||
<div class="collapse navbar-collapse" id="Menu">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
@foreach (var p in MenuPages)
|
||||
{
|
||||
if (p.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
|
||||
@if (p.Icon != string.Empty)
|
||||
{
|
||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
@p.Name<span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="@GetUrl(p)" target="@GetTarget(p)" >
|
||||
@if (p.Icon != string.Empty)
|
||||
{
|
||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
@p.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
<MenuItemsHorizontal ParentPage="null" Pages="MenuPages" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
27
Oqtane.Client/Themes/Controls/MenuItemsBase.cs
Normal file
27
Oqtane.Client/Themes/Controls/MenuItemsBase.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using Microsoft.AspNetCore.Components;
|
||||
|
||||
using Oqtane.Models;
|
||||
using Oqtane.UI;
|
||||
|
||||
namespace Oqtane.Themes.Controls
|
||||
{
|
||||
public abstract class MenuItemsBase : MenuBase
|
||||
{
|
||||
[Parameter()]
|
||||
public Page ParentPage { get; set; }
|
||||
|
||||
[Parameter()]
|
||||
public IEnumerable<Page> Pages { get; set; }
|
||||
|
||||
protected IEnumerable<Page> GetChildPages()
|
||||
{
|
||||
return Pages
|
||||
.Where(e => e.ParentId == ParentPage?.PageId)
|
||||
.OrderBy(e => e.Order)
|
||||
.AsEnumerable();
|
||||
}
|
||||
}
|
||||
}
|
77
Oqtane.Client/Themes/Controls/MenuItemsHorizontal.razor
Normal file
77
Oqtane.Client/Themes/Controls/MenuItemsHorizontal.razor
Normal file
|
@ -0,0 +1,77 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits MenuItemsBase
|
||||
|
||||
@if (ParentPage != null)
|
||||
{
|
||||
<div class="dropdown-menu" aria-labelledby="@($"navbarDropdown{ParentPage.PageId}")">
|
||||
@foreach (var childPage in GetChildPages())
|
||||
{
|
||||
if (childPage.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<a class="dropdown-item active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name <span class="sr-only">(current)</span>
|
||||
</a>
|
||||
}
|
||||
else
|
||||
{
|
||||
<a class="dropdown-item" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name
|
||||
</a>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul class="navbar-nav mr-auto">
|
||||
@foreach (var childPage in GetChildPages())
|
||||
{
|
||||
if (!Pages.Any(e => e.ParentId == childPage.PageId))
|
||||
{
|
||||
if (childPage.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name <span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (childPage.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="nav-item dropdown active">
|
||||
<a class="nav-link dropdown-toggle" href="@GetUrl(childPage)" target="@GetTarget(childPage)" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name <span class="sr-only">(current)</span>
|
||||
</a>
|
||||
<MenuItemsHorizontal ParentPage="childPage" Pages="Pages" />
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="@GetUrl(childPage)" target="@GetTarget(childPage)" id="@($"navbarDropdown{childPage.PageId}")" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name
|
||||
</a>
|
||||
<MenuItemsHorizontal ParentPage="childPage" Pages="Pages" />
|
||||
</li>
|
||||
}
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
61
Oqtane.Client/Themes/Controls/MenuItemsVertical.razor
Normal file
61
Oqtane.Client/Themes/Controls/MenuItemsVertical.razor
Normal file
|
@ -0,0 +1,61 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits MenuItemsBase
|
||||
|
||||
@if (ParentPage != null)
|
||||
{
|
||||
foreach (var childPage in GetChildPages())
|
||||
{
|
||||
if (childPage.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
|
||||
<a class="nav-link active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name <span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
|
||||
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
if (Pages.Any(e => e.ParentId == childPage.PageId))
|
||||
{
|
||||
<MenuItemsVertical ParentPage="childPage" Pages="Pages" />
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<ul class="nav flex-column">
|
||||
@foreach (var childPage in GetChildPages())
|
||||
{
|
||||
if (childPage.PageId == PageState.Page.PageId)
|
||||
{
|
||||
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
|
||||
<a class="nav-link active" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name <span class="sr-only">(current)</span>
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item px-3" style="margin-left: @(childPage.Level * 15)px;">
|
||||
<a class="nav-link" href="@GetUrl(childPage)" target="@GetTarget(childPage)">
|
||||
<FontIcon Value="@childPage.Icon" />
|
||||
@childPage.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
if (Pages.Any(e => e.ParentId == childPage.PageId))
|
||||
{
|
||||
<MenuItemsVertical ParentPage="childPage" Pages="Pages" />
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits MenuBase
|
||||
|
||||
@if (MenuPages.Any())
|
||||
|
@ -10,25 +10,7 @@
|
|||
</span>
|
||||
<div class="app-menu">
|
||||
<div class="collapse navbar-collapse" id="Menu">
|
||||
<ul class="nav flex-column">
|
||||
@foreach (var p in MenuPages)
|
||||
{
|
||||
<li class="nav-item px-3">
|
||||
<a href="@GetUrl(p)" class="nav-link" style="padding-left:@((p.Level + 1) * 15)px !important;" target="@GetTarget(p)">
|
||||
|
||||
@if (p.HasChildren)
|
||||
{
|
||||
<i class="oi oi-chevron-right"></i>
|
||||
}
|
||||
@if (p.Icon != string.Empty)
|
||||
{
|
||||
<span class="oi oi-@p.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
@p.Name
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
<MenuItemsVertical ParentPage="null" Pages="MenuPages" />
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ModuleActionsBase
|
||||
@attribute [OqtaneIgnore]
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
<span class="oi oi-@action.Icon" aria-hidden="true"></span>
|
||||
<span class="@action.Icon" aria-hidden="true"></span>
|
||||
}
|
||||
|
||||
@action.Name
|
||||
|
|
|
@ -9,21 +9,15 @@
|
|||
@code {
|
||||
private string title = "";
|
||||
|
||||
protected override Task OnParametersSetAsync()
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
title = ModuleState.Title;
|
||||
// check for core module actions component
|
||||
if (Constants.DefaultModuleActions.Contains(PageState.Action))
|
||||
if (!string.IsNullOrEmpty(ModuleState.ControlTitle))
|
||||
{
|
||||
title = PageState.Action;
|
||||
title = ModuleState.ControlTitle;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ModuleState.ControlTitle))
|
||||
{
|
||||
title = ModuleState.ControlTitle;
|
||||
}
|
||||
title = ModuleState.Title;
|
||||
}
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@namespace Oqtane.Themes.Controls
|
||||
@inherits ThemeControlBase
|
||||
@inject IStringLocalizer<UserProfile> Localizer
|
||||
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
|
@ -14,7 +15,7 @@
|
|||
<NotAuthorized>
|
||||
@if (PageState.Site.AllowRegistration)
|
||||
{
|
||||
<button type="button" class="btn btn-primary" @onclick="RegisterUser">Register</button>
|
||||
<button type="button" class="btn btn-primary" @onclick="RegisterUser">@Localizer["Register"]</button>
|
||||
}
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
|
|
|
@ -88,5 +88,10 @@ namespace Oqtane.Themes
|
|||
{
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid);
|
||||
}
|
||||
|
||||
public string ContentUrl(int fileid, bool asAttachment)
|
||||
{
|
||||
return Utilities.ContentUrl(PageState.Alias, fileid, asAttachment);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@namespace Oqtane.UI
|
||||
@namespace Oqtane.UI
|
||||
|
||||
<CascadingValue Value="@_moduleState">
|
||||
<CascadingValue Value="@_moduleState" IsFixed="true">
|
||||
@DynamicComponent
|
||||
</CascadingValue>
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
string container = _moduleState.ContainerType;
|
||||
if (PageState.ModuleId != -1 && _moduleState.UseAdminContainer)
|
||||
{
|
||||
container = Constants.DefaultAdminContainer;
|
||||
container = (!string.IsNullOrEmpty(PageState.Site.AdminContainerType)) ? PageState.Site.AdminContainerType : Constants.DefaultAdminContainer;
|
||||
}
|
||||
|
||||
DynamicComponent = builder =>
|
||||
|
|
|
@ -1,37 +1,38 @@
|
|||
@namespace Oqtane.UI
|
||||
@namespace Oqtane.UI
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject IInstallationService InstallationService
|
||||
@inject ISiteService SiteService
|
||||
@inject IUserService UserService
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IStringLocalizer<Installer> Localizer
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="mx-auto text-center">
|
||||
<img src="oqtane-black.png" />
|
||||
<div style="font-weight: bold">Version: @Constants.Version</div>
|
||||
<div style="font-weight: bold">@Localizer["Version:"] @Constants.Version</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr class="app-rule" />
|
||||
<div class="row justify-content-center">
|
||||
<div class="col text-center">
|
||||
<h2>Database Configuration</h2><br />
|
||||
<h2>@Localizer["Database Configuration"]</h2><br />
|
||||
<table class="form-group" cellpadding="4" cellspacing="4" style="margin: auto;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Database Type: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Database Type:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" @bind="@_databaseType">
|
||||
<option value="LocalDB">Local Database</option>
|
||||
<option value="SQLServer">SQL Server</option>
|
||||
<option value="LocalDB">@Localizer["Local Database"]</option>
|
||||
<option value="SQLServer">@Localizer["SQL Server"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Server: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Server:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="@_serverName" />
|
||||
|
@ -39,7 +40,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Database: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Database:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="@_databaseName" />
|
||||
|
@ -47,18 +48,18 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Integrated Security: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Integrated Security:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="custom-select" @onchange="SetIntegratedSecurity">
|
||||
<option value="true" selected>True</option>
|
||||
<option value="false">False</option>
|
||||
<option value="true" selected>@Localizer["True"]</option>
|
||||
<option value="false">@Localizer["False"]</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="@_integratedSecurityDisplay">
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Username: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Username:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="@_username" />
|
||||
|
@ -66,7 +67,7 @@
|
|||
</tr>
|
||||
<tr style="@_integratedSecurityDisplay">
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Password: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@_password" />
|
||||
|
@ -76,12 +77,12 @@
|
|||
</table>
|
||||
</div>
|
||||
<div class="col text-center">
|
||||
<h2>Application Administrator</h2><br />
|
||||
<h2>@Localizer["Application Administrator"]</h2><br />
|
||||
<table class="form-group" cellpadding="4" cellspacing="4" style="margin: auto;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Username: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Username:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="@_hostUsername" readonly />
|
||||
|
@ -89,7 +90,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Password: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Password:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@_hostPassword" />
|
||||
|
@ -97,7 +98,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Confirm: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Confirm:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@_confirmPassword" />
|
||||
|
@ -105,7 +106,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label class="control-label" style="font-weight: bold">Email: </label>
|
||||
<label class="control-label" style="font-weight: bold">@Localizer["Email:"] </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" class="form-control" @bind="@_hostEmail" />
|
||||
|
@ -118,7 +119,7 @@
|
|||
<hr class="app-rule" />
|
||||
<div class="row">
|
||||
<div class="mx-auto text-center">
|
||||
<button type="button" class="btn btn-success" @onclick="Install">Install Now</button><br /><br />
|
||||
<button type="button" class="btn btn-success" @onclick="Install">@Localizer["Install Now"]</button><br /><br />
|
||||
<ModuleMessage Message="@_message" Type="MessageType.Error"></ModuleMessage>
|
||||
</div>
|
||||
<div class="app-progress-indicator" style="@_loadingDisplay"></div>
|
||||
|
@ -207,7 +208,7 @@
|
|||
}
|
||||
else
|
||||
{
|
||||
_message = "Please Enter All Fields And Ensure Passwords Match And Are Greater Than 5 Characters In Length";
|
||||
_message = Localizer["Please Enter All Fields And Ensure Passwords Match And Are Greater Than 5 Characters In Length"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.JSInterop;
|
||||
using Oqtane.Models;
|
||||
using Microsoft.JSInterop;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Oqtane.UI
|
||||
|
@ -233,6 +232,5 @@ namespace Oqtane.UI
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user