improving admin components

This commit is contained in:
Shaun Walker 2020-04-17 12:59:53 -04:00
parent b9d70dd11a
commit f56d1fe543
9 changed files with 797 additions and 675 deletions

View File

@ -4,26 +4,8 @@
@inject IFileService FileService @inject IFileService FileService
@inject IFolderService FolderService @inject IFolderService FolderService
@if (_folders != null) <TabStrip>
{ <TabPanel Name="Upload" Heading="Upload Files">
<div class="container-fluid">
<div class="form-group">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#Upload" role="tab">
Upload Files
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#Download" role="tab">
Download Files
</a>
</li>
</ul>
<div class="tab-content">
<div id="Upload" class="tab-pane fade show active" role="tabpanel">
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
@ -34,12 +16,15 @@
</td> </td>
</tr> </tr>
</table> </table>
</div> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<div id="Download" class="tab-pane fade" role="tabpanel"> </TabPanel>
<TabPanel Name="Download" Heading="Download Files">
@if (_folders != null)
{
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="url" HelpText="Enter the file url">Url: </Label> <Label For="url" HelpText="Enter the url of the file you wish to download">Url: </Label>
</td> </td>
<td> <td>
<input id="url" class="form-control" @bind="@url" /> <input id="url" class="form-control" @bind="@url" />
@ -47,7 +32,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="folder" HelpText="Select the folder the file is in">Folder: </Label> <Label For="folder" HelpText="Select the folder to save the file in">Folder: </Label>
</td> </td>
<td> <td>
<select id="folder" class="form-control" @bind="@_folderId"> <select id="folder" class="form-control" @bind="@_folderId">
@ -60,14 +45,11 @@
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-primary" @onclick="Download">Download</button> <button type="button" class="btn btn-success" @onclick="Download">Download</button>
</div>
</div>
</div>
</div>
<br />
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
} }
</TabPanel>
</TabStrip>
@code { @code {
private string url = string.Empty; private string url = string.Empty;

View File

@ -33,7 +33,7 @@
</tr> </tr>
<tr> <tr>
<td colspan="2" align="center"> <td colspan="2" align="center">
<Label For="permissions" HelpText="Select the permissions you want for the file">Permissions: </Label> <Label For="permissions" HelpText="Select the permissions you want for the folder">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" /> <PermissionGrid EntityName="@EntityNames.Folder" PermissionNames="Browse,View,Edit" Permissions="@_permissions" @ref="_permissionGrid" />
</td> </td>
</tr> </tr>

View File

@ -3,7 +3,9 @@
@inject IModuleDefinitionService ModuleDefinitionService @inject IModuleDefinitionService ModuleDefinitionService
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
<table class="table table-borderless"> <TabStrip>
<TabPanel Name="Definition">
<table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="name" HelpText="The name of the module">Name: </Label> <Label For="name" HelpText="The name of the module">Name: </Label>
@ -13,21 +15,101 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" align="center"> <td>
<Label For="permissions" HelpText="Select who you want to access the module">Permissions: </Label> <Label For="version" HelpText="The version of the module">Version: </Label>
</td>
<td>
<input id="version" class="form-control" @bind="@_version" disabled />
</td>
</tr>
<tr>
<td>
<Label For="categories" HelpText="Comma delimited list of module categories">Categories: </Label>
</td>
<td>
<input id="categories" class="form-control" @bind="@_categories" />
</td>
</tr>
</table>
<Section Name="Information">
<table class="table table-borderless">
<tr>
<td>
<Label For="moduledefinitionname" HelpText="The internal name of the module">Internal Name: </Label>
</td>
<td>
<input id="moduledefinitionname" class="form-control" @bind="@_moduledefinitionname" disabled />
</td>
</tr>
<tr>
<td>
<Label For="description" HelpText="The description of the module">Description: </Label>
</td>
<td>
<textarea id="description" class="form-control" @bind="@_description" rows="2" disabled></textarea>
</td>
</tr>
<tr>
<td>
<Label For="owner" HelpText="The owner or creator of the module">Owner: </Label>
</td>
<td>
<input id="owner" class="form-control" @bind="@_owner" disabled />
</td>
</tr>
<tr>
<td>
<Label For="url" HelpText="The reference url of the module">Reference Url: </Label>
</td>
<td>
<input id="url" class="form-control" @bind="@_url" disabled />
</td>
</tr>
<tr>
<td>
<Label For="contact" HelpText="The contact for the module">Contact: </Label>
</td>
<td>
<input id="contact" class="form-control" @bind="@_contact" disabled />
</td>
</tr>
<tr>
<td>
<Label For="license" HelpText="The license of the module">License: </Label>
</td>
<td>
<textarea id="license" class="form-control" @bind="@_license" rows="5" disabled></textarea>
</td>
</tr>
</table>
</Section>
</TabPanel>
<TabPanel Name="Permissions">
<table class="table table-borderless">
<tr>
<td>
<PermissionGrid EntityName="@EntityNames.ModuleDefinition" PermissionNames="@PermissionNames.Utilize" Permissions="@_permissions" @ref="_permissionGrid" /> <PermissionGrid EntityName="@EntityNames.ModuleDefinition" PermissionNames="@PermissionNames.Utilize" Permissions="@_permissions" @ref="_permissionGrid" />
</td> </td>
</tr> </tr>
</table> </table>
</TabPanel>
</TabStrip>
<button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">Save</button> <button type="button" class="btn btn-success" @onclick="SaveModuleDefinition">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br /><br />
<br />
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo> <AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon"></AuditInfo>
@code { @code {
private int _moduleDefinitionId; private int _moduleDefinitionId;
private string _name; private string _name;
private string _version;
private string _categories;
private string _moduledefinitionname = "";
private string _description = "";
private string _owner = "";
private string _url = "";
private string _contact = "";
private string _license = "";
private string _permissions; private string _permissions;
private string _createdby; private string _createdby;
private DateTime _createdon; private DateTime _createdon;
@ -49,6 +131,14 @@
if (moduleDefinition != null) if (moduleDefinition != null)
{ {
_name = moduleDefinition.Name; _name = moduleDefinition.Name;
_version = moduleDefinition.Version;
_categories = moduleDefinition.Categories;
_moduledefinitionname = moduleDefinition.ModuleDefinitionName;
_description = moduleDefinition.Description;
_owner = moduleDefinition.Owner;
_url = moduleDefinition.Url;
_contact = moduleDefinition.Contact;
_license = moduleDefinition.License;
_permissions = moduleDefinition.Permissions; _permissions = moduleDefinition.Permissions;
_createdby = moduleDefinition.CreatedBy; _createdby = moduleDefinition.CreatedBy;
_createdon = moduleDefinition.CreatedOn; _createdon = moduleDefinition.CreatedOn;

View File

@ -5,32 +5,11 @@
@inject IModuleService ModuleService @inject IModuleService ModuleService
@inject IPageModuleService PageModuleService @inject IPageModuleService PageModuleService
@if (_containers != null) <TabStrip>
{ <TabPanel Name="Settings" Heading="Module Settings">
<div class="container-fluid"> @if (_containers != null)
<div class="form-group">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#Settings" role="tab">
Module Settings
</a>
</li>
@if (_settingsModuleType != null)
{ {
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#ModuleSettings" role="tab">
@_settingstitle
</a>
</li>
}
</ul>
<div class="tab-content">
<div id="Settings" class="tab-pane fade show active" role="tabpanel">
<br />
<table class="table table-borderless"> <table class="table table-borderless">
<tbody>
<tr> <tr>
<td> <td>
<Label For="title" HelpText="Enter the title of the module">Title: </Label> <Label For="title" HelpText="Enter the title of the module">Title: </Label>
@ -53,12 +32,6 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td colspan="2" align="center">
<Label For="permissions" HelpText="Who do you want to be able to access the module">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
</td>
</tr>
<tr> <tr>
<td> <td>
<Label For="page" HelpText="The page that the module is on">Page: </Label> <Label For="page" HelpText="The page that the module is on">Page: </Label>
@ -67,28 +40,38 @@
<select id="page" class="form-control" @bind="@_pageId"> <select id="page" class="form-control" @bind="@_pageId">
@foreach (Page p in PageState.Pages) @foreach (Page p in PageState.Pages)
{ {
<option value="@p.PageId">@p.Name</option> if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
{
<option value="@p.PageId">@(new string('-', p.Level * 2))@(p.Name)</option>
}
} }
</select> </select>
</td> </td>
</tr> </tr>
</tbody>
</table> </table>
</div> }
</TabPanel>
<TabPanel Name="Permissions">
@if (_containers != null)
{
<table class="table table-borderless">
<tr>
<td>
<PermissionGrid EntityName="@EntityNames.Module" PermissionNames="@_permissionNames" Permissions="@_permissions" @ref="_permissionGrid" />
</td>
</tr>
</table>
}
</TabPanel>
@if (_settingsModuleType != null) @if (_settingsModuleType != null)
{ {
<div id="ModuleSettings" class="tab-pane fade" role="tabpanel"> <TabPanel Name="ModuleSettings" Heading="@_settingstitle">
<br />
@DynamicComponent @DynamicComponent
</div> </TabPanel>
} }
</div> </TabStrip>
</div> <button type="button" class="btn btn-success" @onclick="SaveModule">Save</button>
</div> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<button type="button" class="btn btn-success" @onclick="SaveModule">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
}
@code { @code {
private Dictionary<string, string> _containers; private Dictionary<string, string> _containers;

View File

@ -4,8 +4,10 @@
@inject IPageService PageService @inject IPageService PageService
@inject IThemeService ThemeService @inject IThemeService ThemeService
@if (_themeList != null) <TabStrip>
{ <TabPanel Name="Settings">
@if (_themeList != null)
{
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
@ -17,23 +19,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Title" HelpText="Enter the page title">Title: </Label> <Label For="Parent" HelpText="Select the parent for the page in the site hierarchy">Parent: </Label>
</td>
<td>
<input id="Title" class="form-control" @bind="@_title" />
</td>
</tr>
<tr>
<td>
<Label For="Path" HelpText="Enter the path for the page">Path: </Label>
</td>
<td>
<input id="Path" class="form-control" @bind="@_path" />
</td>
</tr>
<tr>
<td>
<Label For="Parent" HelpText="Select the parent for the page">Parent: </Label>
</td> </td>
<td> <td>
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))"> <select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
@ -47,7 +33,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Insert" HelpText="Select the insert for the page">Insert: </Label> <Label For="Insert" HelpText="Select the location where you would like the page to be inserted in relation to other pages">Insert: </Label>
</td> </td>
<td> <td>
<select id="Insert" class="form-control" @bind="@_insert"> <select id="Insert" class="form-control" @bind="@_insert">
@ -61,7 +47,7 @@
</select> </select>
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{ {
<select id="Insert" class="form-control" @bind="@_childid"> <select class="form-control" @bind="@_childid">
<option value="-1">&lt;Select Page&gt;</option> <option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in _children) @foreach (Page page in _children)
{ {
@ -73,7 +59,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Navigation" HelpText="Select whether the page has navigation bar">Navigation? </Label> <Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden">Navigation? </Label>
</td> </td>
<td> <td>
<select id="Navigation" class="form-control" @bind="@_isnavigation"> <select id="Navigation" class="form-control" @bind="@_isnavigation">
@ -84,26 +70,84 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Url" HelpText="Enter the url for the page">Url: </Label> <Label For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used.">Url Path: </Label>
</td>
<td>
<input id="Path" class="form-control" @bind="@_path" />
</td>
</tr>
<tr>
<td>
<Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it">Redirect: </Label>
</td> </td>
<td> <td>
<input id="Url" class="form-control" @bind="@_url" /> <input id="Url" class="form-control" @bind="@_url" />
</td> </td>
</tr> </tr>
</table>
<Section Name="Appearance">
<table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="Personalizable" HelpText="Do you want the page to be personalized by users">Personalizable? </Label> <Label For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used.">Title: </Label>
</td> </td>
<td> <td>
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable"> <input id="Title" class="form-control" @bind="@_title" />
<option value="True">Yes</option> </td>
<option value="False">No</option> </tr>
<tr>
<td>
<Label For="Theme" HelpText="Select the theme for this page">Theme: </Label>
</td>
<td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in _themes)
{
if (item.Key == _themetype)
{
<option value="@item.Key" selected>@item.Value</option>
}
else
{
<option value="@item.Key">@item.Value</option>
}
}
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Default-Mode" HelpText="Select the default mode you want for the page">Default Mode? </Label> <Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
</td>
<td>
<select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{
if (panelayout.Key == _layouttype)
{
<option value="@panelayout.Key" selected>@panelayout.Value</option>
}
else
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
}
</select>
</td>
</tr>
<tr>
<td>
<Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation">Icon: </Label>
</td>
<td>
<input id="Icon" class="form-control" @bind="@_icon" />
</td>
</tr>
<tr>
<td>
<Label For="Default-Mode" HelpText="Select the default administration mode you want for this page">Default Mode? </Label>
</td> </td>
<td> <td>
<select id="Default-Mode" class="form-control" @bind="@_mode"> <select id="Default-Mode" class="form-control" @bind="@_mode">
@ -114,54 +158,35 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Theme" HelpText="Select the theme you want for the page">Theme: </Label> <Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
<option value="">&lt;Select Theme&gt;</option> <option value="True">Yes</option>
@foreach (KeyValuePair<string, string> item in _themes) <option value="False">No</option>
{
<option value="@item.Key">@item.Value</option>
}
</select> </select>
</td> </td>
</tr> </tr>
<tr> </table>
<td> </Section>
<Label For="Layout" HelpText="Select the layout for the page">Layout: </Label>
</td>
<td>
<select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
} }
</select> </TabPanel>
</td> <TabPanel Name="Permissions">
</tr> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="Icon" HelpText="Enter the icon for the page">Icon: </Label>
</td>
<td>
<input id="Icon" class="form-control" @bind="@_icon" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<Label For="Permissions" HelpText="Select the permissions you want for the page">Permissions: </Label>
<PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" /> <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button> </TabPanel>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> </TabStrip>
} <button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
@code { @code {
private Dictionary<string, string> _themes = new Dictionary<string, string>(); private Dictionary<string, string> _themes;
private Dictionary<string, string> _panelayouts = new Dictionary<string, string>(); private Dictionary<string, string> _panelayouts;
private List<Theme> _themeList; private List<Theme> _themeList;
private List<Page> _pageList; private List<Page> _pageList;
private string _name; private string _name;
@ -191,12 +216,12 @@
_pageList = PageState.Pages; _pageList = PageState.Pages;
_children = PageState.Pages.Where(item => item.ParentId == null).ToList(); _children = PageState.Pages.Where(item => item.ParentId == null).ToList();
_themes = ThemeService.GetThemeTypes(_themeList);
_themetype = PageState.Site.DefaultThemeType; _themetype = PageState.Site.DefaultThemeType;
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_layouttype = PageState.Site.DefaultLayoutType; _layouttype = PageState.Site.DefaultLayoutType;
_themes = ThemeService.GetThemeTypes(_themeList);
_panelayouts = ThemeService.GetPaneLayoutTypes(_themeList, _themetype);
_permissions = string.Empty; _permissions = string.Empty;
} }
catch (Exception ex) catch (Exception ex)
@ -211,13 +236,26 @@
try try
{ {
_parentid = (string)e.Value; _parentid = (string)e.Value;
_children = new List<Page>();
if (_parentid == "-1") if (_parentid == "-1")
{ {
_children = PageState.Pages.Where(item => item.ParentId == null).ToList(); foreach (Page p in PageState.Pages.Where(item => item.ParentId == null))
{
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
{
_children.Add(p);
}
}
} }
else else
{ {
_children = PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)).ToList(); foreach (Page p in PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)))
{
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
{
_children.Add(p);
}
}
} }
StateHasChanged(); StateHasChanged();
} }
@ -241,7 +279,6 @@
{ {
_panelayouts = new Dictionary<string, string>(); _panelayouts = new Dictionary<string, string>();
} }
StateHasChanged(); StateHasChanged();
} }
catch (Exception ex) catch (Exception ex)

View File

@ -4,36 +4,22 @@
@inject IPageService PageService @inject IPageService PageService
@inject IThemeService ThemeService @inject IThemeService ThemeService
@if (_themeList != null) <TabStrip>
{ <TabPanel Name="Settings">
@if (_themeList != null)
{
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<Label For="Name" HelpText="Enter the page name">Name: </Label> <Label For="Name" HelpText="Enter the page name">Name: </Label>
</td> </td>
<td> <td>
<input id="name" class="form-control" @bind="@_name" /> <input id="Name" class="form-control" @bind="@_name" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Title" HelpText="Enter the page title">Title: </Label> <Label For="Parent" HelpText="Select the parent for the page in the site hierarchy">Parent: </Label>
</td>
<td>
<input id="Title" class="form-control" @bind="@_title" />
</td>
</tr>
<tr>
<td>
<Label For="Path" HelpText="Enter the path for the page">Path: </Label>
</td>
<td>
<input id="Path" class="form-control" @bind="@_path" />
</td>
</tr>
<tr>
<td>
<Label For="Parent" HelpText="Select the parent for the page">Parent: </Label>
</td> </td>
<td> <td>
<select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))"> <select id="Parent" class="form-control" @onchange="(e => ParentChanged(e))">
@ -54,7 +40,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Move" HelpText="Select where you wan to move the page">Move: </Label> <Label For="Move" HelpText="Select the location where you would like the page to be moved in relation to other pages">Move: </Label>
</td> </td>
<td> <td>
<select id="Move" class="form-control" @bind="@_insert"> <select id="Move" class="form-control" @bind="@_insert">
@ -72,7 +58,7 @@
</select> </select>
@if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">")) @if (_children != null && _children.Count > 0 && (_insert == "<" || _insert == ">"))
{ {
<select id="Move" class="form-control" @bind="@_childid"> <select class="form-control" @bind="@_childid">
<option value="-1">&lt;Select Page&gt;</option> <option value="-1">&lt;Select Page&gt;</option>
@foreach (Page page in _children) @foreach (Page page in _children)
{ {
@ -84,15 +70,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label for="Url" HelpText="Enter the url for the page">Url: </Label> <Label For="Navigation" HelpText="Select whether the page is part of the site navigation or hidden">Navigation? </Label>
</td>
<td>
<input id="Url" class="form-control" @bind="@_url" />
</td>
</tr>
<tr>
<td>
<Label For="Navigation" HelpText="Select whether the page has navigation bar">Navigation? </Label>
</td> </td>
<td> <td>
<select id="Navigation" class="form-control" @bind="@_isnavigation"> <select id="Navigation" class="form-control" @bind="@_isnavigation">
@ -103,29 +81,34 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Personalizable" HelpText="Do you want the page to be personalized by users">Personalizable? </Label> <Label For="Path" HelpText="Optionally enter a url path for this page (ie. home ). If you do not provide a url path, the page name will be used.">Url Path: </Label>
</td> </td>
<td> <td>
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable"> <input id="Path" class="form-control" @bind="@_path" />
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Default-Mode" HelpText="Select the default mode you want for the page">Default Mode? </Label> <Label For="Url" HelpText="Optionally enter a url which this page should redirect to when a user navigates to it">Redirect: </Label>
</td> </td>
<td> <td>
<select id="Default-Mode" class="form-control" @bind="@_mode"> <input id="Url" class="form-control" @bind="@_url" />
<option value="view">View Mode</option> </td>
<option value="edit">Edit Mode</option> </tr>
</select> </table>
<Section Name="Appearance">
<table class="table table-borderless">
<tr>
<td>
<Label For="Title" HelpText="Optionally enter the page title. If you do not provide a page title, the page name will be used.">Title: </Label>
</td>
<td>
<input id="Title" class="form-control" @bind="@_title" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Theme" HelpText="Select the theme you want for the page">Theme: </Label> <Label For="Theme" HelpText="Select the theme for this page">Theme: </Label>
</td> </td>
<td> <td>
<select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))"> <select id="Theme" class="form-control" @onchange="(e => ThemeChanged(e))">
@ -146,43 +129,77 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Layout" HelpText="Select the layout for the page">Layout: </Label> <Label For="Layout" HelpText="Select a layout for the page (if the selected theme supports it)">Layout: </Label>
</td> </td>
<td> <td>
<select id="Layout" class="form-control" @bind="@_layouttype"> <select id="Layout" class="form-control" @bind="@_layouttype">
<option value="">&lt;Select Layout&gt;</option> <option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in _panelayouts) @foreach (KeyValuePair<string, string> panelayout in _panelayouts)
{
if (panelayout.Key == _layouttype)
{
<option value="@panelayout.Key" selected>@panelayout.Value</option>
}
else
{ {
<option value="@panelayout.Key">@panelayout.Value</option> <option value="@panelayout.Key">@panelayout.Value</option>
} }
}
</select> </select>
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<Label For="Icon" HelpText="Enter the icon for the page">Icon: </Label> <Label For="Icon" HelpText="Optionally provide an icon for this page which will be displayed in the site navigation">Icon: </Label>
</td> </td>
<td> <td>
<input id="Icon" class="form-control" @bind="@_icon" /> <input id="Icon" class="form-control" @bind="@_icon" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td colspan="2" align="center"> <td>
<Label For="Permissions" HelpText="Select the permissions you want for the page">Permissions: </Label> <Label For="Default-Mode" HelpText="Select the default administration mode you want for this page">Default Mode? </Label>
</td>
<td>
<select id="Default-Mode" class="form-control" @bind="@_mode">
<option value="view">View Mode</option>
<option value="edit">Edit Mode</option>
</select>
</td>
</tr>
<tr>
<td>
<Label For="Personalizable" HelpText="Select whether you would like users to be able to personalize this page with their own content">Personalizable? </Label>
</td>
<td>
<select id="Personalizable" class="form-control" @bind="@_ispersonalizable">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
</table>
</Section>
<br /><br />
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
}
</TabPanel>
<TabPanel Name="Permissions">
<table class="table table-borderless">
<tr>
<td>
<PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" /> <PermissionGrid EntityName="@EntityNames.Page" Permissions="@_permissions" @ref="_permissionGrid" />
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button> </TabPanel>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> </TabStrip>
<br /> <button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
<br /> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<AuditInfo CreatedBy="@_createdby" CreatedOn="@_createdon" ModifiedBy="@_modifiedby" ModifiedOn="@_modifiedon" DeletedBy="@_deletedby" DeletedOn="@_deletedon"></AuditInfo>
}
@code { @code {
private Dictionary<string, string> _themes = new Dictionary<string, string>(); private Dictionary<string, string> _themes;
private Dictionary<string, string> _panelayouts = new Dictionary<string, string>(); private Dictionary<string, string> _panelayouts;
private List<Theme> _themeList; private List<Theme> _themeList;
private List<Page> _pageList; private List<Page> _pageList;
private int _pageId; private int _pageId;
@ -277,13 +294,26 @@
try try
{ {
_parentid = (string)e.Value; _parentid = (string)e.Value;
_children = new List<Page>();
if (_parentid == "-1") if (_parentid == "-1")
{ {
_children = PageState.Pages.Where(item => item.ParentId == null).ToList(); foreach(Page p in PageState.Pages.Where(item => item.ParentId == null))
{
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
{
_children.Add(p);
}
}
} }
else else
{ {
_children = PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)).ToList(); foreach (Page p in PageState.Pages.Where(item => item.ParentId == int.Parse(_parentid)))
{
if (UserSecurity.IsAuthorized(PageState.User, PermissionNames.View, p.Permissions))
{
_children.Add(p);
}
}
} }
if (_parentid == _currentparentid) if (_parentid == _currentparentid)
{ {

View File

@ -6,26 +6,10 @@
@inject ISettingService SettingService @inject ISettingService SettingService
@inject INotificationService NotificationService @inject INotificationService NotificationService
@if (PageState.User != null && profiles != null) <TabStrip>
{ <TabPanel Name="Identity">
<div class="container-fluid"> @if (PageState.User != null)
<div class="form-group"> {
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" data-toggle="tab" href="#Profile" role="tab">
Profile
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" href="#Notifications" role="tab">
Notifications
</a>
</li>
</ul>
<div class="tab-content">
<div id="Profile" class="tab-pane fade show active" role="tabpanel">
@if (photofileid != -1) @if (photofileid != -1)
{ {
<img src="@(ContentUrl(photofileid))" alt="@displayname" style="max-width: 400px" class="rounded-circle mx-auto d-block"> <img src="@(ContentUrl(photofileid))" alt="@displayname" style="max-width: 400px" class="rounded-circle mx-auto d-block">
@ -83,7 +67,15 @@
<FileManager FileId="@photofileid.ToString()" @ref="filemanager" /> <FileManager FileId="@photofileid.ToString()" @ref="filemanager" />
</td> </td>
</tr> </tr>
</table>
<button type="button" class="btn btn-primary" @onclick="Save">Save</button>
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
}
</TabPanel>
<TabPanel Name="Profile">
@if (profiles != null)
{
<table class="table table-borderless">
@foreach (Profile profile in profiles) @foreach (Profile profile in profiles)
{ {
var p = profile; var p = profile;
@ -108,10 +100,11 @@
</table> </table>
<button type="button" class="btn btn-primary" @onclick="Save">Save</button> <button type="button" class="btn btn-primary" @onclick="Save">Save</button>
<button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button> <button type="button" class="btn btn-secondary" @onclick="Cancel">Cancel</button>
</div> }
</TabPanel>
<div id="Notifications" class="tab-pane fade" role="tabpanel"> <TabPanel Name="Notifications">
<br /> @if (notifications != null)
{
<ActionLink Action="Add" Text="Send Notification" Security="SecurityAccessLevel.View" EditMode="false" /> <ActionLink Action="Add" Text="Send Notification" Security="SecurityAccessLevel.View" EditMode="false" />
<br /><br /> <br /><br />
@if (filter == "to") @if (filter == "to")
@ -133,7 +126,7 @@
</Row> </Row>
<Detail> <Detail>
<td colspan="2"></td> <td colspan="2"></td>
<td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0,100) : context.Body)</td> <td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body)</td>
</Detail> </Detail>
</Pager> </Pager>
} }
@ -156,7 +149,7 @@
</Row> </Row>
<Detail> <Detail>
<td colspan="2"></td> <td colspan="2"></td>
<td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0,100) : context.Body)</td> <td colspan="3">@(context.Body.Length > 100 ? context.Body.Substring(0, 100) : context.Body)</td>
</Detail> </Detail>
</Pager> </Pager>
} }
@ -165,11 +158,9 @@
<option value="to">Inbox</option> <option value="to">Inbox</option>
<option value="from">Sent Items</option> <option value="from">Sent Items</option>
</select> </select>
</div> }
</div> </TabPanel>
</div> </TabStrip>
</div>
}
@code { @code {
private string username = string.Empty; private string username = string.Empty;

View File

@ -12,7 +12,7 @@
<th>Role</th> <th>Role</th>
@foreach (PermissionString permission in _permissions) @foreach (PermissionString permission in _permissions)
{ {
<th style="text-align: center;">@permission.PermissionName @EntityName</th> <th style="text-align: center;">@permission.PermissionName</th>
} }
</tr> </tr>
@foreach (Role role in _roles) @foreach (Role role in _roles)
@ -38,7 +38,7 @@
<th>User</th> <th>User</th>
@foreach (PermissionString permission in _permissions) @foreach (PermissionString permission in _permissions)
{ {
<th style="text-align: center;">@permission.PermissionName @EntityName</th> <th style="text-align: center;">@permission.PermissionName</th>
} }
</tr> </tr>
</thead> </thead>

View File

@ -38,7 +38,15 @@
public RenderFragment ChildContent { get; set; } // contains the TabPanels public RenderFragment ChildContent { get; set; } // contains the TabPanels
[Parameter] [Parameter]
public string ActiveTab { get; set; } // optional - defaults to first TabPanel if not specified public string ActiveTab { get; set; } // optional - defaults to first TabPanel if not specified. Can also be set using a "tab=" querystring parameter.
protected override void OnInitialized()
{
if (PageState.QueryString.ContainsKey("tab"))
{
ActiveTab = PageState.QueryString["tab"];
}
}
internal void AddTabPanel(TabPanel tabPanel) internal void AddTabPanel(TabPanel tabPanel)
{ {
@ -47,6 +55,7 @@
{ {
ActiveTab = tabPanel.Name; ActiveTab = tabPanel.Name;
} }
StateHasChanged();
} }
private string DisplayHeading(string Name, string Heading) private string DisplayHeading(string Name, string Heading)