- @Localizer["Folder:"]
+ @Localizer["Folder"]
- FolderChanged(e))">
+ FolderChanged(e))">
@foreach (Folder folder in _folders)
{
@(new string('-', folder.Level * 2))@(folder.Name)
@@ -31,23 +32,23 @@
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
@Localizer["Modified"]
@Localizer["Type"]
@Localizer["Size"]
-
+
@context.Name
@context.ModifiedOn
- @context.Extension.ToUpper() @Localizer["File"]
+ @context.Extension.ToUpper() @SharedLocalizer["File"]
@string.Format("{0:0.00}", ((decimal)context.Size / 1000)) KB
@if (_files.Count == 0)
{
- @Localizer["No Files Exist In Selected Folder"]
+ @Localizer["NoFiles"]
}
}
@@ -63,7 +64,7 @@
try
{
_folders = await FolderService.GetFoldersAsync(PageState.Site.SiteId);
-
+
if (_folderId == -1 && _folders.Count > 0)
{
_folderId = _folders[0].FolderId;
@@ -73,7 +74,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Files"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.File.Load"], MessageType.Error);
}
}
@@ -93,7 +94,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Files"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.File.Load"], MessageType.Error);
}
}
@@ -103,14 +104,14 @@
{
await FileService.DeleteFileAsync(file.FileId);
await logger.LogInformation("File Deleted {File}", file.Name);
- AddModuleMessage(Localizer["File {0} Deleted", file.Name], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.File.Delete"], file.Name), MessageType.Success);
await GetFiles();
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting File {File} {Error}", file.Name, ex.Message);
- AddModuleMessage(Localizer["Error Deleting File {0}", file.Name], MessageType.Error);
+ AddModuleMessage(string.Format(Localizer["Error.File.Delete"], file.Name), MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Jobs/Edit.razor b/Oqtane.Client/Modules/Admin/Jobs/Edit.razor
index 9a436b6d..31d982c3 100644
--- a/Oqtane.Client/Modules/Admin/Jobs/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Jobs/Edit.razor
@@ -3,10 +3,11 @@
@inject NavigationManager NavigationManager
@inject IJobService JobService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
+
+
+
@code {
private int _jobId;
@@ -93,6 +97,10 @@
private string _endDate = string.Empty;
private string _retentionHistory = string.Empty;
private string _nextExecution = string.Empty;
+ private string createdby;
+ private DateTime createdon;
+ private string modifiedby;
+ private DateTime modifiedon;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
@@ -113,12 +121,16 @@
_endDate = (job.EndDate != null) ? job.EndDate.ToString() : string.Empty;
_retentionHistory = job.RetentionHistory.ToString();
_nextExecution = job.NextExecution.ToString();
+ createdby = job.CreatedBy;
+ createdon = job.CreatedOn;
+ modifiedby = job.ModifiedBy;
+ modifiedon = job.ModifiedOn;
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Job {JobId} {Error}", _jobId, ex.Message);
- AddModuleMessage(Localizer["Error Loading Job"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Job.Load"], MessageType.Error);
}
}
@@ -171,12 +183,12 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Udate Job {Job} {Error}", job, ex.Message);
- AddModuleMessage(Localizer["Error Updating Job"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Job.Update"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide The Job Name, Type, Frequency, and Retention"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.JobInfo"], MessageType.Warning);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Jobs/Index.razor b/Oqtane.Client/Modules/Admin/Jobs/Index.razor
index 5aefdcbe..1996d62b 100644
--- a/Oqtane.Client/Modules/Admin/Jobs/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Jobs/Index.razor
@@ -2,10 +2,11 @@
@inherits ModuleBase
@inject IJobService JobService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_jobs == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -19,10 +20,10 @@ else
- @Localizer["Name"]
- @Localizer["Status"]
+ @SharedLocalizer["Name"]
+ @SharedLocalizer["Status"]
@Localizer["Frequency"]
- @Localizer["Next Execution"]
+ @Localizer["NextExecution"]
@@ -118,7 +119,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Job {Job} {Error}", job, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Job"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Job.Delete"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Jobs/Log.razor b/Oqtane.Client/Modules/Admin/Jobs/Log.razor
index b0049db7..23b605c2 100644
--- a/Oqtane.Client/Modules/Admin/Jobs/Log.razor
+++ b/Oqtane.Client/Modules/Admin/Jobs/Log.razor
@@ -2,46 +2,47 @@
@inherits ModuleBase
@inject IJobLogService JobLogService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_jobLogs == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
-
-
- @Localizer["Name"]
- @Localizer["Status"]
- @Localizer["Started"]
- @Localizer["Finished"]
-
-
- @context.Job.Name
- @DisplayStatus(context.Job.IsExecuting, context.Succeeded)
- @context.StartDate
- @context.FinishDate
-
-
- @((MarkupString)context.Notes)
-
-
+
+
+ @SharedLocalizer["Name"]
+ @SharedLocalizer["Status"]
+ @Localizer["Started"]
+ @Localizer["Finished"]
+
+
+ @context.Job.Name
+ @DisplayStatus(context.Job.IsExecuting, context.Succeeded)
+ @context.StartDate
+ @context.FinishDate
+
+
+ @((MarkupString)context.Notes)
+
+
}
@code {
private List _jobLogs;
-
+
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
protected override async Task OnParametersSetAsync()
{
_jobLogs = await JobLogService.GetJobLogsAsync();
-
+
if (PageState.QueryString.ContainsKey("id"))
{
_jobLogs = _jobLogs.Where(item => item.JobId == Int32.Parse(PageState.QueryString["id"])).ToList();
}
-
+
_jobLogs = _jobLogs.OrderByDescending(item => item.JobLogId).ToList();
}
@@ -63,7 +64,7 @@ else
status = Localizer["Failed"];
}
}
-
+
return status;
}
}
diff --git a/Oqtane.Client/Modules/Admin/Languages/Add.razor b/Oqtane.Client/Modules/Admin/Languages/Add.razor
index aecb372c..636305aa 100644
--- a/Oqtane.Client/Modules/Admin/Languages/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Languages/Add.razor
@@ -7,10 +7,11 @@
@inject ILanguageService LanguageService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_supportedCultures == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -22,75 +23,92 @@ else
}
else
{
-
+
+
+
+ Name:
+
+
+
+ @foreach (var culture in _availableCultures)
+ {
+ @culture.DisplayName
+ }
+
+
+
+
+
+ Default?
+
+
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
+
+
+
+
+ @SharedLocalizer["Save"]
+ }
+ @SharedLocalizer["Cancel"]
+
+
+
+
+
- @Localizer["Save"]
- }
- @Localizer["Cancel"]
-
-
- @if (_packages != null && _packages.Count > 0)
+
+ @if (_packages != null)
{
-
-
-
- @Localizer["Name"]
- @Localizer["Version"]
-
-
-
- @context.Name
- @context.Version
-
- await DownloadLanguage(context.PackageId, context.Version))>@Localizer["Download"]
-
-
-
- @Localizer["Install"]
- @Localizer["Cancel"]
- }
- else
- {
-
+ @if (_packages.Count > 0)
+ {
+
+
+
+ by: @context.Owner
+ @(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
+ @(String.Format("{0:n0}", context.Downloads)) @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: @context.ReleaseDate.ToString("MMM dd, yyyy") | @SharedLocalizer["Search.Version"]: @context.Version | @SharedLocalizer["Search.Source"]: @context.PackageUrl
+
+
+ await DownloadLanguage(context.PackageId, context.Version))>@SharedLocalizer["Download"]
+
+
+
+ }
+ else
+ {
+
+
+ @Localizer["Search.NoResults"]
+
+ }
+ @SharedLocalizer["Install"]
+ @SharedLocalizer["Cancel"]
}
- @Localizer["Install"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Install"]
+ @SharedLocalizer["Cancel"]
}
@@ -102,6 +120,7 @@ else
private IEnumerable _supportedCultures;
private IEnumerable _availableCultures;
private List _packages;
+ private string _search = "";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
@@ -113,15 +132,45 @@ else
_supportedCultures = await LocalizationService.GetCulturesAsync();
_availableCultures = _supportedCultures
.Where(c => !c.Name.Equals(Constants.DefaultCulture) && !languagesCodes.Contains(c.Name));
- _packages = await PackageService.GetPackagesAsync("language");
+ await LoadTranslations();
if (_supportedCultures.Count() == 1)
{
- _message = Localizer["The Only Installed Language Is English"];
+ _message = Localizer["OnlyEnglish"];
}
else if (_availableCultures.Count() == 0)
{
- _message = Localizer["All The Installed Languages Have Been Added."];
+ _message = Localizer["AllLanguages"];
+ }
+ }
+
+ private async Task LoadTranslations()
+ {
+ _packages = await PackageService.GetPackagesAsync("translation", _search);
+ }
+
+ private async Task Search()
+ {
+ try
+ {
+ await LoadTranslations();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error On Search");
+ }
+ }
+
+ private async Task Reset()
+ {
+ try
+ {
+ _search = "";
+ await LoadTranslations();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error On Reset");
}
}
@@ -151,7 +200,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Adding Language {Language} {Error}", language, ex.Message);
- AddModuleMessage(Localizer["Error Adding Language"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Language.Add"], MessageType.Error);
}
}
@@ -160,11 +209,11 @@ else
try
{
await PackageService.InstallPackagesAsync();
- AddModuleMessage(Localizer["Language Packages Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Language.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
catch (Exception ex)
{
- await logger.LogError(ex, "Error Installing Language Package");
+ await logger.LogError(ex, "Error Installing Translations");
}
}
@@ -174,13 +223,13 @@ else
{
await PackageService.DownloadPackageAsync(packageid, version, "Packages");
await logger.LogInformation("Language Paclage {Name} {Version} Downloaded Successfully", packageid, version);
- AddModuleMessage(Localizer["Language Package Downloaded Successfully. Click Install To Complete Installation."], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Language.Download"], MessageType.Success);
StateHasChanged();
}
catch (Exception ex)
{
- await logger.LogError(ex, "Error Downloading Language Package {Name} {Version}", packageid, version);
- AddModuleMessage(Localizer["Error Downloading Language Package"], MessageType.Error);
+ await logger.LogError(ex, "Error Downloading Translation {Name} {Version}", packageid, version);
+ AddModuleMessage(Localizer["Error.Language.Download"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Languages/Index.razor b/Oqtane.Client/Modules/Admin/Languages/Index.razor
index eef0c6af..b8a3d21d 100644
--- a/Oqtane.Client/Modules/Admin/Languages/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Languages/Index.razor
@@ -4,10 +4,11 @@
@inject ILocalizationService LocalizationService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_languages == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -16,21 +17,21 @@ else
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
@Localizer["Code"]
- @Localizer["Default?"]
+ @Localizer["Default"]
-
+
@context.Name
@context.Code
@if (UpgradeAvailable(context.Code))
- {
- await DownloadLanguage(context.Code))>@Localizer["Upgrade"]
- }
+ {
+ await DownloadLanguage(context.Code))>@SharedLocalizer["Upgrade"]
+ }
@@ -48,13 +49,13 @@ else
var cultures = await LocalizationService.GetCulturesAsync();
var culture = cultures.First(c => c.Name.Equals(Constants.DefaultCulture));
-
+
// Adds English as default language
_languages.Insert(0, new Language { Name = culture.DisplayName, Code = culture.Name, IsDefault = !_languages.Any(l => l.IsDefault) });
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
- _packages = await PackageService.GetPackagesAsync("language");
+ _packages = await PackageService.GetPackagesAsync("translation");
}
}
@@ -71,7 +72,7 @@ else
{
await logger.LogError(ex, "Error Deleting Language {Language} {Error}", language, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Language"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Language.Delete"], MessageType.Error);
}
}
@@ -97,15 +98,15 @@ else
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
await PackageService.DownloadPackageAsync(Constants.PackageId + ".Client." + code, Constants.Version, "Packages");
- await logger.LogInformation("Language Package Downloaded {Code} {Version}", code, Constants.Version);
+ await logger.LogInformation("Translation Downloaded {Code} {Version}", code, Constants.Version);
await PackageService.InstallPackagesAsync();
- AddModuleMessage(Localizer["Language Package Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Language.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
}
catch (Exception ex)
{
- await logger.LogError(ex, "Error Downloading Language Package {Code} {Version} {Error}", code, Constants.Version, ex.Message);
- AddModuleMessage(Localizer["Error Downloading Language Package"], MessageType.Error);
+ await logger.LogError(ex, "Error Downloading Translation {Code} {Version} {Error}", code, Constants.Version, ex.Message);
+ AddModuleMessage(Localizer["Error.Language.Download"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Login/Index.razor b/Oqtane.Client/Modules/Admin/Login/Index.razor
index 3da1c2ea..868031fd 100644
--- a/Oqtane.Client/Modules/Admin/Login/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Login/Index.razor
@@ -3,7 +3,9 @@
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IServiceProvider ServiceProvider
+@inject SiteState SiteState
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_message != string.Empty)
{
@@ -14,29 +16,29 @@
...
-
+
@@ -57,7 +59,7 @@
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous;
public override List Resources => new List()
- {
+{
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
};
@@ -82,11 +84,11 @@
if (user != null)
{
- _message = Localizer["User Account Verified Successfully. You Can Now Login With Your Username And Password Below."];
+ _message = Localizer["Success.Account.Verified"];
}
else
{
- _message = Localizer["User Account Could Not Be Verified. Please Contact Your Administrator For Further Instructions."];
+ _message = Localizer["Message.Account.NotVerfied"];
_type = MessageType.Warning;
}
}
@@ -108,7 +110,6 @@
{
if (PageState.Runtime == Oqtane.Shared.Runtime.Server)
{
- // server-side Blazor
var user = new User();
user.SiteId = PageState.Site.SiteId;
user.Username = _username;
@@ -118,16 +119,15 @@
if (user.IsAuthenticated)
{
await logger.LogInformation("Login Successful For Username {Username}", _username);
- // complete the login on the server so that the cookies are set correctly
- string antiforgerytoken = await interop.GetElementByName("__RequestVerificationToken");
- var fields = new { __RequestVerificationToken = antiforgerytoken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
+ // server-side Blazor needs to post to the Login page so that the cookies are set correctly
+ var fields = new { __RequestVerificationToken = SiteState.AntiForgeryToken, username = _username, password = _password, remember = _remember, returnurl = _returnUrl };
string url = Utilities.TenantUrl(PageState.Alias, "/pages/login/");
await interop.SubmitForm(url, fields);
}
else
{
await logger.LogInformation("Login Failed For Username {Username}", _username);
- AddModuleMessage(Localizer["Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email."], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Login.Fail"], MessageType.Error);
}
}
else
@@ -143,18 +143,18 @@
await logger.LogInformation("Login Successful For Username {Username}", _username);
var authstateprovider = (IdentityAuthenticationStateProvider)ServiceProvider.GetService(typeof(IdentityAuthenticationStateProvider));
authstateprovider.NotifyAuthenticationChanged();
- NavigationManager.NavigateTo(NavigateUrl(_returnUrl, "reload"));
+ NavigationManager.NavigateTo(NavigateUrl(_returnUrl, true));
}
else
{
await logger.LogInformation("Login Failed For Username {Username}", _username);
- AddModuleMessage(Localizer["Login Failed. Please Remember That Passwords Are Case Sensitive And User Accounts Require Verification When They Are Initially Created So You May Wish To Check Your Email."], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Login.Fail"], MessageType.Error);
}
}
}
else
{
- AddModuleMessage(Localizer["Please Provide Your Username And Password"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Logs/Detail.razor b/Oqtane.Client/Modules/Admin/Logs/Detail.razor
index 481a9636..65fa7a2c 100644
--- a/Oqtane.Client/Modules/Admin/Logs/Detail.razor
+++ b/Oqtane.Client/Modules/Admin/Logs/Detail.razor
@@ -6,11 +6,12 @@
@inject IPageService PageService
@inject IPageModuleService PageModuleService
@inject IUserService UserService
-@inject IStringLocalizer Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Date/Time:
@@ -134,7 +135,7 @@
-@Localizer["Cancel"]
+@SharedLocalizer["Cancel"]
@code {
private int _logId;
@@ -207,7 +208,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Log {LogId} {Error}", _logId, ex.Message);
- AddModuleMessage(Localizer["Error Loading Log"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Log.Load"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Logs/Index.razor b/Oqtane.Client/Modules/Admin/Logs/Index.razor
index cbd355db..02bd9d62 100644
--- a/Oqtane.Client/Modules/Admin/Logs/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Logs/Index.razor
@@ -1,11 +1,12 @@
@namespace Oqtane.Modules.Admin.Logs
@inherits ModuleBase
@inject ILogService LogService
-@inject IStringLocalizer Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_logs == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -13,8 +14,8 @@ else
Level:
- LevelChanged(e))">
- <@Localizer["All Levels"]>
+ LevelChanged(e))">
+ <@Localizer["AllLevels"]>
@Localizer["Trace"]
@Localizer["Debug"]
@Localizer["Information"]
@@ -25,19 +26,19 @@ else
Function:
- FunctionChanged(e))">
- <@Localizer["All Functions"]>
+ FunctionChanged(e))">
+ <@Localizer["AllFunctions"]>
@Localizer["Create"]
@Localizer["Read"]
- @Localizer["Update"]
- @Localizer["Delete"]
+ @SharedLocalizer["Update"]
+ @SharedLocalizer["Delete"]
@Localizer["Security"]
@Localizer["Other"]
Maximum Items:
- RowsChanged(e))">
+ RowsChanged(e))">
10
50
100
@@ -67,7 +68,7 @@ else
}
else
{
- @Localizer["No Logs Match The Criteria Specified"]
+ @Localizer["NoLogs"]
}
}
@@ -88,7 +89,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Log.Load"], MessageType.Error);
}
}
@@ -103,7 +104,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Log.Load"], MessageType.Error);
}
}
@@ -118,7 +119,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Log.Load"], MessageType.Error);
}
}
@@ -134,7 +135,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Logs {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Logs"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Log.Load"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
index bd29e7ca..a6ac643b 100644
--- a/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleCreator/Index.razor
@@ -6,12 +6,13 @@
@inject IModuleService ModuleService
@inject ISettingService SettingService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (string.IsNullOrEmpty(_moduledefinitionname) && _templates != null)
{
-
+
Owner Name:
@@ -39,8 +40,8 @@
Template:
- TemplateChanged(e))">
- <@Localizer["Select Template"]>
+ TemplateChanged(e))">
+ <@Localizer["Template.Select"]>
@foreach (Template template in _templates)
{
@template.Title
@@ -53,7 +54,7 @@
Framework Reference:
-
+
@foreach (string version in _versions)
{
if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
@@ -61,7 +62,7 @@
@(version)
}
}
- @Localizer["Local Version"]
+ @SharedLocalizer["LocalVersion"]
@@ -77,11 +78,11 @@
}
- @Localizer["Create Module"]
+ @Localizer["Module.Create"]
}
else
{
- @Localizer["Activate Module"]
+ @Localizer["Module.Activate"]
}
@code {
@@ -108,11 +109,11 @@ else
if (string.IsNullOrEmpty(_moduledefinitionname))
{
- AddModuleMessage(Localizer["Please Note That The Module Creator Is Only Intended To Be Used In A Development Environment"], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Module.Creator"], MessageType.Info);
}
else
{
- AddModuleMessage(Localizer["Once You Have Compiled The Module And Restarted The Application You Can Activate The Module Below"], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Module.Activate"], MessageType.Info);
}
}
catch (Exception ex)
@@ -136,11 +137,11 @@ else
GetLocation();
- 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);
+ AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
}
else
{
- 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);
+ AddModuleMessage(Localizer["Message.Require.ValidName"], MessageType.Warning);
}
}
catch (Exception ex)
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
index 36b41591..400ec49b 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Add.razor
@@ -5,50 +5,70 @@
@inject IModuleDefinitionService ModuleDefinitionService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-@if (_packages != null)
-{
-
- @if (_packages.Count > 0)
+
+
+
+
+
+
+ @if (_packages != null)
{
-
-
+ if (_packages.Count > 0)
+ {
-
- @Localizer["Name"]
- @Localizer["Version"]
-
-
- @context.Name
- @context.Version
- await DownloadModule(context.PackageId, context.Version))>@Localizer["Download"]
+ by: @context.Owner
+ @(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
+ @(String.Format("{0:n0}", context.Downloads)) @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: @context.ReleaseDate.ToString("MMM dd, yyyy") | @SharedLocalizer["Search.Version"]: @context.Version | @SharedLocalizer["Search.Source"]: @context.PackageUrl
+
+
+ await DownloadModule(context.PackageId, context.Version))>@SharedLocalizer["Download"]
-
+ }
+ else
+ {
+
+
+ @Localizer["Search.NoResults"]
+
+ }
}
-
-
-
-
- Module:
-
-
-
-
-
-
-
-
+
+
+
+
+
+ Module:
+
+
+
+
+
+
+
+
- @Localizer["Install"]
- @Localizer["Cancel"]
-}
+@SharedLocalizer["Install"]
+@SharedLocalizer["Cancel"]
@code {
private List _packages;
+ private string _search = "";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
@@ -56,9 +76,22 @@
{
try
{
- var moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
- _packages = await PackageService.GetPackagesAsync("module");
+ await LoadModuleDefinitions();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.Package.Load"], MessageType.Error);
+ }
+ }
+ private async Task LoadModuleDefinitions()
+ {
+ var moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync(PageState.Site.SiteId);
+ _packages = await PackageService.GetPackagesAsync("module", _search);
+
+ if (_packages != null)
+ {
foreach (Package package in _packages.ToArray())
{
if (moduledefinitions.Exists(item => item.PackageName == package.PackageId))
@@ -67,10 +100,30 @@
}
}
}
+ }
+
+ private async Task Search()
+ {
+ try
+ {
+ await LoadModuleDefinitions();
+ }
catch (Exception ex)
{
- await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Packages"], MessageType.Error);
+ await logger.LogError(ex, "Error On Search");
+ }
+ }
+
+ private async Task Reset()
+ {
+ try
+ {
+ _search = "";
+ await LoadModuleDefinitions();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error On Reset");
}
}
@@ -79,7 +132,7 @@
try
{
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
- AddModuleMessage(Localizer["Module Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Module.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
catch (Exception ex)
{
@@ -93,13 +146,13 @@
{
await PackageService.DownloadPackageAsync(packageid, version, "Packages");
await logger.LogInformation("Module {ModuleDefinitionName} {Version} Downloaded Successfully", packageid, version);
- AddModuleMessage(Localizer["Modules Downloaded Successfully. Click Install To Complete Installation."], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Module.Download"], MessageType.Success);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Downloading Module {ModuleDefinitionName} {Version}", packageid, version);
- AddModuleMessage(Localizer["Error Downloading Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Download"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Create.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Create.razor
index 98324f3a..c4fae60b 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Create.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Create.razor
@@ -5,13 +5,14 @@
@inject IModuleDefinitionService ModuleDefinitionService
@inject IModuleService ModuleService
@inject ISettingService SettingService
-@inject IStringLocalizer Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_templates != null)
{
-
+
Owner Name:
@@ -39,8 +40,8 @@
Template:
- TemplateChanged(e))">
- <@Localizer["Select Template"]>
+ TemplateChanged(e))">
+ <@Localizer["Template.Select"]>
@foreach (Template template in _templates)
{
@template.Title
@@ -53,7 +54,7 @@
Framework Reference:
-
+
@foreach (string version in _versions)
{
if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
@@ -61,7 +62,7 @@
@(version)
}
}
- @Localizer["Local Version"]
+ @SharedLocalizer["LocalVersion"]
@@ -77,8 +78,8 @@
}
- @Localizer["Create Module"]
- @Localizer["Cancel"]
+ @Localizer["CreateModule"]
+ @SharedLocalizer["Cancel"]
}
@code {
@@ -100,7 +101,7 @@
{
_templates = await ModuleDefinitionService.GetModuleDefinitionTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
- AddModuleMessage(Localizer["Please Note That The Module Creator Is Only Intended To Be Used In A Development Environment"], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Module.Development"], MessageType.Info);
}
catch (Exception ex)
{
@@ -117,11 +118,11 @@
var moduleDefinition = new ModuleDefinition { Owner = _owner, Name = _module, Description = _description, Template = _template, Version = _reference };
moduleDefinition = await ModuleDefinitionService.CreateModuleDefinitionAsync(moduleDefinition);
GetLocation();
- 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 Activate The Module.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Module.Create"], NavigateUrl("admin/system")), MessageType.Success);
}
else
{
- 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);
+ AddModuleMessage(Localizer["Message.Require.ValidName"], MessageType.Warning);
}
}
catch (Exception ex)
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
index 70310bd4..604a5904 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Edit.razor
@@ -3,12 +3,13 @@
@inject IModuleDefinitionService ModuleDefinitionService
@inject NavigationManager NavigationManager
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Name:
@@ -35,7 +36,7 @@
-
+
Internal Name:
@@ -103,8 +104,8 @@
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
@@ -161,7 +162,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
- AddModuleMessage(Localizer["Error Loading Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Load"], MessageType.Error);
}
}
@@ -190,7 +191,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving ModuleDefinition {ModuleDefinitionId} {Error}", _moduleDefinitionId, ex.Message);
- AddModuleMessage(Localizer["Error Saving Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Save"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
index c9c47456..70a3abba 100644
--- a/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
@@ -4,23 +4,24 @@
@inject IModuleDefinitionService ModuleDefinitionService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_moduleDefinitions == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@((MarkupString)" ")
-
+
- @Localizer["Name"]
- @Localizer["Version"]
+ @SharedLocalizer["Name"]
+ @SharedLocalizer["Version"]
@@ -28,7 +29,7 @@ else
@if (context.AssemblyName != "Oqtane.Client")
{
-
+
}
@context.Name
@@ -36,7 +37,7 @@ else
@if (UpgradeAvailable(context.PackageName, context.Version))
{
- await DownloadModule(context.PackageName, context.Version))>@Localizer["Upgrade"]
+ await DownloadModule(context.PackageName, context.Version))>@SharedLocalizer["Upgrade"]
}
@@ -61,7 +62,7 @@ else
if (_moduleDefinitions == null)
{
await logger.LogError(ex, "Error Loading Modules {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Modules"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Load"], MessageType.Error);
}
}
}
@@ -88,12 +89,12 @@ else
await PackageService.DownloadPackageAsync(packagename, version, "Packages");
await logger.LogInformation("Module Downloaded {ModuleDefinitionName} {Version}", packagename, version);
await ModuleDefinitionService.InstallModuleDefinitionsAsync();
- AddModuleMessage(Localizer["Module Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Module.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Downloading Module {ModuleDefinitionName} {Version} {Error}", packagename, version, ex.Message);
- AddModuleMessage(Localizer["Error Downloading Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Download"], MessageType.Error);
}
}
@@ -102,13 +103,13 @@ else
try
{
await ModuleDefinitionService.DeleteModuleDefinitionAsync(moduleDefinition.ModuleDefinitionId, moduleDefinition.SiteId);
- AddModuleMessage(Localizer["Module Deleted Successfully"], MessageType.Success);
- NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "reload"));
+ AddModuleMessage(Localizer["Success.Module.Delete"], MessageType.Success);
+ NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, true));
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Module {ModuleDefinition} {Error}", moduleDefinition, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Delete"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Modules/Export.razor b/Oqtane.Client/Modules/Admin/Modules/Export.razor
index fd1aa71c..41c7d73b 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Export.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Export.razor
@@ -3,11 +3,12 @@
@inject NavigationManager NavigationManager
@inject IModuleService ModuleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Content:
@@ -17,7 +18,7 @@
@Localizer["Export"]
-@Localizer["Cancel"]
+@SharedLocalizer["Cancel"]
@code {
diff --git a/Oqtane.Client/Modules/Admin/Modules/Import.razor b/Oqtane.Client/Modules/Admin/Modules/Import.razor
index 423361f6..833dbefc 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Import.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Import.razor
@@ -3,11 +3,12 @@
@inject NavigationManager NavigationManager
@inject IModuleService ModuleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Content:
@@ -17,7 +18,7 @@
@Localizer["Import"]
-@Localizer["Cancel"]
+@SharedLocalizer["Cancel"]
@code {
@@ -35,22 +36,22 @@
bool success = await ModuleService.ImportModuleAsync(ModuleState.ModuleId, _content);
if (success)
{
- AddModuleMessage(Localizer["Content Imported Successfully"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Content.Import"], MessageType.Success);
}
else
{
- AddModuleMessage(Localizer["A Problem Was Encountered Importing Content. Please Ensure The Content Is Formatted Correctly For The Module."], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Content.ImportProblem"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Importing Module {ModuleId} {Error}", ModuleState.ModuleId, ex.Message);
- AddModuleMessage(Localizer["Error Importing Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Import"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["You Must Enter Some Content To Import"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.ImportContent"], MessageType.Warning);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Modules/Settings.razor b/Oqtane.Client/Modules/Admin/Modules/Settings.razor
index 5d75d71b..7fc04462 100644
--- a/Oqtane.Client/Modules/Admin/Modules/Settings.razor
+++ b/Oqtane.Client/Modules/Admin/Modules/Settings.razor
@@ -6,6 +6,7 @@
@inject IModuleService ModuleService
@inject IPageModuleService PageModuleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@@ -13,7 +14,7 @@
{
-
+
Title:
@@ -25,7 +26,7 @@
Container:
-
+
@foreach (var container in _containers)
{
@container.Name
@@ -38,9 +39,9 @@
Display On All Pages?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -49,7 +50,7 @@
Page:
-
+
@foreach (Page p in PageState.Pages)
{
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
@@ -88,8 +89,11 @@
}
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
+
+
+
@code {
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Edit;
@@ -111,6 +115,10 @@
private Type _containerSettingsType;
private object _containerSettings;
private RenderFragment ContainerSettingsComponent { get; set; }
+ private string createdby;
+ private DateTime createdon;
+ private string modifiedby;
+ private DateTime modifiedon;
protected override async Task OnInitializedAsync()
{
@@ -122,6 +130,10 @@
_permissions = ModuleState.Permissions;
_permissionNames = ModuleState.ModuleDefinition.PermissionNames;
_pageId = ModuleState.PageId.ToString();
+ createdby = ModuleState.CreatedBy;
+ createdon = ModuleState.CreatedOn;
+ modifiedby = ModuleState.ModifiedBy;
+ modifiedon = ModuleState.ModifiedOn;
if (!string.IsNullOrEmpty(ModuleState.ModuleDefinition.SettingsType))
{
@@ -212,7 +224,7 @@
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Title For The Module"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.Title"], MessageType.Warning);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor
index 0c97da2c..91a2f391 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor
@@ -4,6 +4,7 @@
@inject IPageService PageService
@inject IThemeService ThemeService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@@ -11,7 +12,7 @@
{
-
+
Name:
@@ -23,8 +24,8 @@
Parent:
- ParentChanged(e))">
- <@Localizer["Site Root"]>
+ ParentChanged(e))">
+ <@Localizer["SiteRoot"]>
@foreach (Page page in _pageList)
{
@(new string('-', page.Level * 2))@(page.Name)
@@ -37,19 +38,19 @@
Insert:
-
- @Localizer["At Beginning"]
+
+ @Localizer["AtBeginning"]
@if (_children != null && _children.Count > 0)
{
@Localizer["Before"]
@Localizer["After"]
}
- @Localizer["At End"]
+ @Localizer["AtEnd"]
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{
-
- <@Localizer["Select Page"]>
+
+ <@Localizer["Page.Select"]>
@foreach (Page page in _children)
{
@(page.Name)
@@ -60,12 +61,23 @@
- Navigation?
+ Navigation?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
+
+
+
+
+
+ Clickable?
+
+
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -89,7 +101,7 @@
-
+
Title:
@@ -101,7 +113,7 @@
Theme:
- ThemeChanged(e))">
+ ThemeChanged(e))">
@foreach (var theme in _themes)
{
@theme.Name
@@ -114,8 +126,8 @@
Default Container:
-
- <@Localizer["Select Container"]>
+
+ <@Localizer["Container.Select"]>
@foreach (var container in _containers)
{
@container.Name
@@ -136,9 +148,9 @@
Personalizable?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -162,8 +174,8 @@
}
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
@code {
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
@@ -180,6 +192,7 @@
private List _children;
private int _childid = -1;
private string _isnavigation = "True";
+ private string _isclickable = "True";
private string _url;
private string _ispersonalizable = "False";
private string _themetype = string.Empty;
@@ -209,7 +222,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Initializing Page {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Initializing Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Initialize"], MessageType.Error);
}
}
@@ -244,7 +257,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message);
- AddModuleMessage(Localizer["Error Loading Child Pages For Parent"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.ChildPage.Load"], MessageType.Error);
}
}
@@ -261,7 +274,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
- AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Pane.Load"], MessageType.Error);
}
}
@@ -327,7 +340,7 @@
if (!PagePathIsUnique(page.Path, page.SiteId, _pageList))
{
- 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);
+ AddModuleMessage(string.Format(Localizer["Message.Page.Exists"], _path), MessageType.Warning);
return;
}
@@ -351,6 +364,7 @@
}
page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation));
+ page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
page.Url = _url;
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
@@ -382,14 +396,14 @@
}
else
{
- AddModuleMessage(Localizer["You Must Provide Page Name, Theme, and Container"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
- AddModuleMessage(Localizer["Error Saving Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
index d012f87f..3e1c964a 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
@@ -5,6 +5,7 @@
@inject IPageService PageService
@inject IThemeService ThemeService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@@ -12,7 +13,7 @@
{
-
+
Name:
@@ -24,8 +25,8 @@
Parent:
- ParentChanged(e))">
- <@Localizer["Site Root"]>
+ ParentChanged(e))">
+ <@Localizer["SiteRoot"]>
@foreach (Page page in _pageList)
{
if (page.PageId != _pageId)
@@ -41,23 +42,23 @@
Move:
-
+
@if (_parentid == _currentparentid)
{
- <@Localizer["Maintain Current Location"]>
+ <@Localizer["ThisLocation.Keep"]>
}
- @Localizer["To Beginning"]
+ @Localizer["ToBeginning"]
@if (_children != null && _children.Count > 0)
{
@Localizer["Before"]
@Localizer["After"]
}
- @Localizer["To End"]
+ @Localizer["ToEnd"]
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{
-
- <@Localizer["Select Page"]>
+
+ <@Localizer["Page.Select"]>
@foreach (Page page in _children)
{
@(page.Name)
@@ -71,9 +72,20 @@
Navigation?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
+
+
+
+
+
+ Clickable?
+
+
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -97,7 +109,7 @@
-
+
Title:
@@ -109,7 +121,7 @@
Theme:
- ThemeChanged(e))">
+ ThemeChanged(e))">
@foreach (var theme in _themes)
{
@theme.Name
@@ -122,8 +134,8 @@
Default Container:
-
- <@Localizer["Select Container"]>
+
+ <@Localizer["Container.Select"]>
@foreach (var container in _containers)
{
@container.Name
@@ -144,9 +156,9 @@
Personalizable?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -175,8 +187,8 @@
}
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
@code {
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
@@ -195,6 +207,7 @@
private List _children;
private int _childid = -1;
private string _isnavigation;
+ private string _isclickable;
private string _url;
private string _ispersonalizable;
private string _themetype;
@@ -247,6 +260,7 @@
_currentparentid = _parentid;
_isnavigation = page.IsNavigation.ToString();
+ _isclickable = page.IsClickable.ToString();
_url = page.Url;
_ispersonalizable = page.IsPersonalizable.ToString();
_themetype = page.ThemeType;
@@ -275,7 +289,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Page {PageId} {Error}", _pageId, ex.Message);
- AddModuleMessage(Localizer["Error Loading Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Load"], MessageType.Error);
}
}
@@ -318,7 +332,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message);
- AddModuleMessage(Localizer["Error Loading Child Pages For Parent"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.ChildPage.Load"], MessageType.Error);
}
}
@@ -335,7 +349,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
- AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Pane.Load"], MessageType.Error);
}
}
@@ -401,7 +415,7 @@
if (!PagePathIsUnique(page.Path, page.SiteId, page.PageId, _pageList))
{
- 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);
+ AddModuleMessage(string.Format(Localizer["Mesage.Page.PathExists"], _path), MessageType.Warning);
return;
}
@@ -427,6 +441,7 @@
}
}
page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation));
+ page.IsClickable = (_isclickable == null ? true : Boolean.Parse(_isclickable));
page.Url = _url;
page.ThemeType = (_themetype != "-") ? _themetype : string.Empty;
if (!string.IsNullOrEmpty(page.ThemeType) && page.ThemeType == PageState.Site.DefaultThemeType)
@@ -481,13 +496,13 @@
}
else
{
- AddModuleMessage(Localizer["You Must Provide Page Name, Theme, and Container"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.PageInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Page {Page} {Error}", page, ex.Message);
- AddModuleMessage(Localizer["Error Saving Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Save"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Pages/Index.razor b/Oqtane.Client/Modules/Admin/Pages/Index.razor
index fef67427..0b772dae 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Index.razor
@@ -2,7 +2,8 @@
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject IPageService PageService
-@inject IStringLocalizer Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (PageState.Pages != null)
{
@@ -12,11 +13,11 @@
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
-
+
@(new string('-', context.Level * 2))@(context.Name)
@@ -30,7 +31,7 @@
try
{
page.IsDeleted = true;
-
+
await PageService.UpdatePageAsync(page);
await logger.LogInformation("Page Deleted {Page}", page);
NavigationManager.NavigateTo(NavigateUrl("admin/pages"));
@@ -38,7 +39,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Page {Page} {Error}", page, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Delete"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Profiles/Edit.razor b/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
index 86a71c8c..5249172b 100644
--- a/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Profiles/Edit.razor
@@ -3,10 +3,11 @@
@inject NavigationManager NavigationManager
@inject IProfileService ProfileService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Name:
@@ -74,9 +75,9 @@
Required?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -85,15 +86,21 @@
Private?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
+@if (PageState.QueryString.ContainsKey("id"))
+{
+
+
+
+}
@code {
private int _profileid = -1;
@@ -107,6 +114,10 @@
private string _options = string.Empty;
private string _isrequired = "False";
private string _isprivate = "False";
+ private string createdby;
+ private DateTime createdon;
+ private string modifiedby;
+ private DateTime modifiedon;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
@@ -132,13 +143,17 @@
_options = profile.Options;
_isrequired = profile.IsRequired.ToString();
_isprivate = profile.IsPrivate.ToString();
+ createdby = profile.CreatedBy;
+ createdon = profile.CreatedOn;
+ modifiedby = profile.ModifiedBy;
+ modifiedon = profile.ModifiedOn;
}
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Profile {ProfileId} {Error}", _profileid, ex.Message);
- AddModuleMessage(Localizer["Error Loading Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Load"], MessageType.Error);
}
}
@@ -182,7 +197,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Profile {ProfleId} {Error}", _profileid, ex.Message);
- AddModuleMessage(Localizer["Error Saving Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Profiles/Index.razor b/Oqtane.Client/Modules/Admin/Profiles/Index.razor
index 4705b290..1bbfb6b9 100644
--- a/Oqtane.Client/Modules/Admin/Profiles/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Profiles/Index.razor
@@ -2,10 +2,11 @@
@inherits ModuleBase
@inject IProfileService ProfileService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_profiles == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -15,11 +16,11 @@ else
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
-
+
@context.Name
@@ -42,7 +43,7 @@ else
await ProfileService.DeleteProfileAsync(profileId);
await logger.LogInformation("Profile Deleted {ProfileId}", profileId);
- AddModuleMessage(Localizer["Profile Deleted"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Profile.Delete"], MessageType.Success);
await GetProfilesAsync();
@@ -51,7 +52,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Profile {ProfileId} {Error}", profileId, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Delete"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor b/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
index 47e2a47a..e70165b9 100644
--- a/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
+++ b/Oqtane.Client/Modules/Admin/RecycleBin/Index.razor
@@ -5,13 +5,14 @@
@inject IModuleService ModuleService
@inject IPageService PageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_pages == null)
{
- @Localizer["No Deleted Pages"]
+ @Localizer["NoPage.Deleted"]
}
else
{
@@ -19,13 +20,13 @@
- @Localizer["Name"]
- @Localizer["Deleted By"]
- @Localizer["Deleted On"]
+ @SharedLocalizer["Name"]
+ @Localizer["DeletedBy"]
+ @Localizer["DeletedOn"]
RestorePage(context))" class="btn btn-info" title="Restore">Restore
-
+
@context.Name
@context.DeletedBy
@context.DeletedOn
@@ -43,7 +44,7 @@
@if (_modules == null)
{
- @Localizer["No Deleted Modules"]
+ @Localizer["NoModule.Deleted"]
}
else
{
@@ -53,12 +54,12 @@
@Localizer["Page"]
@Localizer["Module"]
- @Localizer["Deleted By"]
- @Localizer["Deleted On"]
+ @Localizer["DeletedBy"]
+ @Localizer["DeletedOn"]
RestoreModule(context))" class="btn btn-info" title="Restore">@Localizer["Restore"]
-
+
@PageState.Pages.Find(item => item.PageId == context.PageId).Name
@context.Title
@context.DeletedBy
@@ -91,7 +92,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Deleted Pages Or Modules {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Deleted Pages Or Modules"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.DeletedModulePage.Load"], MessageType.Error);
}
}
@@ -118,7 +119,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Restoring Deleted Page {Page} {Error}", page, ex.Message);
- AddModuleMessage(Localizer["Error Restoring Deleted Page"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Page.Restore"], MessageType.Error);
}
}
@@ -175,7 +176,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Restoring Deleted Module {Module} {Error}", module, ex.Message);
- AddModuleMessage(Localizer["Error Restoring Deleted Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Restore"], MessageType.Error);
}
}
@@ -199,7 +200,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Permanently Deleting Module {Module} {Error}", module, ex.Message);
- AddModuleMessage(Localizer["Error Permanently Deleting Module"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Module.Delete"], MessageType.Error);
}
}
@@ -226,7 +227,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Permanently Deleting Modules {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Permanently Deleting Modules"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Modules.Delete"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Register/Index.razor b/Oqtane.Client/Modules/Admin/Register/Index.razor
index e78e4c7c..f942eb84 100644
--- a/Oqtane.Client/Modules/Admin/Register/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Register/Index.razor
@@ -3,6 +3,7 @@
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (PageState.Site.AllowRegistration)
{
@@ -11,41 +12,62 @@
...
-
+
-
+
-
+
+
+ @Localizer["Register"]
+ @SharedLocalizer["Cancel"]
}
else
{
-
+
}
@code {
@@ -53,7 +75,7 @@ else
private string _password = string.Empty;
private string _confirm = string.Empty;
private string _email = string.Empty;
- private string _displayName = string.Empty;
+ private string _displayname = string.Empty;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Anonymous;
@@ -71,7 +93,7 @@ else
{
SiteId = PageState.Site.SiteId,
Username = _username,
- DisplayName = (_displayName == string.Empty ? _username : _displayName),
+ DisplayName = (_displayname == string.Empty ? _username : _displayname),
Email = _email,
Password = _password
};
@@ -80,28 +102,28 @@ else
if (user != null)
{
await logger.LogInformation("User Created {Username} {Email}", _username, _email);
- AddModuleMessage(Localizer["User Account Created. Please Check Your Email For Verification Instructions."], MessageType.Info);
+ AddModuleMessage(Localizer["Info.User.AccountCreate"], MessageType.Info);
}
else
{
await logger.LogError("Error Adding User {Username} {Email}", _username, _email);
- AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username Is Not Already In Use."], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.AddInfo"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Username, Password, and Email Address"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", _username, _email, ex.Message);
- AddModuleMessage(Localizer["Error Adding User"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Reset/Index.razor b/Oqtane.Client/Modules/Admin/Reset/Index.razor
index 4ee8ed15..64acc352 100644
--- a/Oqtane.Client/Modules/Admin/Reset/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Reset/Index.razor
@@ -3,22 +3,23 @@
@inject NavigationManager NavigationManager
@inject IUserService UserService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@code {
@@ -35,7 +36,7 @@
_username = PageState.QueryString["name"];
}
else
- {
+ {
NavigationManager.NavigateTo(NavigateUrl(string.Empty));
}
}
@@ -64,23 +65,23 @@
else
{
await logger.LogError("Error Resetting User Password {Username}", _username);
- AddModuleMessage(Localizer["Error Resetting User Password. Please Ensure Password Meets Complexity Requirements."], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Password.ResetInfo"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Username, Password, and Email Address"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.UserInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Resetting User Password {Username} {Error}", _username, ex.Message);
- AddModuleMessage(Localizer["Error Resetting User Password"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Password.Reset"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Add.razor b/Oqtane.Client/Modules/Admin/Roles/Add.razor
index c5bc2a38..905d8061 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Add.razor
@@ -3,40 +3,46 @@
@inject NavigationManager NavigationManager
@inject IRoleService RoleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
-@Localizer["Save"]
-@Localizer["Cancel"]
+
@code {
+ private ElementReference form;
+ private bool validated = false;
+
private string _name = string.Empty;
private string _description = string.Empty;
private string _isautoassigned = "False";
@@ -45,24 +51,33 @@
private async Task SaveRole()
{
- var role = new Role();
- role.SiteId = PageState.Page.SiteId;
- role.Name = _name;
- role.Description = _description;
- role.IsAutoAssigned = (_isautoassigned == null ? false : Boolean.Parse(_isautoassigned));
- role.IsSystem = false;
-
- try
+ validated = true;
+ var interop = new Interop(JSRuntime);
+ if (await interop.FormValid(form))
{
- role = await RoleService.AddRoleAsync(role);
- await logger.LogInformation("Role Added {Role}", role);
+ var role = new Role();
+ role.SiteId = PageState.Page.SiteId;
+ role.Name = _name;
+ role.Description = _description;
+ role.IsAutoAssigned = (_isautoassigned == null ? false : Boolean.Parse(_isautoassigned));
+ role.IsSystem = false;
- NavigationManager.NavigateTo(NavigateUrl());
+ try
+ {
+ role = await RoleService.AddRoleAsync(role);
+ await logger.LogInformation("Role Added {Role}", role);
+
+ NavigationManager.NavigateTo(NavigateUrl());
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Adding Role {Role} {Error}", role, ex.Message);
+ AddModuleMessage(Localizer["Error.AddRole"], MessageType.Error);
+ }
}
- catch (Exception ex)
+ else
{
- await logger.LogError(ex, "Error Adding Role {Role} {Error}", role, ex.Message);
- AddModuleMessage(Localizer["Error Adding Role"], MessageType.Error);
+ AddModuleMessage(Localizer["Message.InfoRequired"], MessageType.Warning);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Edit.razor b/Oqtane.Client/Modules/Admin/Roles/Edit.razor
index bac812c9..54d1bb0f 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Edit.razor
@@ -3,44 +3,56 @@
@inject NavigationManager NavigationManager
@inject IRoleService RoleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
-@Localizer["Save"]
-@Localizer["Cancel"]
+
+
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
+
+
+
@code {
+ private ElementReference form;
+ private bool validated = false;
+
private int _roleid;
private string _name = string.Empty;
private string _description = string.Empty;
private string _isautoassigned = "False";
+ private string _createdby;
+ private DateTime _createdon;
+ private string _modifiedby;
+ private DateTime _modifiedon;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
@@ -55,33 +67,46 @@
_name = role.Name;
_description = role.Description;
_isautoassigned = role.IsAutoAssigned.ToString();
+ _createdby = role.CreatedBy;
+ _createdon = role.CreatedOn;
+ _modifiedby = role.ModifiedBy;
+ _modifiedon = role.ModifiedOn;
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Role {RoleId} {Error}", _roleid, ex.Message);
- AddModuleMessage(Localizer["Error Loading Role"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.LoadRole"], MessageType.Error);
}
}
private async Task SaveRole()
{
- var role = await RoleService.GetRoleAsync(_roleid);
- role.Name = _name;
- role.Description = _description;
- role.IsAutoAssigned = (_isautoassigned != null && Boolean.Parse(_isautoassigned));
- role.IsSystem = false;
+ validated = true;
+ var interop = new Interop(JSRuntime);
+ if (await interop.FormValid(form))
+ {
+ var role = await RoleService.GetRoleAsync(_roleid);
+ role.Name = _name;
+ role.Description = _description;
+ role.IsAutoAssigned = (_isautoassigned != null && Boolean.Parse(_isautoassigned));
+ role.IsSystem = false;
- try
- {
- role = await RoleService.UpdateRoleAsync(role);
- await logger.LogInformation("Role Saved {Role}", role);
- NavigationManager.NavigateTo(NavigateUrl());
+ try
+ {
+ role = await RoleService.UpdateRoleAsync(role);
+ await logger.LogInformation("Role Saved {Role}", role);
+ NavigationManager.NavigateTo(NavigateUrl());
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Saving Role {Role} {Error}", role, ex.Message);
+ AddModuleMessage(Localizer["Error.SaveRole"], MessageType.Error);
+ }
}
- catch (Exception ex)
+ else
{
- await logger.LogError(ex, "Error Saving Role {Role} {Error}", role, ex.Message);
- AddModuleMessage(Localizer["Error Saving Role"], MessageType.Error);
+ AddModuleMessage(Localizer["Message.InfoRequired"], MessageType.Warning);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Roles/Index.razor b/Oqtane.Client/Modules/Admin/Roles/Index.razor
index 0bfadcc1..40bc1a86 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Index.razor
@@ -2,10 +2,11 @@
@inherits ModuleBase
@inject IRoleService RoleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_roles == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
@@ -16,11 +17,11 @@ else
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
-
+
@context.Name
@@ -33,6 +34,27 @@ else
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Admin;
protected override async Task OnParametersSetAsync()
+ {
+ await GetRoles();
+ }
+
+ private async Task DeleteRole(Role role)
+ {
+ try
+ {
+ await RoleService.DeleteRoleAsync(role.RoleId);
+ await logger.LogInformation("Role Deleted {Role}", role);
+ await GetRoles();
+ StateHasChanged();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Deleting Role {Role} {Error}", role, ex.Message);
+ AddModuleMessage(Localizer["Error.DeleteRole"], MessageType.Error);
+ }
+ }
+
+ private async Task GetRoles()
{
if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
@@ -44,19 +66,4 @@ else
_roles = await RoleService.GetRolesAsync(PageState.Site.SiteId);
}
}
-
- private async Task DeleteRole(Role role)
- {
- try
- {
- await RoleService.DeleteRoleAsync(role.RoleId);
- await logger.LogInformation("Role Deleted {Role}", role);
- StateHasChanged();
- }
- catch (Exception ex)
- {
- await logger.LogError(ex, "Error Deleting Role {Role} {Error}", role, ex.Message);
- 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 c8049b18..4732c9f5 100644
--- a/Oqtane.Client/Modules/Admin/Roles/Users.razor
+++ b/Oqtane.Client/Modules/Admin/Roles/Users.razor
@@ -3,16 +3,17 @@
@inject IRoleService RoleService
@inject IUserRoleService UserRoleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (userroles == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
-
+
Role:
@@ -24,8 +25,8 @@ else
User:
-
- <@Localizer["Select User"]>
+
+ <@Localizer["User.Select"]>
@foreach (UserRole userrole in users)
{
@userrole.User.DisplayName
@@ -50,8 +51,8 @@ else
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
@@ -67,7 +68,7 @@ else
@context.EffectiveDate
@context.ExpiryDate
-
+
@@ -102,7 +103,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Users"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.Load"], MessageType.Error);
}
}
@@ -116,7 +117,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading User Roles {RoleId} {Error}", roleid, ex.Message);
- AddModuleMessage(Localizer["Error Loading User Roles"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.LoadRole"], MessageType.Error);
}
}
@@ -145,19 +146,19 @@ else
}
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
- AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.User.AssignedRole"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
else
{
- AddModuleMessage(Localizer["You Must Select A User"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.UserSelect"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving User Roles {RoleId} {Error}", roleid, ex.Message);
- AddModuleMessage(Localizer["Error Saving User Roles"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
}
}
@@ -167,14 +168,14 @@ else
{
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
- AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
+ AddModuleMessage(Localizer["Confirm.User.RoleRemoved"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
- AddModuleMessage(Localizer["Error Removing User From Role"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.RemoveRole"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor
index 91630ccf..328c039b 100644
--- a/Oqtane.Client/Modules/Admin/Site/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Site/Index.razor
@@ -3,17 +3,19 @@
@inject NavigationManager NavigationManager
@inject ISiteService SiteService
@inject ITenantService TenantService
+@inject IDatabaseService DatabaseService
@inject IAliasService AliasService
@inject IThemeService ThemeService
@inject ISettingService SettingService
@inject IStringLocalizer Localizer
@inject INotificationService NotificationService
+@inject IStringLocalizer SharedLocalizer
@if (_initialized)
{
-
+
Name:
@@ -22,28 +24,28 @@
- Tenant:
+ Aliases:
-
-
-
-
-
- Aliases:
-
-
-
+ @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
+ {
+
+ }
+ else
+ {
+
+ }
+
Allow User Registration?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -52,9 +54,9 @@
Is Deleted?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -62,7 +64,7 @@
-
+
Logo:
@@ -82,8 +84,8 @@
Default Theme:
- ThemeChanged(e))">
- <@Localizer["Select Theme"]>
+ ThemeChanged(e))">
+ <@Localizer["Theme.Select"]>
@foreach (var theme in _themes)
{
@theme.Name
@@ -96,8 +98,8 @@
Default Container:
-
- <@Localizer["Select Container"]>
+
+ <@Localizer["Container.Select"]>
@foreach (var container in _containers)
{
@container.Name
@@ -110,9 +112,9 @@
Default Admin Container:
-
- <@Localizer["Select Container"]>
- <@Localizer["Default Admin Container"]>
+
+ <@Localizer["Container.Select"]>
+ <@Localizer["DefaultAdminContainer"]>
@foreach (var container in _containers)
{
@container.Name
@@ -125,8 +127,9 @@
-
- @Localizer["Please Note That SMTP Requires The Notification Job To Be Enabled In Scheduled Jobs"]
+
+
+ @Localizer["Smtp.Required.EnableNotificationJob"]
@@ -150,9 +153,9 @@
SSL Enabled:
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -181,19 +184,19 @@
- @Localizer["Test SMTP Configuration"]
+ @Localizer["Smtp.TestConfig"]
-
+
Is Enabled?
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -215,10 +218,40 @@
-
+ @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
+ {
+
+ }
- @Localizer["Save"]
-
+ @SharedLocalizer["Save"]
+
@@ -230,8 +263,6 @@
private List _themes = new List();
private List _containers = new List();
private string _name = string.Empty;
- private List _tenantList;
- private string _tenant = string.Empty;
private List _aliasList;
private string _urls = string.Empty;
private int _logofileid = -1;
@@ -253,6 +284,9 @@
private FileManager _pwaappiconfilemanager;
private int _pwasplashiconfileid = -1;
private FileManager _pwasplashiconfilemanager;
+ private string _tenant = string.Empty;
+ private string _database = string.Empty;
+ private string _connectionstring = string.Empty;
private string _createdby;
private DateTime _createdon;
private string _modifiedby;
@@ -268,18 +302,24 @@
try
{
_themeList = await ThemeService.GetThemesAsync();
- _aliasList = await AliasService.GetAliasesAsync();
Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId);
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())
+ _allowregistration = site.AllowRegistration.ToString();
+ _isdeleted = site.IsDeleted.ToString();
+
+ if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
- _urls += alias.Name + ",";
+ _aliasList = await AliasService.GetAliasesAsync();
+ foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
+ {
+ _urls += alias.Name + ",";
+ }
+ _urls = _urls.Substring(0, _urls.Length - 1);
+
}
- _urls = _urls.Substring(0, _urls.Length - 1);
+
if (site.LogoFileId != null)
{
_logofileid = site.LogoFileId.Value;
@@ -295,7 +335,6 @@
_containers = ThemeService.GetContainerControls(_themeList, _themetype);
_containertype = (!string.IsNullOrEmpty(site.DefaultContainerType)) ? site.DefaultContainerType : Constants.DefaultContainer;
_admincontainertype = (!string.IsNullOrEmpty(site.AdminContainerType)) ? site.AdminContainerType : Constants.DefaultAdminContainer;
- _allowregistration = site.AllowRegistration.ToString();
var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
_smtphost = SettingService.GetSetting(settings, "SMTPHost", string.Empty);
@@ -327,13 +366,25 @@
_pwasplashiconfileid = site.PwaSplashIconFileId.Value;
}
+ if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
+ {
+ var tenants = await TenantService.GetTenantsAsync();
+ var _databases = await DatabaseService.GetDatabasesAsync();
+ var tenant = tenants.Find(item => item.TenantId == site.TenantId);
+ if (tenant != null)
+ {
+ _tenant = tenant.Name;
+ _database = _databases.Find(item => item.DBType == tenant.DBType)?.Name;
+ _connectionstring = tenant.DBConnectionString;
+ }
+ }
+
_createdby = site.CreatedBy;
_createdon = site.CreatedOn;
_modifiedby = site.ModifiedBy;
_modifiedon = site.ModifiedOn;
_deletedby = site.DeletedBy;
_deletedon = site.DeletedOn;
- _isdeleted = site.IsDeleted.ToString();
_initialized = true;
}
@@ -365,7 +416,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message);
- AddModuleMessage(Localizer["Error Loading Pane Layouts For Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.LoadPane"], MessageType.Error);
}
}
@@ -376,11 +427,14 @@
if (_name != string.Empty && _urls != string.Empty && _themetype != "-" && _containertype != "-")
{
var unique = true;
- foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
+ if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
- if (_aliasList.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId))
+ foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
- unique = false;
+ if (_aliasList.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId))
+ {
+ unique = false;
+ }
}
}
@@ -392,34 +446,30 @@
bool refresh = (site.DefaultThemeType != _themetype || site.DefaultContainerType != _containertype);
site.Name = _name;
+ site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
+ site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
+
site.LogoFileId = null;
var logofileid = _logofilemanager.GetFileId();
if (logofileid != -1)
{
site.LogoFileId = logofileid;
}
-
-
var faviconFieldId = _faviconfilemanager.GetFileId();
if (faviconFieldId != -1)
{
site.FaviconFileId = faviconFieldId;
}
-
site.DefaultThemeType = _themetype;
site.DefaultContainerType = _containertype;
site.AdminContainerType = _admincontainertype;
- site.AllowRegistration = (_allowregistration == null ? true : Boolean.Parse(_allowregistration));
- site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted));
site.PwaIsEnabled = (_pwaisenabled == null ? true : Boolean.Parse(_pwaisenabled));
-
var pwaappiconfileid = _pwaappiconfilemanager.GetFileId();
if (pwaappiconfileid != -1)
{
site.PwaAppIconFileId = pwaappiconfileid;
}
-
var pwasplashiconfileid = _pwasplashiconfilemanager.GetFileId();
if (pwasplashiconfileid != -1)
{
@@ -428,27 +478,6 @@
site = await SiteService.UpdateSiteAsync(site);
- var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
- foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
- {
- if (!names.Contains(alias.Name))
- {
- await AliasService.DeleteAliasAsync(alias.AliasId);
- }
- }
-
- foreach (string name in names)
- {
- if (!_aliasList.Exists(item => item.Name == name))
- {
- Alias alias = new Alias();
- alias.Name = name;
- alias.TenantId = site.TenantId;
- alias.SiteId = site.SiteId;
- await AliasService.AddAliasAsync(alias);
- }
- }
-
var settings = await SettingService.GetSiteSettingsAsync(site.SiteId);
SettingService.SetSetting(settings, "SMTPHost", _smtphost);
SettingService.SetSetting(settings, "SMTPPort", _smtpport);
@@ -458,31 +487,56 @@
SettingService.SetSetting(settings, "SMTPSender", _smtpsender);
await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId);
+ if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
+ {
+ var names = _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+ foreach (Alias alias in _aliasList.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList())
+ {
+ if (!names.Contains(alias.Name))
+ {
+ await AliasService.DeleteAliasAsync(alias.AliasId);
+ }
+ }
+
+ foreach (string name in names)
+ {
+ if (!_aliasList.Exists(item => item.Name == name))
+ {
+ Alias alias = new Alias();
+ alias.Name = name;
+ alias.TenantId = site.TenantId;
+ alias.SiteId = site.SiteId;
+ await AliasService.AddAliasAsync(alias);
+ }
+ }
+ }
+
await logger.LogInformation("Site Settings Saved {Site}", site);
+
if (refresh)
{
NavigationManager.NavigateTo(NavigateUrl()); // refresh to show new theme or container
}
else
{
- AddModuleMessage(Localizer["Site Settings Saved"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Settings.SaveSite"], MessageType.Success);
}
}
}
else
{
- AddModuleMessage(Localizer["An Alias Specified Has Already Been Used For Another Site"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Aliases.Taken"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Site Name, Alias, And Default Theme/Container"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.SiteName"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Site {SiteId} {Error}", PageState.Site.SiteId, ex.Message);
- AddModuleMessage(Localizer["Error Saving Site"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.SaveSite"], MessageType.Error);
}
}
@@ -497,7 +551,7 @@
await logger.LogInformation("Site Deleted {SiteId}", PageState.Site.SiteId);
var aliases = await AliasService.GetAliasesAsync();
- foreach (Alias a in aliases.Where(item => item.SiteId == PageState.Site.SiteId))
+ foreach (Alias a in aliases.Where(item => item.SiteId == PageState.Site.SiteId && item.TenantId == PageState.Site.TenantId))
{
await AliasService.DeleteAliasAsync(a.AliasId);
}
@@ -506,13 +560,13 @@
}
else
{
- AddModuleMessage(Localizer["You Are Not Authorized To Delete The Site"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.FailAuth.DeleteSite"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Site {SiteId} {Error}", PageState.Site.SiteId, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Site"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.DeleteSite"], MessageType.Error);
}
}
@@ -533,18 +587,17 @@
await logger.LogInformation("Site SMTP Settings Saved");
await NotificationService.AddNotificationAsync(new Notification(PageState.Site.SiteId, PageState.User.DisplayName, PageState.User.Email, PageState.User.DisplayName, PageState.User.Email, PageState.Site.Name + " SMTP Configuration Test", "SMTP Server Is Configured Correctly."));
- AddModuleMessage(Localizer["SMTP Settings Saved And A Message Has Been Sent To The Email Address Associated To Your User Account... Please Wait A Few Minutes For Delivery. If You Do Not Receive The Email Please Review The Notification Job In Scheduled Jobs For Any Log Details."], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Smtp.SaveSettings"], MessageType.Info);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Testing SMTP Configuration");
- AddModuleMessage(Localizer["Error Testing SMTP Configuration"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Smtp.TestConfig"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["You Must Specify The SMTP Host, Port, And Sender"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.required.Smtp"], MessageType.Warning);
}
-
}
}
diff --git a/Oqtane.Client/Modules/Admin/Sites/Add.razor b/Oqtane.Client/Modules/Admin/Sites/Add.razor
index 832f1b33..016ff9d4 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Add.razor
@@ -11,16 +11,17 @@
@inject IInstallationService InstallationService
@inject IDatabaseService DatabaseService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_tenants == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
-
+
Site Name:
@@ -40,8 +41,8 @@ else
Default Theme:
- ThemeChanged(e))">
- <@Localizer["Select Theme"]>
+ ThemeChanged(e))">
+ <@Localizer["Theme.Select"]>
@foreach (var theme in _themes)
{
@theme.Name
@@ -54,8 +55,8 @@ else
Default Container:
-
- <@Localizer["Select Container"]>
+
+ <@Localizer["Container.Select"]>
@foreach (var container in _containers)
{
@container.Name
@@ -68,9 +69,9 @@ else
Admin Container:
-
- <@Localizer["Select Container"]>
- <@Localizer["Default Admin Container"]>
+
+ <@Localizer["Container.Select"]>
+ <@Localizer["DefaultContainer.Admin"]>
@foreach (var container in _containers)
{
@container.Name
@@ -83,8 +84,8 @@ else
Site Template:
-
- <@Localizer["Select Site Template"]>
+
+ <@Localizer["SiteTemplate.Select"]>
@foreach (SiteTemplate siteTemplate in _siteTemplates)
{
@siteTemplate.Name
@@ -97,9 +98,9 @@ else
Tenant:
- TenantChanged(e))">
- <@Localizer["Select Tenant"]>
- <@Localizer["Create New Tenant"]>
+ TenantChanged(e))">
+ <@Localizer["Tenant.Select"]>
+ <@Localizer["Tenant.Add"]>
@foreach (Tenant tenant in _tenants)
{
@tenant.Name
@@ -127,10 +128,17 @@ else
Database Type:
- DatabaseChanged(e))">
+ DatabaseChanged(e))">
@foreach (var database in _databases)
{
- @Localizer[@database.Name]
+ if (database.IsDefault)
+ {
+ @Localizer[@database.Name]
+ }
+ else
+ {
+ @Localizer[@database.Name]
+ }
}
@@ -157,8 +165,8 @@ else
}
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
}
@code {
@@ -211,7 +219,7 @@ else
}
catch
{
- AddModuleMessage(Localizer["Error loading Database Configuration Control"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Database.LoadConfig"], MessageType.Error);
}
}
@@ -260,7 +268,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Containers For Theme {ThemeType} {Error}", _themetype, ex.Message);
- AddModuleMessage(Localizer["Error Loading Containers For Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.LoadContainers"], MessageType.Error);
}
}
@@ -313,17 +321,17 @@ else
}
else
{
- AddModuleMessage(Localizer["You Must Specify A Server And Database"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Required.ServerDatabase"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["Invalid Host Password"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.InvalidPassword"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["Tenant Name Is Missing Or Already Exists"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.TenantName.Exists"], MessageType.Error);
}
}
else
@@ -365,12 +373,12 @@ else
}
else
{
- AddModuleMessage(Localizer["{0} Already Used For Another Site", string.Join(", ", duplicates.ToArray())], MessageType.Warning);
+ AddModuleMessage(string.Format(Localizer["Message.SiteName.InUse"], string.Join(", ", duplicates.ToArray())), MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Tenant, Site Name, Alias, Default Theme/Container, And Site Template"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.Tenant"], MessageType.Warning);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Sites/Index.razor b/Oqtane.Client/Modules/Admin/Sites/Index.razor
index f0927b1a..f6d829a4 100644
--- a/Oqtane.Client/Modules/Admin/Sites/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Sites/Index.razor
@@ -4,6 +4,7 @@
@inject IAliasService AliasService
@inject ISiteService SiteService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_sites == null)
{
@@ -16,11 +17,13 @@ else
- @Localizer["Name"]
+
+ @SharedLocalizer["Name"]
- @Localizer["Edit"]
- @context.Name
+ Edit(context.Name))">@SharedLocalizer["Edit"]
+ Browse(context.Name))">@Localizer["Browse"]
+ @context.Name
}
@@ -46,4 +49,14 @@ else
}
}
}
+
+ private void Edit(string name)
+ {
+ NavigationManager.NavigateTo(_scheme + name + "/admin/site/?reload");
+ }
+
+ private void Browse(string name)
+ {
+ NavigationManager.NavigateTo(_scheme + name + "/?reload");
+ }
}
diff --git a/Oqtane.Client/Modules/Admin/Sql/Index.razor b/Oqtane.Client/Modules/Admin/Sql/Index.razor
index 5edd39ab..a74d8d54 100644
--- a/Oqtane.Client/Modules/Admin/Sql/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Sql/Index.razor
@@ -2,23 +2,25 @@
@inherits ModuleBase
@inject NavigationManager NavigationManager
@inject ITenantService TenantService
+@inject IDatabaseService DatabaseService
@inject ISqlService SqlService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_tenants == null)
{
- Loading...
+ @SharedLocalizer["Loading"]
}
else
{
@Localizer["Execute"]
@@ -47,6 +68,8 @@ else
@code {
private List _tenants;
private string _tenantid = "-1";
+ private string _database = string.Empty;
+ private string _connectionstring = string.Empty;
private string _sql = string.Empty;
private string _results = string.Empty;
@@ -54,20 +77,59 @@ else
protected override async Task OnInitializedAsync()
{
- _tenants = await TenantService.GetTenantsAsync();
+ try
+ {
+ _tenants = await TenantService.GetTenantsAsync();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading Tenants {Error}", ex.Message);
+ AddModuleMessage(ex.Message, MessageType.Error);
+ }
+ }
+
+ private async void TenantChanged(ChangeEventArgs e)
+ {
+ try
+ {
+ _tenantid = (string)e.Value;
+ var tenants = await TenantService.GetTenantsAsync();
+ var _databases = await DatabaseService.GetDatabasesAsync();
+ var tenant = tenants.Find(item => item.TenantId == int.Parse(_tenantid));
+ if (tenant != null)
+ {
+ _database = _databases.Find(item => item.DBType == tenant.DBType)?.Name;
+ _connectionstring = tenant.DBConnectionString;
+ }
+ StateHasChanged();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading Tenant {TenantId} {Error}", _tenantid, ex.Message);
+ AddModuleMessage(ex.Message, MessageType.Error);
+ }
}
private async Task Execute()
{
- if (_tenantid != "-1" && !string.IsNullOrEmpty(_sql))
+ try
{
- var sqlquery = new SqlQuery { TenantId = int.Parse(_tenantid), Query = _sql };
- sqlquery = await SqlService.ExecuteQueryAsync(sqlquery);
- _results = DisplayResults(sqlquery.Results);
+ if (_tenantid != "-1" && !string.IsNullOrEmpty(_sql))
+ {
+ var sqlquery = new SqlQuery { TenantId = int.Parse(_tenantid), Query = _sql };
+ sqlquery = await SqlService.ExecuteQueryAsync(sqlquery);
+ _results = DisplayResults(sqlquery.Results);
+ AddModuleMessage(Localizer["Success.QueryExecuted"], MessageType.Success);
+ }
+ else
+ {
+ AddModuleMessage(Localizer["Message.Required.Tenant"], MessageType.Warning);
+ }
}
- else
+ catch (Exception ex)
{
- AddModuleMessage(Localizer["You Must Select A Tenant And Provide A SQL Query"], MessageType.Warning);
+ await logger.LogError(ex, "Error Executing SQL Query {SQL} {Error}", _sql, ex.Message);
+ AddModuleMessage(ex.Message, MessageType.Error);
}
}
@@ -105,7 +167,7 @@ else
}
else
{
- table = Localizer["No Results Returned"];
+ table = Localizer["Return.NoResult"];
}
return table;
diff --git a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
index 0cd12dcd..1d8771d3 100644
--- a/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
+++ b/Oqtane.Client/Modules/Admin/SystemInfo/Index.razor
@@ -3,92 +3,206 @@
@inject ISystemService SystemService
@inject IInstallationService InstallationService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
-@Localizer["Access Framework API"]
-
+
+
+
+
+
+
+
+
+
+
+ Blazor Runtime:
+
+
+
+ @Localizer["Server"]
+ @Localizer["WebAssembly"]
+
+
+
+
+
+ Render Mode:
+
+
+
+ @Localizer["Server"]
+ @Localizer["ServerPrerendered"]
+
+
+
+
+
+ Detailed Errors?
+
+
+
+ @SharedLocalizer["True"]
+ @SharedLocalizer["False"]
+
+
+
+
+
+ Logging Level:
+
+
+
+ @Localizer["Trace"]
+ @Localizer["Debug"]
+ @Localizer["Information"]
+ @Localizer["Warning"]
+ @Localizer["Error"]
+ @Localizer["Critical"]
+
+
+
+
+
+ Swagger Enabled?
+
+
+
+ @SharedLocalizer["True"]
+ @SharedLocalizer["False"]
+
+
+
+
+
+ Enable Package Service?
+
+
+
+ @SharedLocalizer["True"]
+ @SharedLocalizer["False"]
+
+
+
+
+
+ @SharedLocalizer["Save"]
+ @Localizer["Access.ApiFramework"]
+
+
+
@code {
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
private string _version = string.Empty;
- private string _runtime = string.Empty;
- private string _rendermode = string.Empty;
private string _clrversion = string.Empty;
private string _osversion = string.Empty;
private string _serverpath = string.Empty;
private string _servertime = string.Empty;
+ private string _installationid = string.Empty;
+
+ private string _runtime = string.Empty;
+ private string _rendermode = string.Empty;
+ private string _detailederrors = string.Empty;
+ private string _logginglevel = string.Empty;
+ private string _swagger = string.Empty;
+ private string _packageservice = string.Empty;
protected override async Task OnInitializedAsync()
{
_version = Constants.Version;
- _runtime = PageState.Runtime.ToString();
Dictionary systeminfo = await SystemService.GetSystemInfoAsync();
if (systeminfo != null)
{
- _rendermode = systeminfo["rendermode"];
_clrversion = systeminfo["clrversion"];
_osversion = systeminfo["osversion"];
_serverpath = systeminfo["serverpath"];
_servertime = systeminfo["servertime"];
+ _installationid = systeminfo["installationid"];
+
+ _runtime = systeminfo["runtime"];
+ _rendermode = systeminfo["rendermode"];
+ _detailederrors = systeminfo["detailederrors"];
+ _logginglevel = systeminfo["logginglevel"];
+ _swagger = systeminfo["swagger"];
+ _packageservice = systeminfo["packageservice"];
+ }
+ }
+
+ private async Task SaveConfig()
+ {
+ try
+ {
+ var settings = new Dictionary();
+ settings.Add("runtime", _runtime);
+ settings.Add("rendermode", _rendermode);
+ settings.Add("detailederrors", _detailederrors);
+ settings.Add("logginglevel", _logginglevel);
+ settings.Add("swagger", _swagger);
+ settings.Add("packageservice", _packageservice);
+ await SystemService.UpdateSystemInfoAsync(settings);
+ AddModuleMessage(Localizer["Success.UpdateConfig.Restart"], MessageType.Success);
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Saving Configuration");
+ AddModuleMessage(Localizer["Error.UpdateConfig"], MessageType.Error);
}
}
@@ -98,7 +212,7 @@
{
ShowProgressIndicator();
var interop = new Interop(JSRuntime);
- await interop.RedirectBrowser(NavigateUrl(""), 10);
+ await interop.RedirectBrowser(NavigateUrl(""), 20);
await InstallationService.RestartAsync();
}
catch (Exception ex)
@@ -106,4 +220,20 @@
await logger.LogError(ex, "Error Restarting Application");
}
}
+
+ private async Task RegisterChecked(ChangeEventArgs e)
+ {
+ try
+ {
+ if ((bool)e.Value)
+ {
+ await InstallationService.RegisterAsync(PageState.User.Email);
+ AddModuleMessage(Localizer["Success.Register"], MessageType.Success);
+ }
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error On Register");
+ }
+ }
}
\ 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 175ed65d..41dbace0 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Add.razor
@@ -5,50 +5,70 @@
@inject IThemeService ThemeService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-@if (_packages != null)
-{
-
- @if (_packages.Count > 0)
+
+
+
+
+
+
+ @if (_packages != null)
{
-
-
+ if (_packages.Count > 0)
+ {
-
- @Localizer["Name"]
- @Localizer["Version"]
-
-
- @context.Name
- @context.Version
- await DownloadTheme(context.PackageId, context.Version))>@Localizer["Download"]
+ @SharedLocalizer["Search.By"]: @context.Owner
+ @(context.Description.Length > 400 ? (context.Description.Substring(0, 400) + "...") : context.Description)
+ @(String.Format("{0:n0}", context.Downloads)) @SharedLocalizer["Search.Downloads"] | @SharedLocalizer["Search.Released"]: @context.ReleaseDate.ToString("MMM dd, yyyy") | @SharedLocalizer["Search.Version"]: @context.Version | @SharedLocalizer["Search.Source"]: @context.PackageUrl
+
+
+ await DownloadTheme(context.PackageId, context.Version))>@SharedLocalizer["Download"]
-
+ }
+ else
+ {
+
+
+ @Localizer["Search.NoResults"]
+
+ }
}
-
-
-
-
+
+
+
+
+
- @Localizer["Install"]
- @Localizer["Cancel"]
-}
+@SharedLocalizer["Install"]
+@SharedLocalizer["Cancel"]
@code {
private List _packages;
+ private string _search = "";
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
@@ -56,9 +76,22 @@
{
try
{
- var themes = await ThemeService.GetThemesAsync();
- _packages = await PackageService.GetPackagesAsync("theme");
+ await LoadThemes();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.Package.Load"], MessageType.Error);
+ }
+ }
+ private async Task LoadThemes()
+ {
+ var themes = await ThemeService.GetThemesAsync();
+ _packages = await PackageService.GetPackagesAsync("theme", _search);
+
+ if (_packages != null)
+ {
foreach (Package package in _packages.ToArray())
{
if (themes.Exists(item => item.PackageName == package.PackageId))
@@ -67,10 +100,30 @@
}
}
}
+ }
+
+ private async Task Search()
+ {
+ try
+ {
+ await LoadThemes();
+ }
catch (Exception ex)
{
- await logger.LogError(ex, "Error Loading Packages {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Packages"], MessageType.Error);
+ await logger.LogError(ex, "Error On Search");
+ }
+ }
+
+ private async Task Reset()
+ {
+ try
+ {
+ _search = "";
+ await LoadThemes();
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error On Reset");
}
}
@@ -79,7 +132,7 @@
try
{
await ThemeService.InstallThemesAsync();
- AddModuleMessage(Localizer["Theme Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Theme.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
catch (Exception ex)
{
@@ -93,13 +146,13 @@
{
await PackageService.DownloadPackageAsync(packageid, version, "Packages");
await logger.LogInformation("Theme {ThemeName} {Version} Downloaded Successfully", packageid, version);
- AddModuleMessage(Localizer["Themes Downloaded Successfully. Click Install To Complete Installation."], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Theme.Download"], MessageType.Success);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Downloading Module {ThemeName} {Version}", packageid, version);
- AddModuleMessage(Localizer["Error Downloading Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.Download"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Themes/Create.razor b/Oqtane.Client/Modules/Admin/Themes/Create.razor
index 491bf746..ba3c1930 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Create.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Create.razor
@@ -6,13 +6,14 @@
@inject IModuleService ModuleService
@inject IPageModuleService PageModuleService
@inject ISettingService SettingService
-@inject IStringLocalizer Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_templates != null)
{
-
+
Owner Name:
@@ -32,8 +33,8 @@
Template:
- TemplateChanged(e))">
- <@Localizer["Select Template"]>
+ TemplateChanged(e))">
+ <@Localizer["Template.Select"]>
@foreach (Template template in _templates)
{
@template.Title
@@ -46,7 +47,7 @@
Framework Reference:
-
+
@foreach (string version in _versions)
{
if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0)
@@ -54,7 +55,7 @@
@(version)
}
}
- @Localizer["Local Version"]
+ @SharedLocalizer["LocalVersion"]
@@ -70,8 +71,8 @@
}
- @Localizer["Create Theme"]
- @Localizer["Cancel"]
+ @Localizer["Theme.Create"]
+ @SharedLocalizer["Cancel"]
}
@code {
@@ -92,7 +93,7 @@
{
_templates = await ThemeService.GetThemeTemplatesAsync();
_versions = Constants.ReleaseVersions.Split(',').Where(item => Version.Parse(item).CompareTo(Version.Parse("2.0.0")) >= 0).ToArray();
- AddModuleMessage(Localizer["Please Note That The Theme Creator Is Only Intended To Be Used In A Development Environment"], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Theme.CreatorIntent"], MessageType.Info);
}
catch (Exception ex)
{
@@ -109,11 +110,11 @@
var theme = new Theme { Owner = _owner, Name = _theme, Template = _template, Version = _reference };
theme = await ThemeService.CreateThemeAsync(theme);
GetLocation();
- AddModuleMessage(Localizer["The Source Code For Your Theme 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 Activate The Module.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Theme.Create"], NavigateUrl("admin/system")), MessageType.Success);
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Valid Owner Name And Theme Name ( ie. No Punctuation Or Spaces And The Values Cannot Be The Same ) And Choose A Template"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.ValidName"], MessageType.Warning);
}
}
catch (Exception ex)
diff --git a/Oqtane.Client/Modules/Admin/Themes/Index.razor b/Oqtane.Client/Modules/Admin/Themes/Index.razor
index fc13417f..a2a3932e 100644
--- a/Oqtane.Client/Modules/Admin/Themes/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/Index.razor
@@ -5,23 +5,24 @@
@inject IThemeService ThemeService
@inject IPackageService PackageService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_themes == null)
{
- Loading...
+ @SharedLocalizer["Loading"]
}
else
{
@((MarkupString)" ")
-
+
- @Localizer["Name"]
- @Localizer["Version"]
+ @SharedLocalizer["Name"]
+ @SharedLocalizer["Version"]
@@ -29,7 +30,7 @@ else
@if (context.AssemblyName != "Oqtane.Client")
{
-
+
}
@context.Name
@@ -37,7 +38,7 @@ else
@if (UpgradeAvailable(context.PackageName, context.Version))
{
- await DownloadTheme(context.PackageName, context.Version))>@Localizer["Upgrade"]
+ await DownloadTheme(context.PackageName, context.Version))>@SharedLocalizer["Upgrade"]
}
@@ -63,7 +64,7 @@ else
if (_themes == null)
{
await logger.LogError(ex, "Error Loading Themes {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Themes"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.Load"], MessageType.Error);
}
}
}
@@ -89,12 +90,12 @@ else
await PackageService.DownloadPackageAsync(packagename, version, "Packages");
await logger.LogInformation("Theme Downloaded {ThemeName} {Version}", packagename, version);
await ThemeService.InstallThemesAsync();
- AddModuleMessage(Localizer["Theme Installed Successfully. You Must Restart Your Application To Apply These Changes.", NavigateUrl("admin/system")], MessageType.Success);
+ AddModuleMessage(string.Format(Localizer["Success.Theme.Install"], NavigateUrl("admin/system")), MessageType.Success);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Downloading Theme {ThemeName} {Version} {Error}", packagename, version, ex.Message);
- AddModuleMessage(Localizer["Error Downloading Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.Download"], MessageType.Error);
}
}
@@ -103,13 +104,13 @@ else
try
{
await ThemeService.DeleteThemeAsync(Theme.ThemeName);
- AddModuleMessage(Localizer["Theme Deleted Successfully"], MessageType.Success);
- NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "reload"));
+ AddModuleMessage(Localizer["Success.Theme.Delete"], MessageType.Success);
+ NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, true));
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting Theme {Theme} {Error}", Theme, ex.Message);
- AddModuleMessage(Localizer["Error Deleting Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.Delete"], 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 d6d4b4de..a9bb2281 100644
--- a/Oqtane.Client/Modules/Admin/Themes/View.razor
+++ b/Oqtane.Client/Modules/Admin/Themes/View.razor
@@ -4,10 +4,11 @@
@inject IThemeService ThemeService
@inject NavigationManager NavigationManager
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Name:
@@ -63,7 +64,7 @@
-@Localizer["Cancel"]
+@SharedLocalizer["Cancel"]
@code {
private string _themeName = "";
@@ -96,7 +97,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Theme {ThemeName} {Error}", _themeName, ex.Message);
- AddModuleMessage(Localizer["Error Loading Theme"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Theme.Loading"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/Upgrade/Index.razor b/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
index b1fc04d8..73679d5b 100644
--- a/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Upgrade/Index.razor
@@ -5,38 +5,36 @@
@inject IPackageService PackageService
@inject IInstallationService InstallationService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-@if (_package != null)
-{
-
-
- @if (_upgradeavailable)
- {
-
- await Download(Constants.PackageId, @_package.Version))>@Localizer["Download"] @_package.Version
- @Localizer["Upgrade"]
- }
- else
- {
-
- }
-
-
-
-
-
-
- Framework:
-
-
-
-
-
-
- @Localizer["Upgrade"]
-
-
-}
+
+
+ @if (_package != null && _upgradeavailable)
+ {
+
+ await Download(Constants.PackageId, @_package.Version))>@SharedLocalizer["Download"] @_package.Version
+ @SharedLocalizer["Upgrade"]
+ }
+ else
+ {
+
+ }
+
+
+
+
+
+
+ Framework:
+
+
+
+
+
+
+ @SharedLocalizer["Upgrade"]
+
+
@code {
private Package _package;
@@ -72,16 +70,16 @@
{
try
{
- AddModuleMessage(Localizer["Please Be Patient While The Upgrade Is In Progress..."], MessageType.Info);
+ AddModuleMessage(Localizer["Info.Upgrade.Wait"], MessageType.Info);
ShowProgressIndicator();
var interop = new Interop(JSRuntime);
- await interop.RedirectBrowser(NavigateUrl(), 30);
+ await interop.RedirectBrowser(NavigateUrl(), 20);
await InstallationService.Upgrade();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Executing Upgrade {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Executing Upgrade"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Upgrade.Execute"], MessageType.Error);
}
}
@@ -91,12 +89,12 @@
{
await PackageService.DownloadPackageAsync(packageid, version, "Packages");
await PackageService.DownloadPackageAsync(Constants.UpdaterPackageId, version, "Packages");
- AddModuleMessage(Localizer["Framework Downloaded Successfully... Please Select Upgrade To Complete the Process"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.Framework.Download"], MessageType.Success);
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Downloading Framework Package {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Downloading Framework Package"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Framework.Download"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Add.razor b/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
index 48959e80..a10e0c3a 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Add.razor
@@ -1,73 +1,74 @@
-@namespace Oqtane.Modules.Admin.UserProfile
-@inherits ModuleBase
-@inject NavigationManager NavigationManager
-@inject IUserService UserService
+@namespace Oqtane.Modules.Admin.UserProfile
+@inherits ModuleBase
+@inject NavigationManager NavigationManager
+@inject IUserService UserService
@inject INotificationService NotificationService
-@inject IStringLocalizer Localizer
-
-@if (PageState.User != null)
-{
-
- @Localizer["Send"]
- @Localizer["Cancel"]
-}
-
-@code {
- private string username = "";
- private string subject = "";
- private string body = "";
-
- public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
-
- public override string Title => "Send Notification";
-
- private async Task Send()
- {
- try
- {
- var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
- if (user != null)
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
+
+@if (PageState.User != null)
+{
+
+ @SharedLocalizer["Send"]
+ @SharedLocalizer["Cancel"]
+}
+
+@code {
+ private string username = "";
+ private string subject = "";
+ private string body = "";
+
+ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
+
+ public override string Title => "Send Notification";
+
+ private async Task Send()
+ {
+ try
+ {
+ var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
+ if (user != null)
{
var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, null);
- notification = await NotificationService.AddNotificationAsync(notification);
- await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
- NavigationManager.NavigateTo(NavigateUrl());
- }
- else
- {
- AddModuleMessage(Localizer["User Does Not Exist. Please Verify That The Username Provided Is Correct."], MessageType.Warning);
- }
- }
- catch (Exception ex)
- {
- await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Adding Notification"], MessageType.Error);
- }
- }
-
-}
+ notification = await NotificationService.AddNotificationAsync(notification);
+ await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
+ NavigationManager.NavigateTo(NavigateUrl());
+ }
+ else
+ {
+ AddModuleMessage(Localizer["Message.User.Invalid"], MessageType.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.Notification.Add"], MessageType.Error);
+ }
+ }
+
+}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
index 9c15f010..54e2d398 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/Index.razor
@@ -7,6 +7,7 @@
@inject INotificationService NotificationService
@inject IFileService FileService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (PageState.User != null && photo != null)
{
@@ -22,56 +23,56 @@ else
{
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
}
@@ -93,13 +94,13 @@ else
category = p.Category;
}
-
+
@p.Title
@if (!string.IsNullOrEmpty(p.Options))
{
- ProfileChanged(e, p.Name))">
+ ProfileChanged(e, p.Name))">
@foreach (var option in p.Options.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
{
@if (GetProfileValue(p.Name, "") == option || (GetProfileValue(p.Name, "") == "" && p.DefaultValue == option))
@@ -129,8 +130,8 @@ else
}
}
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
}
@@ -205,9 +206,9 @@ else
}
- FilterChanged(e))">
+ FilterChanged(e))">
@Localizer["Inbox"]
- @Localizer["Sent Items"]
+ @Localizer["Items.Sent"]
}
@@ -258,13 +259,13 @@ else
}
else
{
- AddModuleMessage(Localizer["Current User Is Not Logged In"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.User.NoLogIn"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading User Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Load"], MessageType.Error);
}
}
@@ -304,18 +305,18 @@ else
}
else
{
- AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Password.Invalid"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Username and Email Address As Well As All Required Profile Information"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving User Profile {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Saving User Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Save"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/UserProfile/View.razor b/Oqtane.Client/Modules/Admin/UserProfile/View.razor
index 263a0345..555190c1 100644
--- a/Oqtane.Client/Modules/Admin/UserProfile/View.razor
+++ b/Oqtane.Client/Modules/Admin/UserProfile/View.razor
@@ -1,201 +1,202 @@
-@namespace Oqtane.Modules.Admin.UserProfile
-@inherits ModuleBase
-@inject NavigationManager NavigationManager
-@inject IUserService UserService
+@namespace Oqtane.Modules.Admin.UserProfile
+@inherits ModuleBase
+@inject NavigationManager NavigationManager
+@inject IUserService UserService
@inject INotificationService NotificationService
-@inject IStringLocalizer Localizer
-
-@if (PageState.User != null)
-{
-
-
-
- @if (reply != string.Empty)
- {
- @Localizer["Send"]
- }
- else
- {
- if (title == "From")
- {
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
+
+@if (PageState.User != null)
+{
+
+
+
+ @if (reply != string.Empty)
+ {
+ @SharedLocalizer["Send"]
+ }
+ else
+ {
+ if (title == "From")
+ {
@Localizer["Reply"]
- }
- }
- @Localizer["Cancel"]
-
-
- @if (title == "To")
- {
-
- @Localizer["Original Message"]
-
-
- }
-}
-
-@code {
- private int notificationid;
- private string title = string.Empty;
- private string username = "";
- private string subject = string.Empty;
- private string createdon = string.Empty;
- private string body = string.Empty;
- private string reply = string.Empty;
-
- public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
- public override string Title => "View Notification";
-
- protected override async Task OnInitializedAsync()
- {
- try
- {
- notificationid = Int32.Parse(PageState.QueryString["id"]);
- Notification notification = await NotificationService.GetNotificationAsync(notificationid);
- if (notification != null)
- {
- int userid = -1;
- if (notification.ToUserId == PageState.User.UserId)
- {
- title = "From";
- if (notification.FromUserId != null)
- {
- userid = notification.FromUserId.Value;
- }
- }
- else
- {
- title = "To";
- if (notification.ToUserId != null)
- {
- userid = notification.ToUserId.Value;
- }
- }
- if (userid != -1)
- {
- var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
- if (user != null)
- {
- username = user.Username;
- }
- }
- if (username == "")
- {
- username = "System";
- }
- subject = notification.Subject;
- createdon = notification.CreatedOn.ToString();
- body = notification.Body;
- }
- }
- catch (Exception ex)
- {
- await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Users"], MessageType.Error);
- }
- }
-
- private void Reply()
- {
- title = "To";
- if (!subject.Contains("RE:"))
- {
- subject = "RE: " + subject;
- }
- reply = body;
- body = "\n\n____________________________________________\nSent: " + createdon + "\nSubject: " + subject + "\n\n" + body;
- StateHasChanged();
- }
-
- private async Task Send()
- {
- try
- {
- var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
- if (user != null)
+ }
+ }
+ @SharedLocalizer["Cancel"]
+
+
+ @if (title == "To")
+ {
+
+ @Localizer["OriginalMessage"]
+
+
+ }
+}
+
+@code {
+ private int notificationid;
+ private string title = string.Empty;
+ private string username = "";
+ private string subject = string.Empty;
+ private string createdon = string.Empty;
+ private string body = string.Empty;
+ private string reply = string.Empty;
+
+ public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.View;
+ public override string Title => "View Notification";
+
+ protected override async Task OnInitializedAsync()
+ {
+ try
+ {
+ notificationid = Int32.Parse(PageState.QueryString["id"]);
+ Notification notification = await NotificationService.GetNotificationAsync(notificationid);
+ if (notification != null)
+ {
+ int userid = -1;
+ if (notification.ToUserId == PageState.User.UserId)
+ {
+ title = "From";
+ if (notification.FromUserId != null)
+ {
+ userid = notification.FromUserId.Value;
+ }
+ }
+ else
+ {
+ title = "To";
+ if (notification.ToUserId != null)
+ {
+ userid = notification.ToUserId.Value;
+ }
+ }
+ if (userid != -1)
+ {
+ var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
+ if (user != null)
+ {
+ username = user.Username;
+ }
+ }
+ if (username == "")
+ {
+ username = "System";
+ }
+ subject = notification.Subject;
+ createdon = notification.CreatedOn.ToString();
+ body = notification.Body;
+ }
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Loading Users {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.User.Load"], MessageType.Error);
+ }
+ }
+
+ private void Reply()
+ {
+ title = "To";
+ if (!subject.Contains("RE:"))
+ {
+ subject = "RE: " + subject;
+ }
+ reply = body;
+ body = "\n\n____________________________________________\nSent: " + createdon + "\nSubject: " + subject + "\n\n" + body;
+ StateHasChanged();
+ }
+
+ private async Task Send()
+ {
+ try
+ {
+ var user = await UserService.GetUserAsync(username, PageState.Site.SiteId);
+ if (user != null)
{
var notification = new Notification(PageState.Site.SiteId, PageState.User, user, subject, body, notificationid);
- notification = await NotificationService.AddNotificationAsync(notification);
- await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
- NavigationManager.NavigateTo(NavigateUrl());
- }
- else
- {
- 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 {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Adding Notification"], MessageType.Error);
- }
- }
-}
-
+ notification = await NotificationService.AddNotificationAsync(notification);
+ await logger.LogInformation("Notification Created {NotificationId}", notification.NotificationId);
+ NavigationManager.NavigateTo(NavigateUrl());
+ }
+ else
+ {
+ AddModuleMessage(Localizer["Message.User.Invalid"], MessageType.Warning);
+ }
+ }
+ catch (Exception ex)
+ {
+ await logger.LogError(ex, "Error Adding Notification {Error}", ex.Message);
+ AddModuleMessage(Localizer["Error.Notification.Add"], MessageType.Error);
+ }
+ }
+}
+
diff --git a/Oqtane.Client/Modules/Admin/Users/Add.razor b/Oqtane.Client/Modules/Admin/Users/Add.razor
index 176050d3..386bd1b0 100644
--- a/Oqtane.Client/Modules/Admin/Users/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Add.razor
@@ -5,6 +5,7 @@
@inject IProfileService ProfileService
@inject ISettingService SettingService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@@ -12,43 +13,43 @@
{
@@ -71,7 +72,7 @@
category = p.Category;
}
-
+
@p.Title
@@ -91,8 +92,8 @@
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
@code {
private string username = string.Empty;
@@ -116,7 +117,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading User Profile {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading User Profile"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Profile.Load"], MessageType.Error);
}
}
@@ -153,28 +154,28 @@
else
{
await logger.LogError("Error Adding User {Username} {Email}", username, email);
- AddModuleMessage(Localizer["Error Adding User. Please Ensure Password Meets Complexity Requirements And Username And Email Are Not Already In Use."], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.AddCheckPass"], MessageType.Error);
}
}
else
{
- AddModuleMessage(Localizer["Username Already Exists"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Username.Exists"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Username, Password, Email Address And All Required Profile Information"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Adding User {Username} {Email} {Error}", username, email, ex.Message);
- AddModuleMessage(Localizer["Error Adding User"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.Add"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Users/Edit.razor b/Oqtane.Client/Modules/Admin/Users/Edit.razor
index 19254613..5f53e756 100644
--- a/Oqtane.Client/Modules/Admin/Users/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Edit.razor
@@ -6,6 +6,7 @@
@inject ISettingService SettingService
@inject IFileService FileService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (PageState.User != null && photo != null)
{
@@ -21,48 +22,48 @@ else
{
-
- @Localizer["Username:"]
+
+
-
+
- @Localizer["Password:"]
+
-
+
- @Localizer["Confirm Password:"]
+
-
+
- @Localizer["Email:"]
+
-
+
- @Localizer["Full Name:"]
+
-
+
- @Localizer["Photo:"]
+
@@ -70,12 +71,12 @@ else
- @Localizer["Is Deleted?"]
+
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
@@ -99,7 +100,7 @@ else
category = p.Category;
}
-
+
@p.Title
@@ -119,8 +120,8 @@ else
-@Localizer["Save"]
-@Localizer["Cancel"]
+@SharedLocalizer["Save"]
+@SharedLocalizer["Cancel"]
@@ -152,39 +153,42 @@ else
{
try
{
- profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
-
- userid = Int32.Parse(PageState.QueryString["id"]);
- var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
- if (user != null)
+ // OnParametersSetAsync is called when the edit modal is closed - in which case there is no id parameter
+ if (PageState.QueryString.ContainsKey("id"))
{
- username = user.Username;
- email = user.Email;
- displayname = user.DisplayName;
- if (user.PhotoFileId != null)
+ profiles = await ProfileService.GetProfilesAsync(PageState.Site.SiteId);
+ userid = Int32.Parse(PageState.QueryString["id"]);
+ var user = await UserService.GetUserAsync(userid, PageState.Site.SiteId);
+ if (user != null)
{
- photofileid = user.PhotoFileId.Value;
- photo = await FileService.GetFileAsync(photofileid);
+ username = user.Username;
+ email = user.Email;
+ displayname = user.DisplayName;
+ if (user.PhotoFileId != null)
+ {
+ photofileid = user.PhotoFileId.Value;
+ photo = await FileService.GetFileAsync(photofileid);
+ }
+ else
+ {
+ photofileid = -1;
+ photo = null;
+ }
+ settings = await SettingService.GetUserSettingsAsync(user.UserId);
+ createdby = user.CreatedBy;
+ createdon = user.CreatedOn;
+ modifiedby = user.ModifiedBy;
+ modifiedon = user.ModifiedOn;
+ deletedby = user.DeletedBy;
+ deletedon = user.DeletedOn;
+ isdeleted = user.IsDeleted.ToString();
}
- else
- {
- photofileid = -1;
- photo = null;
- }
- settings = await SettingService.GetUserSettingsAsync(user.UserId);
- createdby = user.CreatedBy;
- createdon = user.CreatedOn;
- modifiedby = user.ModifiedBy;
- modifiedon = user.ModifiedOn;
- deletedby = user.DeletedBy;
- deletedon = user.DeletedOn;
- isdeleted = user.IsDeleted.ToString();
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading User {UserId} {Error}", userid, ex.Message);
- AddModuleMessage(Localizer["Error Loading User"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.Load"], MessageType.Error);
}
}
@@ -222,18 +226,18 @@ else
}
else
{
- AddModuleMessage(Localizer["Passwords Entered Do Not Match"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Password.NoMatch"], MessageType.Warning);
}
}
else
{
- AddModuleMessage(Localizer["You Must Provide A Username, Password, Email Address, And All Required Profile Information"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.ProfileInfo"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving User {Username} {Email} {Error}", username, email, ex.Message);
- AddModuleMessage(Localizer["Error Saving User"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.Save"], MessageType.Error);
}
}
diff --git a/Oqtane.Client/Modules/Admin/Users/Index.razor b/Oqtane.Client/Modules/Admin/Users/Index.razor
index 4245c649..e14dc97d 100644
--- a/Oqtane.Client/Modules/Admin/Users/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Index.razor
@@ -4,39 +4,43 @@
@inject IUserService UserService
@inject ISettingService SettingService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (userroles == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
-
+
- @Localizer["Name"]
+ @SharedLocalizer["Name"]
-
+
@@ -66,7 +70,7 @@ else
if (string.IsNullOrEmpty(_search))
{
- results = results.Where(item =>
+ results = results.Where(item =>
(
item.User.Username.Contains(search, StringComparison.OrdinalIgnoreCase) ||
item.User.Email.Contains(search, StringComparison.OrdinalIgnoreCase) ||
diff --git a/Oqtane.Client/Modules/Admin/Users/Roles.razor b/Oqtane.Client/Modules/Admin/Users/Roles.razor
index 13c4e780..260ecb12 100644
--- a/Oqtane.Client/Modules/Admin/Users/Roles.razor
+++ b/Oqtane.Client/Modules/Admin/Users/Roles.razor
@@ -4,16 +4,17 @@
@inject IUserService UserService
@inject IUserRoleService UserRoleService
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (userroles == null)
{
- @Localizer["Loading..."]
+ @SharedLocalizer["Loading"]
}
else
{
-
+
User:
@@ -25,8 +26,8 @@ else
Role:
-
- <@Localizer["Select Role"]>
+
+ <@Localizer["Role.Select"]>
@foreach (Role role in roles)
{
@role.Name
@@ -51,8 +52,8 @@ else
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
@@ -68,7 +69,7 @@ else
@context.EffectiveDate
@context.ExpiryDate
-
+
@@ -107,7 +108,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading Roles {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Loading Roles"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.LoadRole"], MessageType.Error);
}
}
@@ -121,7 +122,7 @@ else
catch (Exception ex)
{
await logger.LogError(ex, "Error Loading User Roles {UserId} {Error}", userid, ex.Message);
- AddModuleMessage(Localizer["Error Loading User Roles"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.LoadRole"], MessageType.Error);
}
}
@@ -181,19 +182,19 @@ else
}
await logger.LogInformation("User Assigned To Role {UserRole}", userrole);
- AddModuleMessage(Localizer["User Assigned To Role"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.User.AssignRole"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
else
{
- AddModuleMessage(Localizer["You Must Select A Role"], MessageType.Warning);
+ AddModuleMessage(Localizer["Message.Required.Role"], MessageType.Warning);
}
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving User Roles {UserId} {Error}", userid, ex.Message);
- AddModuleMessage(Localizer["Error Saving User Roles"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.SaveRole"], MessageType.Error);
}
}
@@ -203,14 +204,14 @@ else
{
await UserRoleService.DeleteUserRoleAsync(UserRoleId);
await logger.LogInformation("User Removed From Role {UserRoleId}", UserRoleId);
- AddModuleMessage(Localizer["User Removed From Role"], MessageType.Success);
+ AddModuleMessage(Localizer["Success.User.Remove"], MessageType.Success);
await GetUserRoles();
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Removing User From Role {UserRoleId} {Error}", UserRoleId, ex.Message);
- AddModuleMessage(Localizer["Error Removing User From Role"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.User.RemoveRole"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/Controls/ActionDialog.razor b/Oqtane.Client/Modules/Controls/ActionDialog.razor
index 43d6e0af..5cda1386 100644
--- a/Oqtane.Client/Modules/Controls/ActionDialog.razor
+++ b/Oqtane.Client/Modules/Controls/ActionDialog.razor
@@ -9,7 +9,7 @@
@Message
diff --git a/Oqtane.Client/Modules/Controls/AuditInfo.razor b/Oqtane.Client/Modules/Controls/AuditInfo.razor
index aa2cf790..1584fd6e 100644
--- a/Oqtane.Client/Modules/Controls/AuditInfo.razor
+++ b/Oqtane.Client/Modules/Controls/AuditInfo.razor
@@ -44,12 +44,12 @@
if (!String.IsNullOrEmpty(CreatedBy))
{
- _text += $" {Localizer["by"]}
{CreatedBy} ";
+ _text += $" {Localizer["By"]}
{CreatedBy} ";
}
if (CreatedOn != null)
{
- _text += $" {Localizer["on"]}
{CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss")} ";
+ _text += $" {Localizer["On"]}
{CreatedOn.Value.ToString("MMM dd yyyy HH:mm:ss")} ";
}
_text += "";
@@ -57,7 +57,7 @@
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn.HasValue)
{
- _text += $"
{Localizer["Last modified"]} ";
+ _text += $"
{Localizer["LastModified"]} ";
if (!String.IsNullOrEmpty(ModifiedBy))
{
@@ -78,12 +78,12 @@
if (!String.IsNullOrEmpty(DeletedBy))
{
- _text += $" {Localizer["by"]} {DeletedBy} ";
+ _text += $" {Localizer["By"]} {DeletedBy} ";
}
if (DeletedOn != null)
{
- _text += $" {Localizer["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 df468bbe..9628ff48 100644
--- a/Oqtane.Client/Modules/Controls/FileManager.razor
+++ b/Oqtane.Client/Modules/Controls/FileManager.razor
@@ -3,6 +3,7 @@
@inject IFolderService FolderService
@inject IFileService FileService
@inject IStringLocalizer
Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_folders != null)
{
@@ -12,10 +13,10 @@
@if (ShowFolders || FolderId <= 0)
{
-
FolderChanged(e))">
+ FolderChanged(e))">
@if (string.IsNullOrEmpty(Folder))
{
- <@Localizer["Select Folder"]>
+ <@Localizer["Folder.Select"]>
}
@foreach (Folder folder in _folders)
{
@@ -27,8 +28,8 @@
@if (ShowFiles)
{
@@ -208,7 +209,7 @@
{
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
- _message = Localizer["Error Loading Files"];
+ _message = Localizer["Error.File.Load"];
_messagetype = MessageType.Error;
}
}
@@ -268,7 +269,7 @@
{
await logger.LogInformation("File Upload Succeeded {Files}", upload);
- _message = Localizer["File Upload Succeeded"];
+ _message = Localizer["Success.File.Upload"];
_messagetype = MessageType.Success;
await GetFiles();
@@ -288,7 +289,7 @@
{
await logger.LogError("File Upload Failed For {Files}", result.Replace(",", ", "));
- _message = Localizer["File Upload Failed"];
+ _message = Localizer["Error.File.Upload"];
_messagetype = MessageType.Error;
}
}
@@ -296,13 +297,13 @@
{
await logger.LogError(ex, "File Upload Failed {Error}", ex.Message);
- _message = Localizer["File Upload Failed"];
+ _message = Localizer["Error.File.Upload"];
_messagetype = MessageType.Error;
}
}
else
{
- _message = Localizer["You Have Not Selected A File To Upload"];
+ _message = Localizer["Message.File.NotSelected"];
_messagetype = MessageType.Warning;
}
}
@@ -315,7 +316,7 @@
await FileService.DeleteFileAsync(FileId);
await logger.LogInformation("File Deleted {File}", FileId);
- _message = Localizer["File Deleted"];
+ _message = Localizer["Success.File.Delete"];
_messagetype = MessageType.Success;
await GetFiles();
@@ -327,7 +328,7 @@
{
await logger.LogError(ex, "Error Deleting File {File} {Error}", FileId, ex.Message);
- _message = Localizer["Error Deleting File"];
+ _message = Localizer["Error.File.Delete"];
_messagetype = MessageType.Error;
}
}
diff --git a/Oqtane.Client/Modules/Controls/Label.razor b/Oqtane.Client/Modules/Controls/Label.razor
index b67143cb..f237d5f3 100644
--- a/Oqtane.Client/Modules/Controls/Label.razor
+++ b/Oqtane.Client/Modules/Controls/Label.razor
@@ -30,6 +30,11 @@ else
{
base.OnParametersSet();
+ if (string.IsNullOrEmpty(Class))
+ {
+ Class = "form-label";
+ }
+
_openLabel = "
+
@((MarkupString)_message)
@if (Type == MessageType.Error && PageState != null && UserSecurity.IsAuthorized(PageState.User, RoleNames.Host))
{
@((MarkupString)" ")View Details
}
+
}
@@ -54,4 +55,10 @@
return classname;
}
+
+ private void DismissModal()
+ {
+ _message = "";
+ StateHasChanged();
+ }
}
diff --git a/Oqtane.Client/Modules/Controls/Pager.razor b/Oqtane.Client/Modules/Controls/Pager.razor
index c89b1301..c0b285b7 100644
--- a/Oqtane.Client/Modules/Controls/Pager.razor
+++ b/Oqtane.Client/Modules/Controls/Pager.razor
@@ -8,15 +8,15 @@
@if (_endPage > 1)
{
-
UpdateList(1))>
+
UpdateList(1))>
}
@if (_page > _maxPages)
{
-
SetPagerSize("back"))>
+
SetPagerSize("back"))>
}
@if (_endPage > 1)
{
-
NavigateToPage("previous"))>
+
NavigateToPage("previous"))>
@for (int i = _startPage; i <= _endPage; i++)
{
var pager = i;
@@ -24,15 +24,15 @@
@pager
}
-
NavigateToPage("next"))>
+
NavigateToPage("next"))>
}
@if (_endPage < _pages)
{
-
SetPagerSize("forward"))>
+
SetPagerSize("forward"))>
}
@if (_endPage > 1)
{
-
UpdateList(_pages))>
+
UpdateList(_pages))>
}
@if (_endPage > 1)
{
diff --git a/Oqtane.Client/Modules/Controls/PermissionGrid.razor b/Oqtane.Client/Modules/Controls/PermissionGrid.razor
index a35a5209..cca00dc5 100644
--- a/Oqtane.Client/Modules/Controls/PermissionGrid.razor
+++ b/Oqtane.Client/Modules/Controls/PermissionGrid.razor
@@ -2,12 +2,13 @@
@inherits ModuleControlBase
@inject IRoleService RoleService
@inject IUserService UserService
-@inject IStringLocalizer
Localizer
+@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_permissions != null)
{
-
+
@Localizer["Role"]
@@ -33,7 +34,7 @@
@if (_users.Count != 0)
{
-
+
@Localizer["User"]
@@ -61,12 +62,12 @@
}
-
+
-
- @Localizer["Add"]
+
+ @SharedLocalizer["Add"]
@@ -180,7 +181,7 @@
}
catch
{
- _message = Localizer["Username Does Not Exist"];
+ _message = Localizer["Message.Username.DontExist"];
}
}
diff --git a/Oqtane.Client/Modules/Controls/RichTextEditor.razor b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
index ce50272d..793761f5 100644
--- a/Oqtane.Client/Modules/Controls/RichTextEditor.razor
+++ b/Oqtane.Client/Modules/Controls/RichTextEditor.razor
@@ -14,9 +14,9 @@
}
-
-
@Localizer["Synchronize Content"]
-
@Localizer["Insert Image"]
+
+ @Localizer["SynchronizeContent"]
+ @Localizer["InsertImage"]
@if (_filemanagervisible)
{
@((MarkupString)" ")
@@ -66,8 +66,8 @@
-
-
@Localizer["Synchronize Content"]
+
+ @Localizer["SynchronizeContent"]
@if (ReadOnly)
{
@@ -143,6 +143,8 @@
await interop.LoadEditorContent(_editorElement, Content);
+ _content = Content; // raw HTML
+
// preserve a copy of the rich text content ( Quill sanitizes content so we need to retrieve it from the editor )
_original = await interop.GetHtml(_editorElement);
}
@@ -200,7 +202,7 @@
}
else
{
- _message = Localizer["You Must Select An Image To Insert"];
+ _message = Localizer["Message.Require.Image"];
}
}
else
diff --git a/Oqtane.Client/Modules/Controls/Section.razor b/Oqtane.Client/Modules/Controls/Section.razor
index 7f253cc2..3620d893 100644
--- a/Oqtane.Client/Modules/Controls/Section.razor
+++ b/Oqtane.Client/Modules/Controls/Section.razor
@@ -1,14 +1,14 @@
@namespace Oqtane.Modules.Controls
@inherits LocalizableComponent
-
+
-
-
+
diff --git a/Oqtane.Client/Modules/Controls/TabStrip.razor b/Oqtane.Client/Modules/Controls/TabStrip.razor
index b2806a82..2d423818 100644
--- a/Oqtane.Client/Modules/Controls/TabStrip.razor
+++ b/Oqtane.Client/Modules/Controls/TabStrip.razor
@@ -10,13 +10,13 @@
@if (tabPanel.Name == ActiveTab)
{
-
+
@tabPanel.DisplayHeading()
}
else
{
-
+
@tabPanel.DisplayHeading()
}
diff --git a/Oqtane.Client/Modules/Controls/TriStateCheckBox.razor b/Oqtane.Client/Modules/Controls/TriStateCheckBox.razor
index 26991f37..538aa3ae 100644
--- a/Oqtane.Client/Modules/Controls/TriStateCheckBox.razor
+++ b/Oqtane.Client/Modules/Controls/TriStateCheckBox.razor
@@ -52,11 +52,11 @@
{
case true:
_src = "images/checked.png";
- _title = Localizer["Permission Granted"];
+ _title = Localizer["PermissionGranted"];
break;
case false:
_src = "images/unchecked.png";
- _title = Localizer["Permission Denied"];
+ _title = Localizer["PermissionDenied"];
break;
case null:
_src = "images/null.png";
diff --git a/Oqtane.Client/Modules/HtmlText/Edit.razor b/Oqtane.Client/Modules/HtmlText/Edit.razor
index 5e93e330..bc94cebc 100644
--- a/Oqtane.Client/Modules/HtmlText/Edit.razor
+++ b/Oqtane.Client/Modules/HtmlText/Edit.razor
@@ -7,12 +7,13 @@
@inject ISettingService SettingService
@inject NavigationManager NavigationManager
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
@if (_content != null)
{
- @Localizer["Save"]
- @Localizer["Cancel"]
+ @SharedLocalizer["Save"]
+ @SharedLocalizer["Cancel"]
@if (!string.IsNullOrEmpty(_content))
{
@@ -96,7 +97,7 @@
catch (Exception ex)
{
await logger.LogError(ex, "Error Saving Content {Error}", ex.Message);
- AddModuleMessage(Localizer["Error Saving Content"], MessageType.Error);
+ AddModuleMessage(Localizer["Error.Content.Save"], MessageType.Error);
}
}
}
diff --git a/Oqtane.Client/Modules/HtmlText/Index.razor b/Oqtane.Client/Modules/HtmlText/Index.razor
index 21263f72..b1dc8fd6 100644
--- a/Oqtane.Client/Modules/HtmlText/Index.razor
+++ b/Oqtane.Client/Modules/HtmlText/Index.razor
@@ -2,17 +2,21 @@
@namespace Oqtane.Modules.HtmlText
@inherits ModuleBase
@inject IHtmlTextService HtmlTextService
+@inject IStringLocalizer Localizer
@((MarkupString)content)
@if (PageState.EditMode)
{
-
+
+
+
+
}
@code {
public override List Resources => new List()
- {
+{
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" }
};
diff --git a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
index a90451cd..73776394 100644
--- a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
+++ b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
@@ -1,5 +1,3 @@
-using System.Collections.Generic;
-using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Oqtane.Services;
@@ -9,34 +7,28 @@ namespace Oqtane.Modules.HtmlText.Services
{
public class HtmlTextService : ServiceBase, IHtmlTextService, IService
{
- private readonly SiteState _siteState;
+ public HtmlTextService(HttpClient http, SiteState siteState) : base(http, siteState) {}
- public HtmlTextService(HttpClient http, SiteState siteState) : base(http)
- {
- _siteState = siteState;
- }
-
- private string ApiUrl => CreateApiUrl("HtmlText", _siteState.Alias);
+ private string ApiUrl => CreateApiUrl("HtmlText");
public async Task GetHtmlTextAsync(int moduleId)
{
- var htmltext = await GetJsonAsync>(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", new Dictionary() { { EntityNames.Module, moduleId } }));
- return htmltext.FirstOrDefault();
+ return await GetJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", EntityNames.Module, moduleId));
}
public async Task AddHtmlTextAsync(Models.HtmlText htmlText)
{
- await PostJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}", new Dictionary() { { EntityNames.Module, htmlText.ModuleId } }), htmlText);
+ await PostJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}", EntityNames.Module, htmlText.ModuleId), htmlText);
}
public async Task UpdateHtmlTextAsync(Models.HtmlText htmlText)
{
- await PutJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{htmlText.HtmlTextId}", new Dictionary() { { EntityNames.Module, htmlText.ModuleId } }), htmlText);
+ await PutJsonAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{htmlText.HtmlTextId}", EntityNames.Module, htmlText.ModuleId), htmlText);
}
public async Task DeleteHtmlTextAsync(int moduleId)
{
- await DeleteAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", new Dictionary() { { EntityNames.Module, moduleId } }));
+ await DeleteAsync(CreateAuthorizationPolicyUrl($"{ApiUrl}/{moduleId}", EntityNames.Module, moduleId));
}
}
}
diff --git a/Oqtane.Client/Modules/HtmlText/Settings.razor b/Oqtane.Client/Modules/HtmlText/Settings.razor
index 6e7795e4..cf903c0e 100644
--- a/Oqtane.Client/Modules/HtmlText/Settings.razor
+++ b/Oqtane.Client/Modules/HtmlText/Settings.razor
@@ -3,16 +3,17 @@
@inject ISettingService SettingService
@implements Oqtane.Interfaces.ISettingsControl
@inject IStringLocalizer Localizer
+@inject IStringLocalizer SharedLocalizer
-
+
Allow File Management:
-
- @Localizer["Yes"]
- @Localizer["No"]
+
+ @SharedLocalizer["Yes"]
+ @SharedLocalizer["No"]
diff --git a/Oqtane.Client/Modules/ModuleBase.cs b/Oqtane.Client/Modules/ModuleBase.cs
index 3fd548ac..e7c6658d 100644
--- a/Oqtane.Client/Modules/ModuleBase.cs
+++ b/Oqtane.Client/Modules/ModuleBase.cs
@@ -84,11 +84,21 @@ namespace Oqtane.Modules
return NavigateUrl(path, "");
}
+ public string NavigateUrl(bool refresh)
+ {
+ return NavigateUrl(PageState.Page.Path, refresh);
+ }
+
public string NavigateUrl(string path, string parameters)
{
return Utilities.NavigateUrl(PageState.Alias.Path, path, parameters);
}
+ public string NavigateUrl(string path, bool refresh)
+ {
+ return Utilities.NavigateUrl(PageState.Alias.Path, path, refresh ? "refresh" : "");
+ }
+
public string EditUrl(string action)
{
return EditUrl(ModuleState.ModuleId, action);
diff --git a/Oqtane.Client/Oqtane.Client.csproj b/Oqtane.Client/Oqtane.Client.csproj
index 24e2efb7..1971e531 100644
--- a/Oqtane.Client/Oqtane.Client.csproj
+++ b/Oqtane.Client/Oqtane.Client.csproj
@@ -5,7 +5,7 @@
Exe
3.0
Debug;Release
- 2.1.0
+ 2.2.0
Oqtane
Shaun Walker
.NET Foundation
@@ -13,7 +13,7 @@
.NET Foundation
https://www.oqtane.org
https://github.com/oqtane/oqtane.framework/blob/dev/LICENSE
- https://github.com/oqtane/oqtane.framework/releases/tag/v2.1.0
+ https://github.com/oqtane/oqtane.framework/releases/tag/v2.2.0
https://github.com/oqtane/oqtane.framework
Git
Oqtane
@@ -33,4 +33,9 @@
+
+
+
+
+
diff --git a/Oqtane.Client/Program.cs b/Oqtane.Client/Program.cs
index 3ae04bd8..f27f0c2e 100644
--- a/Oqtane.Client/Program.cs
+++ b/Oqtane.Client/Program.cs
@@ -8,14 +8,11 @@ using System.Net.Http;
using System.Reflection;
using System.Runtime.Loader;
using System.Threading.Tasks;
-using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.JSInterop;
-using Oqtane.Interfaces;
using Oqtane.Modules;
-using Oqtane.Providers;
using Oqtane.Services;
using Oqtane.Shared;
using Oqtane.UI;
@@ -28,7 +25,8 @@ namespace Oqtane.Client
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add("app");
- HttpClient httpClient = new HttpClient {BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)};
+
+ var httpClient = new HttpClient {BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)};
builder.Services.AddSingleton(httpClient);
builder.Services.AddOptions();
@@ -37,38 +35,10 @@ namespace Oqtane.Client
builder.Services.AddLocalization(options => options.ResourcesPath = "Resources");
// register auth services
- builder.Services.AddAuthorizationCore();
- builder.Services.AddScoped();
- builder.Services.AddScoped(s => s.GetRequiredService());
+ builder.Services.AddOqtaneAuthorization();
// register scoped core services
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
- builder.Services.AddScoped();
+ builder.Services.AddOqtaneScopedServices();
await LoadClientAssemblies(httpClient);
@@ -76,38 +46,15 @@ namespace Oqtane.Client
foreach (var assembly in assemblies)
{
// dynamically register module services
- var implementationTypes = assembly.GetInterfaces();
- foreach (var implementationType in implementationTypes)
- {
- if (implementationType.AssemblyQualifiedName != null)
- {
- var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}"));
- builder.Services.AddScoped(serviceType ?? implementationType, implementationType);
- }
- }
+ RegisterModuleServices(assembly, builder.Services);
// register client startup services
- var startUps = assembly.GetInstances();
- foreach (var startup in startUps)
- {
- startup.ConfigureServices(builder.Services);
- }
+ RegisterClientStartups(assembly, builder.Services);
}
var host = builder.Build();
- var jsRuntime = host.Services.GetRequiredService();
- var interop = new Interop(jsRuntime);
- var localizationCookie = await interop.GetCookie(CookieRequestCultureProvider.DefaultCookieName);
- var culture = CookieRequestCultureProvider.ParseCookieValue(localizationCookie).UICultures[0].Value;
- var localizationService = host.Services.GetRequiredService();
- var cultures = await localizationService.GetCulturesAsync();
- if (culture == null || !cultures.Any(c => c.Name.Equals(culture, StringComparison.OrdinalIgnoreCase)))
- {
- culture = cultures.Single(c => c.IsDefault).Name;
- }
-
- SetCulture(culture);
+ await SetCultureFromLocalizationCookie(host.Services);
ServiceActivator.Configure(host.Services);
@@ -163,6 +110,45 @@ namespace Oqtane.Client
}
}
+ private static void RegisterModuleServices(Assembly assembly, IServiceCollection services)
+ {
+ var implementationTypes = assembly.GetInterfaces();
+ foreach (var implementationType in implementationTypes)
+ {
+ if (implementationType.AssemblyQualifiedName != null)
+ {
+ var serviceType = Type.GetType(implementationType.AssemblyQualifiedName.Replace(implementationType.Name, $"I{implementationType.Name}"));
+ services.AddScoped(serviceType ?? implementationType, implementationType);
+ }
+ }
+ }
+
+ private static void RegisterClientStartups(Assembly assembly, IServiceCollection services)
+ {
+ var startUps = assembly.GetInstances();
+ foreach (var startup in startUps)
+ {
+ startup.ConfigureServices(services);
+ }
+ }
+
+ private static async Task SetCultureFromLocalizationCookie(IServiceProvider serviceProvider)
+ {
+ var jsRuntime = serviceProvider.GetRequiredService();
+ var interop = new Interop(jsRuntime);
+ var localizationCookie = await interop.GetCookie(CookieRequestCultureProvider.DefaultCookieName);
+ var culture = CookieRequestCultureProvider.ParseCookieValue(localizationCookie)?.UICultures?[0].Value;
+ var localizationService = serviceProvider.GetRequiredService();
+ var cultures = await localizationService.GetCulturesAsync();
+
+ if (culture == null || !cultures.Any(c => c.Name.Equals(culture, StringComparison.OrdinalIgnoreCase)))
+ {
+ culture = cultures.Single(c => c.IsDefault).Name;
+ }
+
+ SetCulture(culture);
+ }
+
private static void SetCulture(string culture)
{
var cultureInfo = CultureInfo.GetCultureInfo(culture);
diff --git a/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs b/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
index 8bc0dd98..146df8d4 100644
--- a/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
+++ b/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
@@ -30,14 +30,11 @@ namespace Oqtane.Providers
// get HttpClient lazily from IServiceProvider as you cannot use standard dependency injection due to the AuthenticationStateProvider being initialized prior to NavigationManager(https://github.com/aspnet/AspNetCore/issues/11867 )
var http = _serviceProvider.GetRequiredService();
- // get alias as SiteState has not been initialized ( cannot use AliasService as it is not yet registered )
- var path = new Uri(_navigationManager.Uri).LocalPath.Substring(1);
- var alias = await http.GetFromJsonAsync($"/api/Alias/name/?path={WebUtility.UrlEncode(path)}&sync={DateTime.UtcNow.ToString("yyyyMMddHHmmssfff")}");
- // get user
- User user = await http.GetFromJsonAsync(Utilities.TenantUrl(alias, "/api/User/authenticate"));
+ var siteState = _serviceProvider.GetRequiredService();
+ User user = await http.GetFromJsonAsync(Utilities.TenantUrl(siteState.Alias, "/api/User/authenticate"));
if (user.IsAuthenticated)
{
- identity = UserSecurity.CreateClaimsIdentity(alias, user);
+ identity = UserSecurity.CreateClaimsIdentity(siteState.Alias, user);
}
return new AuthenticationState(new ClaimsPrincipal(identity));
diff --git a/Oqtane.Client/Resources/.gitkeep b/Oqtane.Client/Resources/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/Oqtane.Client/Resources/Installer/Controls/LocalDBConfig.resx b/Oqtane.Client/Resources/Installer/Controls/LocalDBConfig.resx
new file mode 100644
index 00000000..a3acd769
--- /dev/null
+++ b/Oqtane.Client/Resources/Installer/Controls/LocalDBConfig.resx
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+