- Level:
+ @Localizer["Level:"]
LevelChanged(e))">
- <All Levels>
- Trace
- Debug
- Information
- Warning
- Error
- Critical
+ <@Localizer["All Levels"]>
+ @Localizer["Trace"]
+ @Localizer["Debug"]
+ @Localizer["Information"]
+ @Localizer["Warning"]
+ @Localizer["Error"]
+ @Localizer["Critical"]
- Function:
+ @Localizer["Function:"]
FunctionChanged(e))">
- <All Functions>
- Create
- Read
- Update
- Delete
- Security
- Other
+ <@Localizer["All Functions"]>
+ @Localizer["Create"]
+ @Localizer["Read"]
+ @Localizer["Update"]
+ @Localizer["Delete"]
+ @Localizer["Security"]
+ @Localizer["Other"]
- Rows:
+ @Localizer["Rows:"]
RowsChanged(e))">
10
50
@@ -50,13 +51,13 @@ else
- Date
- Level
- Feature
- Function
+ @Localizer["Date"]
+ @Localizer["Level"]
+ @Localizer["Feature"]
+ @Localizer["Function"]
-
+
@context.LogDate
@context.Level
@context.Feature
@@ -66,7 +67,7 @@ else
}
else
{
- No Logs Match The Criteria Specified
+ @Localizer["No Logs Match The Criteria Specified"]
}
}
@@ -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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
index cafecf3b..66794ad5 100644
--- a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
@@ -4,11 +4,17 @@
@inject IModuleDefinitionService ModuleDefinitionService
@inject IModuleService ModuleService
@inject ISystemService SystemService
+@inject ISettingService SettingService
+@inject IStringLocalizer Localizer
+@using System.Text.RegularExpressions
+@using System.IO;
+@if (string.IsNullOrEmpty(_moduledefinitionname))
+{
- Owner Name:
+ Owner Name:
@@ -16,7 +22,7 @@
- Module Name:
+ Module Name:
@@ -24,7 +30,7 @@
- Description:
+ Description:
@@ -32,19 +38,19 @@
- Template:
+ Template:
TemplateChanged(e))">
- <Select Template>
- Internal
- External
+ <@Localizer["Select Template"]>
+ @Localizer["Internal"]
+ @Localizer["External"]
- Framework Reference:
+ Framework Reference:
@@ -55,7 +61,7 @@
@(version)
}
}
- Local Version
+ @Localizer["Local Version"]
@@ -63,7 +69,7 @@
{
- Location:
+ Location:
@@ -71,10 +77,15 @@
}
-
-Create Module
+ @Localizer["Create Module"]
+}
+else
+{
+ @Localizer["Activate Module"]
+}
@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 Restart 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 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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
index 526f1af4..92f26844 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
@@ -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 Localizer
@if (_packages != null)
{
@if (_packages.Count > 0)
{
-
+
- Name
- Version
+ @Localizer["Name"]
+ @Localizer["Version"]
@context.Name
@context.Version
- await DownloadModule(context.PackageId, context.Version))>Download
+ await DownloadModule(context.PackageId, context.Version))>@Localizer["Download"]
}
-
+
- Module:
+ Module:
@@ -42,8 +43,8 @@
- Install
- Cancel
+ @Localizer["Install"]
+ @Localizer["Cancel"]
}
@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 Restart 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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
index 51ed8992..70310bd4 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
@@ -1,14 +1,15 @@
-@namespace Oqtane.Modules.Admin.ModuleDefinitions
+@namespace Oqtane.Modules.Admin.ModuleDefinitions
@inherits ModuleBase
@inject IModuleDefinitionService ModuleDefinitionService
@inject NavigationManager NavigationManager
+@inject IStringLocalizer Localizer
-
+
-
+
- Internal Name:
+ Internal Name:
@@ -43,7 +44,7 @@
- Version:
+ Version:
@@ -51,7 +52,7 @@
- Owner:
+ Owner:
@@ -59,7 +60,7 @@
- Reference Url:
+ Reference Url:
@@ -67,7 +68,7 @@
- Contact:
+ Contact:
@@ -75,7 +76,7 @@
- License:
+ License:
@@ -83,7 +84,7 @@
- Runtimes:
+ Runtimes:
@@ -92,7 +93,7 @@
-
+
-Save
-Cancel
-
+@Localizer["Save"]
+@Localizer["Cancel"]
+
+
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
index fabf6973..538bf700 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
@@ -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 Localizer
@if (_moduleDefinitions == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
-
+
- Name
- Version
+ @Localizer["Name"]
+ @Localizer["Version"]
-
+
@if (context.AssemblyName != "Oqtane.Client")
- {
-
- }
+ {
+
+ }
@context.Name
@context.Version
@if (UpgradeAvailable(context.ModuleDefinitionName, context.Version))
- {
- await DownloadModule(context.ModuleDefinitionName, context.Version))>Upgrade
- }
+ {
+ await DownloadModule(context.ModuleDefinitionName, context.Version))>@Localizer["Upgrade"]
+ }
@@ -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 Restart 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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Modules/Export.razor b/Oqtane.Client/Modules/Admin/Modules/Export.razor
index eaa0bc92..fd1aa71c 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Export.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Export.razor
@@ -1,13 +1,14 @@
-@namespace Oqtane.Modules.Admin.Modules
+@namespace Oqtane.Modules.Admin.Modules
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IModuleService ModuleService
+@inject IStringLocalizer Localizer
- Content:
+ Content:
@@ -15,15 +16,15 @@
-Export
-Cancel
+@Localizer["Export"]
+@Localizer["Cancel"]
@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()
diff --git a/Oqtane.Client/Modules/Admin/Modules/Import.razor b/Oqtane.Client/Modules/Admin/Modules/Import.razor
index 1d99bcb9..423361f6 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Import.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Import.razor
@@ -1,13 +1,14 @@
-@namespace Oqtane.Modules.Admin.Modules
+@namespace Oqtane.Modules.Admin.Modules
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IModuleService ModuleService
+@inject IStringLocalizer Localizer
- Content:
+ Content:
@@ -15,15 +16,15 @@
-Import
-Cancel
+@Localizer["Import"]
+@Localizer["Cancel"]
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Modules/Settings.razor b/Oqtane.Client/Modules/Admin/Modules/Settings.razor
index 31cedb01..c6ebe5c3 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Settings.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Settings.razor
@@ -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 Localizer
-
+
@if (_containers != null)
{
}
-
+
@if (_permissions != null)
{
@@ -76,13 +78,13 @@
@if (_settingsModuleType != null)
{
-
+
@DynamicComponent
}
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
@code {
private List _containers = new List();
@@ -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());
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor
index f666441b..171ab885 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor
@@ -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 Localizer
-
+
@if (_themeList != null)
{
-
+
- Title:
+ Title:
@@ -97,11 +98,11 @@
- Theme:
+ Theme:
ThemeChanged(e))">
- <Inherit From Site>
+ <@Localizer["Inherit From Site"]>
@foreach (var theme in _themes)
{
if (theme.TypeName == _themetype)
@@ -120,11 +121,11 @@
{
- Layout:
+ Layout:
- <Inherit From Site>
+ <@Localizer["Inherit From Site"]>
@foreach (var layout in _layouts)
{
if (layout.TypeName == _layouttype)
@@ -142,11 +143,11 @@
}
- Default Container:
+ Default Container:
- <Inherit From Site>
+ <@Localizer["Inherit From Site"]>
@foreach (var container in _containers)
{
@container.Name
@@ -156,7 +157,7 @@
- Icon:
+ Icon:
@@ -164,12 +165,12 @@
- Personalizable?
+ Personalizable?
- Yes
- No
+ @Localizer["Yes"]
+ @Localizer["No"]
@@ -177,7 +178,7 @@
}
-
+
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
@code {
private List _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());
}
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
index ee191dd8..5efdd992 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
@@ -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 Localizer
-
+
@if (_themeList != null)
{
-
+
- Title:
+ Title:
@@ -108,7 +109,7 @@
- Theme:
+ Theme:
ThemeChanged(e))">
@@ -131,11 +132,11 @@
{
- Layout:
+ Layout:
- <Inherit From Site>
+ <@Localizer["Inherit From Site"]>
@foreach (var layout in _layouts)
{
if (layout.TypeName == _layouttype)
@@ -153,11 +154,11 @@
}
- Default Container:
+ Default Container:
- <Inherit From Site>
+ <@Localizer["Inherit From Site"]>
@foreach (var container in _containers)
{
@container.Name
@@ -167,7 +168,7 @@
- Icon:
+ Icon:
@@ -175,12 +176,12 @@
- Personalizable?
+ Personalizable?
- Yes
- No
+ @Localizer["Yes"]
+ @Localizer["No"]
@@ -190,7 +191,7 @@
}
-
+
@if (_permissions != null)
{
@@ -203,8 +204,8 @@
}
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
@code {
private List _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());
}
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Index.razor b/Oqtane.Client/Modules/Admin/Pages/Index.razor
index 02d1d14c..4ff925fc 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Index.razor
@@ -1,21 +1,22 @@
-@namespace Oqtane.Modules.Admin.Pages
+@namespace Oqtane.Modules.Admin.Pages
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IPageService PageService
+@inject IStringLocalizer Localizer
@if (PageState.Pages != null)
{
-
+
- Name
+ @Localizer["Name"]
-
-
+
+
@(new string('-', context.Level * 2))@(context.Name)
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Profiles/Edit.razor b/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
index 44843e8e..86a71c8c 100644
--- a/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
@@ -2,97 +2,98 @@
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IProfileService ProfileService
+@inject IStringLocalizer Localizer
-
-Save
-Cancel
+
+@Localizer["Save"]
+@Localizer["Cancel"]
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Profiles/Index.razor b/Oqtane.Client/Modules/Admin/Profiles/Index.razor
index 36df1731..0bdf8554 100644
--- a/Oqtane.Client/Modules/Admin/Profiles/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Profiles/Index.razor
@@ -1,24 +1,25 @@
-@namespace Oqtane.Modules.Admin.Profiles
+@namespace Oqtane.Modules.Admin.Profiles
@inherits ModuleBase
@inject IProfileService ProfileService
+@inject IStringLocalizer Localizer
@if (_profiles == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
-
+
- Name
+ @Localizer["Name"]
-
-
+
+
@context.Name
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor b/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
index 220f5ffe..2d81476a 100644
--- a/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
+++ b/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
@@ -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 Localizer
-
+
@if (_pages == null)
{
- No Deleted Pages
+ @Localizer["No Deleted Pages"]
}
else
{
@@ -18,13 +19,13 @@
- Name
- Deleted By
- Deleted On
+ @Localizer["Name"]
+ @Localizer["Deleted By"]
+ @Localizer["Deleted On"]
RestorePage(context))" class="btn btn-info" title="Restore">Restore
-
+
@context.Name
@context.DeletedBy
@context.DeletedOn
@@ -32,11 +33,11 @@
}
-
+
@if (_modules == null)
{
- No Deleted Modules
+ @Localizer["No Deleted Modules"]
}
else
{
@@ -44,14 +45,14 @@
- Page
- Module
- Deleted By
- Deleted On
+ @Localizer["Page"]
+ @Localizer["Module"]
+ @Localizer["Deleted By"]
+ @Localizer["Deleted On"]
- RestoreModule(context))" class="btn btn-info" title="Restore">Restore
-
+ RestoreModule(context))" class="btn btn-info" title="Restore">@Localizer["Restore"]
+
@PageState.Pages.Find(item => item.PageId == context.PageId).Name
@context.Title
@context.DeletedBy
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Register/Index.razor b/Oqtane.Client/Modules/Admin/Register/Index.razor
index 2ea64944..a9789507 100644
--- a/Oqtane.Client/Modules/Admin/Register/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Register/Index.razor
@@ -1,7 +1,8 @@
-@namespace Oqtane.Modules.Admin.Register
+@namespace Oqtane.Modules.Admin.Register
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
+@inject IStringLocalizer Localizer
@if (PageState.Site.AllowRegistration)
{
@@ -10,41 +11,41 @@
...
-
+
-
+
}
else
{
-
+
}
@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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Reset/Index.razor b/Oqtane.Client/Modules/Admin/Reset/Index.razor
index b6e4eb66..4ee8ed15 100644
--- a/Oqtane.Client/Modules/Admin/Reset/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Reset/Index.razor
@@ -1,23 +1,24 @@
-@namespace Oqtane.Modules.Admin.Reset
+@namespace Oqtane.Modules.Admin.Reset
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IUserService UserService
+@inject IStringLocalizer Localizer
@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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Add.razor b/Oqtane.Client/Modules/Admin/Roles/Add.razor
index 34e93e2d..c5bc2a38 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Add.razor
@@ -1,12 +1,13 @@
-@namespace Oqtane.Modules.Admin.Roles
+@namespace Oqtane.Modules.Admin.Roles
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IRoleService RoleService
+@inject IStringLocalizer Localizer
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
-@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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Edit.razor b/Oqtane.Client/Modules/Admin/Roles/Edit.razor
index 4b0dd0e0..bac812c9 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Edit.razor
@@ -1,12 +1,13 @@
-@namespace Oqtane.Modules.Admin.Roles
+@namespace Oqtane.Modules.Admin.Roles
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IRoleService RoleService
+@inject IStringLocalizer Localizer
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Index.razor b/Oqtane.Client/Modules/Admin/Roles/Index.razor
index a41998d4..3afa6c88 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Index.razor
@@ -1,26 +1,27 @@
-@namespace Oqtane.Modules.Admin.Roles
+@namespace Oqtane.Modules.Admin.Roles
@inherits ModuleBase
@inject IRoleService RoleService
+@inject IStringLocalizer Localizer
@if (_roles == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
-
+
- Name
+ @Localizer["Name"]
-
-
-
+
+
+
@context.Name
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Users.razor b/Oqtane.Client/Modules/Admin/Roles/Users.razor
index a583aedc..b9dcd431 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Users.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Users.razor
@@ -1,18 +1,19 @@
-@namespace Oqtane.Modules.Admin.Roles
+@namespace Oqtane.Modules.Admin.Roles
@inherits ModuleBase
@inject IRoleService RoleService
@inject IUserRoleService UserRoleService
+@inject IStringLocalizer Localizer
@if (userroles == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
- Users
+ @Localizer["Users"]
@context.User.DisplayName
- await DeleteUserRole(context.UserRoleId))>Delete
+ await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]
@@ -74,8 +75,8 @@ else
private string name = string.Empty;
private List 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 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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor
index 6b5e98ee..bbfd28f7 100644
--- a/Oqtane.Client/Modules/Admin/Site/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Site/Index.razor
@@ -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 Localizer
@if (_initialized)
{
-
-
+
-
+
- Is Enabled?
+ Is Enabled?
- Yes
- No
+ @Localizer["Yes"]
+ @Localizer["No"]
- App Icon:
+ App Icon:
@@ -193,7 +225,7 @@
- Splash Icon:
+ Splash Icon:
@@ -203,8 +235,7 @@
- Save
- Cancel
+ @Localizer["Save"]
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Sites/Add.razor b/Oqtane.Client/Modules/Admin/Sites/Add.razor
index 7ee36435..a4b430e9 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Add.razor
@@ -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 Localizer
@if (_tenants == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
- Site Name:
+ Site Name:
@@ -26,7 +27,7 @@ else
- Aliases:
+ Aliases:
@@ -34,11 +35,11 @@ else
- Default Theme:
+ Default Theme:
ThemeChanged(e))">
- <Select Theme>
+ <@Localizer["Select Theme"]>
@foreach (var theme in _themes)
{
@theme.Name
@@ -50,11 +51,11 @@ else
{
- Default Layout:
+ Default Layout:
- <Select Layout>
+ <@Localizer["Select Layout"]>
@foreach (var layout in _layouts)
{
@(layout.Name)
@@ -65,11 +66,11 @@ else
}
- Default Container:
+ Default Container:
- <Select Container>
+ <@Localizer["Select Container"]>
@foreach (var container in _containers)
{
@container.Name
@@ -79,11 +80,26 @@ else
- Site Template:
+ Admin Container:
+
+
+
+ <@Localizer["Select Container"]>
+ <@Localizer["Default Admin Container"]>
+ @foreach (var container in _containers)
+ {
+ @container.Name
+ }
+
+
+
+
+
+ Site Template:
- <Select Site Template>
+ <@Localizer["Select Site Template"]>
@foreach (SiteTemplate siteTemplate in _siteTemplates)
{
@siteTemplate.Name
@@ -93,12 +109,12 @@ else
- Tenant:
+ Tenant:
TenantChanged(e))">
- <Select Tenant>
- <Create New Tenant>
+ <@Localizer["Select Tenant"]>
+ <@Localizer["Create New Tenant"]>
@foreach (Tenant tenant in _tenants)
{
@tenant.Name
@@ -115,7 +131,7 @@ else
- Tenant Name:
+ Tenant Name:
@@ -123,18 +139,18 @@ else
- Database Type:
+ Database Type:
- Local Database
- SQL Server
+ @Localizer["Local Database"]
+ @Localizer["SQL Server"]
- Server:
+ Server:
@@ -142,7 +158,7 @@ else
- Database:
+ Database:
@@ -150,12 +166,12 @@ else
- Integrated Security:
+ Integrated Security:
- True
- False
+ @Localizer["True"]
+ @Localizer["False"]
@@ -163,7 +179,7 @@ else
{
- Database Username:
+ Database Username:
@@ -171,7 +187,7 @@ else
- Database Password:
+ Database Password:
@@ -180,7 +196,7 @@ else
}
- Host Username:
+ Host Username:
@@ -188,7 +204,7 @@ else
- Host Password:
+ Host Password:
@@ -196,8 +212,8 @@ else
}
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
}
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Sites/Edit.razor b/Oqtane.Client/Modules/Admin/Sites/Edit.razor
index 43599e98..b1afc85c 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Edit.razor
@@ -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 Localizer
@if (_initialized)
{
- Name:
+ Name:
@@ -19,15 +20,7 @@
- Tenant:
-
-
-
-
-
-
-
- Aliases:
+ Aliases:
@@ -35,11 +28,11 @@
- Default Theme:
+ Default Theme:
ThemeChanged(e))">
- <Select Theme>
+ <@Localizer["Select Theme"]>
@foreach (var theme in _themes)
{
if (theme.TypeName == _themetype)
@@ -58,11 +51,11 @@
{
- Default Layout:
+ Default Layout:
- <Select Layout>
+ <@Localizer["Select Layout"]>
@foreach (var layout in _layouts)
{
@(layout.Name)
@@ -73,11 +66,11 @@
}
- Default Container:
+ Default Container:
- <Select Container>
+ <@Localizer["Select Container"]>
@foreach (var container in _containers)
{
@container.Name
@@ -87,19 +80,51 @@
- Is Deleted?
+ Default Admin Container:
+
+
+
+ <@Localizer["Select Container"]>
+ <@Localizer["Default Admin Container"]>
+ @foreach (var container in _containers)
+ {
+ @container.Name
+ }
+
+
+
+
+
+ Is Deleted?
- Yes
- No
+ @Localizer["Yes"]
+ @Localizer["No"]
+
+
+ Tenant:
+
+
+
+
+
+
+
+
+ Connection String:
+
+
+
+
+
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
@@ -113,13 +138,12 @@
private List _containers = new List();
private Alias _alias;
private string _name = string.Empty;
- private List _tenantList;
- private string _tenant = string.Empty;
private List _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 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);
}
}
- }
+}
diff --git a/Oqtane.Client/Modules/Admin/Sites/Index.razor b/Oqtane.Client/Modules/Admin/Sites/Index.razor
index 8d82492d..3a571cd3 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Index.razor
@@ -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 Localizer
@if (_sites == null)
{
@@ -10,17 +11,17 @@
}
else
{
-
+
- Name
+ @Localizer["Name"]
-
-
+
+
@context.Name
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Sql/Index.razor b/Oqtane.Client/Modules/Admin/Sql/Index.razor
index e27350f8..5edd39ab 100644
--- a/Oqtane.Client/Modules/Admin/Sql/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Sql/Index.razor
@@ -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 Localizer
@if (_tenants == null)
{
@@ -13,11 +14,11 @@ else
- Tenant:
+ Tenant:
- <Select Tenant>
+ <@Localizer["Select Tenant"]>
@foreach (Tenant tenant in _tenants)
{
@tenant.Name
@@ -27,15 +28,16 @@ else
- SQL Query:
+ SQL Query:
- Execute
-
+ @Localizer["Execute"]
+
+
@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 = "";
table += "
";
-
+
foreach (KeyValuePair kvp in item)
{
table += "" + kvp.Key + " ";
}
-
+
table += " ";
}
-
+
table += "";
-
+
foreach (KeyValuePair kvp in item)
{
table += "" + kvp.Value + " ";
}
-
+
table += " ";
}
-
+
if (table != string.Empty)
{
table += "
";
}
else
{
- table = "No Results Returned";
+ table = Localizer["No Results Returned"];
}
-
+
return table;
}
}
diff --git a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
index ca7c7f2c..e7e69635 100644
--- a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
+++ b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
@@ -1,11 +1,13 @@
-@namespace Oqtane.Modules.Admin.SystemInfo
+@namespace Oqtane.Modules.Admin.SystemInfo
@inherits ModuleBase
@inject ISystemService SystemService
+@inject IInstallationService InstallationService
+@inject IStringLocalizer Localizer
- Framework Version:
+ Framework Version:
@@ -13,7 +15,7 @@
- Blazor Runtime:
+ Blazor Runtime:
@@ -21,7 +23,7 @@
- CLR Version:
+ CLR Version:
@@ -29,7 +31,7 @@
- OS Version:
+ OS Version:
@@ -37,7 +39,7 @@
- Server Path:
+ Server Path:
@@ -45,14 +47,15 @@
- Server Time:
+ Server Time:
-Access Framework API
+@Localizer["Access Framework API"]
+
@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");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Oqtane.Client/Modules/Admin/Tenants/Edit.razor b/Oqtane.Client/Modules/Admin/Tenants/Edit.razor
deleted file mode 100644
index 245ce1cb..00000000
--- a/Oqtane.Client/Modules/Admin/Tenants/Edit.razor
+++ /dev/null
@@ -1,85 +0,0 @@
-@namespace Oqtane.Modules.Admin.Tenants
-@inherits ModuleBase
-@inject NavigationManager NavigationManager
-@inject ITenantService TenantService
-
-
-Save
-Cancel
-
-@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);
- }
- }
-}
diff --git a/Oqtane.Client/Modules/Admin/Tenants/Index.razor b/Oqtane.Client/Modules/Admin/Tenants/Index.razor
deleted file mode 100644
index 5858a059..00000000
--- a/Oqtane.Client/Modules/Admin/Tenants/Index.razor
+++ /dev/null
@@ -1,67 +0,0 @@
-@namespace Oqtane.Modules.Admin.Tenants
-@inherits ModuleBase
-@inject ITenantService TenantService
-@inject IAliasService AliasService
-
-@if (tenants == null)
-{
- Loading...
-}
-else
-{
-
-
-
-
-
- @context.Name
-
-
-
-}
-
-@code {
- private List 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);
- }
- }
-}
\ No newline at end of file
diff --git a/Oqtane.Client/Modules/Admin/Themes/Add.razor b/Oqtane.Client/Modules/Admin/Themes/Add.razor
index eda40597..ab042ed5 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Add.razor
@@ -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 Localizer
@if (_packages != null)
{
@if (_packages.Count > 0)
{
-
+
- Name
- Version
+ @Localizer["Name"]
+ @Localizer["Version"]
@context.Name
@context.Version
- await DownloadTheme(context.PackageId, context.Version))>Download
+ await DownloadTheme(context.PackageId, context.Version))>@Localizer["Download"]
}
-
+
- Theme:
+ Theme:
@@ -42,8 +43,8 @@
- Install
- Cancel
+ @Localizer["Install"]
+ @Localizer["Cancel"]
}
@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 Restart 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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Themes/Index.razor b/Oqtane.Client/Modules/Admin/Themes/Index.razor
index 29ed1b00..9e8677f7 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Index.razor
@@ -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 Localizer
@if (_themes == null)
{
@@ -17,25 +18,25 @@ else
- Name
- Version
+ @Localizer["Name"]
+ @Localizer["Version"]
-
+
@if (context.AssemblyName != "Oqtane.Client")
- {
-
- }
+ {
+
+ }
@context.Name
@context.Version
@if (UpgradeAvailable(context.ThemeName, context.Version))
- {
- await DownloadTheme(context.ThemeName, context.Version))>Upgrade
- }
+ {
+ await DownloadTheme(context.ThemeName, context.Version))>@Localizer["Upgrade"]
+ }
@@ -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 Restart 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);
}
}
}
\ No newline at end of file
diff --git a/Oqtane.Client/Modules/Admin/Themes/View.razor b/Oqtane.Client/Modules/Admin/Themes/View.razor
index eb655799..2510759d 100644
--- a/Oqtane.Client/Modules/Admin/Themes/View.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/View.razor
@@ -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 Localizer
- Name:
+ Name:
@@ -15,7 +16,7 @@
- Internal Name:
+ Internal Name:
@@ -23,7 +24,7 @@
- Version:
+ Version:
@@ -31,7 +32,7 @@
- Owner:
+ Owner:
@@ -39,7 +40,7 @@
- Reference Url:
+ Reference Url:
@@ -47,7 +48,7 @@
- Contact:
+ Contact:
@@ -55,14 +56,14 @@
- License:
+ License:
-Cancel
+@Localizer["Cancel"]
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Upgrade/Index.razor b/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
index 06611217..c0475d59 100644
--- a/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
@@ -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 Localizer
@if (_package != null)
{
-
+
@if (_upgradeavailable)
{
- await Download(Constants.PackageId, @_package.Version))>Upgrade To @_package.Version
+ await Download(Constants.PackageId, @_package.Version))>@Localizer["Upgrade To"] @_package.Version
}
else
{
}
-
+
- Framework:
+ Framework:
- Install
+ @Localizer["Install"]
}
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Add.razor b/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
index b19bae1d..dcc96ff4 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
@@ -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 Localizer
@if (PageState.User != null)
{
- Send
- Cancel
+ @Localizer["Send"]
+ @Localizer["Cancel"]
}
@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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
index d108507e..4b2874b6 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
@@ -5,6 +5,7 @@
@inject IProfileService ProfileService
@inject ISettingService SettingService
@inject INotificationService NotificationService
+@inject IStringLocalizer Localizer
@if (PageState.User != null && photofileid != -1)
{
@@ -15,13 +16,13 @@ else
}
-
+
@if (PageState.User != null)
{
- Username:
+ @Localizer["Username:"]
@@ -29,7 +30,7 @@ else
- Password:
+ @Localizer["Password:"]
@@ -37,7 +38,7 @@ else
- Confirm Password:
+ @Localizer["Confirm Password:"]
@@ -45,7 +46,7 @@ else
- Email:
+ @Localizer["Email:"]
@@ -53,7 +54,7 @@ else
- Full Name:
+ @Localizer["Full Name:"]
@@ -61,18 +62,18 @@ else
- Photo:
+ @Localizer["Photo:"]
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
}
-
+
@if (profiles != null && settings != null)
{
@@ -127,14 +128,14 @@ else
}
}
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
}
-
+
@if (notifications != null)
{
-
+
@if (filter == "to")
{
@@ -142,13 +143,13 @@ else
- From
- Subject
- Received
+ @Localizer["From"]
+ @Localizer["Subject"]
+ @Localizer["Received"]
-
-
+
+
@context.FromDisplayName
@context.Subject
@context.CreatedOn
@@ -174,13 +175,13 @@ else
- To
- Subject
- Sent
+ @Localizer["To"]
+ @Localizer["Subject"]
+ @Localizer["Sent"]
-
-
+
+
@context.ToDisplayName
@context.Subject
@context.CreatedOn
@@ -202,8 +203,8 @@ else
}
FilterChanged(e))">
- Inbox
- Sent Items
+ @Localizer["Inbox"]
+ @Localizer["Sent Items"]
}
@@ -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);
}
}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/View.razor b/Oqtane.Client/Modules/Admin/UserProfile/View.razor
index 5621001f..ff9f3937 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/View.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/View.razor
@@ -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 Localizer
@if (PageState.User != null)
{
- @title:
+ @Localizer["Title:"]
@if (title == "From")
{
@@ -26,7 +27,7 @@
- Subject:
+ @Localizer["Subject:"]
@if (title == "From")
{
@@ -45,7 +46,7 @@
{
- Date:
+ @Localizer["Date:"]
@@ -56,7 +57,7 @@
{
- Message:
+ @Localizer["Message:"]
@@ -67,7 +68,7 @@
{
- Message:
+ @Localizer["Message:"]
@@ -79,24 +80,26 @@
@if (reply != string.Empty)
{
- Send }
+ @Localizer["Send"]
+ }
else
{
if (title == "From")
{
- Reply }
+ @Localizer["Reply"]
+ }
}
- Cancel
+ @Localizer["Cancel"]
@if (title == "To")
{
- Original Message
+ @Localizer["Original Message"]
- }
}
+}
@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);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Users/Add.razor b/Oqtane.Client/Modules/Admin/Users/Add.razor
index 4b15ce82..89b1e775 100644
--- a/Oqtane.Client/Modules/Admin/Users/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Add.razor
@@ -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 Localizer
-
+
@if (profiles != null)
{
- Username:
+ @Localizer["Username:"]
@@ -20,7 +21,7 @@
- Password:
+ @Localizer["Password:"]
@@ -28,7 +29,7 @@
- Confirm Password:
+ @Localizer["Confirm Password:"]
@@ -36,7 +37,7 @@
- Email:
+ @Localizer["Email:"]
@@ -44,7 +45,7 @@
- Full Name:
+ @Localizer["Full Name:"]
@@ -53,45 +54,45 @@
}
-
+
@if (profiles != null)
{
-
- @foreach (Profile profile in profiles)
- {
- var p = profile;
- if (p.Category != category)
+
+
}
-Save
-Cancel
+@Localizer["Save"]
+@Localizer["Cancel"]
@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;
diff --git a/Oqtane.Client/Modules/Admin/Users/Edit.razor b/Oqtane.Client/Modules/Admin/Users/Edit.razor
index 87a6a387..be68ff7d 100644
--- a/Oqtane.Client/Modules/Admin/Users/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Edit.razor
@@ -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 Localizer
@if (PageState.User != null && photofileid != -1)
{
@@ -14,13 +15,13 @@ else
}
-
+
@if (profiles != null)
{
- Username:
+ @Localizer["Username:"]
@@ -28,7 +29,7 @@ else
- Password:
+ @Localizer["Password:"]
@@ -36,7 +37,7 @@ else
- Confirm Password:
+ @Localizer["Confirm Password:"]
@@ -44,7 +45,7 @@ else
- Email:
+ @Localizer["Email:"]
@@ -52,7 +53,7 @@ else
- Full Name:
+ @Localizer["Full Name:"]
@@ -60,7 +61,7 @@ else
- Photo:
+ @Localizer["Photo:"]
@@ -68,58 +69,59 @@ else
- Is Deleted?
+ @Localizer["Is Deleted?"]
- Yes
- No
+ @Localizer["Yes"]
+ @Localizer["No"]
}
-
+
@if (profiles != null)
{
-
- @foreach (Profile profile in profiles)
- {
- var p = profile;
- if (p.Category != category)
+
+
}
-Save
-Cancel
-
+@Localizer["Save"]
+@Localizer["Cancel"]
+
+
@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;
diff --git a/Oqtane.Client/Modules/Admin/Users/Index.razor b/Oqtane.Client/Modules/Admin/Users/Index.razor
index efcd89a2..8ac788ee 100644
--- a/Oqtane.Client/Modules/Admin/Users/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Index.razor
@@ -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 Localizer
@if (userroles == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
-
+
- Search
+ @Localizer["Search"]
@@ -23,17 +24,17 @@ else
- Name
+ @Localizer["Name"]
-
+
-
+
-
+
@context.User.DisplayName
diff --git a/Oqtane.Client/Modules/Admin/Users/Roles.razor b/Oqtane.Client/Modules/Admin/Users/Roles.razor
index 9a056a43..037daabb 100644
--- a/Oqtane.Client/Modules/Admin/Users/Roles.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Roles.razor
@@ -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 Localizer
@if (userroles == null)
{
- Loading...
+ @Localizer["Loading..."]
}
else
{
- Save
- Cancel
+ @Localizer["Save"]
+ @Localizer["Cancel"]
- Roles
+ @Localizer["Roles"]
@context.Role.Name
@if (context.Role.Name != RoleNames.Registered)
- {
- await DeleteUserRole(context.UserRoleId))>Delete
- }
+ {
+ await DeleteUserRole(context.UserRoleId))>@Localizer["Delete"]
+ }
@@ -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);
}
}
}
diff --git a/Oqtane.Client/Modules/Controls/ActionDialog.razor b/Oqtane.Client/Modules/Controls/ActionDialog.razor
index fa992e97..43d6e0af 100644
--- a/Oqtane.Client/Modules/Controls/ActionDialog.razor
+++ b/Oqtane.Client/Modules/Controls/ActionDialog.razor
@@ -94,14 +94,16 @@
if (!string.IsNullOrEmpty(IconName))
{
- _iconSpan = $" ";
+ if (!IconName.Contains(" "))
+ {
+ IconName = "oi oi-" + IconName;
+ }
+ _iconSpan = $" ";
}
- 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();
}
diff --git a/Oqtane.Client/Modules/Controls/ActionLink.razor b/Oqtane.Client/Modules/Controls/ActionLink.razor
index b375038d..cf2cd1df 100644
--- a/Oqtane.Client/Modules/Controls/ActionLink.razor
+++ b/Oqtane.Client/Modules/Controls/ActionLink.razor
@@ -91,15 +91,15 @@
if (!string.IsNullOrEmpty(IconName))
{
- _iconSpan = $" {(IconOnly ? "" : " ")}";
+ if (!IconName.Contains(" "))
+ {
+ IconName = "oi oi-" + IconName;
+ }
+ _iconSpan = $" {(IconOnly ? "" : " ")}";
}
- if (IsLocalizable)
- {
- _text = Localize(nameof(Text));
- }
-
+ _text = Localize(nameof(Text), _text);
_url = EditUrl(Action, _parameters);
_authorized = IsAuthorized();
}
diff --git a/Oqtane.Client/Modules/Controls/AuditInfo.razor b/Oqtane.Client/Modules/Controls/AuditInfo.razor
index 026a2986..aa2cf790 100644
--- a/Oqtane.Client/Modules/Controls/AuditInfo.razor
+++ b/Oqtane.Client/Modules/Controls/AuditInfo.razor
@@ -1,5 +1,6 @@
@namespace Oqtane.Modules.Controls
@inherits ModuleControlBase
+@inject IStringLocalizer Localizer
@if (_text != string.Empty)
{
@@ -39,16 +40,16 @@
_text = string.Empty;
if (!String.IsNullOrEmpty(CreatedBy) || CreatedOn.HasValue)
{
- _text += "Created ";
+ _text += $"
{Localizer["Created"]} ";
if (!String.IsNullOrEmpty(CreatedBy))
{
- _text += " by " + CreatedBy + " ";
+ _text += $" {Localizer["by"]} {CreatedBy} ";
}
if (CreatedOn != null)
{
- _text += " on " + CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + " ";
+ _text += $" {Localizer["on"]} {CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss")} ";
}
_text += "
";
@@ -56,16 +57,16 @@
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn.HasValue)
{
- _text += "Last modified ";
+ _text += $"
{Localizer["Last modified"]} ";
if (!String.IsNullOrEmpty(ModifiedBy))
{
- _text += " by " + ModifiedBy + " ";
+ _text += $" {Localizer["by"]} {ModifiedBy} ";
}
if (ModifiedOn != null)
{
- _text += " on " + ModifiedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + " ";
+ _text += $" {Localizer["on"]} {ModifiedOn.Value.ToString("MMM dd yyyy HH:mm:ss")} ";
}
_text += "
";
@@ -73,16 +74,16 @@
if (!String.IsNullOrEmpty(DeletedBy) || DeletedOn.HasValue)
{
- _text += "Deleted ";
+ _text += $"
{Localizer["Deleted"]} ";
if (!String.IsNullOrEmpty(DeletedBy))
{
- _text += " by " + DeletedBy + " ";
+ _text += $" {Localizer["by"]} {DeletedBy} ";
}
if (DeletedOn != null)
{
- _text += " on " + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + " ";
+ _text += $" {Localizer["on"]} {DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss")} ";
}
_text += "
";
diff --git a/Oqtane.Client/Modules/Controls/FileManager.razor b/Oqtane.Client/Modules/Controls/FileManager.razor
index 291b2acb..f4650202 100644
--- a/Oqtane.Client/Modules/Controls/FileManager.razor
+++ b/Oqtane.Client/Modules/Controls/FileManager.razor
@@ -1,7 +1,8 @@
-@namespace Oqtane.Modules.Controls
+@namespace Oqtane.Modules.Controls
@inherits ModuleControlBase
@inject IFolderService FolderService
@inject IFileService FileService
+@inject IStringLocalizer Localizer
@if (_folders != null)
{
@@ -14,7 +15,7 @@
FolderChanged(e))">
@if (string.IsNullOrEmpty(Folder))
{
- <Select Folder>
+ <@Localizer["Select Folder"]>
}
@foreach (Folder folder in _folders)
{
@@ -34,7 +35,7 @@
{
FileChanged(e))">
- <Select File>
+ <@Localizer["Select File"]>
@foreach (File file in _files)
{
if (file.FileId == FileId)
@@ -62,10 +63,10 @@
}
- Upload
+ @Localizer["Upload"]
@if (ShowFiles && GetFileId() != -1)
{
- Delete
+ @Localizer["Delete"]
}
@@ -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;
}
}
diff --git a/Oqtane.Client/Modules/Controls/Label.razor b/Oqtane.Client/Modules/Controls/Label.razor
index 3869d8b4..b67143cb 100644
--- a/Oqtane.Client/Modules/Controls/Label.razor
+++ b/Oqtane.Client/Modules/Controls/Label.razor
@@ -43,10 +43,12 @@ else
_openLabel += ">";
- if (IsLocalizable)
+ var text = Localize("Text", String.Empty);
+ if (text != String.Empty)
{
- ChildContent =@@Localize("Text") ;
- HelpText = Localize(nameof(HelpText));
+ ChildContent =@@text ;
}
+
+ HelpText = Localize(nameof(HelpText), HelpText);
}
}
diff --git a/Oqtane.Client/Modules/Controls/LocalizableComponent.cs b/Oqtane.Client/Modules/Controls/LocalizableComponent.cs
index 80222e66..773df857 100644
--- a/Oqtane.Client/Modules/Controls/LocalizableComponent.cs
+++ b/Oqtane.Client/Modules/Controls/LocalizableComponent.cs
@@ -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();
- _localizer = localizerFactory.Create(moduleType);
- }
+ var localizerFactory = scope.ServiceProvider.GetService();
+ _localizer = localizerFactory.Create(moduleType);
+
+ IsLocalizable = true;
}
}
-
- IsLocalizable = true;
- }
- else
- {
- IsLocalizable = false;
}
}
}
diff --git a/Oqtane.Client/Modules/Controls/ModuleMessage.razor b/Oqtane.Client/Modules/Controls/ModuleMessage.razor
index ee846b13..04a1056e 100644
--- a/Oqtane.Client/Modules/Controls/ModuleMessage.razor
+++ b/Oqtane.Client/Modules/Controls/ModuleMessage.razor
@@ -5,7 +5,7 @@
@if (!string.IsNullOrEmpty(_message))
{
- @_message
+ @((MarkupString)_message)
@if (Type == MessageType.Error && PageState != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
@((MarkupString)" ")
View Details
diff --git a/Oqtane.Client/Modules/Controls/Pager.razor b/Oqtane.Client/Modules/Controls/Pager.razor
index 5f3ae713..64f32728 100644
--- a/Oqtane.Client/Modules/Controls/Pager.razor
+++ b/Oqtane.Client/Modules/Controls/Pager.razor
@@ -3,6 +3,43 @@
@typeparam TableItem
+ @if (Toolbar == "Top")
+ {
+
+ @if (_endPage > 1)
+ {
+ UpdateList(1))>
+ }
+ @if (_page > _maxPages)
+ {
+ SetPagerSize("back"))>
+ }
+ @if (_endPage > 1)
+ {
+ NavigateToPage("previous"))>
+ @for (int i = _startPage; i <= _endPage; i++)
+ {
+ var pager = i;
+
+ }
+ NavigateToPage("next"))>
+ }
+ @if (_endPage < _pages)
+ {
+ SetPagerSize("forward"))>
+ }
+ @if (_endPage > 1)
+ {
+ UpdateList(_pages))>
+ }
+ @if (_endPage > 1)
+ {
+ Page @_page of @_pages
+ }
+
+ }
@if (Format == "Table")
{
@@ -35,32 +72,43 @@
}
}
-
- @if (_page > _maxPages)
- {
-
SetPagerSize("back"))>
- }
- @if (_endPage > 1)
- {
-
NavigateToPage("previous"))>
- @for (int i = _startPage; i <= _endPage; i++)
+ @if (Toolbar == "Bottom")
+ {
+
+ @if (_endPage > 1)
{
- var pager = i;
-
+ UpdateList(1))>
}
- NavigateToPage("next"))>
- }
- @if (_endPage < _pages)
- {
- SetPagerSize("forward"))>
- }
- @if (_endPage > 1)
- {
- Page @_page of @_pages
- }
-
+ @if (_page > _maxPages)
+ {
+
SetPagerSize("back"))>
+ }
+ @if (_endPage > 1)
+ {
+
NavigateToPage("previous"))>
+ @for (int i = _startPage; i <= _endPage; i++)
+ {
+ var pager = i;
+
+ }
+
NavigateToPage("next"))>
+ }
+ @if (_endPage < _pages)
+ {
+
SetPagerSize("forward"))>
+ }
+ @if (_endPage > 1)
+ {
+
UpdateList(_pages))>
+ }
+ @if (_endPage > 1)
+ {
+
Page @_page of @_pages
+ }
+
+ }
@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")
diff --git a/Oqtane.Client/Modules/Controls/PermissionGrid.razor b/Oqtane.Client/Modules/Controls/PermissionGrid.razor
index 204aa21f..a35a5209 100644
--- a/Oqtane.Client/Modules/Controls/PermissionGrid.razor
+++ b/Oqtane.Client/Modules/Controls/PermissionGrid.razor
@@ -1,7 +1,8 @@
-@namespace Oqtane.Modules.Controls
+@namespace Oqtane.Modules.Controls
@inherits ModuleControlBase
@inject IRoleService RoleService
@inject IUserService UserService
+@inject IStringLocalizer Localizer
@if (_permissions != null)
{
@@ -9,10 +10,10 @@
- Role
+ @Localizer["Role"]
@foreach (PermissionString permission in _permissions)
{
- @permission.PermissionName
+ @Localizer[permission.PermissionName]
}
@foreach (Role role in _roles)
@@ -35,10 +36,10 @@
- User
+ @Localizer["User"]
@foreach (PermissionString permission in _permissions)
{
- @permission.PermissionName
+ @Localizer[permission.PermissionName]
}
@@ -64,8 +65,8 @@
-
- Add
+
+ @Localizer["Add"]
@@ -179,7 +180,7 @@
}
catch
{
- _message = "Username Does Not Exist";
+ _message = Localizer["Username Does Not Exist"];
}
}
diff --git a/Oqtane.Client/Modules/Controls/RichTextEditor.razor b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
index 3d7d2327..3a33cc33 100644
--- a/Oqtane.Client/Modules/Controls/RichTextEditor.razor
+++ b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
@@ -1,5 +1,6 @@
-@namespace Oqtane.Modules.Controls
+@namespace Oqtane.Modules.Controls
@inherits ModuleControlBase
+@inject IStringLocalizer Localizer
@@ -12,12 +13,12 @@
}
- Synchronize Content
- Insert Image
+ @Localizer["Synchronize Content"]
+ @Localizer["Insert Image"]
@if (_filemanagervisible)
{
@((MarkupString)" ")
- Close
+ @Localizer["Close"]
}
@@ -61,9 +62,9 @@
-
+
- Synchronize Content
+ @Localizer["Synchronize Content"]
@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
diff --git a/Oqtane.Client/Modules/Controls/Section.razor b/Oqtane.Client/Modules/Controls/Section.razor
index 573a536b..7f253cc2 100644
--- a/Oqtane.Client/Modules/Controls/Section.razor
+++ b/Oqtane.Client/Modules/Controls/Section.razor
@@ -16,13 +16,14 @@
-
+
@ChildContent
@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);
}
}
diff --git a/Oqtane.Client/Modules/Controls/TabPanel.razor b/Oqtane.Client/Modules/Controls/TabPanel.razor
index 9472bab3..e618c896 100644
--- a/Oqtane.Client/Modules/Controls/TabPanel.razor
+++ b/Oqtane.Client/Modules/Controls/TabPanel.razor
@@ -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);
}
}
diff --git a/Oqtane.Client/Modules/Controls/TabStrip.razor b/Oqtane.Client/Modules/Controls/TabStrip.razor
index be82b9ff..d5186930 100644
--- a/Oqtane.Client/Modules/Controls/TabStrip.razor
+++ b/Oqtane.Client/Modules/Controls/TabStrip.razor
@@ -1,7 +1,7 @@
@namespace Oqtane.Modules.Controls
@inherits ModuleControlBase
-
+