diff --git a/Oqtane.Client/App.razor b/Oqtane.Client/App.razor index ca4b25bd..01022680 100644 --- a/Oqtane.Client/App.razor +++ b/Oqtane.Client/App.razor @@ -1,4 +1,6 @@ @inject IInstallationService InstallationService +@inject IJSRuntime JSRuntime +@inject SiteState SiteState @if (_initialized) { @@ -20,21 +22,35 @@ {
@_installation.Message -
+ } } } @code { - private Installation _installation; - private bool _initialized; + private bool _initialized = false; + private Installation _installation = new Installation { Success = false, Message = "" }; private PageState PageState { get; set; } - protected override async Task OnParametersSetAsync() + protected override async Task OnAfterRenderAsync(bool firstRender) { - _installation = await InstallationService.IsInstalled(); - _initialized = true; + if (firstRender && !_initialized) + { + var interop = new Interop(JSRuntime); + SiteState.AntiForgeryToken = await interop.GetElementByName(Constants.RequestVerificationToken); + _installation = await InstallationService.IsInstalled(); + if (_installation.Alias != null) + { + SiteState.Alias = _installation.Alias; + } + else + { + _installation.Message = "Site Not Configured Correctly - No Matching Alias Exists For Host Name"; + } + _initialized = true; + StateHasChanged(); + } } private void ChangeState(PageState pageState) diff --git a/Oqtane.Client/AssemblyInfo.cs b/Oqtane.Client/AssemblyInfo.cs index d598bfb9..159ad127 100644 --- a/Oqtane.Client/AssemblyInfo.cs +++ b/Oqtane.Client/AssemblyInfo.cs @@ -1,3 +1,5 @@ -using Microsoft.Extensions.Localization; +using System.Runtime.CompilerServices; +using Microsoft.Extensions.Localization; [assembly: RootNamespace("Oqtane")] +[assembly: InternalsVisibleTo("Oqtane.Server")] diff --git a/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs b/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs new file mode 100644 index 00000000..8bb5372a --- /dev/null +++ b/Oqtane.Client/Extensions/OqtaneLocalizationExtensions.cs @@ -0,0 +1,22 @@ +namespace Microsoft.Extensions.Localization +{ + public static class OqtaneLocalizationExtensions + { + /// + /// Gets the string resource for the specified key and returns the value if the resource does not exist + /// + /// + /// the static key used to identify the string resource + /// the default value if the resource for the static key does not exist + /// + public static string GetString(this IStringLocalizer localizer, string key, string value) + { + string localizedValue = localizer[key]; + if (localizedValue == key && !string.IsNullOrEmpty(value)) // not localized + { + localizedValue = value; + } + return localizedValue; + } + } +} diff --git a/Oqtane.Client/Extensions/OqtaneServiceCollectionExtensions.cs b/Oqtane.Client/Extensions/OqtaneServiceCollectionExtensions.cs new file mode 100644 index 00000000..40db5da5 --- /dev/null +++ b/Oqtane.Client/Extensions/OqtaneServiceCollectionExtensions.cs @@ -0,0 +1,54 @@ +using Microsoft.AspNetCore.Components.Authorization; +using Oqtane.Providers; +using Oqtane.Services; +using Oqtane.Shared; + +namespace Microsoft.Extensions.DependencyInjection +{ + public static class OqtaneServiceCollectionExtensions + { + public static IServiceCollection AddOqtaneAuthorization(this IServiceCollection services) + { + services.AddAuthorizationCore(); + services.AddScoped(); + services.AddScoped(s => s.GetRequiredService()); + + return services; + } + + internal static IServiceCollection AddOqtaneScopedServices(this IServiceCollection services) + { + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + services.AddScoped(); + + return services; + } + } +} diff --git a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor index ac46bb69..012d6fdb 100644 --- a/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor +++ b/Oqtane.Client/Installer/Controls/PostgreSQLConfig.razor @@ -1,6 +1,7 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer @{ foreach (var field in _connectionStringFields) @@ -10,7 +11,7 @@ { var isVisible = ""; var fieldType = (field.Name == "Pwd") ? "password" : "text"; - if ((field.Name == "Uid" || field.Name == "Pwd") ) + if ((field.Name == "Uid" || field.Name == "Pwd")) { var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity"); if (intSecurityField != null) @@ -20,7 +21,7 @@ } field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - + @@ -38,8 +39,8 @@ @@ -50,13 +51,13 @@ @code { private readonly List _connectionStringFields = new() { - new() {Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText="Enter the database server"}, - new() {Name = "Port", FriendlyName = "Port", Value = "5432", HelpText="Enter the port used to connect to the server"}, - new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}, - new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"}, - new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"}, - new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"} - }; + new() { Name = "Server", FriendlyName = "Server", Value = "127.0.0.1", HelpText = "Enter the database server" }, + new() { Name = "Port", FriendlyName = "Port", Value = "5432", HelpText = "Enter the port used to connect to the server" }, + new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" }, + new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" }, + new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" }, + new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" } + }; public string GetConnectionString() { @@ -69,7 +70,7 @@ var userId = _connectionStringFields[4].Value; var password = _connectionStringFields[5].Value; - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port)) + if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database) && !String.IsNullOrEmpty(port)) { connectionString = $"Server={server};Port={port};Database={database};"; } diff --git a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor index 302959f9..25ddd0ab 100644 --- a/Oqtane.Client/Installer/Controls/SqlServerConfig.razor +++ b/Oqtane.Client/Installer/Controls/SqlServerConfig.razor @@ -1,6 +1,7 @@ @namespace Oqtane.Installer.Controls @implements Oqtane.Interfaces.IDatabaseConfigControl @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer @{ foreach (var field in _connectionStringFields) @@ -10,7 +11,7 @@ { var isVisible = ""; var fieldType = (field.Name == "Pwd") ? "password" : "text"; - if ((field.Name == "Uid" || field.Name == "Pwd") ) + if ((field.Name == "Uid" || field.Name == "Pwd")) { var intSecurityField = _connectionStringFields.Single(f => f.Name == "IntegratedSecurity"); if (intSecurityField != null) @@ -20,7 +21,7 @@ } field.Value = field.Value.Replace("{{Date}}", DateTime.UtcNow.ToString("yyyyMMddHHmm")); - + @@ -38,8 +39,8 @@ @@ -50,12 +51,12 @@ @code { private readonly List _connectionStringFields = new() { - new() {Name = "Server", FriendlyName = "Server", Value = ".", HelpText="Enter the database server"}, - new() {Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText="Enter the name of the database"}, - new() {Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText="Select if you want integrated security or not"}, - new() {Name = "Uid", FriendlyName = "User Id", Value = "", HelpText="Enter the username to use for the database"}, - new() {Name = "Pwd", FriendlyName = "Password", Value = "", HelpText="Enter the password to use for the database"} - }; + new() { Name = "Server", FriendlyName = "Server", Value = ".", HelpText = "Enter the database server" }, + new() { Name = "Database", FriendlyName = "Database", Value = "Oqtane-{{Date}}", HelpText = "Enter the name of the database" }, + new() { Name = "IntegratedSecurity", FriendlyName = "Integrated Security", Value = "true", HelpText = "Select if you want integrated security or not" }, + new() { Name = "Uid", FriendlyName = "User Id", Value = "", HelpText = "Enter the username to use for the database" }, + new() { Name = "Pwd", FriendlyName = "Password", Value = "", HelpText = "Enter the password to use for the database" } + }; public string GetConnectionString() { @@ -67,7 +68,7 @@ var userId = _connectionStringFields[3].Value; var password = _connectionStringFields[4].Value; - if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database)) + if (!String.IsNullOrEmpty(server) && !String.IsNullOrEmpty(database)) { connectionString = $"Data Source={server};Initial Catalog={database};"; } diff --git a/Oqtane.Client/Installer/Installer.razor b/Oqtane.Client/Installer/Installer.razor index 968c582e..e0a1ac71 100644 --- a/Oqtane.Client/Installer/Installer.razor +++ b/Oqtane.Client/Installer/Installer.razor @@ -7,18 +7,19 @@ @inject IDatabaseService DatabaseService @inject IJSRuntime JSRuntime @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer
-
@Localizer["Version:"] @Constants.Version
+
@SharedLocalizer["Version"] @Constants.Version

-

@Localizer["Database Configuration"]


+

@Localizer["DatabaseConfig"]


@@ -31,7 +32,14 @@ { foreach (var database in _databases) { - + if (database.IsDefault) + { + + } + else + { + + } } } @@ -47,7 +55,7 @@
-

@Localizer["Application Administrator"]


+

@Localizer["ApplicationAdmin"]


@@ -89,11 +97,16 @@
-

+

+
+
+ @Localizer["Register"] +
+
@code { @@ -107,6 +120,7 @@ private string _hostPassword = string.Empty; private string _confirmPassword = string.Empty; private string _hostEmail = string.Empty; + private bool _register = true; private string _message = string.Empty; private string _loadingDisplay = "display: none;"; @@ -126,7 +140,7 @@ } catch { - _message = Localizer["Error loading Database Configuration Control"]; + _message = Localizer["Error.DbConfig.Load"]; } } @@ -162,13 +176,13 @@ connectionString = databaseConfigControl.GetConnectionString(); } - if (connectionString != "" && _hostUsername != "" && _hostPassword.Length >= 6 && _hostPassword == _confirmPassword && _hostEmail != "") + if (connectionString != "" && _hostUsername != "" && _hostPassword.Length >= 6 && _hostPassword == _confirmPassword && _hostEmail != "" && _hostEmail.Contains("@")) { _loadingDisplay = ""; StateHasChanged(); Uri uri = new Uri(NavigationManager.Uri); - + var database = _databases.SingleOrDefault(d => d.Name == _databaseName); var config = new InstallConfig @@ -181,7 +195,8 @@ HostName = UserNames.Host, TenantName = TenantNames.Master, IsNewTenant = true, - SiteName = Constants.DefaultSite + SiteName = Constants.DefaultSite, + Register = _register }; var installation = await InstallationService.Install(config); @@ -197,7 +212,7 @@ } else { - _message = Localizer["Please Enter All Fields And Ensure Passwords Match And Are Greater Than 5 Characters In Length"]; + _message = Localizer["Message.Require.DbInfo"]; } } diff --git a/Oqtane.Client/Localization/SharedResources.cs b/Oqtane.Client/Localization/SharedResources.cs deleted file mode 100644 index 77cb9d36..00000000 --- a/Oqtane.Client/Localization/SharedResources.cs +++ /dev/null @@ -1,47 +0,0 @@ -namespace Oqtane -{ - public class SharedResources - { - public static readonly string UserLogin = "User Login"; - - public static readonly string UserRegistration = "User Registration"; - - public static readonly string PasswordReset = "Password Reset"; - - public static readonly string UserProfile = "User Profile"; - - public static readonly string AdminDashboard = "Admin Dashboard"; - - public static readonly string SiteSettings = "Site Settings"; - - public static readonly string PageManagement = "Page Management"; - - public static readonly string UserManagement = "User Management"; - - public static readonly string ProfileManagement = "Profile Management"; - - public static readonly string RoleManagement = "Role Management"; - - public static readonly string FileManagement = "File Management"; - - public static readonly string RecycleBin = "Recycle Bin"; - - public static readonly string EventLog = "Event Log"; - - public static readonly string SiteManagement = "Site Management"; - - public static readonly string ModuleManagement = "Module Management"; - - public static readonly string ThemeManagement = "Theme Management"; - - public static readonly string LanguageManagement = "Language Management"; - - public static readonly string ScheduledJobs = "Scheduled Jobs"; - - public static readonly string SqlManagement = "Sql Management"; - - public static readonly string SystemInfo = "System Info"; - - public static readonly string SystemUpdate = "System Update"; - } -} diff --git a/Oqtane.Client/Modules/Admin/Dashboard/Index.razor b/Oqtane.Client/Modules/Admin/Dashboard/Index.razor index 0c7cd842..6c665ba2 100644 --- a/Oqtane.Client/Modules/Admin/Dashboard/Index.razor +++ b/Oqtane.Client/Modules/Admin/Dashboard/Index.razor @@ -2,7 +2,7 @@ @inherits ModuleBase @inject IPageService PageService @inject IUserService UserService -@inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer
@foreach (var p in _pages) @@ -12,7 +12,7 @@ string url = NavigateUrl(p.Path);
-

@Localizer[p.Name] +

@SharedLocalizer[p.Name]
} diff --git a/Oqtane.Client/Modules/Admin/Error/Index.razor b/Oqtane.Client/Modules/Admin/Error/Index.razor index 381665ae..0e085ab9 100644 --- a/Oqtane.Client/Modules/Admin/Error/Index.razor +++ b/Oqtane.Client/Modules/Admin/Error/Index.razor @@ -11,7 +11,7 @@ Module module = await ModuleService.GetModuleAsync(ModuleState.ModuleId); if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)) { - string message = Localizer["A Problem Was Encountered Loading Module {0}", module.ModuleDefinitionName]; + string message = string.Format(Localizer["Error.Module.Load"], module.ModuleDefinitionName); AddModuleMessage(message, MessageType.Error); } diff --git a/Oqtane.Client/Modules/Admin/Files/Add.razor b/Oqtane.Client/Modules/Admin/Files/Add.razor index a848ee19..727c0bcf 100644 --- a/Oqtane.Client/Modules/Admin/Files/Add.razor +++ b/Oqtane.Client/Modules/Admin/Files/Add.razor @@ -5,6 +5,7 @@ @inject IFileService FileService @inject IFolderService FolderService @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer @@ -18,7 +19,7 @@
- @Localizer["Cancel"] + @SharedLocalizer["Cancel"] @if (_folders != null) @@ -37,8 +38,8 @@ - + @foreach (Folder folder in _folders) { @@ -47,8 +48,8 @@ - - @Localizer["Cancel"] + + @SharedLocalizer["Cancel"] } @@ -74,7 +75,7 @@ { if (url == string.Empty || _folderId == -1) { - AddModuleMessage(Localizer["You Must Enter A Url And Select A Folder"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Required.UrlFolder"], MessageType.Warning); return; } @@ -83,13 +84,13 @@ if (!Constants.UploadableFiles.Split(',') .Contains(Path.GetExtension(filename).ToLower().Replace(".", ""))) { - AddModuleMessage(Localizer["File Could Not Be Downloaded From Url Due To Its File Extension"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Download.InvalidExtension"], MessageType.Warning); return; } if (!filename.IsPathOrFileValid()) { - AddModuleMessage(Localizer["You Must Enter A Url With A Valid File Name"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Required.UrlName"], MessageType.Warning); return; } @@ -97,12 +98,12 @@ { await FileService.UploadFileAsync(url, _folderId); await logger.LogInformation("File Downloaded Successfully From Url {Url}", url); - AddModuleMessage(Localizer["File Downloaded Successfully From Url"], MessageType.Success); + AddModuleMessage(Localizer["Success.Download.File"], MessageType.Success); } catch (Exception ex) { await logger.LogError(ex, "Error Downloading File From Url {Url} {Error}", url, ex.Message); - AddModuleMessage(Localizer["Error Downloading File From Url. Please Verify That The Url Is Valid."], MessageType.Error); + AddModuleMessage(Localizer["Error.Download.InvalidUrl"], MessageType.Error); } } } diff --git a/Oqtane.Client/Modules/Admin/Files/Details.razor b/Oqtane.Client/Modules/Admin/Files/Details.razor index 93bd73a8..44e7e3a2 100644 --- a/Oqtane.Client/Modules/Admin/Files/Details.razor +++ b/Oqtane.Client/Modules/Admin/Files/Details.razor @@ -4,12 +4,13 @@ @inject IFolderService FolderService @inject NavigationManager NavigationManager @inject IStringLocalizer
Localizer +@inject IStringLocalizer SharedLocalizer @if (_folders != null) { -
+ @@ -21,7 +22,7 @@ - @foreach (Folder folder in _folders) { @@ -38,8 +39,8 @@
- - @Localizer["Cancel"] + + @SharedLocalizer["Cancel"]

@@ -81,7 +82,7 @@ catch (Exception ex) { await logger.LogError(ex, "Error Loading File {FileId} {Error}", _fileId, ex.Message); - AddModuleMessage(Localizer["Error Loading File"], MessageType.Error); + AddModuleMessage(Localizer["Error.File.Load"], MessageType.Error); } } @@ -100,13 +101,13 @@ } else { - AddModuleMessage(Localizer["File Name Not Valid"], MessageType.Warning); + AddModuleMessage(Localizer["Message.File.InvalidName"], MessageType.Warning); } } catch (Exception ex) { await logger.LogError(ex, "Error Saving File {FileId} {Error}", _fileId, ex.Message); - AddModuleMessage(Localizer["Error Saving File"], MessageType.Error); + AddModuleMessage(Localizer["Error.File.Save"], MessageType.Error); } } } diff --git a/Oqtane.Client/Modules/Admin/Files/Edit.razor b/Oqtane.Client/Modules/Admin/Files/Edit.razor index 4f6054db..48d5ef79 100644 --- a/Oqtane.Client/Modules/Admin/Files/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Files/Edit.razor @@ -4,19 +4,20 @@ @inject IFileService FileService @inject NavigationManager NavigationManager @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer @if (_folders != null) { -
+ - @if (PageState.QueryString.ContainsKey("id")) { - + } @foreach (Folder folder in _folders) { @@ -44,7 +45,7 @@ } else { - @@ -60,11 +61,13 @@
@if (!_isSystem) { - + + @((MarkupString)" ") } - @Localizer["Cancel"] + @SharedLocalizer["Cancel"] @if (!_isSystem && PageState.QueryString.ContainsKey("id")) { + @((MarkupString)" ") }
@@ -128,7 +131,7 @@ catch (Exception ex) { await logger.LogError(ex, "Error Loading Folder {FolderId} {Error}", _folderId, ex.Message); - AddModuleMessage(Localizer["Error Loading Folder"], MessageType.Error); + AddModuleMessage(Localizer["Error.Folder.Load"], MessageType.Error); } } @@ -136,13 +139,13 @@ { if (_name == string.Empty || _parentId == -1) { - AddModuleMessage(Localizer["Folders Must Have A Parent And A Name"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Required.FolderParent"], MessageType.Warning); return; } if (!_name.IsPathOrFileValid()) { - AddModuleMessage(Localizer["Folder Name Not Valid."], MessageType.Warning); + AddModuleMessage(Localizer["Message.Folder.InvalidName"], MessageType.Warning); return; } @@ -191,13 +194,13 @@ } else { - AddModuleMessage(Localizer["An Error Was Encountered Saving The Folder"], MessageType.Error); + AddModuleMessage(Localizer["Error.Folder.Save"], MessageType.Error); } } catch (Exception ex) { await logger.LogError(ex, "Error Saving Folder {FolderId} {Error}", _folderId, ex.Message); - AddModuleMessage(Localizer["Error Saving Folder"], MessageType.Error); + AddModuleMessage(Localizer["Error.Folder.Save"], MessageType.Error); } } @@ -225,18 +228,18 @@ } else { - AddModuleMessage(Localizer["Folder Has Files And Cannot Be Deleted"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Folder.Files.InvalidDelete"], MessageType.Warning); } } else { - AddModuleMessage(Localizer["Folder Has Subfolders And Cannot Be Deleted"], MessageType.Warning); + AddModuleMessage(Localizer["Message.Folder.Subfolders.InvalidDelete"], MessageType.Warning); } } catch (Exception ex) { await logger.LogError(ex, "Error Deleting Folder {Folder} {Error}", _folderId, ex.Message); - AddModuleMessage(Localizer["Error Deleting Folder"], MessageType.Error); + AddModuleMessage(Localizer["Error.Folder.Delete"], MessageType.Error); } } } diff --git a/Oqtane.Client/Modules/Admin/Files/Index.razor b/Oqtane.Client/Modules/Admin/Files/Index.razor index bd670d21..e119515c 100644 --- a/Oqtane.Client/Modules/Admin/Files/Index.razor +++ b/Oqtane.Client/Modules/Admin/Files/Index.razor @@ -4,16 +4,17 @@ @inject IFolderService FolderService @inject IFileService FileService @inject IStringLocalizer Localizer +@inject IStringLocalizer SharedLocalizer @if (_files != null) { - + - + - + @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
- + - @foreach (Folder folder in _folders) { @@ -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
- @@ -38,7 +39,7 @@
+ @@ -26,9 +27,9 @@ - + +
- @@ -79,8 +80,11 @@
- -@Localizer["Cancel"] + +@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 { - +
+ + + + + + + + +
+ + + +
+ + + +
+ + } + @SharedLocalizer["Cancel"] + + + + + - - - -
- + - -
- - - +   +
- - } - @Localizer["Cancel"] -
- - @if (_packages != null && _packages.Count > 0) + + @if (_packages != null) { - - -
- @Localizer["Name"] - @Localizer["Version"] - -
- - @context.Name - @context.Version - - - - -
- - @Localizer["Cancel"] - } - else - { - + @if (_packages.Count > 0) + { + + + +

@context.Name

  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 + + + + +
+
+ } + else + { +
+
+ @Localizer["Search.NoResults"] +
+ } + + @SharedLocalizer["Cancel"] }
- +
- - @Localizer["Cancel"] + + @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)) - { - - } + { + + }
@@ -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 -
+ @@ -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

- + @@ -25,19 +26,19 @@ else

- + - - + +

- @@ -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) { - @@ -77,11 +78,11 @@ }
+ @@ -39,8 +40,8 @@ - + @foreach (Template template in _templates) { @@ -53,7 +54,7 @@ - @foreach (string version in _versions) { if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0) @@ -61,7 +62,7 @@ } } - +
- + } else { - + } @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 - +

@context.Name

  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 + + +
-
+ } + else + { +
+
+ @Localizer["Search.NoResults"] +
+ } } - - - - - - -
- - - -
-
-
+ + + + + + + +
+ + + +
+
+
- - @Localizer["Cancel"] -} + +@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) { - @@ -77,8 +78,8 @@ }
+ @@ -39,8 +40,8 @@ - + @foreach (Template template in _templates) { @@ -53,7 +54,7 @@ - @foreach (string version in _versions) { if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0) @@ -61,7 +62,7 @@ } } - +
- - @Localizer["Cancel"] + + @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 - - - + + @@ -28,7 +29,7 @@ else @@ -36,7 +37,7 @@ else @@ -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
+ @@ -35,7 +36,7 @@
-
+ @@ -103,8 +104,8 @@
- -@Localizer["Cancel"] + +@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"]   @if (context.AssemblyName != "Oqtane.Client") { - + } @context.Name @if (UpgradeAvailable(context.PackageName, context.Version)) { - + }
-
+ @@ -17,7 +18,7 @@
-@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 -
+ @@ -17,7 +18,7 @@
-@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 @@ { - @@ -49,7 +50,7 @@ - + - + @@ -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 @@
- - - + + + - + @@ -43,7 +44,7 @@ @if (_modules == null) {
-

@Localizer["No Deleted Modules"]

+

@Localizer["NoModule.Deleted"]

} else { @@ -53,12 +54,12 @@ - - + + - + @@ -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 @@ ... - + - + -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- - -
+
+ @@ -25,7 +26,7 @@ - @foreach (var container in _containers) { @@ -38,9 +39,9 @@ - + +
- @foreach (Page p in PageState.Pages) { if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions)) @@ -88,8 +89,11 @@ } - -@Localizer["Cancel"] + +@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 @@ { - + + + + @@ -89,7 +101,7 @@
+ @@ -23,8 +24,8 @@ - + @foreach (Page page in _pageList) { @@ -37,19 +38,19 @@ - + @if (_children != null && _children.Count > 0) { } - + @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) { - + @foreach (Page page in _children) { @@ -60,12 +61,23 @@
- + - + + + +
+ + +
- @@ -162,8 +174,8 @@ } - - + + @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 @@ {
+ @@ -101,7 +113,7 @@ - @foreach (var theme in _themes) { @@ -114,8 +126,8 @@ - + @foreach (var container in _containers) { @@ -136,9 +148,9 @@ - + +
- + + + + @@ -97,7 +109,7 @@
+ @@ -24,8 +25,8 @@ - + @foreach (Page page in _pageList) { if (page.PageId != _pageId) @@ -41,23 +42,23 @@ - @if (_parentid == _currentparentid) { - + } - + @if (_children != null && _children.Count > 0) { } - + @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) { - + @foreach (Page page in _children) { @@ -71,9 +72,20 @@ - + + + +
+ + +
- @@ -175,8 +187,8 @@ } - - + + @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 @@
- + - + @@ -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
+ @@ -109,7 +121,7 @@ - @foreach (var theme in _themes) { @@ -122,8 +134,8 @@ - + @foreach (var container in _containers) { @@ -144,9 +156,9 @@ - + +
   @Localizer["Name"]@SharedLocalizer["Name"] @(new string('-', context.Level * 2))@(context.Name)
- @@ -85,15 +86,21 @@
+ @@ -74,9 +75,9 @@ - + +
- + +
- -@Localizer["Cancel"] + +@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    @Localizer["Name"]@Localizer["Deleted By"]@Localizer["Deleted On"]@SharedLocalizer["Name"]@Localizer["DeletedBy"]@Localizer["DeletedOn"] @context.Name @context.DeletedBy @context.DeletedOn  @Localizer["Page"] @Localizer["Module"]@Localizer["Deleted By"]@Localizer["Deleted On"]@Localizer["DeletedBy"]@Localizer["DeletedOn"] @PageState.Pages.Find(item => item.PageId == context.PageId).Name @context.Title @context.DeletedBy
+ + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + } 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["Cancel"] +
+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + @SharedLocalizer["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["Cancel"] +
+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + @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 { -
+ @@ -24,8 +25,8 @@ else - + @foreach (UserRole userrole in users) { @@ -50,8 +51,8 @@ else
- - @Localizer["Cancel"] + + @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) { - - - - - + @@ -52,9 +54,9 @@ @@ -62,7 +64,7 @@
+ @@ -22,28 +24,28 @@
- + - -
- - - + @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)) + { + + } + else + { + + }
- + +
- + +
- - + + - - + + + } @@ -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 {
+ @@ -82,8 +84,8 @@ - + @foreach (var theme in _themes) { @@ -96,8 +98,8 @@ - + @foreach (var container in _containers) { @@ -110,9 +112,9 @@ - + + @foreach (var container in _containers) { @@ -125,8 +127,9 @@
- + @@ -150,9 +153,9 @@ @@ -181,19 +184,19 @@
- @Localizer["Please Note That SMTP Requires The Notification Job To Be Enabled In Scheduled Jobs"] +   + @Localizer["Smtp.Required.EnableNotificationJob"]
- + +
- +

- @@ -215,10 +218,40 @@
+ - + +
- + @if (UserSecurity.IsAuthorized(PageState.User, RoleNames.Host)) + { +
+ + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+
+ }
- - + +

@@ -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 { - @@ -157,8 +165,8 @@ else }
+ @@ -40,8 +41,8 @@ else - + @foreach (var theme in _themes) { @@ -54,8 +55,8 @@ else - + @foreach (var container in _containers) { @@ -68,9 +69,9 @@ else - + + @foreach (var container in _containers) { @@ -83,8 +84,8 @@ else - + @foreach (SiteTemplate siteTemplate in _siteTemplates) { @@ -97,9 +98,9 @@ else - + + @foreach (Tenant tenant in _tenants) { @@ -127,10 +128,17 @@ else - @foreach (var database in _databases) { - + if (database.IsDefault) + { + + } + else + { + + } }
- - @Localizer["Cancel"] + + @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@context.Name
- - - - - + @if (_tenantid != "-1") + { + + + + + + + + + + + + + }
+ - + @foreach (Tenant tenant in _tenants) { @@ -26,14 +28,33 @@ else
- - - -
+ + + +
+ + + +
+ + + +

@@ -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"]  - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
  +
@Localizer["Register"] +
+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+

+   + @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 - +

@context.Name

  @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 + + +
-
+ } + else + { +
+
+ @Localizer["Search.NoResults"] +
+ } } - - - - - - -
- - - -
-
-
+
+ + + + + + +
+ + + +
+
+
- - @Localizer["Cancel"] -} + +@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) { - @@ -70,8 +71,8 @@ }
+ @@ -32,8 +33,8 @@ - + @foreach (Template template in _templates) { @@ -46,7 +47,7 @@ - @foreach (string version in _versions) { if (Version.Parse(version).CompareTo(Version.Parse(_minversion)) >= 0) @@ -54,7 +55,7 @@ } } - +
- - @Localizer["Cancel"] + + @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)) { - + } @@ -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 -
+ @@ -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) - { - - - - } - else - { - - } - - - - - - - - -
- - - -
- -
-
-} + + + @if (_package != null && _upgradeavailable) + { + + + + } + else + { + + } + + + + + + + + +
+ + + +
+ +
+
@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) -{ - - - - - - - - - - - -
- - - -
- - - -
- - -