Client fixes
Client is partially done. 227 warnings left out of 1500 I like Rider
This commit is contained in:
@ -54,7 +54,6 @@
|
||||
List<Folder> _folders;
|
||||
int _folderId = -1;
|
||||
List<File> _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)
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
@inject IPageService PageService
|
||||
@inject IThemeService ThemeService
|
||||
|
||||
@if (Themes != null)
|
||||
@if (_themeList != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
@ -12,7 +12,7 @@
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@name" />
|
||||
<input class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -20,7 +20,7 @@
|
||||
<label for="Name" class="control-label">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@path" />
|
||||
<input class="form-control" @bind="@_path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -30,7 +30,7 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
@foreach (Page page in pages)
|
||||
@foreach (Page page in _pageList)
|
||||
{
|
||||
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
@ -42,20 +42,20 @@
|
||||
<label for="Name" class="control-label">Insert: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@insert">
|
||||
<select class="form-control" @bind="@_insert">
|
||||
<option value="<<">At Beginning</option>
|
||||
@if (children != null && children.Count > 0)
|
||||
@if (_children != null && _children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
}
|
||||
<option value=">>">At End</option>
|
||||
</select>
|
||||
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
|
||||
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
|
||||
{
|
||||
<select class="form-control" @bind="@childid">
|
||||
<select class="form-control" @bind="@_childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
@foreach (Page page in children)
|
||||
@foreach (Page page in _children)
|
||||
{
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
}
|
||||
@ -68,7 +68,7 @@
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isnavigation">
|
||||
<select class="form-control" @bind="@_isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -79,7 +79,7 @@
|
||||
<label for="Name" class="control-label">Personalizable? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@ispersonalizable">
|
||||
<select class="form-control" @bind="@_ispersonalizable">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -90,7 +90,7 @@
|
||||
<label for="Name" class="control-label">Default Mode? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@mode">
|
||||
<select class="form-control" @bind="@_mode">
|
||||
<option value="view">View Mode</option>
|
||||
<option value="edit">Edit Mode</option>
|
||||
</select>
|
||||
@ -103,7 +103,7 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
}
|
||||
@ -115,9 +115,9 @@
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<select class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
}
|
||||
@ -129,7 +129,7 @@
|
||||
<label for="Name" class="control-label">Icon: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@icon" />
|
||||
<input class="form-control" @bind="@_icon" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -137,7 +137,7 @@
|
||||
<label for="Name" class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
|
||||
<PermissionGrid EntityName="Page" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -148,45 +148,45 @@
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||
|
||||
Dictionary<string, string> themes = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
Dictionary<string, string> _themes = new Dictionary<string, string>();
|
||||
Dictionary<string, string> _panelayouts = new Dictionary<string, string>();
|
||||
|
||||
List<Theme> Themes;
|
||||
List<Page> pages;
|
||||
string name;
|
||||
string path = "";
|
||||
string parentid;
|
||||
string insert = ">>";
|
||||
List<Page> children;
|
||||
int childid = -1;
|
||||
string isnavigation = "True";
|
||||
string ispersonalizable = "False";
|
||||
string mode = "view";
|
||||
string themetype = "";
|
||||
string layouttype = "";
|
||||
string icon = "";
|
||||
string permissions = "";
|
||||
List<Theme> _themeList;
|
||||
List<Page> _pageList;
|
||||
string _name;
|
||||
string _path = "";
|
||||
string _parentid;
|
||||
string _insert = ">>";
|
||||
List<Page> _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<PermissionString> permissionstrings = new List<PermissionString>();
|
||||
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<string, string>();
|
||||
_panelayouts = new Dictionary<string, string>();
|
||||
}
|
||||
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);
|
||||
|
@ -4,7 +4,7 @@
|
||||
@inject IPageService PageService
|
||||
@inject IThemeService ThemeService
|
||||
|
||||
@if (Themes != null)
|
||||
@if (_themeList != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
@ -12,7 +12,7 @@
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@name" />
|
||||
<input class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -20,7 +20,7 @@
|
||||
<label for="Name" class="control-label">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@path" />
|
||||
<input class="form-control" @bind="@_path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -30,9 +30,9 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
@foreach (Page page in pages)
|
||||
@foreach (Page page in _pageList)
|
||||
{
|
||||
if (page.PageId.ToString() == parentid)
|
||||
if (page.PageId.ToString() == _parentid)
|
||||
{
|
||||
<option value="@(page.PageId)" selected>@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
@ -49,24 +49,24 @@
|
||||
<label for="Name" class="control-label">Move: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@insert">
|
||||
@if (parentid == currentparentid)
|
||||
<select class="form-control" @bind="@_insert">
|
||||
@if (_parentid == _currentparentid)
|
||||
{
|
||||
<option value="="><Maintain Current Location></option>
|
||||
}
|
||||
<option value="<<">To Beginning</option>
|
||||
@if (children != null && children.Count > 0)
|
||||
@if (_children != null && _children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
}
|
||||
<option value=">>">To End</option>
|
||||
</select>
|
||||
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
|
||||
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
|
||||
{
|
||||
<select class="form-control" @bind="@childid">
|
||||
<select class="form-control" @bind="@_childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
@foreach (Page page in children)
|
||||
@foreach (Page page in _children)
|
||||
{
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
}
|
||||
@ -79,7 +79,7 @@
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isnavigation">
|
||||
<select class="form-control" @bind="@_isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -90,7 +90,7 @@
|
||||
<label for="Name" class="control-label">Personalizable? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@ispersonalizable">
|
||||
<select class="form-control" @bind="@_ispersonalizable">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -101,7 +101,7 @@
|
||||
<label for="Name" class="control-label">Default Mode? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@mode">
|
||||
<select class="form-control" @bind="@_mode">
|
||||
<option value="view">View Mode</option>
|
||||
<option value="edit">Edit Mode</option>
|
||||
</select>
|
||||
@ -114,9 +114,9 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
if (item.Key == themetype)
|
||||
if (item.Key == _themetype)
|
||||
{
|
||||
<option value="@item.Key" selected>@item.Value</option>
|
||||
}
|
||||
@ -133,9 +133,9 @@
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<select class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
}
|
||||
@ -147,7 +147,7 @@
|
||||
<label for="Name" class="control-label">Icon: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@icon" />
|
||||
<input class="form-control" @bind="@_icon" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -155,7 +155,7 @@
|
||||
<label for="Name" class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
|
||||
<PermissionGrid EntityName="Page" Permissions="@_permissions" @ref="_permissionGrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -163,89 +163,91 @@
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||
|
||||
Dictionary<string, string> themes = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
Dictionary<string, string> _themes = new Dictionary<string, string>();
|
||||
Dictionary<string, string> _panelayouts = new Dictionary<string, string>();
|
||||
|
||||
List<Theme> Themes;
|
||||
List<Page> pages;
|
||||
int PageId;
|
||||
string name;
|
||||
string path;
|
||||
string currentparentid;
|
||||
string parentid;
|
||||
string insert = "=";
|
||||
List<Page> 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<Theme> _themeList;
|
||||
List<Page> _pageList;
|
||||
int _pageId;
|
||||
string _name;
|
||||
string _path;
|
||||
string _currentparentid;
|
||||
string _parentid;
|
||||
string _insert = "=";
|
||||
List<Page> _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<string, string>();
|
||||
_panelayouts = new Dictionary<string, string>();
|
||||
}
|
||||
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)))
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
@inject IThemeService ThemeService
|
||||
@inject ISettingService SettingService
|
||||
|
||||
@if (themes != null)
|
||||
@if (_themes != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
@ -15,7 +15,7 @@
|
||||
<label class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@name" />
|
||||
<input class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -23,7 +23,7 @@
|
||||
<label class="control-label">Tenant: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@tenant" readonly />
|
||||
<input class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -31,7 +31,7 @@
|
||||
<label class="control-label">Aliases: </label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="form-control" @bind="@urls" rows="3"></textarea>
|
||||
<textarea class="form-control" @bind="@_urls" rows="3"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -39,7 +39,7 @@
|
||||
<label class="control-label">Logo: </label>
|
||||
</td>
|
||||
<td>
|
||||
<FileManager FileId="@logofileid.ToString()" @ref="filemanager" />
|
||||
<FileManager FileId="@_logofileid.ToString()" @ref="_filemanager" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -49,9 +49,9 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
if (item.Key == themetype)
|
||||
if (item.Key == _themetype)
|
||||
{
|
||||
<option value="@item.Key" selected>@item.Value</option>
|
||||
}
|
||||
@ -68,9 +68,9 @@
|
||||
<label class="control-label">Default Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<select class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
}
|
||||
@ -82,9 +82,9 @@
|
||||
<label class="control-label">Default Container: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@containertype">
|
||||
<select class="form-control" @bind="@_containertype">
|
||||
<option value=""><Select Container></option>
|
||||
@foreach (KeyValuePair<string, string> container in containers)
|
||||
@foreach (KeyValuePair<string, string> container in _containers)
|
||||
{
|
||||
<option value="@container.Key">@container.Value</option>
|
||||
}
|
||||
@ -96,7 +96,7 @@
|
||||
<label class="control-label">Is Deleted? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isdeleted">
|
||||
<select class="form-control" @bind="@_isdeleted">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -114,7 +114,7 @@
|
||||
<label class="control-label">Host: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@smtphost" />
|
||||
<input class="form-control" @bind="@_smtphost" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -122,7 +122,7 @@
|
||||
<label class="control-label">Port: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@smtpport" />
|
||||
<input class="form-control" @bind="@_smtpport" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -130,7 +130,7 @@
|
||||
<label class="control-label">SSL Enabled: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@smtpssl" />
|
||||
<input class="form-control" @bind="@_smtpssl" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -138,7 +138,7 @@
|
||||
<label class="control-label">Username: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@smtpusername" />
|
||||
<input class="form-control" @bind="@_smtpusername" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -146,7 +146,7 @@
|
||||
<label class="control-label">Password: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="password" class="form-control" @bind="@smtppassword" />
|
||||
<input type="password" class="form-control" @bind="@_smtppassword" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@ -156,85 +156,85 @@
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
||||
|
||||
Dictionary<string, string> themes;
|
||||
Dictionary<string, string> panelayouts;
|
||||
Dictionary<string, string> containers;
|
||||
Dictionary<string, string> _themes;
|
||||
Dictionary<string, string> _panelayouts;
|
||||
Dictionary<string, string> _containers;
|
||||
|
||||
List<Theme> Themes;
|
||||
string name = "";
|
||||
List<Tenant> tenants;
|
||||
string tenant = "";
|
||||
List<Alias> aliases;
|
||||
string urls = "";
|
||||
int logofileid = -1;
|
||||
FileManager filemanager;
|
||||
string themetype;
|
||||
string layouttype;
|
||||
string containertype;
|
||||
List<Theme> _themeList;
|
||||
string _name = "";
|
||||
List<Tenant> _tenantList;
|
||||
string _tenant = "";
|
||||
List<Alias> _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<string, string> 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<string, string>();
|
||||
_panelayouts = new Dictionary<string, string>();
|
||||
}
|
||||
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<string, string> 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);
|
||||
|
@ -6,7 +6,7 @@
|
||||
@inject IAliasService AliasService
|
||||
@inject IThemeService ThemeService
|
||||
|
||||
@if (themes != null)
|
||||
@if (_themes != null)
|
||||
{
|
||||
<table class="table table-borderless">
|
||||
<tr>
|
||||
@ -14,7 +14,7 @@
|
||||
<label class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@name" />
|
||||
<input class="form-control" @bind="@_name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -22,7 +22,7 @@
|
||||
<label class="control-label">Tenant: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@tenant" readonly />
|
||||
<input class="form-control" @bind="@_tenant" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -30,7 +30,7 @@
|
||||
<label class="control-label">Aliases: </label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea class="form-control" @bind="@urls" rows="3" />
|
||||
<textarea class="form-control" @bind="@_urls" rows="3" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -40,9 +40,9 @@
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
@foreach (KeyValuePair<string, string> item in _themes)
|
||||
{
|
||||
if (item.Key == themetype)
|
||||
if (item.Key == _themetype)
|
||||
{
|
||||
<option value="@item.Key" selected>@item.Value</option>
|
||||
}
|
||||
@ -59,9 +59,9 @@
|
||||
<label class="control-label">Default Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<select class="form-control" @bind="@_layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
}
|
||||
@ -73,9 +73,9 @@
|
||||
<label class="control-label">Default Container: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@containertype">
|
||||
<select class="form-control" @bind="@_containertype">
|
||||
<option value=""><Select Container></option>
|
||||
@foreach (KeyValuePair<string, string> container in containers)
|
||||
@foreach (KeyValuePair<string, string> container in _containers)
|
||||
{
|
||||
<option value="@container.Key">@container.Value</option>
|
||||
}
|
||||
@ -87,7 +87,7 @@
|
||||
<label class="control-label">Is Deleted? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isdeleted">
|
||||
<select class="form-control" @bind="@_isdeleted">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
@ -99,73 +99,73 @@
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
<br />
|
||||
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon" DeletedBy="@deletedby" DeletedOn="@deletedon"></AuditInfo>
|
||||
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
|
||||
}
|
||||
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
|
||||
Dictionary<string, string> themes;
|
||||
Dictionary<string, string> panelayouts;
|
||||
Dictionary<string, string> containers;
|
||||
Dictionary<string, string> _themes;
|
||||
Dictionary<string, string> _panelayouts;
|
||||
Dictionary<string, string> _containers;
|
||||
|
||||
Alias Alias;
|
||||
List<Theme> Themes;
|
||||
string name = "";
|
||||
List<Tenant> tenants;
|
||||
string tenant = "";
|
||||
List<Alias> aliases;
|
||||
string urls = "";
|
||||
string themetype;
|
||||
string layouttype;
|
||||
string containertype;
|
||||
Alias _alias;
|
||||
List<Theme> _themeList;
|
||||
string _name = "";
|
||||
List<Tenant> _tenantList;
|
||||
string _tenant = "";
|
||||
List<Alias> _aliasList;
|
||||
string _urls = "";
|
||||
string _themetype;
|
||||
string _layouttype;
|
||||
string _containertype;
|
||||
|
||||
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();
|
||||
|
||||
Alias = aliases.Find(item => item.AliasId == Int32.Parse(PageState.QueryString["id"]));
|
||||
Site site = await SiteService.GetSiteAsync(Alias.SiteId, Alias);
|
||||
_alias = _aliasList.Find(item => item.AliasId == Int32.Parse(PageState.QueryString["id"]));
|
||||
Site site = await SiteService.GetSiteAsync(_alias.SiteId, _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";
|
||||
}
|
||||
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;
|
||||
|
||||
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)
|
||||
{
|
||||
await Log(Alias, LogLevel.Error, "", ex, "Error Loading Site {SiteId} {Error}", Alias.SiteId, ex.Message);
|
||||
await Log(_alias, LogLevel.Error, "", ex, "Error Loading Site {SiteId} {Error}", _alias.SiteId, ex.Message);
|
||||
AddModuleMessage(ex.Message, MessageType.Error);
|
||||
}
|
||||
}
|
||||
@ -174,20 +174,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<string, string>();
|
||||
_panelayouts = new Dictionary<string, string>();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -196,33 +196,33 @@
|
||||
{
|
||||
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 != Alias.SiteId && item.TenantId != Alias.TenantId))
|
||||
if (_aliasList.Exists(item => item.Name == name && item.SiteId != _alias.SiteId && item.TenantId != _alias.TenantId))
|
||||
{
|
||||
unique = false;
|
||||
}
|
||||
}
|
||||
if (unique)
|
||||
{
|
||||
Site site = await SiteService.GetSiteAsync(Alias.SiteId, Alias);
|
||||
Site site = await SiteService.GetSiteAsync(_alias.SiteId, _alias);
|
||||
if (site != null)
|
||||
{
|
||||
site.Name = name;
|
||||
site.Name = _name;
|
||||
site.LogoFileId = null;
|
||||
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 ?? "";
|
||||
site.DefaultContainerType = _containertype;
|
||||
site.IsDeleted = (_isdeleted == null || Boolean.Parse(_isdeleted));
|
||||
|
||||
site = await SiteService.UpdateSiteAsync(site, Alias);
|
||||
site = await SiteService.UpdateSiteAsync(site, _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))
|
||||
{
|
||||
@ -231,17 +231,19 @@
|
||||
}
|
||||
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;
|
||||
alias.TenantId = site.TenantId;
|
||||
alias.SiteId = site.SiteId;
|
||||
Alias alias = new Alias
|
||||
{
|
||||
Name = name,
|
||||
TenantId = site.TenantId,
|
||||
SiteId = site.SiteId
|
||||
};
|
||||
await AliasService.AddAliasAsync(alias);
|
||||
}
|
||||
}
|
||||
|
||||
await Log(Alias, LogLevel.Information,PermissionNames.Edit, null, "Site Saved {Site}", site);
|
||||
await Log(_alias, LogLevel.Information,PermissionNames.Edit, null, "Site Saved {Site}", site);
|
||||
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
@ -258,7 +260,7 @@
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Log(Alias, LogLevel.Error, "", ex, "Error Saving Site {SiteId} {Error}", Alias.SiteId, ex.Message);
|
||||
await Log(_alias, LogLevel.Error, "", ex, "Error Saving Site {SiteId} {Error}", _alias.SiteId, ex.Message);
|
||||
AddModuleMessage("Error Saving Site", MessageType.Error);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
@inject IAliasService AliasService
|
||||
@inject ISiteService SiteService
|
||||
|
||||
@if (sites == null)
|
||||
@if (_sites == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
@ -12,7 +12,7 @@ else
|
||||
{
|
||||
<ActionLink Action="Add" Text="Add Site" />
|
||||
|
||||
<Pager Items="@sites">
|
||||
<Pager Items="@_sites">
|
||||
<Header>
|
||||
<th> </th>
|
||||
<th> </th>
|
||||
@ -21,7 +21,7 @@ else
|
||||
<Row>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.AliasId.ToString())" /></td>
|
||||
<td><ActionDialog Header="Delete Site" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Site?")" Action="Delete" Security="SecurityAccessLevel.Admin" Class="btn btn-danger" OnClick="@(async () => await DeleteSite(context))" /></td>
|
||||
<td><a href="@(scheme + context.Name)">@context.Name</a></td>
|
||||
<td><a href="@(_scheme + context.Name)">@context.Name</a></td>
|
||||
</Row>
|
||||
</Pager>
|
||||
}
|
||||
@ -29,37 +29,37 @@ else
|
||||
@code {
|
||||
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Host; } }
|
||||
|
||||
List<Alias> sites;
|
||||
string scheme;
|
||||
List<Alias> _sites;
|
||||
string _scheme;
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
Uri uri = new Uri(NavigationManager.Uri);
|
||||
scheme = uri.Scheme + "://";
|
||||
_scheme = uri.Scheme + "://";
|
||||
|
||||
List<Alias> aliases = await AliasService.GetAliasesAsync();
|
||||
sites = new List<Alias>();
|
||||
_sites = new List<Alias>();
|
||||
foreach (Alias alias in aliases)
|
||||
{
|
||||
if (!sites.Exists(item => item.TenantId == alias.TenantId && item.SiteId == alias.SiteId))
|
||||
if (!_sites.Exists(item => item.TenantId == alias.TenantId && item.SiteId == alias.SiteId))
|
||||
{
|
||||
sites.Add(alias);
|
||||
_sites.Add(alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteSite(Alias Alias)
|
||||
private async Task DeleteSite(Alias alias)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Alias.SiteId != PageState.Site.SiteId || Alias.TenantId != PageState.Site.TenantId)
|
||||
if (alias.SiteId != PageState.Site.SiteId || alias.TenantId != PageState.Site.TenantId)
|
||||
{
|
||||
await SiteService.DeleteSiteAsync(Alias.SiteId, Alias);
|
||||
await Log(Alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", Alias.SiteId);
|
||||
await SiteService.DeleteSiteAsync(alias.SiteId, alias);
|
||||
await Log(alias, LogLevel.Information, "", null, "Site Deleted {SiteId}", alias.SiteId);
|
||||
List<Alias> aliases = await AliasService.GetAliasesAsync();
|
||||
foreach (Alias alias in aliases.Where(item => item.SiteId == Alias.SiteId && item.TenantId == Alias.TenantId).ToList())
|
||||
foreach (Alias a in aliases.Where(item => item.SiteId == alias.SiteId && item.TenantId == alias.TenantId))
|
||||
{
|
||||
await AliasService.DeleteAliasAsync(alias.AliasId);
|
||||
await AliasService.DeleteAliasAsync(a.AliasId);
|
||||
}
|
||||
NavigationManager.NavigateTo(NavigateUrl());
|
||||
}
|
||||
@ -70,8 +70,8 @@ else
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await Log(Alias, LogLevel.Error, "", ex, "Error Deleting Site {SiteId} {Error}", Alias.SiteId, ex.Message);
|
||||
await Log(alias, LogLevel.Error, "", ex, "Error Deleting Site {SiteId} {Error}", alias.SiteId, ex.Message);
|
||||
AddModuleMessage("Error Deleting Site", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@if (visible)
|
||||
@if (_visible)
|
||||
{
|
||||
<div class="app-admin-modal">
|
||||
<div class="modal" tabindex="-1" role="dialog">
|
||||
@ -26,7 +26,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@if (authorized)
|
||||
@if (_authorized)
|
||||
{
|
||||
if (Disabled)
|
||||
{
|
||||
@ -66,9 +66,9 @@
|
||||
[Parameter]
|
||||
public Action OnClick { get; set; } // required if an Action is specified - executes a method in the calling component
|
||||
|
||||
bool visible = false;
|
||||
bool editmode = true;
|
||||
bool authorized = false;
|
||||
bool _visible = false;
|
||||
bool _editmode = true;
|
||||
bool _authorized = false;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
@ -82,15 +82,15 @@
|
||||
}
|
||||
if (!string.IsNullOrEmpty(EditMode))
|
||||
{
|
||||
editmode = bool.Parse(EditMode);
|
||||
_editmode = bool.Parse(EditMode);
|
||||
}
|
||||
authorized = IsAuthorized();
|
||||
_authorized = IsAuthorized();
|
||||
}
|
||||
|
||||
private bool IsAuthorized()
|
||||
{
|
||||
bool authorized = false;
|
||||
if (PageState.EditMode || !editmode)
|
||||
if (PageState.EditMode || !_editmode)
|
||||
{
|
||||
SecurityAccessLevel security = SecurityAccessLevel.Host;
|
||||
if (Security == null)
|
||||
@ -135,7 +135,7 @@
|
||||
|
||||
private void DisplayModal()
|
||||
{
|
||||
visible = !visible;
|
||||
_visible = !_visible;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,15 @@
|
||||
@inherits ModuleBase
|
||||
@inject IUserService UserService
|
||||
|
||||
@if (authorized)
|
||||
@if (_authorized)
|
||||
{
|
||||
if (Disabled)
|
||||
{
|
||||
<NavLink class="@classname" href="@url" style="@style" disabled>@text</NavLink>
|
||||
<NavLink class="@_classname" href="@_url" style="@_style" disabled>@_text</NavLink>
|
||||
}
|
||||
else
|
||||
{
|
||||
<NavLink class="@classname" href="@url" style="@style">@text</NavLink>
|
||||
<NavLink class="@_classname" href="@_url" style="@_style">@_text</NavLink>
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,50 +39,50 @@
|
||||
[Parameter]
|
||||
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true
|
||||
|
||||
string text = "";
|
||||
string url = "";
|
||||
string parameters = "";
|
||||
string classname = "btn btn-primary";
|
||||
string style = "";
|
||||
bool editmode = true;
|
||||
bool authorized = false;
|
||||
string _text = "";
|
||||
string _url = "";
|
||||
string _parameters = "";
|
||||
string _classname = "btn btn-primary";
|
||||
string _style = "";
|
||||
bool _editmode = true;
|
||||
bool _authorized = false;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
text = Action;
|
||||
_text = Action;
|
||||
if (!string.IsNullOrEmpty(Text))
|
||||
{
|
||||
text = Text;
|
||||
_text = Text;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Parameters))
|
||||
{
|
||||
parameters = Parameters;
|
||||
_parameters = Parameters;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Class))
|
||||
{
|
||||
classname = Class;
|
||||
_classname = Class;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Style))
|
||||
{
|
||||
style = Style;
|
||||
_style = Style;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(EditMode))
|
||||
{
|
||||
editmode = bool.Parse(EditMode);
|
||||
_editmode = bool.Parse(EditMode);
|
||||
}
|
||||
|
||||
url = EditUrl(Action, parameters);
|
||||
authorized = IsAuthorized();
|
||||
_url = EditUrl(Action, _parameters);
|
||||
_authorized = IsAuthorized();
|
||||
}
|
||||
|
||||
private bool IsAuthorized()
|
||||
{
|
||||
bool authorized = false;
|
||||
if (PageState.EditMode || !editmode)
|
||||
if (PageState.EditMode || !_editmode)
|
||||
{
|
||||
SecurityAccessLevel security = SecurityAccessLevel.Host;
|
||||
if (Security == null)
|
||||
|
@ -1,9 +1,9 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@if (text != "")
|
||||
@if (_text != "")
|
||||
{
|
||||
@((MarkupString)@text)
|
||||
@((MarkupString)_text)
|
||||
}
|
||||
|
||||
@code {
|
||||
@ -31,51 +31,51 @@
|
||||
[Parameter]
|
||||
public string Style { get; set; }
|
||||
|
||||
string text = "";
|
||||
string _text = "";
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
text = "";
|
||||
_text = "";
|
||||
if (!String.IsNullOrEmpty(CreatedBy) || CreatedOn != null)
|
||||
{
|
||||
text += "<p style=\"" + Style + "\">Created ";
|
||||
_text += "<p style=\"" + Style + "\">Created ";
|
||||
if (!String.IsNullOrEmpty(CreatedBy))
|
||||
{
|
||||
text += " by <b>" + CreatedBy + "</b>";
|
||||
_text += " by <b>" + CreatedBy + "</b>";
|
||||
}
|
||||
if (CreatedOn != null)
|
||||
{
|
||||
text += " on <b>" + CreatedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += " on <b>" + CreatedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
text += "</p>";
|
||||
_text += "</p>";
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(ModifiedBy) || ModifiedOn != null)
|
||||
{
|
||||
text += "<p style=\"" + Style + "\">Last modified ";
|
||||
_text += "<p style=\"" + Style + "\">Last modified ";
|
||||
if (!String.IsNullOrEmpty(ModifiedBy))
|
||||
{
|
||||
text += " by <b>" + ModifiedBy + "</b>";
|
||||
_text += " by <b>" + ModifiedBy + "</b>";
|
||||
}
|
||||
if (ModifiedOn != null)
|
||||
{
|
||||
text += " on <b>" + ModifiedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += " on <b>" + ModifiedOn.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
text += "</p>";
|
||||
_text += "</p>";
|
||||
}
|
||||
|
||||
if (!String.IsNullOrEmpty(DeletedBy) || DeletedOn.HasValue)
|
||||
{
|
||||
text += "<p style=\"" + Style + "\">Deleted ";
|
||||
_text += "<p style=\"" + Style + "\">Deleted ";
|
||||
if (!String.IsNullOrEmpty(DeletedBy))
|
||||
{
|
||||
text += " by <b>" + DeletedBy + "</b>";
|
||||
_text += " by <b>" + DeletedBy + "</b>";
|
||||
}
|
||||
if (DeletedOn != null)
|
||||
{
|
||||
text += " on <b>" + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
_text += " on <b>" + DeletedOn.Value.ToString("MMM dd yyyy HH:mm:ss") + "</b>";
|
||||
}
|
||||
text += "</p>";
|
||||
_text += "</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,9 @@
|
||||
@inherits ModuleBase
|
||||
@inject IFolderService FolderService
|
||||
@inject IFileService FileService
|
||||
@inject IJSRuntime jsRuntime
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
@if (folders != null)
|
||||
@if (_folders != null)
|
||||
{
|
||||
<div class="container-fluid px-0">
|
||||
<div class="row">
|
||||
@ -15,9 +15,9 @@
|
||||
{
|
||||
<option value="-1"><Select Folder></option>
|
||||
}
|
||||
@foreach (Folder folder in folders)
|
||||
@foreach (Folder folder in _folders)
|
||||
{
|
||||
if (folder.FolderId == folderid)
|
||||
if (folder.FolderId == _folderid)
|
||||
{
|
||||
<option value="@(folder.FolderId)" selected>@(new string('-', folder.Level * 2))@(folder.Name)</option>
|
||||
}
|
||||
@ -28,14 +28,14 @@
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
@if (showfiles)
|
||||
@if (_showfiles)
|
||||
{
|
||||
<div>
|
||||
<select class="form-control" @onchange="(e => FileChanged(e))">
|
||||
<option value="-1"><Select File></option>
|
||||
@foreach (File file in files)
|
||||
@foreach (File file in _files)
|
||||
{
|
||||
if (file.FileId == fileid)
|
||||
if (file.FileId == _fileid)
|
||||
{
|
||||
<option value="@(file.FileId)" selected>@(file.Name)</option>
|
||||
}
|
||||
@ -47,33 +47,33 @@
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
@if (haseditpermission)
|
||||
@if (_haseditpermission)
|
||||
{
|
||||
<div>
|
||||
@if (uploadmultiple)
|
||||
@if (_uploadmultiple)
|
||||
{
|
||||
<input type="file" id="@fileinputid" name="file" accept="@filter" multiple />
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" multiple />
|
||||
}
|
||||
else
|
||||
{
|
||||
<input type="file" id="@fileinputid" name="file" accept="@filter" />
|
||||
<input type="file" id="@_fileinputid" name="file" accept="@_filter" />
|
||||
}
|
||||
<span id="@progressinfoid"></span><progress id="@progressbarid" style="width: 150px; visibility: hidden;"></progress>
|
||||
<span id="@_progressinfoid"></span><progress id="@_progressbarid" style="width: 150px; visibility: hidden;"></progress>
|
||||
<span class="float-right">
|
||||
<button type="button" class="btn btn-success" @onclick="UploadFile">Upload</button>
|
||||
@if (showfiles && GetFileId() != -1)
|
||||
@if (_showfiles && GetFileId() != -1)
|
||||
{
|
||||
<button type="button" class="btn btn-danger" @onclick="DeleteFile">Delete</button>
|
||||
}
|
||||
</span>
|
||||
</div>
|
||||
@((MarkupString)@message)
|
||||
@((MarkupString)_message)
|
||||
}
|
||||
</div>
|
||||
@if (@image != "")
|
||||
@if (_image != "")
|
||||
{
|
||||
<div class="col-auto">
|
||||
@((MarkupString)@image)
|
||||
@((MarkupString)_image)
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@ -99,143 +99,142 @@
|
||||
[Parameter]
|
||||
public string UploadMultiple { get; set; } // optional - enable multiple file uploads - default false
|
||||
|
||||
string id;
|
||||
List<Folder> folders;
|
||||
int folderid = -1;
|
||||
List<File> files = new List<File>();
|
||||
int fileid = -1;
|
||||
bool showfiles = true;
|
||||
string fileinputid = "";
|
||||
string progressinfoid = "";
|
||||
string progressbarid = "";
|
||||
string filter = "*";
|
||||
bool uploadmultiple = false;
|
||||
bool haseditpermission = false;
|
||||
string message = "";
|
||||
string image = "";
|
||||
string _id;
|
||||
List<Folder> _folders;
|
||||
int _folderid = -1;
|
||||
List<File> _files = new List<File>();
|
||||
int _fileid = -1;
|
||||
bool _showfiles = true;
|
||||
string _fileinputid = "";
|
||||
string _progressinfoid = "";
|
||||
string _progressbarid = "";
|
||||
string _filter = "*";
|
||||
bool _uploadmultiple = false;
|
||||
bool _haseditpermission = false;
|
||||
string _message = "";
|
||||
string _image = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
folders = new List<Folder>();
|
||||
folders.Add(new Folder { FolderId = -1, Name = Folder });
|
||||
folderid = -1;
|
||||
_folders = new List<Folder> {new Folder {FolderId = -1, Name = Folder}};
|
||||
_folderid = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
|
||||
_folders = await FolderService.GetFoldersAsync(ModuleState.SiteId);
|
||||
if (!string.IsNullOrEmpty(FolderId))
|
||||
{
|
||||
folderid = int.Parse(FolderId);
|
||||
_folderid = int.Parse(FolderId);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(FileId))
|
||||
{
|
||||
fileid = int.Parse(FileId);
|
||||
_fileid = int.Parse(FileId);
|
||||
await SetImage();
|
||||
if (fileid != -1)
|
||||
if (_fileid != -1)
|
||||
{
|
||||
File file = await FileService.GetFileAsync(int.Parse(FileId));
|
||||
if (file != null)
|
||||
{
|
||||
folderid = file.FolderId;
|
||||
_folderid = file.FolderId;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(ShowFiles))
|
||||
{
|
||||
showfiles = bool.Parse(ShowFiles);
|
||||
_showfiles = bool.Parse(ShowFiles);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Filter))
|
||||
{
|
||||
filter = "." + Filter.Replace(",",",.");
|
||||
_filter = "." + Filter.Replace(",",",.");
|
||||
}
|
||||
|
||||
await GetFiles();
|
||||
|
||||
// create unique id for component
|
||||
id = Guid.NewGuid().ToString("N");
|
||||
fileinputid = id + "FileInput";
|
||||
progressinfoid = id + "ProgressInfo";
|
||||
progressbarid = id + "ProgressBar";
|
||||
_id = Guid.NewGuid().ToString("N");
|
||||
_fileinputid = _id + "FileInput";
|
||||
_progressinfoid = _id + "ProgressInfo";
|
||||
_progressbarid = _id + "ProgressBar";
|
||||
|
||||
if (!string.IsNullOrEmpty(UploadMultiple))
|
||||
{
|
||||
uploadmultiple = bool.Parse(UploadMultiple);
|
||||
_uploadmultiple = bool.Parse(UploadMultiple);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task GetFiles()
|
||||
{
|
||||
haseditpermission = false;
|
||||
_haseditpermission = false;
|
||||
if (!string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
haseditpermission = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
||||
files = await FileService.GetFilesAsync(Folder);
|
||||
_haseditpermission = UserSecurity.IsAuthorized(PageState.User, Constants.HostRole);
|
||||
_files = await FileService.GetFilesAsync(Folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
Folder folder = folders.Where(item => item.FolderId == folderid).FirstOrDefault();
|
||||
Folder folder = _folders.FirstOrDefault(item => item.FolderId == _folderid);
|
||||
if (folder != null)
|
||||
{
|
||||
haseditpermission = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, folder.Permissions);
|
||||
files = await FileService.GetFilesAsync(folderid);
|
||||
_haseditpermission = UserSecurity.IsAuthorized(PageState.User,PermissionNames.Edit, folder.Permissions);
|
||||
_files = await FileService.GetFilesAsync(_folderid);
|
||||
}
|
||||
else
|
||||
{
|
||||
haseditpermission = false;
|
||||
files = new List<File>();
|
||||
_haseditpermission = false;
|
||||
_files = new List<File>();
|
||||
}
|
||||
}
|
||||
if (filter != "*")
|
||||
if (_filter != "*")
|
||||
{
|
||||
List<File> filtered = new List<File>();
|
||||
foreach (File file in files)
|
||||
foreach (File file in _files)
|
||||
{
|
||||
if (filter.ToUpper().IndexOf("." + file.Extension.ToUpper()) != -1)
|
||||
if (_filter.ToUpper().IndexOf("." + file.Extension.ToUpper()) != -1)
|
||||
{
|
||||
filtered.Add(file);
|
||||
}
|
||||
}
|
||||
files = filtered;
|
||||
_files = filtered;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FolderChanged(ChangeEventArgs e)
|
||||
{
|
||||
message = "";
|
||||
_message = "";
|
||||
try
|
||||
{
|
||||
folderid = int.Parse((string)e.Value);
|
||||
_folderid = int.Parse((string)e.Value);
|
||||
await GetFiles();
|
||||
fileid = -1;
|
||||
image = "";
|
||||
_fileid = -1;
|
||||
_image = "";
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Loading Files {Error}", ex.Message);
|
||||
message = "<br /><div class=\"alert alert-danger\" role=\"alert\">Error Loading Files</div>";
|
||||
_message = "<br /><div class=\"alert alert-danger\" role=\"alert\">Error Loading Files</div>";
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FileChanged(ChangeEventArgs e)
|
||||
{
|
||||
message = "";
|
||||
fileid = int.Parse((string)e.Value);
|
||||
_message = "";
|
||||
_fileid = int.Parse((string)e.Value);
|
||||
await SetImage();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
private async Task SetImage()
|
||||
{
|
||||
image = "";
|
||||
if (fileid != -1)
|
||||
_image = "";
|
||||
if (_fileid != -1)
|
||||
{
|
||||
File file = await FileService.GetFileAsync(fileid);
|
||||
File file = await FileService.GetFileAsync(_fileid);
|
||||
if (file.ImageHeight != 0 && file.ImageWidth != 0)
|
||||
{
|
||||
int maxwidth = 200;
|
||||
@ -245,7 +244,7 @@
|
||||
double ratioY = (double)maxheight / (double)file.ImageHeight;
|
||||
double ratio = ratioX < ratioY ? ratioX : ratioY;
|
||||
|
||||
image = "<img src=\"" + ContentUrl(fileid) + "\" alt=\"" + file.Name +
|
||||
_image = "<img src=\"" + ContentUrl(_fileid) + "\" alt=\"" + file.Name +
|
||||
"\" width=\"" + Convert.ToInt32(file.ImageWidth * ratio).ToString() +
|
||||
"\" height=\"" + Convert.ToInt32(file.ImageHeight * ratio).ToString() + "\" />";
|
||||
}
|
||||
@ -254,8 +253,8 @@
|
||||
|
||||
private async Task UploadFile()
|
||||
{
|
||||
var interop = new Interop(jsRuntime);
|
||||
string[] upload = await interop.GetFiles(fileinputid);
|
||||
var interop = new Interop(JsRuntime);
|
||||
string[] upload = await interop.GetFiles(_fileinputid);
|
||||
if (upload.Length > 0)
|
||||
{
|
||||
try
|
||||
@ -263,23 +262,23 @@
|
||||
string result;
|
||||
if (!string.IsNullOrEmpty(Folder))
|
||||
{
|
||||
result = await FileService.UploadFilesAsync(Folder, upload, id);
|
||||
result = await FileService.UploadFilesAsync(Folder, upload, _id);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = await FileService.UploadFilesAsync(folderid, upload, id);
|
||||
result = await FileService.UploadFilesAsync(_folderid, upload, _id);
|
||||
}
|
||||
if (result == "")
|
||||
{
|
||||
await logger.LogInformation("File Upload Succeeded {Files}", upload);
|
||||
message = "<br /><div class=\"alert alert-success\" role=\"alert\">File Upload Succeeded</div>";
|
||||
_message = "<br /><div class=\"alert alert-success\" role=\"alert\">File Upload Succeeded</div>";
|
||||
await GetFiles();
|
||||
if (upload.Length == 1)
|
||||
{
|
||||
File file = files.Where(item => item.Name == upload[0]).FirstOrDefault();
|
||||
File file = _files.Where(item => item.Name == upload[0]).FirstOrDefault();
|
||||
if (file != null)
|
||||
{
|
||||
fileid = file.FileId;
|
||||
_fileid = file.FileId;
|
||||
await SetImage();
|
||||
}
|
||||
}
|
||||
@ -288,44 +287,44 @@
|
||||
else
|
||||
{
|
||||
await logger.LogError("File Upload Failed For {Files}", result.Replace(",", ", "));
|
||||
message = "<br /><div class=\"alert alert-danger\" role=\"alert\">File Upload Failed</div>";
|
||||
_message = "<br /><div class=\"alert alert-danger\" role=\"alert\">File Upload Failed</div>";
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "File Upload Failed {Error}", ex.Message);
|
||||
message = "<br /><div class=\"alert alert-danger\" role=\"alert\">File Upload Failed</div>";
|
||||
_message = "<br /><div class=\"alert alert-danger\" role=\"alert\">File Upload Failed</div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Have Not Selected A File To Upload</div>";
|
||||
_message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Have Not Selected A File To Upload</div>";
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeleteFile()
|
||||
{
|
||||
message = "";
|
||||
_message = "";
|
||||
try
|
||||
{
|
||||
await FileService.DeleteFileAsync(fileid);
|
||||
await logger.LogInformation("File Deleted {File}", fileid);
|
||||
message = "<br /><div class=\"alert alert-success\" role=\"alert\">File Deleted</div>";
|
||||
await FileService.DeleteFileAsync(_fileid);
|
||||
await logger.LogInformation("File Deleted {File}", _fileid);
|
||||
_message = "<br /><div class=\"alert alert-success\" role=\"alert\">File Deleted</div>";
|
||||
await GetFiles();
|
||||
fileid = -1;
|
||||
_fileid = -1;
|
||||
await SetImage();
|
||||
StateHasChanged();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await logger.LogError(ex, "Error Deleting File {File} {Error}", fileid, ex.Message);
|
||||
message = "<br /><div class=\"alert alert-danger\" role=\"alert\">Error Deleting File</div>";
|
||||
await logger.LogError(ex, "Error Deleting File {File} {Error}", _fileid, ex.Message);
|
||||
_message = "<br /><div class=\"alert alert-danger\" role=\"alert\">Error Deleting File</div>";
|
||||
}
|
||||
}
|
||||
|
||||
public int GetFileId()
|
||||
{
|
||||
return fileid;
|
||||
return _fileid;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@typeparam TableItem
|
||||
@typeparam TAbleItem
|
||||
|
||||
<p>
|
||||
@if(Format == "Table")
|
||||
@ -36,40 +36,40 @@
|
||||
</div>
|
||||
}
|
||||
<div class="mx-auto text-center">
|
||||
@if (Page > MaxPages)
|
||||
@if (_page > _maxPages)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("back"))><span class="oi oi-media-skip-backward" title="back" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (EndPage > 1)
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("previous"))><span class="oi oi-chevron-left" title="previous" aria-hidden="true"></span></button>
|
||||
@for (int i = StartPage; i <= EndPage; i++)
|
||||
@for (int i = _startPage; i <= _endPage; i++)
|
||||
{
|
||||
var pager = i;
|
||||
<button class="btn @((pager == Page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||
<button class="btn @((pager == _page) ? "btn-primary" : "btn-link")" @onclick=@(async () => UpdateList(pager))>
|
||||
@pager
|
||||
</button>
|
||||
}
|
||||
<button class="btn btn-secondary" @onclick=@(async () => NavigateToPage("next"))><span class="oi oi-chevron-right" title="next" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (EndPage < Pages)
|
||||
@if (_endPage < _pages)
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick=@(async () => SetPagerSize("forward"))><span class="oi oi-media-skip-forward" title="forward" aria-hidden="true"></span></button>
|
||||
}
|
||||
@if (EndPage > 1)
|
||||
@if (_endPage > 1)
|
||||
{
|
||||
<span class="btn btn-link disabled">Page @Page of @Pages</span>
|
||||
<span class="btn btn-link disabled">Page @_page of @_pages</span>
|
||||
}
|
||||
</div>
|
||||
</p>
|
||||
|
||||
@code {
|
||||
int Pages = 0;
|
||||
int Page = 1;
|
||||
int MaxItems;
|
||||
int MaxPages;
|
||||
int StartPage;
|
||||
int EndPage;
|
||||
int _pages = 0;
|
||||
int _page = 1;
|
||||
int _maxItems;
|
||||
int _maxPages;
|
||||
int _startPage;
|
||||
int _endPage;
|
||||
|
||||
[Parameter]
|
||||
public string Format { get; set; }
|
||||
@ -78,13 +78,13 @@
|
||||
public RenderFragment Header { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<TableItem> Row { get; set; }
|
||||
public RenderFragment<TAbleItem> Row { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public RenderFragment<TableItem> Detail { get; set; }
|
||||
public RenderFragment<TAbleItem> Detail { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public IEnumerable<TableItem> Items { get; set; }
|
||||
public IEnumerable<TAbleItem> Items { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string PageSize { get; set; }
|
||||
@ -95,7 +95,7 @@
|
||||
[Parameter]
|
||||
public string Class { get; set; }
|
||||
|
||||
IEnumerable<TableItem> ItemList { get; set; }
|
||||
IEnumerable<TAbleItem> ItemList { get; set; }
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
@ -116,34 +116,34 @@
|
||||
}
|
||||
if (string.IsNullOrEmpty(PageSize))
|
||||
{
|
||||
MaxItems = 10;
|
||||
_maxItems = 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxItems = int.Parse(PageSize);
|
||||
_maxItems = int.Parse(PageSize);
|
||||
}
|
||||
if (string.IsNullOrEmpty(DisplayPages))
|
||||
{
|
||||
MaxPages = 5;
|
||||
_maxPages = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
MaxPages = int.Parse(DisplayPages);
|
||||
_maxPages = int.Parse(DisplayPages);
|
||||
}
|
||||
|
||||
if (Items != null)
|
||||
{
|
||||
ItemList = Items.Skip((Page - 1) * MaxItems).Take(MaxItems);
|
||||
Pages = (int)Math.Ceiling(Items.Count() / (decimal)MaxItems);
|
||||
ItemList = Items.Skip((_page - 1) * _maxItems).Take(_maxItems);
|
||||
_pages = (int)Math.Ceiling(Items.Count() / (decimal)_maxItems);
|
||||
}
|
||||
|
||||
SetPagerSize("forward");
|
||||
}
|
||||
|
||||
public void UpdateList(int CurrentPage)
|
||||
public void UpdateList(int currentPage)
|
||||
{
|
||||
ItemList = Items.Skip((CurrentPage - 1) * MaxItems).Take(MaxItems);
|
||||
Page = CurrentPage;
|
||||
ItemList = Items.Skip((currentPage - 1) * _maxItems).Take(_maxItems);
|
||||
_page = currentPage;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
@ -151,29 +151,29 @@
|
||||
{
|
||||
if (direction == "forward")
|
||||
{
|
||||
if (EndPage + 1 < Pages)
|
||||
if (_endPage + 1 < _pages)
|
||||
{
|
||||
StartPage = EndPage + 1;
|
||||
_startPage = _endPage + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
StartPage = 1;
|
||||
_startPage = 1;
|
||||
}
|
||||
|
||||
if (EndPage + MaxPages < Pages)
|
||||
if (_endPage + _maxPages < _pages)
|
||||
{
|
||||
EndPage = StartPage + MaxPages - 1;
|
||||
_endPage = _startPage + _maxPages - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
EndPage = Pages;
|
||||
_endPage = _pages;
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
else if (direction == "back")
|
||||
{
|
||||
EndPage = StartPage - 1;
|
||||
StartPage = StartPage - MaxPages;
|
||||
_endPage = _startPage - 1;
|
||||
_startPage = _startPage - _maxPages;
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,26 +181,26 @@
|
||||
{
|
||||
if (direction == "next")
|
||||
{
|
||||
if (Page < Pages)
|
||||
if (_page < _pages)
|
||||
{
|
||||
if (Page == EndPage)
|
||||
if (_page == _endPage)
|
||||
{
|
||||
SetPagerSize("forward");
|
||||
}
|
||||
Page += 1;
|
||||
_page += 1;
|
||||
}
|
||||
}
|
||||
else if (direction == "previous")
|
||||
{
|
||||
if (Page > 1)
|
||||
if (_page > 1)
|
||||
{
|
||||
if (Page == StartPage)
|
||||
if (_page == _startPage)
|
||||
{
|
||||
SetPagerSize("back");
|
||||
}
|
||||
Page -= 1;
|
||||
_page -= 1;
|
||||
}
|
||||
}
|
||||
UpdateList(Page);
|
||||
UpdateList(_page);
|
||||
}
|
||||
}
|
@ -3,23 +3,23 @@
|
||||
@inject IRoleService RoleService
|
||||
@inject IUserService UserService
|
||||
|
||||
@if (permissions != null)
|
||||
@if (_permissions != null)
|
||||
{
|
||||
<br />
|
||||
<table class="table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>Role</th>
|
||||
@foreach (PermissionString permission in permissions)
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
<th style="text-align: center;">@permission.PermissionName @EntityName</th>
|
||||
}
|
||||
</tr>
|
||||
@foreach (Role role in roles)
|
||||
@foreach (Role role in _roles)
|
||||
{
|
||||
<tr>
|
||||
<td>@role.Name</td>
|
||||
@foreach (PermissionString permission in permissions)
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
var p = permission;
|
||||
<td style="text-align: center;">
|
||||
@ -30,25 +30,25 @@
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
@if (@users.Count != 0)
|
||||
@if (_users.Count != 0)
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>User</th>
|
||||
@foreach (PermissionString permission in permissions)
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
<th style="text-align: center;">@permission.PermissionName @EntityName</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (User user in users)
|
||||
@foreach (User user in _users)
|
||||
{
|
||||
string userid = "[" + user.UserId.ToString() + "]";
|
||||
<tr>
|
||||
<td>@user.DisplayName</td>
|
||||
@foreach (PermissionString permission in permissions)
|
||||
@foreach (PermissionString permission in _permissions)
|
||||
{
|
||||
var p = permission;
|
||||
<td style="text-align: center;">
|
||||
@ -64,13 +64,13 @@
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: right;"><label for="Username" class="control-label">User: </label></td>
|
||||
<td><input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@username" /></td>
|
||||
<td><input type="text" name="Username" class="form-control" placeholder="Enter Username" @bind="@_username" /></td>
|
||||
<td style="text-align: left;"><button type="button" class="btn btn-primary" @onclick="AddUser">Add</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<ModuleMessage Type="MessageType.Error" Message="@message" />
|
||||
<ModuleMessage Type="MessageType.Error" Message="@_message" />
|
||||
}
|
||||
|
||||
@code {
|
||||
@ -83,38 +83,38 @@
|
||||
[Parameter]
|
||||
public string Permissions { get; set; }
|
||||
|
||||
string permissionnames = "";
|
||||
List<Role> roles;
|
||||
List<PermissionString> permissions;
|
||||
List<User> users = new List<User>();
|
||||
string username = "";
|
||||
string message = "";
|
||||
string _permissionnames = "";
|
||||
List<Role> _roles;
|
||||
List<PermissionString> _permissions;
|
||||
List<User> _users = new List<User>();
|
||||
string _username = "";
|
||||
string _message = "";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
if (string.IsNullOrEmpty(PermissionNames))
|
||||
{
|
||||
permissionnames = "View,Edit";
|
||||
_permissionnames = "View,Edit";
|
||||
}
|
||||
else
|
||||
{
|
||||
permissionnames = PermissionNames;
|
||||
_permissionnames = PermissionNames;
|
||||
}
|
||||
roles = await RoleService.GetRolesAsync(ModuleState.SiteId);
|
||||
roles.Insert(0, new Role { Name = Constants.AllUsersRole });
|
||||
_roles = await RoleService.GetRolesAsync(ModuleState.SiteId);
|
||||
_roles.Insert(0, new Role { Name = Constants.AllUsersRole });
|
||||
|
||||
if (!string.IsNullOrEmpty(Permissions))
|
||||
{
|
||||
permissions = new List<PermissionString>();
|
||||
foreach (string permissionname in permissionnames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
_permissions = new List<PermissionString>();
|
||||
foreach (string permissionname in _permissionnames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
permissions.Add(new PermissionString { PermissionName = permissionname, Permissions = "" });
|
||||
_permissions.Add(new PermissionString { PermissionName = permissionname, Permissions = "" });
|
||||
}
|
||||
foreach (PermissionString permissionstring in UserSecurity.GetPermissionStrings(Permissions))
|
||||
{
|
||||
if (permissions.Find(item => item.PermissionName == permissionstring.PermissionName) != null)
|
||||
if (_permissions.Find(item => item.PermissionName == permissionstring.PermissionName) != null)
|
||||
{
|
||||
permissions[permissions.FindIndex(item => item.PermissionName == permissionstring.PermissionName)].Permissions = permissionstring.Permissions;
|
||||
_permissions[_permissions.FindIndex(item => item.PermissionName == permissionstring.PermissionName)].Permissions = permissionstring.Permissions;
|
||||
}
|
||||
if (permissionstring.Permissions.Contains("["))
|
||||
{
|
||||
@ -123,9 +123,9 @@
|
||||
if (user.Contains("]"))
|
||||
{
|
||||
int userid = int.Parse(user.Substring(0, user.IndexOf("]")));
|
||||
if (users.Where(item => item.UserId == userid).FirstOrDefault() == null)
|
||||
if (_users.Where(item => item.UserId == userid).FirstOrDefault() == null)
|
||||
{
|
||||
users.Add(await UserService.GetUserAsync(userid, ModuleState.SiteId));
|
||||
_users.Add(await UserService.GetUserAsync(userid, ModuleState.SiteId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -134,15 +134,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
private bool? GetPermissionValue(string Permissions, string SecurityKey)
|
||||
private bool? GetPermissionValue(string permissions, string securityKey)
|
||||
{
|
||||
if ((";" + Permissions + ";").Contains(";" + "!" + SecurityKey + ";"))
|
||||
if ((";" + permissions + ";").Contains(";" + "!" + securityKey + ";"))
|
||||
{
|
||||
return false; // deny permission
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((";" + Permissions + ";").Contains(";" + SecurityKey + ";"))
|
||||
if ((";" + permissions + ";").Contains(";" + securityKey + ";"))
|
||||
{
|
||||
return true; // grant permission
|
||||
}
|
||||
@ -153,9 +153,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
private bool GetPermissionDisabled(string RoleName)
|
||||
private bool GetPermissionDisabled(string roleName)
|
||||
{
|
||||
if (RoleName == Constants.AdminRole)
|
||||
if (roleName == Constants.AdminRole)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -167,67 +167,67 @@
|
||||
|
||||
private async Task AddUser()
|
||||
{
|
||||
if (users.Where(item => item.Username == username).FirstOrDefault() == null)
|
||||
if (_users.Where(item => item.Username == _username).FirstOrDefault() == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
User user = await UserService.GetUserAsync(username, ModuleState.SiteId);
|
||||
User user = await UserService.GetUserAsync(_username, ModuleState.SiteId);
|
||||
if (user != null)
|
||||
{
|
||||
users.Add(user);
|
||||
_users.Add(user);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
message = "Username Does Not Exist";
|
||||
_message = "Username Does Not Exist";
|
||||
}
|
||||
}
|
||||
username = "";
|
||||
_username = "";
|
||||
}
|
||||
|
||||
private void PermissionChanged(bool? Value, string PermissionName, string SecurityId)
|
||||
private void PermissionChanged(bool? value, string permissionName, string securityId)
|
||||
{
|
||||
bool? selected = Value;
|
||||
PermissionString permission = permissions.Find(item => item.PermissionName == PermissionName);
|
||||
bool? selected = value;
|
||||
PermissionString permission = _permissions.Find(item => item.PermissionName == permissionName);
|
||||
if (permission != null)
|
||||
{
|
||||
List<string> ids = permission.Permissions.Split(';').ToList();
|
||||
|
||||
ids.Remove(SecurityId); // remove grant permission
|
||||
ids.Remove("!" + SecurityId); // remove deny permission
|
||||
ids.Remove(securityId); // remove grant permission
|
||||
ids.Remove("!" + securityId); // remove deny permission
|
||||
|
||||
switch (selected)
|
||||
{
|
||||
case true:
|
||||
ids.Add(SecurityId); // add grant permission
|
||||
ids.Add(securityId); // add grant permission
|
||||
break;
|
||||
case false:
|
||||
ids.Add("!" + SecurityId); // add deny permission
|
||||
ids.Add("!" + securityId); // add deny permission
|
||||
break;
|
||||
case null:
|
||||
break; // permission not specified
|
||||
}
|
||||
permissions[permissions.FindIndex(item => item.PermissionName == PermissionName)].Permissions = string.Join(";", ids.ToArray());
|
||||
_permissions[_permissions.FindIndex(item => item.PermissionName == permissionName)].Permissions = string.Join(";", ids.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
public string GetPermissions()
|
||||
{
|
||||
ValidatePermissions();
|
||||
return UserSecurity.SetPermissionStrings(permissions);
|
||||
return UserSecurity.SetPermissionStrings(_permissions);
|
||||
}
|
||||
|
||||
private void ValidatePermissions()
|
||||
{
|
||||
PermissionString permission;
|
||||
for (int i = 0; i < permissions.Count; i++)
|
||||
for (int i = 0; i < _permissions.Count; i++)
|
||||
{
|
||||
permission = permissions[i];
|
||||
permission = _permissions[i];
|
||||
List<string> ids = permission.Permissions.Split(';').ToList();
|
||||
ids.Remove("!" + Constants.AllUsersRole); // remove deny all users
|
||||
ids.Remove("!" + Constants.RegisteredRole); // remove deny registered users
|
||||
permission.Permissions = string.Join(";", ids.ToArray());
|
||||
permissions[i] = permission;
|
||||
_permissions[i] = permission;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IJSRuntime JSRuntime
|
||||
@inject IJSRuntime JsRuntime
|
||||
|
||||
@if (filemanagervisible)
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
<FileManager @ref="filemanager" Filter="@Constants.ImageFiles" />
|
||||
@((MarkupString)@message)
|
||||
<FileManager @ref="_fileManager" Filter="@Constants.ImageFiles" />
|
||||
@((MarkupString)_message)
|
||||
<br />
|
||||
}
|
||||
<div class="row justify-content-center">
|
||||
<button type="button" class="btn btn-success" @onclick="InsertImage">Insert Image</button>
|
||||
@if (filemanagervisible)
|
||||
@if (_filemanagervisible)
|
||||
{
|
||||
@((MarkupString)" ")
|
||||
<button type="button" class="btn btn-secondary" @onclick="CloseFileManager">Close</button>
|
||||
@ -18,10 +18,10 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class ="col">
|
||||
<div @ref="@ToolBar">
|
||||
<div @ref="@_toolBar">
|
||||
@ToolbarContent
|
||||
</div>
|
||||
<div @ref="@EditorElement">
|
||||
<div @ref="@_editorElement">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -42,20 +42,20 @@
|
||||
[Parameter]
|
||||
public string DebugLevel { get; set; } = "info";
|
||||
|
||||
private ElementReference EditorElement;
|
||||
private ElementReference ToolBar;
|
||||
bool filemanagervisible = false;
|
||||
FileManager filemanager;
|
||||
string message = "";
|
||||
private ElementReference _editorElement;
|
||||
private ElementReference _toolBar;
|
||||
bool _filemanagervisible = false;
|
||||
FileManager _fileManager;
|
||||
string _message = "";
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await RichTextEditorInterop.CreateEditor(
|
||||
JSRuntime,
|
||||
EditorElement,
|
||||
ToolBar,
|
||||
JsRuntime,
|
||||
_editorElement,
|
||||
_toolBar,
|
||||
ReadOnly,
|
||||
Placeholder,
|
||||
Theme,
|
||||
@ -66,68 +66,68 @@
|
||||
public async Task<string> GetText()
|
||||
{
|
||||
return await RichTextEditorInterop.GetText(
|
||||
JSRuntime,
|
||||
EditorElement);
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task<string> GetHTML()
|
||||
public async Task<string> GetHtml()
|
||||
{
|
||||
return await RichTextEditorInterop.GetHTML(
|
||||
JSRuntime,
|
||||
EditorElement);
|
||||
return await RichTextEditorInterop.GetHtml(
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task<string> GetContent()
|
||||
{
|
||||
return await RichTextEditorInterop.GetContent(
|
||||
JSRuntime,
|
||||
EditorElement);
|
||||
JsRuntime,
|
||||
_editorElement);
|
||||
}
|
||||
|
||||
public async Task LoadContent(string Content)
|
||||
public async Task LoadContent(string content)
|
||||
{
|
||||
await RichTextEditorInterop.LoadEditorContent(
|
||||
JSRuntime,
|
||||
EditorElement, Content);
|
||||
JsRuntime,
|
||||
_editorElement, content);
|
||||
}
|
||||
|
||||
public async Task EnableEditor(bool mode)
|
||||
{
|
||||
await RichTextEditorInterop.EnableEditor(
|
||||
JSRuntime,
|
||||
EditorElement, mode);
|
||||
JsRuntime,
|
||||
_editorElement, mode);
|
||||
}
|
||||
|
||||
public async Task InsertImage()
|
||||
{
|
||||
if (filemanagervisible)
|
||||
if (_filemanagervisible)
|
||||
{
|
||||
int fileid = filemanager.GetFileId();
|
||||
int fileid = _fileManager.GetFileId();
|
||||
if (fileid != -1)
|
||||
{
|
||||
await RichTextEditorInterop.InsertImage(
|
||||
JSRuntime,
|
||||
EditorElement, ContentUrl(fileid));
|
||||
filemanagervisible = false;
|
||||
message = "";
|
||||
JsRuntime,
|
||||
_editorElement, ContentUrl(fileid));
|
||||
_filemanagervisible = false;
|
||||
_message = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select An Image To Insert</div>";
|
||||
_message = "<br /><div class=\"alert alert-warning\" role=\"alert\">You Must Select An Image To Insert</div>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
filemanagervisible = true;
|
||||
message = "";
|
||||
_filemanagervisible = true;
|
||||
_message = "";
|
||||
}
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void CloseFileManager()
|
||||
{
|
||||
filemanagervisible = false;
|
||||
message = "";
|
||||
_filemanagervisible = false;
|
||||
_message = "";
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
<CascadingValue Value="this">
|
||||
<div>
|
||||
@foreach (TabPanel tabPanel in TabPanels)
|
||||
@foreach (TabPanel tabPanel in _tabPanels)
|
||||
{
|
||||
<button type="button"
|
||||
class="btn @GetButtonClass(tabPanel)"
|
||||
@ -21,12 +21,12 @@
|
||||
public RenderFragment ChildContent { get; set; }
|
||||
|
||||
public TabPanel ActiveTabPanel { get; set; }
|
||||
List<TabPanel> TabPanels = new List<TabPanel>();
|
||||
List<TabPanel> _tabPanels = new List<TabPanel>();
|
||||
|
||||
internal void AddTabPanel(TabPanel tabPanel)
|
||||
{
|
||||
TabPanels.Add(tabPanel);
|
||||
if (TabPanels.Count == 1)
|
||||
_tabPanels.Add(tabPanel);
|
||||
if (_tabPanels.Count == 1)
|
||||
ActiveTabPanel = tabPanel;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
@namespace Oqtane.Modules.Controls
|
||||
|
||||
<img src="@src" title="@title" @onclick="SetValue" />
|
||||
<img src="@_src" title="@_title" @onclick="SetValue" />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
@ -12,13 +12,13 @@
|
||||
[Parameter]
|
||||
public Action<bool?> OnChange { get; set; }
|
||||
|
||||
bool? value = null;
|
||||
string title;
|
||||
string src = "";
|
||||
bool? _value = null;
|
||||
string _title;
|
||||
string _src = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
value = Value;
|
||||
_value = Value;
|
||||
SetImage();
|
||||
}
|
||||
|
||||
@ -26,38 +26,38 @@
|
||||
{
|
||||
if (!Disabled)
|
||||
{
|
||||
switch (value)
|
||||
switch (_value)
|
||||
{
|
||||
case true:
|
||||
value = false;
|
||||
_value = false;
|
||||
break;
|
||||
case false:
|
||||
value = null;
|
||||
_value = null;
|
||||
break;
|
||||
case null:
|
||||
value = true;
|
||||
_value = true;
|
||||
break;
|
||||
}
|
||||
SetImage();
|
||||
OnChange(value);
|
||||
OnChange(_value);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetImage()
|
||||
{
|
||||
switch (value)
|
||||
switch (_value)
|
||||
{
|
||||
case true:
|
||||
src = "images/checked.png";
|
||||
title = "Permission Granted";
|
||||
_src = "images/checked.png";
|
||||
_title = "Permission Granted";
|
||||
break;
|
||||
case false:
|
||||
src = "images/unchecked.png";
|
||||
title = "Permission Denied";
|
||||
_src = "images/unchecked.png";
|
||||
_title = "Permission Denied";
|
||||
break;
|
||||
case null:
|
||||
src = "images/null.png";
|
||||
title = "";
|
||||
_src = "images/null.png";
|
||||
_title = "";
|
||||
break;
|
||||
}
|
||||
StateHasChanged();
|
||||
|
@ -158,7 +158,7 @@
|
||||
|
||||
private async Task RawHtmlEditor()
|
||||
{
|
||||
content = await this.RichTextEditorHtml.GetHTML();
|
||||
content = await this.RichTextEditorHtml.GetHtml();
|
||||
RichTextEditorMode = false;
|
||||
StateHasChanged();
|
||||
}
|
||||
@ -167,7 +167,7 @@
|
||||
{
|
||||
if (RichTextEditorMode)
|
||||
{
|
||||
content = await RichTextEditorHtml.GetHTML();
|
||||
content = await RichTextEditorHtml.GetHtml();
|
||||
}
|
||||
|
||||
content = content.Replace(((PageState.Alias.Path == "") ? "/~" : PageState.Alias.Path) + Constants.ContentUrl, Constants.ContentUrl);
|
||||
|
@ -4,6 +4,7 @@ using Oqtane.Models;
|
||||
using System.Threading.Tasks;
|
||||
using Oqtane.Services;
|
||||
using System;
|
||||
using Oqtane.Enums;
|
||||
using Oqtane.UI;
|
||||
|
||||
namespace Oqtane.Modules
|
||||
|
Reference in New Issue
Block a user