197 lines
5.8 KiB
Plaintext
197 lines
5.8 KiB
Plaintext
@using Microsoft.AspNetCore.Components.Routing
|
|
@using Oqtane.Modules.Controls
|
|
@using Oqtane.Models
|
|
@using Oqtane.Services
|
|
@using Oqtane.Modules
|
|
@using Oqtane.Shared
|
|
@using Oqtane.Security
|
|
@namespace Oqtane.Modules.Admin.Pages
|
|
@inherits ModuleBase
|
|
@inject IUriHelper UriHelper
|
|
@inject IPageService PageService
|
|
@inject IThemeService ThemeService
|
|
|
|
<ModuleMessage Message="@message" />
|
|
|
|
<table class="table table-borderless">
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Name: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@name" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Path: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@path" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Parent: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@parentid" readonly>
|
|
<option value=""><Select Parent></option>
|
|
@foreach (Page p in PageState.Pages)
|
|
{
|
|
<option value="@p.PageId">@p.Name</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Navigation? </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@isnavigation" readonly>
|
|
<option value="True">Yes</option>
|
|
<option value="False">No</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Edit Mode? </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@editmode" readonly>
|
|
<option value="True">Yes</option>
|
|
<option value="False">No</option>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Theme: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@themetype" readonly>
|
|
<option value=""><Select Theme></option>
|
|
@foreach (KeyValuePair<string, string> item in themes)
|
|
{
|
|
<option value="@item.Key">@item.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Layout: </label>
|
|
</td>
|
|
<td>
|
|
<select class="form-control" @bind="@layouttype" readonly>
|
|
<option value=""><Select Layout></option>
|
|
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
|
{
|
|
<option value="@panelayout.Key">@panelayout.Value</option>
|
|
}
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Icon: </label>
|
|
</td>
|
|
<td>
|
|
<input class="form-control" @bind="@icon" readonly />
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td>
|
|
<label for="Name" class="control-label">Permissions: </label>
|
|
</td>
|
|
<td>
|
|
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" @ref:suppressField />
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<button type="button" class="btn btn-danger" @onclick="@DeletePage">Delete</button>
|
|
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
|
<br />
|
|
<br />
|
|
<AuditInfo CreatedBy="@createdby" CreatedOn="@createdon" ModifiedBy="@modifiedby" ModifiedOn="@modifiedon"></AuditInfo>
|
|
|
|
@code {
|
|
public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } }
|
|
|
|
string message = "";
|
|
|
|
Dictionary<string, string> themes = new Dictionary<string, string>();
|
|
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
|
|
|
int PageId;
|
|
string name;
|
|
string path;
|
|
string parentid;
|
|
string isnavigation;
|
|
string editmode;
|
|
string themetype;
|
|
string layouttype;
|
|
string icon;
|
|
string permissions;
|
|
string createdby;
|
|
DateTime createdon;
|
|
string modifiedby;
|
|
DateTime modifiedon;
|
|
|
|
PermissionGrid permissiongrid;
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
try
|
|
{
|
|
themes = ThemeService.GetThemeTypes(PageState.Themes);
|
|
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
|
|
|
|
PageId = Int32.Parse(PageState.QueryString["id"]);
|
|
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
|
if (page != null)
|
|
{
|
|
name = page.Name;
|
|
path = page.Path;
|
|
isnavigation = page.IsNavigation.ToString();
|
|
editmode = page.EditMode.ToString();
|
|
themetype = page.ThemeType;
|
|
layouttype = page.LayoutType;
|
|
icon = page.Icon;
|
|
permissions = page.Permissions;
|
|
createdby = page.CreatedBy;
|
|
createdon = page.CreatedOn;
|
|
modifiedby = page.ModifiedBy;
|
|
modifiedon = page.ModifiedOn;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
message = ex.Message;
|
|
}
|
|
}
|
|
|
|
private async Task DeletePage()
|
|
{
|
|
try
|
|
{
|
|
await PageService.DeletePageAsync(Int32.Parse(PageState.QueryString["id"]));
|
|
PageState.Reload = Constants.ReloadSite;
|
|
if (PageState.Page.Name == "Page Management")
|
|
{
|
|
UriHelper.NavigateTo(NavigateUrl());
|
|
}
|
|
else
|
|
{
|
|
UriHelper.NavigateTo(NavigateUrl(""));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
message = ex.Message;
|
|
}
|
|
}
|
|
}
|