Initial commit
This commit is contained in:
34
Oqtane.Client/Modules/Admin/Admin/Index.razor
Normal file
34
Oqtane.Client/Modules/Admin/Admin/Index.razor
Normal file
@ -0,0 +1,34 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models;
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IPageService PageService
|
||||
@inject IUserService UserService
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var p in pages)
|
||||
{
|
||||
if (p.IsNavigation && UserService.IsAuthorized(PageState.User, p.ViewPermissions))
|
||||
{
|
||||
string url = PageState.Alias + p.Path;
|
||||
<li class="list-group-item">
|
||||
<NavLink class="nav-link" href="@url" Match="NavLinkMatch.All">
|
||||
<span class="oi @p.Icon" aria-hidden="true"></span> @p.Name
|
||||
</NavLink>
|
||||
</li>
|
||||
}
|
||||
}
|
||||
</ul>
|
||||
<br /><br />
|
||||
|
||||
@functions {
|
||||
List<Page> pages;
|
||||
|
||||
protected override void OnInit()
|
||||
{
|
||||
// display list of pages which are children of current page
|
||||
pages = PageState.Pages.Where(item => item.ParentId == PageState.Page.PageId).ToList();
|
||||
}
|
||||
}
|
49
Oqtane.Client/Modules/Admin/Login/Index.razor
Normal file
49
Oqtane.Client/Modules/Admin/Login/Index.razor
Normal file
@ -0,0 +1,49 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Modules
|
||||
@using Microsoft.JSInterop
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IJSRuntime jsRuntime
|
||||
@inject IUserService UserService
|
||||
|
||||
<div class="container">
|
||||
@((MarkupString)Message)
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Username: </label>
|
||||
<input type="text" name="Username" class="form-control" placeholder="Username" bind="@Username" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Password: </label>
|
||||
<input type="password" name="Password" class="form-control" placeholder="Password" bind="@Password" />
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary" onclick="@Login">Login</button>
|
||||
<NavLink class="btn btn" href="/">Cancel</NavLink>
|
||||
</div>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Anonymous; } }
|
||||
|
||||
public string Message { get; set; } = "<div class=\"alert alert-info\" role=\"alert\">Use host/host For Demo Access</div>";
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
private async Task Login()
|
||||
{
|
||||
List<User> users = await UserService.GetUsersAsync();
|
||||
User user = users.Where(item => item.Username == Username).FirstOrDefault();
|
||||
if (user != null)
|
||||
{
|
||||
var interop = new Interop(jsRuntime);
|
||||
await interop.SetCookie("user", user.UserId.ToString(), 7);
|
||||
UriHelper.NavigateTo(PageState.Alias, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Message = "<div class=\"alert alert-danger\" role=\"alert\">User Does Not Exist</div>";
|
||||
}
|
||||
}
|
||||
}
|
41
Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
Normal file
41
Oqtane.Client/Modules/Admin/ModuleDefinitions/Index.razor
Normal file
@ -0,0 +1,41 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject IModuleDefinitionService ModuleDefinitionService
|
||||
|
||||
@if (moduledefinitions == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var moduledefinition in moduledefinitions)
|
||||
{
|
||||
<tr>
|
||||
<td>@moduledefinition.Name</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
List<ModuleDefinition> moduledefinitions;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
moduledefinitions = await ModuleDefinitionService.GetModuleDefinitionsAsync();
|
||||
}
|
||||
}
|
115
Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor
Normal file
115
Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor
Normal file
@ -0,0 +1,115 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject ISkinService SkinService
|
||||
@inject IModuleService ModuleService
|
||||
@inject IPageModuleService PageModuleService
|
||||
|
||||
<table class="form-group">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Title" class="control-label">Title: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="Title" class="form-control" bind="@title" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Container" class="control-label">Container: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@containertype">
|
||||
<option value=""><Select Container></option>
|
||||
@foreach (KeyValuePair<string, string> container in containers)
|
||||
{
|
||||
<option value="@container.Key">@container.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="ViewPermissions" class="control-label">View Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="ViewPermissions" class="form-control" bind="@viewpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="EditPermissions" class="control-label">Edit Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="EditPermissions" class="form-control" bind="@editpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Page" class="control-label">Page: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@pageid">
|
||||
@foreach (Page p in PageState.Pages)
|
||||
{
|
||||
<option value="@p.PageId">@p.Name</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@SaveModule">Save</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Edit; } }
|
||||
|
||||
Dictionary<string, string> containers = new Dictionary<string, string>();
|
||||
string title;
|
||||
string containertype;
|
||||
string viewpermissions;
|
||||
string editpermissions;
|
||||
string pageid;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
title = ModuleState.Title;
|
||||
List<Skin> Skins = await SkinService.GetSkinsAsync();
|
||||
foreach (Skin skin in Skins)
|
||||
{
|
||||
foreach (string container in skin.ContainerControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
containers.Add(container, skin.Name + " - " + @Utilities.GetTypeNameClass(container));
|
||||
}
|
||||
}
|
||||
containertype = ModuleState.ContainerType;
|
||||
viewpermissions = ModuleState.ViewPermissions;
|
||||
editpermissions = ModuleState.EditPermissions;
|
||||
pageid = ModuleState.PageId.ToString();
|
||||
}
|
||||
|
||||
private async Task SaveModule()
|
||||
{
|
||||
Module module = ModuleState;
|
||||
module.ViewPermissions = viewpermissions;
|
||||
module.EditPermissions = editpermissions;
|
||||
await ModuleService.UpdateModuleAsync(module);
|
||||
|
||||
PageModule pagemodule = new PageModule();
|
||||
pagemodule.PageModuleId = ModuleState.PageModuleId;
|
||||
pagemodule.PageId = Int32.Parse(pageid);
|
||||
pagemodule.ModuleId = ModuleState.ModuleId;
|
||||
pagemodule.Title = title;
|
||||
pagemodule.Pane = ModuleState.Pane;
|
||||
pagemodule.Order = ModuleState.Order;
|
||||
pagemodule.ContainerType = containertype;
|
||||
await PageModuleService.UpdatePageModuleAsync(pagemodule);
|
||||
|
||||
UriHelper.NavigateTo(NavigateUrl(true));
|
||||
}
|
||||
}
|
187
Oqtane.Client/Modules/Admin/Pages/Add.razor
Normal file
187
Oqtane.Client/Modules/Admin/Pages/Add.razor
Normal file
@ -0,0 +1,187 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IPageService PageService
|
||||
@inject ISkinService SkinService
|
||||
|
||||
<table class="form-group">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Parent: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@parentid">
|
||||
<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">Order: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@order" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@isnavigation">
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Skin: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@skintype">
|
||||
<option value=""><Select Skin></option>
|
||||
@foreach (KeyValuePair<string, string> skin in skins)
|
||||
{
|
||||
<option value="@skin.Key">@skin.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@layouttype">
|
||||
<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" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">View Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@viewpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Edit Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@editpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@SavePage">Save</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Admin; } }
|
||||
|
||||
Dictionary<string, string> skins = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
|
||||
string name;
|
||||
string path;
|
||||
string parentid;
|
||||
string order = "";
|
||||
string isnavigation = "True";
|
||||
string skintype;
|
||||
string layouttype = "";
|
||||
string icon = "";
|
||||
string viewpermissions = "All Users";
|
||||
string editpermissions = "Administrators";
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
List<Skin> Skins = await SkinService.GetSkinsAsync();
|
||||
foreach (Skin skin in Skins)
|
||||
{
|
||||
foreach (string skincontrol in skin.SkinControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
skins.Add(skincontrol, skin.Name + " - " + @Utilities.GetTypeNameClass(skincontrol));
|
||||
}
|
||||
foreach (string panelayout in skin.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
panelayouts.Add(panelayout, skin.Name + " - " + @Utilities.GetTypeNameClass(panelayout));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SavePage()
|
||||
{
|
||||
Page p = new Page();
|
||||
p.SiteId = PageState.Page.SiteId;
|
||||
if (string.IsNullOrEmpty(parentid))
|
||||
{
|
||||
p.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.ParentId = Int32.Parse(parentid);
|
||||
}
|
||||
p.Name = name;
|
||||
p.Path = path;
|
||||
p.Order = (order == null ? 1 : Int32.Parse(order));
|
||||
p.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
|
||||
p.SkinType = skintype;
|
||||
p.LayoutType = (layouttype == null ? "" : layouttype);
|
||||
p.Icon = (icon == null ? "" : icon);
|
||||
Type type;
|
||||
if (!string.IsNullOrEmpty(layouttype))
|
||||
{
|
||||
type = Type.GetType(layouttype);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = Type.GetType(skintype);
|
||||
}
|
||||
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
|
||||
p.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
||||
p.ViewPermissions = viewpermissions;
|
||||
p.EditPermissions = editpermissions;
|
||||
await PageService.AddPageAsync(p);
|
||||
StateHasChanged();
|
||||
UriHelper.NavigateTo(NavigateUrl(path, true));
|
||||
}
|
||||
}
|
173
Oqtane.Client/Modules/Admin/Pages/Delete.razor
Normal file
173
Oqtane.Client/Modules/Admin/Pages/Delete.razor
Normal file
@ -0,0 +1,173 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IPageService PageService
|
||||
@inject ISkinService SkinService
|
||||
|
||||
<table class="form-group">
|
||||
<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">Order: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@order" readonly />
|
||||
</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">Skin: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@skintype">
|
||||
<option value=""><Select Skin></option>
|
||||
@foreach (KeyValuePair<string, string> skin in skins)
|
||||
{
|
||||
<option value="@skin.Key">@skin.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@layouttype">
|
||||
<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">View Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@viewpermissions" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Edit Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@editpermissions" readonly />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@DeletePage">Delete</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Admin; } }
|
||||
|
||||
Dictionary<string, string> skins = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
|
||||
int PageId;
|
||||
string name;
|
||||
string path;
|
||||
string parentid;
|
||||
string order;
|
||||
string isnavigation;
|
||||
string skintype;
|
||||
string layouttype;
|
||||
string icon;
|
||||
string viewpermissions;
|
||||
string editpermissions;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
List<Skin> Skins = await SkinService.GetSkinsAsync();
|
||||
foreach (Skin skin in Skins)
|
||||
{
|
||||
foreach (string skincontrol in skin.SkinControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
skins.Add(skincontrol, skin.Name + " - " + @Utilities.GetTypeNameClass(skincontrol));
|
||||
}
|
||||
foreach (string panelayout in skin.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
panelayouts.Add(panelayout, skin.Name + " - " + @Utilities.GetTypeNameClass(panelayout));
|
||||
}
|
||||
}
|
||||
|
||||
PageId = Int32.Parse(PageState.QueryString["id"]);
|
||||
Page p = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
||||
if (p != null)
|
||||
{
|
||||
name = p.Name;
|
||||
path = p.Path;
|
||||
|
||||
order = p.Order.ToString();
|
||||
isnavigation = p.IsNavigation.ToString();
|
||||
skintype = p.SkinType;
|
||||
layouttype = p.LayoutType;
|
||||
icon = p.Icon;
|
||||
viewpermissions = p.ViewPermissions;
|
||||
editpermissions = p.EditPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DeletePage()
|
||||
{
|
||||
await PageService.DeletePageAsync(Int32.Parse(PageState.QueryString["id"]));
|
||||
UriHelper.NavigateTo(PageState.Alias);
|
||||
}
|
||||
}
|
210
Oqtane.Client/Modules/Admin/Pages/Edit.razor
Normal file
210
Oqtane.Client/Modules/Admin/Pages/Edit.razor
Normal file
@ -0,0 +1,210 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IPageService PageService
|
||||
@inject ISkinService SkinService
|
||||
|
||||
<table class="form-group">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Parent: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@parentid">
|
||||
<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">Order: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@order" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@isnavigation">
|
||||
<option value="true">Yes</option>
|
||||
<option value="false">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Skin: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@skintype">
|
||||
<option value=""><Select Skin></option>
|
||||
@foreach (KeyValuePair<string, string> skin in skins)
|
||||
{
|
||||
<option value="@skin.Key">@skin.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" bind="@layouttype">
|
||||
<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" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">View Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@viewpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Edit Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@editpermissions" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@SavePage">Save</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Admin; } }
|
||||
|
||||
Dictionary<string, string> skins = new Dictionary<string, string>();
|
||||
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
|
||||
|
||||
int PageId;
|
||||
string name;
|
||||
string path;
|
||||
string parentid;
|
||||
string order;
|
||||
string isnavigation;
|
||||
string skintype;
|
||||
string layouttype;
|
||||
string icon;
|
||||
string viewpermissions;
|
||||
string editpermissions;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
List<Skin> Skins = await SkinService.GetSkinsAsync();
|
||||
foreach (Skin skin in Skins)
|
||||
{
|
||||
foreach (string skincontrol in skin.SkinControls.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
skins.Add(skincontrol, skin.Name + " - " + @Utilities.GetTypeNameClass(skincontrol));
|
||||
}
|
||||
foreach (string panelayout in skin.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
|
||||
{
|
||||
panelayouts.Add(panelayout, skin.Name + " - " + @Utilities.GetTypeNameClass(panelayout));
|
||||
}
|
||||
}
|
||||
|
||||
PageId = Int32.Parse(PageState.QueryString["id"]);
|
||||
Page p = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
|
||||
if (p != null)
|
||||
{
|
||||
name = p.Name;
|
||||
path = p.Path;
|
||||
if (p.ParentId == null)
|
||||
{
|
||||
parentid = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
parentid = p.ParentId.ToString();
|
||||
}
|
||||
order = p.Order.ToString();
|
||||
isnavigation = p.IsNavigation.ToString();
|
||||
skintype = p.SkinType;
|
||||
layouttype = p.LayoutType;
|
||||
icon = p.Icon;
|
||||
viewpermissions = p.ViewPermissions;
|
||||
editpermissions = p.EditPermissions;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SavePage()
|
||||
{
|
||||
Page p = PageState.Page;
|
||||
p.PageId = Int32.Parse(PageState.QueryString["id"]);
|
||||
if (string.IsNullOrEmpty(parentid))
|
||||
{
|
||||
p.ParentId = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
p.ParentId = Int32.Parse(parentid);
|
||||
}
|
||||
p.Name = name;
|
||||
p.Path = path;
|
||||
p.Order = (order == null ? 1 : Int32.Parse(order));
|
||||
p.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
|
||||
p.SkinType = skintype;
|
||||
p.LayoutType = (layouttype == null ? "" : layouttype);
|
||||
p.Icon = (icon == null ? "" : icon);
|
||||
Type type;
|
||||
if (!string.IsNullOrEmpty(layouttype))
|
||||
{
|
||||
type = Type.GetType(layouttype);
|
||||
}
|
||||
else
|
||||
{
|
||||
type = Type.GetType(skintype);
|
||||
}
|
||||
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
|
||||
p.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
|
||||
p.ViewPermissions = viewpermissions;
|
||||
p.EditPermissions = editpermissions;
|
||||
await PageService.UpdatePageAsync(p);
|
||||
UriHelper.NavigateTo(NavigateUrl(path));
|
||||
}
|
||||
}
|
40
Oqtane.Client/Modules/Admin/Pages/Index.razor
Normal file
40
Oqtane.Client/Modules/Admin/Pages/Index.razor
Normal file
@ -0,0 +1,40 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject IPageService PageService
|
||||
|
||||
@if (PageState.Pages == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Path</th>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var p in PageState.Pages)
|
||||
{
|
||||
<tr>
|
||||
<td><ActionLink Action="Edit" Parameters="@($"id=" + p.PageId.ToString())" /></td>
|
||||
<td><ActionLink Action="Delete" Parameters="@($"id=" + p.PageId.ToString())" /></td>
|
||||
<td>@p.Path</td>
|
||||
<td>@p.Name</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<ActionLink Action="Add" Text="Add Page" />
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Admin; } }
|
||||
}
|
29
Oqtane.Client/Modules/Admin/Register/Index.razor
Normal file
29
Oqtane.Client/Modules/Admin/Register/Index.razor
Normal file
@ -0,0 +1,29 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Shared
|
||||
@using Oqtane.Modules
|
||||
@using Microsoft.JSInterop
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject IJSRuntime jsRuntime
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div class="form-group">
|
||||
<label for="Username" class="control-label">Email: </label>
|
||||
<input type="text" name="Username" class="form-control" placeholder="Username" bind="@Username" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="Password" class="control-label">Password: </label>
|
||||
<input type="password" name="Password" class="form-control" placeholder="Password" bind="@Password" />
|
||||
</div>
|
||||
<button type="button" class="btn btn-primary">Register</button>
|
||||
<NavLink class="btn btn" href="/">Cancel</NavLink>
|
||||
</div>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Anonymous; } }
|
||||
|
||||
public string Username { get; set; } = "";
|
||||
public string Password { get; set; } = "";
|
||||
}
|
46
Oqtane.Client/Modules/Admin/Sites/Add.razor
Normal file
46
Oqtane.Client/Modules/Admin/Sites/Add.razor
Normal file
@ -0,0 +1,46 @@
|
||||
@using Microsoft.AspNetCore.Components.Routing
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
@inject IUriHelper UriHelper
|
||||
@inject ISiteService SiteService
|
||||
|
||||
<table class="form-group">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Name: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@name" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Alias: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" bind="@alias" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button class="btn btn-success" onclick="@SaveSite">Save</button>
|
||||
<NavLink class="btn btn" href="@NavigateUrl()">Cancel</NavLink>
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
string name;
|
||||
string alias;
|
||||
|
||||
private async Task SaveSite()
|
||||
{
|
||||
Site site = new Site();
|
||||
site.Name = name;
|
||||
site.Logo = "";
|
||||
await SiteService.AddSiteAsync(site);
|
||||
StateHasChanged();
|
||||
UriHelper.NavigateTo(NavigateUrl());
|
||||
}
|
||||
}
|
42
Oqtane.Client/Modules/Admin/Sites/Index.razor
Normal file
42
Oqtane.Client/Modules/Admin/Sites/Index.razor
Normal file
@ -0,0 +1,42 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject ISiteService SiteService
|
||||
|
||||
@if (sites == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var site in sites)
|
||||
{
|
||||
<tr>
|
||||
<td>@site.Name</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
<ActionLink Action="Add" Text="Add Site" />
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
List<Site> sites;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
sites = await SiteService.GetSitesAsync();
|
||||
}
|
||||
}
|
41
Oqtane.Client/Modules/Admin/Skins/Index.razor
Normal file
41
Oqtane.Client/Modules/Admin/Skins/Index.razor
Normal file
@ -0,0 +1,41 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject ISkinService SkinService
|
||||
|
||||
@if (Skins == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var Skin in Skins)
|
||||
{
|
||||
<tr>
|
||||
<td>@Skin.Name</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
List<Skin> Skins;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
Skins = await SkinService.GetSkinsAsync();
|
||||
}
|
||||
}
|
41
Oqtane.Client/Modules/Admin/Users/Index.razor
Normal file
41
Oqtane.Client/Modules/Admin/Users/Index.razor
Normal file
@ -0,0 +1,41 @@
|
||||
@using Oqtane.Services
|
||||
@using Oqtane.Models
|
||||
@using Oqtane.Modules
|
||||
@using Oqtane.Client.Modules.Controls
|
||||
@inherits ModuleBase
|
||||
|
||||
@inject IUserService UserService
|
||||
|
||||
@if (Users == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var User in Users)
|
||||
{
|
||||
<tr>
|
||||
<td>@User.Username</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@functions {
|
||||
public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Host; } }
|
||||
|
||||
List<User> Users;
|
||||
|
||||
protected override async Task OnInitAsync()
|
||||
{
|
||||
Users = await UserService.GetUsersAsync();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user