diff --git a/Oqtane.Client/Modules/Admin/Files/Index.razor b/Oqtane.Client/Modules/Admin/Files/Index.razor index 6dd27603..efe9c33a 100644 --- a/Oqtane.Client/Modules/Admin/Files/Index.razor +++ b/Oqtane.Client/Modules/Admin/Files/Index.razor @@ -54,7 +54,6 @@ List _folders; int _folderId = -1; List _files; - Uri _uri; protected override async Task OnParametersSetAsync() { @@ -66,7 +65,6 @@ _folderId = _folders[0].FolderId; await GetFiles(); } - _uri = new Uri(NavigationManager.Uri); } catch (Exception ex) { diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor index 17a785dc..e912cc9d 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Add.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor @@ -4,7 +4,7 @@ @inject IPageService PageService @inject IThemeService ThemeService -@if (Themes != null) +@if (_themeList != null) { @@ -12,7 +12,7 @@ @@ -20,7 +20,7 @@ @@ -30,7 +30,7 @@ @@ -137,7 +137,7 @@
- +
- +
- - @if (children != null && children.Count > 0) + @if (_children != null && _children.Count > 0) { } - @if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) + @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) { - - @foreach (Page page in children) + @foreach (Page page in _children) { } @@ -68,7 +68,7 @@ - @@ -79,7 +79,7 @@ - @@ -90,7 +90,7 @@ - @@ -103,7 +103,7 @@ - - @foreach (KeyValuePair panelayout in panelayouts) + @foreach (KeyValuePair panelayout in _panelayouts) { } @@ -129,7 +129,7 @@ - +
- +
@@ -148,45 +148,45 @@ @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } } - Dictionary themes = new Dictionary(); - Dictionary panelayouts = new Dictionary(); + Dictionary _themes = new Dictionary(); + Dictionary _panelayouts = new Dictionary(); - List Themes; - List pages; - string name; - string path = ""; - string parentid; - string insert = ">>"; - List children; - int childid = -1; - string isnavigation = "True"; - string ispersonalizable = "False"; - string mode = "view"; - string themetype = ""; - string layouttype = ""; - string icon = ""; - string permissions = ""; + List _themeList; + List _pageList; + string _name; + string _path = ""; + string _parentid; + string _insert = ">>"; + List _children; + int _childid = -1; + string _isnavigation = "True"; + string _ispersonalizable = "False"; + string _mode = "view"; + string _themetype = ""; + string _layouttype = ""; + string _icon = ""; + string _permissions = ""; - PermissionGrid permissiongrid; + PermissionGrid _permissionGrid; protected override async Task OnInitializedAsync() { try { - Themes = await ThemeService.GetThemesAsync(); - pages = PageState.Pages; - children = PageState.Pages.Where(item => item.ParentId == null).ToList(); + _themeList = await ThemeService.GetThemesAsync(); + _pageList = PageState.Pages; + _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); - themes = ThemeService.GetThemeTypes(Themes); - themetype = PageState.Site.DefaultThemeType; + _themes = ThemeService.GetThemeTypes(_themeList); + _themetype = PageState.Site.DefaultThemeType; - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); - layouttype = PageState.Site.DefaultLayoutType; + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); + _layouttype = PageState.Site.DefaultLayoutType; List permissionstrings = new List(); permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.View, Permissions = Constants.AdminRole }); permissionstrings.Add(new PermissionString { PermissionName = PermissionNames.Edit, Permissions = Constants.AdminRole }); - permissions = UserSecurity.SetPermissionStrings(permissionstrings); + _permissions = UserSecurity.SetPermissionStrings(permissionstrings); } catch (Exception ex) { @@ -199,20 +199,20 @@ { try { - parentid = (string)e.Value; - if (parentid == "-1") + _parentid = (string)e.Value; + if (_parentid == "-1") { - children = PageState.Pages.Where(item => item.ParentId == null).ToList(); + _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); } else { - children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid)).ToList(); + _children = PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)).ToList(); } StateHasChanged(); } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", parentid, ex.Message); + await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message); AddModuleMessage("Error Loading Child Pages For Parent", MessageType.Error); } } @@ -221,20 +221,20 @@ { try { - themetype = (string)e.Value; - if (themetype != "") + _themetype = (string)e.Value; + if (_themetype != "") { - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); } else { - panelayouts = new Dictionary(); + _panelayouts = new Dictionary(); } StateHasChanged(); } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", themetype, ex.Message); + await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message); AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error); } } @@ -244,61 +244,61 @@ Page page = null; try { - if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype))) + if (_name != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype))) { page = new Page(); page.SiteId = PageState.Page.SiteId; - page.Name = name; - if (path == "") + page.Name = _name; + if (_path == "") { - path = name; + _path = _name; } - if (path.Contains("/")) + if (_path.Contains("/")) { - path = path.Substring(path.LastIndexOf("/") + 1); + _path = _path.Substring(_path.LastIndexOf("/") + 1); } - if (string.IsNullOrEmpty(parentid)) + if (string.IsNullOrEmpty(_parentid)) { page.ParentId = null; - page.Path = Utilities.GetFriendlyUrl(path); + page.Path = Utilities.GetFriendlyUrl(_path); } else { - page.ParentId = Int32.Parse(parentid); + page.ParentId = Int32.Parse(_parentid); Page parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault(); if (parent.Path == "") { - page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(path); + page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path); } else { - page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); + page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path); } } Page child; - switch (insert) + switch (_insert) { case "<<": page.Order = 0; break; case "<": - child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); + child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault(); page.Order = child.Order - 1; break; case ">": - child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); + child = PageState.Pages.Where(item => item.PageId == _childid).FirstOrDefault(); page.Order = child.Order + 1; break; case ">>": page.Order = int.MaxValue; break; } - page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); - page.EditMode = (mode == "edit" ? true : false); - page.ThemeType = themetype; - page.LayoutType = (layouttype == null ? "" : layouttype); - page.Icon = (icon == null ? "" : icon); - page.Permissions = permissiongrid.GetPermissions(); + page.IsNavigation = (_isnavigation == null ? true : Boolean.Parse(_isnavigation)); + page.EditMode = (_mode == "edit" ? true : false); + page.ThemeType = _themetype; + page.LayoutType = (_layouttype == null ? "" : _layouttype); + page.Icon = (_icon == null ? "" : _icon); + page.Permissions = _permissionGrid.GetPermissions(); if (page.ThemeType == PageState.Site.DefaultThemeType) { @@ -308,7 +308,7 @@ { page.LayoutType = ""; } - page.IsPersonalizable = (ispersonalizable == null ? false : Boolean.Parse(ispersonalizable)); + page.IsPersonalizable = (_ispersonalizable == null ? false : Boolean.Parse(_ispersonalizable)); page.UserId = null; page = await PageService.AddPageAsync(page); diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor index cad64681..ba2eef54 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor @@ -4,7 +4,7 @@ @inject IPageService PageService @inject IThemeService ThemeService -@if (Themes != null) +@if (_themeList != null) { @@ -12,7 +12,7 @@ @@ -20,7 +20,7 @@ @@ -30,9 +30,9 @@ @@ -155,7 +155,7 @@
- +
- +
- + @if (_parentid == _currentparentid) { } - @if (children != null && children.Count > 0) + @if (_children != null && _children.Count > 0) { } - @if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) + @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) { - - @foreach (Page page in children) + @foreach (Page page in _children) { } @@ -79,7 +79,7 @@ - @@ -90,7 +90,7 @@ - @@ -101,7 +101,7 @@ - @@ -114,9 +114,9 @@ - - @foreach (KeyValuePair panelayout in panelayouts) + @foreach (KeyValuePair panelayout in _panelayouts) { } @@ -147,7 +147,7 @@ - +
- +
@@ -163,89 +163,91 @@ Cancel

- + } @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } } - Dictionary themes = new Dictionary(); - Dictionary panelayouts = new Dictionary(); + Dictionary _themes = new Dictionary(); + Dictionary _panelayouts = new Dictionary(); - List Themes; - List pages; - int PageId; - string name; - string path; - string currentparentid; - string parentid; - string insert = "="; - List children; - int childid = -1; - string isnavigation; - string ispersonalizable; - string mode; - string themetype; - string layouttype; - string icon; - string permissions; - string createdby; - DateTime createdon; - string modifiedby; - DateTime modifiedon; - string deletedby; - DateTime? deletedon; + List _themeList; + List _pageList; + int _pageId; + string _name; + string _path; + string _currentparentid; + string _parentid; + string _insert = "="; + List _children; + int _childid = -1; + string _isnavigation; + string _ispersonalizable; + string _mode; + string _themetype; + string _layouttype; + string _icon; + string _permissions; + string _createdby; + DateTime _createdon; + string _modifiedby; + DateTime _modifiedon; + string _deletedby; + DateTime? _deletedon; - PermissionGrid permissiongrid; +#pragma warning disable 649 + PermissionGrid _permissionGrid; +#pragma warning restore 649 protected override async Task OnInitializedAsync() { try { - Themes = await ThemeService.GetThemesAsync(); - pages = PageState.Pages; - children = PageState.Pages.Where(item => item.ParentId == null).ToList(); + _themeList = await ThemeService.GetThemesAsync(); + _pageList = PageState.Pages; + _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); - themes = ThemeService.GetThemeTypes(Themes); + _themes = ThemeService.GetThemeTypes(_themeList); - PageId = Int32.Parse(PageState.QueryString["id"]); - Page page = PageState.Pages.FirstOrDefault(item => item.PageId == PageId); + _pageId = Int32.Parse(PageState.QueryString["id"]); + Page page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId); if (page != null) { - name = page.Name; - path = page.Path; - if (path.Contains("/")) + _name = page.Name; + _path = page.Path; + if (_path.Contains("/")) { - path = path.Substring(path.LastIndexOf("/") + 1); + _path = _path.Substring(_path.LastIndexOf("/") + 1); } if (page.ParentId == null) { - parentid = ""; + _parentid = ""; } else { - parentid = page.ParentId.ToString(); + _parentid = page.ParentId.ToString(); } - currentparentid = parentid; - isnavigation = page.IsNavigation.ToString(); - ispersonalizable = page.IsPersonalizable.ToString(); - mode = (page.EditMode) ? "edit" : "view"; - themetype = page.ThemeType; - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); - layouttype = page.LayoutType; - icon = page.Icon; - permissions = page.Permissions; - createdby = page.CreatedBy; - createdon = page.CreatedOn; - modifiedby = page.ModifiedBy; - modifiedon = page.ModifiedOn; - deletedby = page.DeletedBy; - deletedon = page.DeletedOn; + _currentparentid = _parentid; + _isnavigation = page.IsNavigation.ToString(); + _ispersonalizable = page.IsPersonalizable.ToString(); + _mode = (page.EditMode) ? "edit" : "view"; + _themetype = page.ThemeType; + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); + _layouttype = page.LayoutType; + _icon = page.Icon; + _permissions = page.Permissions; + _createdby = page.CreatedBy; + _createdon = page.CreatedOn; + _modifiedby = page.ModifiedBy; + _modifiedon = page.ModifiedOn; + _deletedby = page.DeletedBy; + _deletedon = page.DeletedOn; } } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Page {PageId} {Error}", PageId, ex.Message); + await logger.LogError(ex, "Error Loading Page {PageId} {Error}", _pageId, ex.Message); AddModuleMessage("Error Loading Page", MessageType.Error); } } @@ -254,28 +256,28 @@ { try { - parentid = (string)e.Value; - if (parentid == "-1") + _parentid = (string)e.Value; + if (_parentid == "-1") { - children = PageState.Pages.Where(item => item.ParentId == null).ToList(); + _children = PageState.Pages.Where(item => item.ParentId == null).ToList(); } else { - children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid)).ToList(); + _children = PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)).ToList(); } - if (parentid == currentparentid) + if (_parentid == _currentparentid) { - insert = "="; + _insert = "="; } else { - insert = ">>"; + _insert = ">>"; } StateHasChanged(); } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", parentid, ex.Message); + await logger.LogError(ex, "Error Loading Child Pages For Parent {PageId} {Error}", _parentid, ex.Message); AddModuleMessage("Error Loading Child Pages For Parent", MessageType.Error); } } @@ -284,20 +286,20 @@ { try { - themetype = (string)e.Value; - if (themetype != "") + _themetype = (string)e.Value; + if (_themetype != "") { - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); } else { - panelayouts = new Dictionary(); + _panelayouts = new Dictionary(); } StateHasChanged(); } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", themetype, ex.Message); + await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message); AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error); } } @@ -307,52 +309,52 @@ Page page = null; try { - if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype))) + if (_name != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype))) { - page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault(); + page = PageState.Pages.FirstOrDefault(item => item.PageId == _pageId); string currentPath = page.Path; - page.Name = name; - if (path == "" && name.ToLower() != "home") + page.Name = _name; + if (_path == "" && _name.ToLower() != "home") { - path = name; + _path = _name; } - if (path.Contains("/")) + if (_path.Contains("/")) { - path = path.Substring(path.LastIndexOf("/") + 1); + _path = _path.Substring(_path.LastIndexOf("/") + 1); } - if (string.IsNullOrEmpty(parentid)) + if (string.IsNullOrEmpty(_parentid)) { page.ParentId = null; - page.Path = Utilities.GetFriendlyUrl(path); + page.Path = Utilities.GetFriendlyUrl(_path); } else { - page.ParentId = Int32.Parse(parentid); + page.ParentId = Int32.Parse(_parentid); Page parent = PageState.Pages.FirstOrDefault(item => item.PageId == page.ParentId); if (parent.Path == "") { - page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(path); + page.Path = Utilities.GetFriendlyUrl(parent.Name) + "/" + Utilities.GetFriendlyUrl(_path); } else { - page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); + page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(_path); } } - if (insert != "=") + if (_insert != "=") { Page child; - switch (insert) + switch (_insert) { case "<<": page.Order = 0; break; case "<": - child = PageState.Pages.FirstOrDefault(item => item.PageId == childid); + child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid); if (child != null) page.Order = child.Order - 1; break; case ">": - child = PageState.Pages.FirstOrDefault(item => item.PageId == childid); + child = PageState.Pages.FirstOrDefault(item => item.PageId == _childid); if (child != null) page.Order = child.Order + 1; break; case ">>": @@ -360,12 +362,12 @@ break; } } - page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); - page.EditMode = (mode == "edit" ? true : false); - page.ThemeType = themetype; - page.LayoutType = layouttype ?? ""; - page.Icon = icon ?? ""; - page.Permissions = permissiongrid.GetPermissions(); + page.IsNavigation = (_isnavigation == null || Boolean.Parse(_isnavigation)); + page.EditMode = (_mode == "edit"); + page.ThemeType = _themetype; + page.LayoutType = _layouttype ?? ""; + page.Icon = _icon ?? ""; + page.Permissions = _permissionGrid.GetPermissions(); if (page.ThemeType == PageState.Site.DefaultThemeType) { @@ -375,22 +377,22 @@ { page.LayoutType = ""; } - page.IsPersonalizable = (ispersonalizable != null && Boolean.Parse(ispersonalizable)); + page.IsPersonalizable = (_ispersonalizable != null && Boolean.Parse(_ispersonalizable)); page.UserId = null; page = await PageService.UpdatePageAsync(page); await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId); - if (currentparentid == "") + if (_currentparentid == "") { await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, null); } else { - await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, int.Parse(currentparentid)); + await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, int.Parse(_currentparentid)); } // update child paths - if (parentid != currentparentid) + if (_parentid != _currentparentid) { foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentPath))) { diff --git a/Oqtane.Client/Modules/Admin/Site/Index.razor b/Oqtane.Client/Modules/Admin/Site/Index.razor index b3692a49..a6bdcac0 100644 --- a/Oqtane.Client/Modules/Admin/Site/Index.razor +++ b/Oqtane.Client/Modules/Admin/Site/Index.razor @@ -7,7 +7,7 @@ @inject IThemeService ThemeService @inject ISettingService SettingService -@if (themes != null) +@if (_themes != null) { @@ -15,7 +15,7 @@ @@ -23,7 +23,7 @@ @@ -31,7 +31,7 @@ @@ -39,7 +39,7 @@ @@ -49,9 +49,9 @@ @@ -122,7 +122,7 @@ @@ -130,7 +130,7 @@ @@ -138,7 +138,7 @@ @@ -146,7 +146,7 @@
- +
- +
- +
- +
- - @foreach (KeyValuePair panelayout in panelayouts) + @foreach (KeyValuePair panelayout in _panelayouts) { } @@ -82,9 +82,9 @@ - - @foreach (KeyValuePair container in containers) + @foreach (KeyValuePair container in _containers) { } @@ -96,7 +96,7 @@ - @@ -114,7 +114,7 @@ - +
- +
- +
- +
- +
@@ -156,85 +156,85 @@ Cancel

- + } @code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } } - Dictionary themes; - Dictionary panelayouts; - Dictionary containers; + Dictionary _themes; + Dictionary _panelayouts; + Dictionary _containers; - List Themes; - string name = ""; - List tenants; - string tenant = ""; - List aliases; - string urls = ""; - int logofileid = -1; - FileManager filemanager; - string themetype; - string layouttype; - string containertype; + List _themeList; + string _name = ""; + List _tenantList; + string _tenant = ""; + List _aliasList; + string _urls = ""; + int _logofileid = -1; + FileManager _filemanager; + string _themetype; + string _layouttype; + string _containertype; - string smtphost = ""; - string smtpport = ""; - string smtpssl = ""; - string smtpusername = ""; - string smtppassword = ""; + string _smtphost = ""; + string _smtpport = ""; + string _smtpssl = ""; + string _smtpusername = ""; + string _smtppassword = ""; - string createdby; - DateTime createdon; - string modifiedby; - DateTime modifiedon; - string deletedby; - DateTime? deletedon; - string isdeleted; + string _createdby; + DateTime _createdon; + string _modifiedby; + DateTime _modifiedon; + string _deletedby; + DateTime? _deletedon; + string _isdeleted; protected override async Task OnInitializedAsync() { try { - Themes = await ThemeService.GetThemesAsync(); - aliases = await AliasService.GetAliasesAsync(); + _themeList = await ThemeService.GetThemesAsync(); + _aliasList = await AliasService.GetAliasesAsync(); Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias); if (site != null) { - name = site.Name; - tenants = await TenantService.GetTenantsAsync(); - tenant = tenants.Find(item => item.TenantId == site.TenantId).Name; - foreach (Alias alias in aliases.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList()) + _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()) { - urls += alias.Name + "\n"; + _urls += alias.Name + "\n"; } if (site.LogoFileId != null) { - logofileid = site.LogoFileId.Value; + _logofileid = site.LogoFileId.Value; } - themetype = site.DefaultThemeType; - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); - layouttype = site.DefaultLayoutType; - containertype = site.DefaultContainerType; + _themetype = site.DefaultThemeType; + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); + _layouttype = site.DefaultLayoutType; + _containertype = site.DefaultContainerType; Dictionary settings = await SettingService.GetSiteSettingsAsync(site.SiteId); - smtphost = SettingService.GetSetting(settings, "SMTPHost", ""); - smtpport = SettingService.GetSetting(settings, "SMTPPort", ""); - smtpssl = SettingService.GetSetting(settings, "SMTPSSL", ""); - smtpusername = SettingService.GetSetting(settings, "SMTPUsername", ""); - smtppassword = SettingService.GetSetting(settings, "SMTPPassword", ""); + _smtphost = SettingService.GetSetting(settings, "SMTPHost", ""); + _smtpport = SettingService.GetSetting(settings, "SMTPPort", ""); + _smtpssl = SettingService.GetSetting(settings, "SMTPSSL", ""); + _smtpusername = SettingService.GetSetting(settings, "SMTPUsername", ""); + _smtppassword = SettingService.GetSetting(settings, "SMTPPassword", ""); - createdby = site.CreatedBy; - createdon = site.CreatedOn; - modifiedby = site.ModifiedBy; - modifiedon = site.ModifiedOn; - deletedby = site.DeletedBy; - deletedon = site.DeletedOn; - isdeleted = site.IsDeleted.ToString(); + _createdby = site.CreatedBy; + _createdon = site.CreatedOn; + _modifiedby = site.ModifiedBy; + _modifiedon = site.ModifiedOn; + _deletedby = site.DeletedBy; + _deletedon = site.DeletedOn; + _isdeleted = site.IsDeleted.ToString(); } - themes = ThemeService.GetThemeTypes(Themes); - containers = ThemeService.GetContainerTypes(Themes); + _themes = ThemeService.GetThemeTypes(_themeList); + _containers = ThemeService.GetContainerTypes(_themeList); } catch (Exception ex) { @@ -247,20 +247,20 @@ { try { - themetype = (string)e.Value; - if (themetype != "") + _themetype = (string)e.Value; + if (_themetype != "") { - panelayouts = ThemeService.GetPaneLayoutTypes(Themes, themetype); + _panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype); } else { - panelayouts = new Dictionary(); + _panelayouts = new Dictionary(); } StateHasChanged(); } catch (Exception ex) { - await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", themetype, ex.Message); + await logger.LogError(ex, "Error Loading Pane Layouts For Theme {ThemeType} {Error}", _themetype, ex.Message); AddModuleMessage("Error Loading Pane Layouts For Theme", MessageType.Error); } } @@ -269,12 +269,12 @@ { try { - if (name != "" && urls != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)) && !string.IsNullOrEmpty(containertype)) + if (_name != "" && _urls != "" && !string.IsNullOrEmpty(_themetype) && (_panelayouts.Count == 0 || !string.IsNullOrEmpty(_layouttype)) && !string.IsNullOrEmpty(_containertype)) { bool unique = true; - foreach (string name in urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) + foreach (string name in _urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { - if (aliases.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId)) + if (_aliasList.Exists(item => item.Name == name && item.SiteId != PageState.Alias.SiteId && item.TenantId != PageState.Alias.TenantId)) { unique = false; } @@ -284,23 +284,23 @@ Site site = await SiteService.GetSiteAsync(PageState.Site.SiteId, PageState.Alias); if (site != null) { - site.Name = name; + site.Name = _name; site.LogoFileId = null; - int logofileid = filemanager.GetFileId(); + int logofileid = _filemanager.GetFileId(); if (logofileid != -1) { site.LogoFileId = logofileid; } - site.DefaultThemeType = themetype; - site.DefaultLayoutType = (layouttype == null ? "" : layouttype); - site.DefaultContainerType = containertype; - site.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted)); + site.DefaultThemeType = _themetype; + site.DefaultLayoutType = (_layouttype == null ? "" : _layouttype); + site.DefaultContainerType = _containertype; + site.IsDeleted = (_isdeleted == null ? true : Boolean.Parse(_isdeleted)); site = await SiteService.UpdateSiteAsync(site, PageState.Alias); - urls = urls.Replace("\n", ","); - string[] names = urls.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - foreach (Alias alias in aliases.Where(item => item.SiteId == site.SiteId && item.TenantId == site.TenantId).ToList()) + _urls = _urls.Replace("\n", ","); + string[] 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)) { @@ -309,7 +309,7 @@ } foreach (string name in names) { - if (!aliases.Exists(item => item.Name == name)) + if (!_aliasList.Exists(item => item.Name == name)) { Alias alias = new Alias(); alias.Name = name; @@ -320,11 +320,11 @@ } Dictionary settings = await SettingService.GetSiteSettingsAsync(site.SiteId); - SettingService.SetSetting(settings, "SMTPHost", smtphost); - SettingService.SetSetting(settings, "SMTPPort", smtpport); - SettingService.SetSetting(settings, "SMTPSSL", smtpssl); - SettingService.SetSetting(settings, "SMTPUsername", smtpusername); - SettingService.SetSetting(settings, "SMTPPassword", smtppassword); + SettingService.SetSetting(settings, "SMTPHost", _smtphost); + SettingService.SetSetting(settings, "SMTPPort", _smtpport); + SettingService.SetSetting(settings, "SMTPSSL", _smtpssl); + SettingService.SetSetting(settings, "SMTPUsername", _smtpusername); + SettingService.SetSetting(settings, "SMTPPassword", _smtppassword); await SettingService.UpdateSiteSettingsAsync(settings, site.SiteId); await logger.LogInformation("Site Saved {Site}", site); diff --git a/Oqtane.Client/Modules/Admin/Sites/Edit.razor b/Oqtane.Client/Modules/Admin/Sites/Edit.razor index bc3b499c..9ff55903 100644 --- a/Oqtane.Client/Modules/Admin/Sites/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Sites/Edit.razor @@ -6,7 +6,7 @@ @inject IAliasService AliasService @inject IThemeService ThemeService -@if (themes != null) +@if (_themes != null) { @@ -14,7 +14,7 @@ @@ -22,7 +22,7 @@ @@ -30,7 +30,7 @@
- +
- +
-