Improvements to themes, layouts, and CSS styling

This commit is contained in:
Shaun Walker 2019-10-16 14:28:49 -04:00
parent c029e70783
commit 05a405e036
51 changed files with 11843 additions and 777 deletions

View File

@ -19,7 +19,7 @@
@if (packages != null) @if (packages != null)
{ {
<hr /> <hr class="app-rule" />
<div class="mx-auto text-center"><h2>Available Modules</h2></div> <div class="mx-auto text-center"><h2>Available Modules</h2></div>
<Pager Items="@packages"> <Pager Items="@packages">

View File

@ -88,7 +88,7 @@
<label for="Name" class="control-label">Theme: </label> <label for="Name" class="control-label">Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype"> <select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @foreach (KeyValuePair<string, string> item in themes)
{ {
@ -161,9 +161,9 @@
children = PageState.Pages.Where(item => item.ParentId == null).ToList(); children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
themetype = PageState.Site.DefaultThemeType; themetype = PageState.Site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = PageState.Site.DefaultLayoutType; layouttype = PageState.Site.DefaultLayoutType;
List<PermissionString> permissionstrings = new List<PermissionString>(); List<PermissionString> permissionstrings = new List<PermissionString>();
@ -198,78 +198,106 @@
} }
} }
private void ThemeChanged(ChangeEventArgs e)
{
try
{
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
}
else
{
panelayouts = new Dictionary<string, string>();
}
StateHasChanged();
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
private async Task SavePage() private async Task SavePage()
{ {
try try
{ {
Page page = new Page(); if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
page.SiteId = PageState.Page.SiteId;
page.Name = name;
if (path == "")
{ {
path = name; Page page = new Page();
} page.SiteId = PageState.Page.SiteId;
if (path.Contains("/")) page.Name = name;
{ if (path == "")
path = path.Substring(path.LastIndexOf("/") + 1);
}
if (string.IsNullOrEmpty(parentid))
{
page.ParentId = null;
page.Path = Utilities.GetFriendlyUrl(path);
}
else
{
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); path = name;
}
if (path.Contains("/"))
{
path = path.Substring(path.LastIndexOf("/") + 1);
}
if (string.IsNullOrEmpty(parentid))
{
page.ParentId = null;
page.Path = Utilities.GetFriendlyUrl(path);
} }
else else
{ {
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); 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);
}
else
{
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path);
}
} }
} Page child;
Page child; switch (insert)
switch (insert) {
{ case "<<":
case "<<": page.Order = 0;
page.Order = 0; break;
break; case "<":
case "<": child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); page.Order = child.Order - 1;
page.Order = child.Order - 1; break;
break; case ">":
case ">": child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); page.Order = child.Order + 1;
page.Order = child.Order + 1; break;
break; case ">>":
case ">>": page.Order = int.MaxValue;
page.Order = int.MaxValue; break;
break; }
} page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); page.EditMode = (mode == "edit" ? true : false);
page.EditMode = (mode == "edit" ? true : false); page.ThemeType = themetype;
page.ThemeType = themetype; page.LayoutType = (layouttype == null ? "" : layouttype);
page.LayoutType = (layouttype == null ? "" : layouttype); page.Icon = (icon == null ? "" : icon);
page.Icon = (icon == null ? "" : icon); page.Permissions = permissiongrid.GetPermissions();
Type type;
if (!string.IsNullOrEmpty(layouttype)) if (page.ThemeType == PageState.Site.DefaultThemeType)
{ {
type = Type.GetType(layouttype); page.ThemeType = "";
}
if (page.LayoutType == PageState.Site.DefaultLayoutType)
{
page.LayoutType = "";
}
await PageService.AddPageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
} }
else else
{ {
type = Type.GetType(themetype); AddModuleMessage("You Must Provide Page Name And Theme", MessageType.Warning);
} }
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
page.Permissions = permissiongrid.GetPermissions();
await PageService.AddPageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -66,7 +66,14 @@
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @foreach (KeyValuePair<string, string> item in themes)
{ {
<option value="@item.Key">@item.Value</option> if (item.Key == themetype)
{
<option value="@item.Key" selected>@item.Value</option>
}
else
{
<option value="@item.Key">@item.Value</option>
}
} }
</select> </select>
</td> </td>
@ -140,7 +147,6 @@
try try
{ {
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
PageId = Int32.Parse(PageState.QueryString["id"]); PageId = Int32.Parse(PageState.QueryString["id"]);
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault(); Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
@ -151,6 +157,7 @@
isnavigation = page.IsNavigation.ToString(); isnavigation = page.IsNavigation.ToString();
mode = (page.EditMode) ? "edit" : "view"; mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType; themetype = page.ThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = page.LayoutType; layouttype = page.LayoutType;
icon = page.Icon; icon = page.Icon;
permissions = page.Permissions; permissions = page.Permissions;

View File

@ -99,11 +99,18 @@
<label for="Name" class="control-label">Theme: </label> <label for="Name" class="control-label">Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype"> <select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @foreach (KeyValuePair<string, string> item in themes)
{ {
<option value="@item.Key">@item.Value</option> if (item.Key == themetype)
{
<option value="@item.Key" selected>@item.Value</option>
}
else
{
<option value="@item.Key">@item.Value</option>
}
} }
</select> </select>
</td> </td>
@ -195,7 +202,6 @@
children = PageState.Pages.Where(item => item.ParentId == null).ToList(); children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
PageId = Int32.Parse(PageState.QueryString["id"]); PageId = Int32.Parse(PageState.QueryString["id"]);
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault(); Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
@ -219,6 +225,7 @@
isnavigation = page.IsNavigation.ToString(); isnavigation = page.IsNavigation.ToString();
mode = (page.EditMode) ? "edit" : "view"; mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType; themetype = page.ThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = page.LayoutType; layouttype = page.LayoutType;
icon = page.Icon; icon = page.Icon;
permissions = page.Permissions; permissions = page.Permissions;
@ -266,102 +273,128 @@
} }
} }
private void ThemeChanged(ChangeEventArgs e)
{
try
{
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
}
else
{
panelayouts = new Dictionary<string, string>();
}
StateHasChanged();
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
private async Task SavePage() private async Task SavePage()
{ {
try try
{ {
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault(); if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
string currentpath = page.Path; {
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
string currentpath = page.Path;
page.Name = name; page.Name = name;
if (path == "") if (path == "" && name.ToLower() != "home")
{
path = name;
}
if (path.Contains("/"))
{
path = path.Substring(path.LastIndexOf("/") + 1);
}
if (string.IsNullOrEmpty(parentid))
{
page.ParentId = null;
page.Path = Utilities.GetFriendlyUrl(path);
}
else
{
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); path = name;
}
if (path.Contains("/"))
{
path = path.Substring(path.LastIndexOf("/") + 1);
}
if (string.IsNullOrEmpty(parentid))
{
page.ParentId = null;
page.Path = Utilities.GetFriendlyUrl(path);
} }
else else
{ {
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); 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);
}
else
{
page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path);
}
} }
} if (insert != "=")
if (insert != "=")
{
Page child;
switch (insert)
{ {
case "<<": Page child;
page.Order = 0; switch (insert)
break; {
case "<": case "<<":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); page.Order = 0;
page.Order = child.Order - 1; break;
break; case "<":
case ">": child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault(); page.Order = child.Order - 1;
page.Order = child.Order + 1; break;
break; case ">":
case ">>": child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = int.MaxValue; page.Order = child.Order + 1;
break; break;
case ">>":
page.Order = int.MaxValue;
break;
}
} }
} page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); page.EditMode = (mode == "edit" ? true : false);
page.EditMode = (mode == "edit" ? true : false); page.ThemeType = themetype;
page.ThemeType = themetype; page.LayoutType = (layouttype == null ? "" : layouttype);
page.LayoutType = (layouttype == null ? "" : layouttype); page.Icon = (icon == null ? "" : icon);
page.Icon = (icon == null ? "" : icon); page.Permissions = permissiongrid.GetPermissions();
Type type; page.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
if (!string.IsNullOrEmpty(layouttype))
{ if (page.ThemeType == PageState.Site.DefaultThemeType)
type = Type.GetType(layouttype); {
page.ThemeType = "";
}
if (page.LayoutType == PageState.Site.DefaultLayoutType)
{
page.LayoutType = "";
}
await PageService.UpdatePageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
if (currentparentid == "")
{
await PageService.UpdatePageOrderAsync(page.SiteId, null);
}
else
{
await PageService.UpdatePageOrderAsync(page.SiteId, int.Parse(currentparentid));
}
// update child paths
if (parentid != currentparentid)
{
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentpath)))
{
p.Path = p.Path.Replace(currentpath, page.Path);
await PageService.UpdatePageAsync(p);
}
}
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
} }
else else
{ {
type = Type.GetType(themetype); AddModuleMessage("You Must Provide Page Name And Theme", MessageType.Warning);
} }
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
page.Permissions = permissiongrid.GetPermissions();
page.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
await PageService.UpdatePageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
if (currentparentid == "")
{
await PageService.UpdatePageOrderAsync(page.SiteId, null);
}
else
{
await PageService.UpdatePageOrderAsync(page.SiteId, int.Parse(currentparentid));
}
// update child paths
if (parentid != currentparentid)
{
foreach (Page p in PageState.Pages.Where(item => item.Path.StartsWith(currentpath)))
{
p.Path = p.Path.Replace(currentpath, page.Path);
await PageService.UpdatePageAsync(p);
}
}
NavigationManager.NavigateTo(NavigateUrl(page.Path, Reload.Site));
} }
catch (Exception ex) catch (Exception ex)
{ {

View File

@ -57,7 +57,7 @@ else
<label for="Name" class="control-label">Default Theme: </label> <label for="Name" class="control-label">Default Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype"> <select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @foreach (KeyValuePair<string, string> item in themes)
{ {
@ -80,6 +80,20 @@ else
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td>
<label for="Name" class="control-label">Default Container: </label>
</td>
<td>
<select class="form-control" @bind="@containertype">
<option value="">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string>container in containers)
{
<option value="@container.Key">@container.Value</option>
}
</select>
</td>
</tr>
@if (!isinitialized) @if (!isinitialized)
{ {
<tr> <tr>
@ -109,6 +123,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>(); Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>(); Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
List<Tenant> tenants; List<Tenant> tenants;
string tenantid = "-1"; string tenantid = "-1";
@ -117,6 +132,7 @@ else
string logo = ""; string logo = "";
string themetype = ""; string themetype = "";
string layouttype = ""; string layouttype = "";
string containertype = "";
bool isinitialized = true; bool isinitialized = true;
string username = ""; string username = "";
string password = ""; string password = "";
@ -126,7 +142,7 @@ else
tenants = await TenantService.GetTenantsAsync(); tenants = await TenantService.GetTenantsAsync();
urls = PageState.Alias.Name; urls = PageState.Alias.Name;
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes); containers = ThemeService.GetContainerTypes(PageState.Themes);
username = PageState.User.Username; username = PageState.User.Username;
} }
@ -151,9 +167,30 @@ else
} }
} }
private void ThemeChanged(ChangeEventArgs e)
{
try
{
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
}
else
{
panelayouts = new Dictionary<string, string>();
}
StateHasChanged();
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
private async Task SaveSite() private async Task SaveSite()
{ {
if (tenantid != "-1" && name != "" && urls != "" && themetype != "") if (tenantid != "-1" && name != "" && urls != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)) && !string.IsNullOrEmpty(containertype))
{ {
bool isvalid = true; bool isvalid = true;
@ -187,6 +224,7 @@ else
site.Logo = (logo == null ? "" : logo); site.Logo = (logo == null ? "" : logo);
site.DefaultThemeType = themetype; site.DefaultThemeType = themetype;
site.DefaultLayoutType = (layouttype == null ? "" : layouttype); site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
site.DefaultContainerType = containertype;
site = await SiteService.AddSiteAsync(site, aliases[0]); site = await SiteService.AddSiteAsync(site, aliases[0]);
foreach(Alias alias in aliases) foreach(Alias alias in aliases)
@ -223,7 +261,7 @@ else
} }
else else
{ {
AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, And Default Theme", MessageType.Warning); AddModuleMessage("You Must Provide A Tenant, Site Name, Alias, And Default Theme/Container", MessageType.Warning);
} }
} }

View File

@ -10,71 +10,92 @@
} }
else else
{ {
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Name: </label> <label for="Name" class="control-label">Name: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@name" disabled /> <input class="form-control" @bind="@name" disabled />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Aliases: </label> <label for="Name" class="control-label">Aliases: </label>
</td> </td>
<td> <td>
<textarea class="form-control" @bind="@urls" rows="3" disabled /> <textarea class="form-control" @bind="@urls" rows="3" disabled />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Logo: </label> <label for="Name" class="control-label">Logo: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@logo" disabled /> <input class="form-control" @bind="@logo" disabled />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Default Theme: </label> <label for="Name" class="control-label">Default Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype" disabled> <select class="form-control" @bind="@themetype" disabled>
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @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> <option value="@item.Key">@item.Value</option>
} }
</select> }
</td> </select>
</tr> </td>
<tr> </tr>
<td> <tr>
<label for="Name" class="control-label">Default Layout: </label> <td>
</td> <label for="Name" class="control-label">Default Layout: </label>
<td> </td>
<select class="form-control" @bind="@layouttype" disabled> <td>
<option value="">&lt;Select Layout&gt;</option> <select class="form-control" @bind="@layouttype" disabled>
@foreach (KeyValuePair<string, string> panelayout in panelayouts) <option value="">&lt;Select Layout&gt;</option>
{ @foreach (KeyValuePair<string, string> panelayout in panelayouts)
<option value="@panelayout.Key">@panelayout.Value</option> {
} <option value="@panelayout.Key">@panelayout.Value</option>
</select> }
</td> </select>
</tr> </td>
<tr> </tr>
<td> <tr>
<label for="Name" class="control-label">Is Deleted? </label> <td>
</td> <label for="Name" class="control-label">Default Container: </label>
<td> </td>
<select class="form-control" @bind="@isdeleted" disabled> <td>
<option value="True">Yes</option> <select class="form-control" @bind="@containertype" disabled>
<option value="False">No</option> <option value="">&lt;Select Container&gt;</option>
</select> @foreach (KeyValuePair<string, string> container in containers)
</td> {
</tr> <option value="@container.Key">@container.Value</option>
</table> }
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Is Deleted? </label>
</td>
<td>
<select class="form-control" @bind="@isdeleted" disabled>
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="DeleteSite">Delete</button> <button type="button" class="btn btn-success" @onclick="DeleteSite">Delete</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br />
@ -87,6 +108,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>(); Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>(); Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
Alias Alias; Alias Alias;
int siteid; int siteid;
@ -96,6 +118,8 @@ else
string logo = ""; string logo = "";
string themetype; string themetype;
string layouttype; string layouttype;
string containertype;
string createdby; string createdby;
DateTime createdon; DateTime createdon;
string modifiedby; string modifiedby;
@ -109,7 +133,7 @@ else
try try
{ {
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes); containers = ThemeService.GetContainerTypes(PageState.Themes);
Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault(); Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault();
siteid = Alias.SiteId; siteid = Alias.SiteId;
@ -124,7 +148,9 @@ else
} }
logo = site.Logo; logo = site.Logo;
themetype = site.DefaultThemeType; themetype = site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = site.DefaultLayoutType; layouttype = site.DefaultLayoutType;
containertype = site.DefaultContainerType;
createdby = site.CreatedBy; createdby = site.CreatedBy;
createdon = site.CreatedOn; createdon = site.CreatedOn;

View File

@ -11,71 +11,92 @@
} }
else else
{ {
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Name: </label> <label for="Name" class="control-label">Name: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@name" /> <input class="form-control" @bind="@name" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Aliases: </label> <label for="Name" class="control-label">Aliases: </label>
</td> </td>
<td> <td>
<textarea class="form-control" @bind="@urls" rows="3" /> <textarea class="form-control" @bind="@urls" rows="3" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Logo: </label> <label for="Name" class="control-label">Logo: </label>
</td> </td>
<td> <td>
<input class="form-control" @bind="@logo" /> <input class="form-control" @bind="@logo" />
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Name" class="control-label">Default Theme: </label> <label for="Name" class="control-label">Default Theme: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@themetype"> <select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option> <option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes) @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> <option value="@item.Key">@item.Value</option>
} }
</select> }
</td> </select>
</tr> </td>
<tr> </tr>
<td> <tr>
<label for="Name" class="control-label">Default Layout: </label> <td>
</td> <label for="Name" class="control-label">Default Layout: </label>
<td> </td>
<select class="form-control" @bind="@layouttype"> <td>
<option value="">&lt;Select Layout&gt;</option> <select class="form-control" @bind="@layouttype">
@foreach (KeyValuePair<string, string> panelayout in panelayouts) <option value="">&lt;Select Layout&gt;</option>
{ @foreach (KeyValuePair<string, string> panelayout in panelayouts)
<option value="@panelayout.Key">@panelayout.Value</option> {
} <option value="@panelayout.Key">@panelayout.Value</option>
</select> }
</td> </select>
</tr> </td>
<tr> </tr>
<td> <tr>
<label for="Name" class="control-label">Is Deleted? </label> <td>
</td> <label for="Name" class="control-label">Default Container: </label>
<td> </td>
<select class="form-control" @bind="@isdeleted"> <td>
<option value="True">Yes</option> <select class="form-control" @bind="@containertype">
<option value="False">No</option> <option value="">&lt;Select Container&gt;</option>
</select> @foreach (KeyValuePair<string, string> container in containers)
</td> {
</tr> <option value="@container.Key">@container.Value</option>
</table> }
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Is Deleted? </label>
</td>
<td>
<select class="form-control" @bind="@isdeleted">
<option value="True">Yes</option>
<option value="False">No</option>
</select>
</td>
</tr>
</table>
<button type="button" class="btn btn-success" @onclick="SaveSite">Save</button> <button type="button" class="btn btn-success" @onclick="SaveSite">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br /> <br />
@ -88,6 +109,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>(); Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>(); Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
Alias Alias; Alias Alias;
int siteid; int siteid;
@ -97,6 +119,7 @@ else
string logo = ""; string logo = "";
string themetype; string themetype;
string layouttype; string layouttype;
string containertype;
string createdby; string createdby;
DateTime createdon; DateTime createdon;
@ -111,7 +134,7 @@ else
try try
{ {
themes = ThemeService.GetThemeTypes(PageState.Themes); themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes); containers = ThemeService.GetContainerTypes(PageState.Themes);
Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault(); Alias = PageState.Aliases.Where(item => item.AliasId == Int32.Parse(PageState.QueryString["id"])).FirstOrDefault();
siteid = Alias.SiteId; siteid = Alias.SiteId;
@ -126,7 +149,9 @@ else
} }
logo = site.Logo; logo = site.Logo;
themetype = site.DefaultThemeType; themetype = site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = site.DefaultLayoutType; layouttype = site.DefaultLayoutType;
containertype = site.DefaultContainerType;
createdby = site.CreatedBy; createdby = site.CreatedBy;
createdon = site.CreatedOn; createdon = site.CreatedOn;
@ -143,11 +168,32 @@ else
} }
} }
private void ThemeChanged(ChangeEventArgs e)
{
try
{
themetype = (string)e.Value;
if (themetype != "")
{
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
}
else
{
panelayouts = new Dictionary<string, string>();
}
StateHasChanged();
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
private async Task SaveSite() private async Task SaveSite()
{ {
try try
{ {
if (name != "" && urls != "" && themetype != "") if (name != "" && urls != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)) && !string.IsNullOrEmpty(containertype))
{ {
Site site = await SiteService.GetSiteAsync(siteid, Alias); Site site = await SiteService.GetSiteAsync(siteid, Alias);
if (site != null) if (site != null)
@ -156,6 +202,7 @@ else
site.Logo = (logo == null ? "" : logo); site.Logo = (logo == null ? "" : logo);
site.DefaultThemeType = themetype; site.DefaultThemeType = themetype;
site.DefaultLayoutType = (layouttype == null ? "" : layouttype); site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
site.DefaultContainerType = containertype;
site.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted)); site.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
site = await SiteService.UpdateSiteAsync(site, Alias); site = await SiteService.UpdateSiteAsync(site, Alias);
@ -181,12 +228,12 @@ else
} }
} }
NavigationManager.NavigateTo(NavigateUrl()); NavigationManager.NavigateTo(NavigateUrl(Reload.Site));
} }
} }
else else
{ {
AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme", MessageType.Warning); AddModuleMessage("You Must Provide A Site Name, Alias, And Default Theme/Container", MessageType.Warning);
} }
} }
catch (Exception ex) catch (Exception ex)

View File

@ -40,6 +40,20 @@
string connectionstring = ""; string connectionstring = "";
string schema = ""; string schema = "";
protected override async Task OnInitializedAsync()
{
try
{
List<Tenant> tenants = await TenantService.GetTenantsAsync();
connectionstring = tenants.FirstOrDefault().DBConnectionString;
schema = tenants.FirstOrDefault().DBSchema;
}
catch (Exception ex)
{
AddModuleMessage(ex.Message, MessageType.Error);
}
}
private async Task SaveTenant() private async Task SaveTenant()
{ {
ShowProgressIndicator(); ShowProgressIndicator();

View File

@ -58,6 +58,7 @@
AddModuleMessage(ex.Message, MessageType.Error); AddModuleMessage(ex.Message, MessageType.Error);
} }
} }
private async Task SaveTenant() private async Task SaveTenant()
{ {
connectionstring = connectionstring.Replace("\\\\", "\\"); connectionstring = connectionstring.Replace("\\\\", "\\");

View File

@ -19,7 +19,7 @@
@if (packages != null) @if (packages != null)
{ {
<hr /> <hr class="app-rule" />
<div class="mx-auto text-center"><h2>Available Themes</h2></div> <div class="mx-auto text-center"><h2>Available Themes</h2></div>
<Pager Items="@packages"> <Pager Items="@packages">

View File

@ -26,7 +26,7 @@ else
@if (upgradeavailable) @if (upgradeavailable)
{ {
<hr /> <hr class="app-rule" />
<div class="mx-auto text-center"><h2>Upgrade Available</h2></div> <div class="mx-auto text-center"><h2>Upgrade Available</h2></div>
<button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, Constants.Version))>Upgrade Framework</button> <button type="button" class="btn btn-success" @onclick=@(async () => await Download(Constants.PackageId, Constants.Version))>Upgrade Framework</button>

View File

@ -44,7 +44,7 @@ else
<button type="button" class="btn btn-success" @onclick="SaveUserRole">Save</button> <button type="button" class="btn btn-success" @onclick="SaveUserRole">Save</button>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink> <NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<hr /> <hr class="app-rule" />
<p align="center"> <p align="center">
<Pager Items="@userroles"> <Pager Items="@userroles">
<Header> <Header>

View File

@ -99,7 +99,7 @@ namespace Oqtane.Modules
public void AddModuleMessage(string message, MessageType type) public void AddModuleMessage(string message, MessageType type)
{ {
AddModuleMessage(message, type); ModuleInstance.AddModuleMessage(message, type);
} }
public void ShowProgressIndicator() public void ShowProgressIndicator()

View File

@ -8,7 +8,7 @@ namespace Oqtane.Services
{ {
Task<List<Theme>> GetThemesAsync(); Task<List<Theme>> GetThemesAsync();
Dictionary<string, string> GetThemeTypes(List<Theme> Themes); Dictionary<string, string> GetThemeTypes(List<Theme> Themes);
Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes); Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes, string ThemeName);
Dictionary<string, string> GetContainerTypes(List<Theme> Themes); Dictionary<string, string> GetContainerTypes(List<Theme> Themes);
Task InstallThemesAsync(); Task InstallThemesAsync();
Task DeleteThemeAsync(string ThemeName); Task DeleteThemeAsync(string ThemeName);

View File

@ -74,14 +74,17 @@ namespace Oqtane.Services
return selectableThemes; return selectableThemes;
} }
public Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes) public Dictionary<string, string> GetPaneLayoutTypes(List<Theme> Themes, string ThemeName)
{ {
var selectablePaneLayouts = new Dictionary<string, string>(); var selectablePaneLayouts = new Dictionary<string, string>();
foreach (Theme theme in Themes) foreach (Theme theme in Themes)
{ {
foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) if (ThemeName.StartsWith(theme.ThemeName))
{ {
selectablePaneLayouts.Add(panelayout, theme.Name + " - " + @Utilities.GetTypeNameClass(panelayout)); foreach (string panelayout in theme.PaneLayouts.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries))
{
selectablePaneLayouts.Add(panelayout, theme.Name + " - " + @Utilities.GetTypeNameClass(panelayout));
}
} }
} }
return selectablePaneLayouts; return selectablePaneLayouts;

View File

@ -11,7 +11,7 @@
<img src="oqtane.png" /> <img src="oqtane.png" />
</div> </div>
</div> </div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" /> <hr class="app-rule" />
<h2 class="text-center">Database Configuration</h2> <h2 class="text-center">Database Configuration</h2>
<div class="row"> <div class="row">
<div class="mx-auto text-center"> <div class="mx-auto text-center">
@ -75,7 +75,7 @@
</table> </table>
</div> </div>
</div> </div>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" /> <hr class="app-rule" />
<h2 class="text-center">Application Administrator</h2> <h2 class="text-center">Application Administrator</h2>
<div class="row"> <div class="row">
<div class="mx-auto text-center"> <div class="mx-auto text-center">
@ -178,7 +178,8 @@
site.Name = "Default Site"; site.Name = "Default Site";
site.Logo = "oqtane.png"; site.Logo = "oqtane.png";
site.DefaultThemeType = Constants.DefaultTheme; site.DefaultThemeType = Constants.DefaultTheme;
site.DefaultLayoutType = ""; site.DefaultLayoutType = Constants.DefaultLayout;
site.DefaultContainerType = Constants.DefaultContainer;
site = await SiteService.AddSiteAsync(site); site = await SiteService.AddSiteAsync(site);
User user = new User(); User user = new User();

View File

@ -1,4 +1,5 @@
using Microsoft.JSInterop; using Microsoft.JSInterop;
using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Oqtane.Shared namespace Oqtane.Shared

View File

@ -218,6 +218,8 @@
if (page != null) if (page != null)
{ {
page = ProcessPage(page, site);
// check if user is authorized to view page // check if user is authorized to view page
if (UserSecurity.IsAuthorized(user, "View", page.Permissions)) if (UserSecurity.IsAuthorized(user, "View", page.Permissions))
{ {
@ -243,7 +245,7 @@
if (PageState == null || reload >= Reload.Page) if (PageState == null || reload >= Reload.Page)
{ {
modules = await ModuleService.GetModulesAsync(page.PageId); modules = await ModuleService.GetModulesAsync(page.PageId);
modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes); modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes, site);
} }
else else
{ {
@ -311,7 +313,35 @@
return querystring; return querystring;
} }
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes) private Page ProcessPage(Page page, Site site)
{
try
{
if (string.IsNullOrEmpty(page.ThemeType))
{
page.ThemeType = site.DefaultThemeType;
page.LayoutType = site.DefaultLayoutType;
}
Type type;
if (!string.IsNullOrEmpty(page.LayoutType))
{
type = Type.GetType(page.LayoutType);
}
else
{
type = Type.GetType(page.ThemeType);
}
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
}
catch
{
// error loading theme or layout
}
return page;
}
private List<Module> ProcessModules(List<Module> modules, List<ModuleDefinition> moduledefinitions, string control, string panes, Site site)
{ {
ModuleDefinition moduledefinition; ModuleDefinition moduledefinition;
@ -374,6 +404,11 @@
paneindex.Add(module.Pane, 0); paneindex.Add(module.Pane, 0);
} }
module.PaneModuleIndex = paneindex[module.Pane]; module.PaneModuleIndex = paneindex[module.Pane];
if (string.IsNullOrEmpty(module.ContainerType))
{
module.ContainerType = site.DefaultContainerType;
}
} }
foreach (Module module in modules) foreach (Module module in modules)

View File

@ -1,15 +1,18 @@
@namespace Oqtane.Themes @namespace Oqtane.Themes
@inherits ContainerBase @inherits ContainerBase
<div id="modal" class="app-admin-modal" style="display: block"> @inject NavigationManager NavigationManager
<div class="app-admin-modal-content">
<a href="@closeurl" class="app-admin-modal-close">x</a> <div class="app-admin-modal">
<div class="container"> <div class="modal" style="display: block">
<div class="row px-4"> <div class="modal-dialog" role="document">
<h2><ModuleTitle /></h2> <div class="modal-content">
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" /> <div class="modal-header">
</div> <h5 class="modal-title"><ModuleTitle /></h5>
<div class="row px-4"> <button type="button" class="close" @onclick="CloseModal" data-dismiss="modal" aria-label="Close">
<div class="container"> <span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<ModuleInstance /> <ModuleInstance />
</div> </div>
</div> </div>
@ -18,11 +21,9 @@
</div> </div>
@code { @code {
string closeurl; private void CloseModal()
protected override void OnInitialized()
{ {
closeurl = NavigateUrl(); NavigationManager.NavigateTo(NavigateUrl());
} }
} }

View File

@ -0,0 +1,13 @@
@namespace Oqtane.Themes.BlazorTheme
@inherits ContainerBase
<div class="container">
<div class="row px-4">
<ModuleActions /><h2><ModuleTitle /></h2>
<hr class="app-rule" />
</div>
<div class="row px-4">
<div class="container">
<ModuleInstance />
</div>
</div>
</div>

View File

@ -3,19 +3,16 @@
<div class="sidebar"> <div class="sidebar">
<div align="center"><Logo /></div> <div align="center"><Logo /></div>
<Menu /> <Menu Orientation="Vertical" />
</div> </div>
<div class="main"> <div class="main">
<div class="top-row px-4"> <div class="top-row px-4">
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div> <Breadcrumbs /> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div> </div>
<div class="container"> <div class="container">
<div class="row px-4"> <div class="row px-4">
<Pane Name="Top" /> <Pane Name="Content" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div> </div>
<div class="row px-4"> <div class="row px-4">
<Pane Name="Admin" /> <Pane Name="Admin" />
@ -24,7 +21,7 @@
</div> </div>
@code { @code {
public override string Panes { get { return "Top;Bottom"; } } public override string Panes { get { return "Content"; } }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {

View File

@ -0,0 +1,31 @@
@namespace Oqtane.Themes.Controls
@inherits ThemeControlBase
@if (breadcrumbs != "")
{
@((MarkupString)breadcrumbs)
}
@code {
string breadcrumbs = "";
protected override void OnParametersSet()
{
breadcrumbs = "";
int? pageid = PageState.Page.PageId;
for (int i = PageState.Pages.Count - 1; i >= 0; i--)
{
Page p = PageState.Pages[i];
if (p.PageId == pageid)
{
breadcrumbs = "<li class=\"breadcrumb-item" + ((p.PageId == PageState.Page.PageId) ? " active" : "") +
"\"><a href=\"" + NavigateUrl(p.Path) + "\">" + p.Name + "</a></li>" + breadcrumbs;
pageid = p.ParentId;
}
}
if (breadcrumbs != "")
{
breadcrumbs = "<ol class=\"breadcrumb\">" + breadcrumbs + "</ol>";
}
}
}

View File

@ -9,58 +9,87 @@
@if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions)) @if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{ {
<div id="actions" class="app-controlpanel"> <div class="app-controlpanel" style="@display">
<a href="javascript:void(0)" class="app-controlpanel-close" onclick="closeActions()">x</a> <div class="card @cardclass mb-3">
<div class="app-controlpanel-content"> <div class="card-header">
<ul class="nav flex-column"> Control Panel
<li class="nav-item px-3"> <button type="button" class="close" @onclick="HideControlPanel" data-dismiss="modal" aria-label="Close">
<NavLink class="btn btn-primary mx-auto" href="@NavigateUrl("admin")">Admin Dashboard</NavLink> <span aria-hidden="true">&times;</span>
</li> </button>
</ul> </div>
<ul class="nav flex-column"> <div class="card-body">
<li class="nav-item px-3"> <ul class="nav flex-column">
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Add")">Add Page</NavLink> <li class="nav-item px-3"><button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Admin"))>Admin Dashboard</button></li>
</li> <li class="nav-item px-3">&nbsp;</li>
<li class="nav-item px-3"> <li class="nav-item px-3"><button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Add"))>Add Page</button></li>
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Edit")">Edit Page</NavLink> <li class="nav-item px-3"><button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Edit"))>Edit Page</button></li>
</li> <li class="nav-item px-3"><button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Delete"))>Delete Page</button></li>
<li class="nav-item px-3"> </ul>
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Delete")">Delete Page</NavLink> <hr class="app-rule" />
</li>
</ul>
<hr style="width: 100%; color: white; height: 1px; background-color:white;" />
<div class="container">
<table class="table table-borderless"> <table class="table table-borderless">
<tr> <tr>
<td> <td>
<label for="Module" class="control-label" style="color: white !important;">Module: </label> <label for="Module" class="control-label">Module: </label>
</td> </td>
<td> <td>
@if (moduledefinitions != null) <select class="form-control" @bind="@moduletype">
<option value="new">Add New Module</option>
<option value="existing">Add Existing Module</option>
</select>
@if (moduletype == "new")
{ {
<select class="form-control" @onchange="(e => CategoryChanged(e))"> @if (moduledefinitions != null)
<option value="-">&lt;Common Modules&gt;</option> {
@foreach (var category in categories) <select class="form-control" @onchange="(e => CategoryChanged(e))">
{ <option value="-">&lt;Common Modules&gt;</option>
<option value="@category">@category</option> @foreach (var category in categories)
}
</select>
<select class="form-control" @bind="@moduledefinitionname">
<option value="">&lt;Select Module&gt;</option>
@foreach (var moduledefinition in moduledefinitions)
{
if (moduledefinition.Permissions == "[]" || UserSecurity.IsAuthorized(PageState.User, "Utilize", moduledefinition.Permissions))
{ {
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option> <option value="@category">@category</option>
} }
</select>
<select class="form-control" @bind="@moduledefinitionname">
<option value="">&lt;Select Module&gt;</option>
@foreach (var moduledefinition in moduledefinitions)
{
if (moduledefinition.Permissions == "[]" || UserSecurity.IsAuthorized(PageState.User, "Utilize", moduledefinition.Permissions))
{
<option value="@moduledefinition.ModuleDefinitionName">@moduledefinition.Name</option>
}
}
</select>
}
}
else
{
<select class="form-control" @onchange="(e => PageChanged(e))">
<option value="-">&lt;Select Page&gt;</option>
@foreach (Page p in pages)
{
<option value="@p.PageId">@p.Name</option>
} }
</select> </select>
<select class="form-control" @bind="@moduleid">
<option value="">&lt;Select Module&gt;</option>
@foreach (Module module in modules)
{
<option value="@module.ModuleId">@module.Title</option>
}
</select>
} }
</td> </td>
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Pane" class="control-label" style="color: white !important;">Pane: </label> <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="Pane" class="control-label">Pane: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@pane"> <select class="form-control" @bind="@pane">
@ -74,15 +103,7 @@
</tr> </tr>
<tr> <tr>
<td> <td>
<label for="Title" class="control-label" style="color: white !important;">Title: </label> <label for="Container" class="control-label">Container: </label>
</td>
<td>
<input type="text" name="Title" class="form-control" @bind="@title" />
</td>
</tr>
<tr>
<td>
<label for="Container" class="control-label" style="color: white !important;">Container: </label>
</td> </td>
<td> <td>
<select class="form-control" @bind="@containertype"> <select class="form-control" @bind="@containertype">
@ -94,46 +115,71 @@
</td> </td>
</tr> </tr>
</table> </table>
<button type="button" class="btn btn-primary mx-auto" style="width: 100%;" @onclick="@AddModule">Add Module To Page</button> <button type="button" class="btn btn-primary btn-block mx-auto" @onclick="@AddModule">Add Module To Page</button>
@((MarkupString)@message)
</div> </div>
</div> </div>
</div> </div>
@if (PageState.EditMode) @if (PageState.EditMode)
{ {
<button type="button" class="btn btn-outline-primary active" data-toggle="button" aria-pressed="true" autocomplete="off" @onclick="EditMode"> <button type="button" class="btn @buttonclass active" data-toggle="button" aria-pressed="true" autocomplete="off" @onclick="EditMode">
<span class="oi oi-pencil"></span> <span class="oi oi-pencil"></span>
</button> </button>
} }
else else
{ {
<button type="button" class="btn btn-outline-primary" data-toggle="button" aria-pressed="false" autocomplete="off" @onclick="EditMode"> <button type="button" class="btn @buttonclass" data-toggle="button" aria-pressed="false" autocomplete="off" @onclick="EditMode">
<span class="oi oi-pencil"></span> <span class="oi oi-pencil"></span>
</button> </button>
} }
<span class="oi oi-menu" onclick="openActions()"></span> <button type="button" class="btn @buttonclass" @onclick="ShowControlPanel">
<span class="oi oi-menu"></span>
</button>
} }
@code { @code {
[Parameter]
public string ButtonClass { get; set; }
[Parameter]
public string CardClass { get; set; }
string moduletype = "new";
List<string> categories = new List<string>(); List<string> categories = new List<string>();
List<ModuleDefinition> moduledefinitions; List<ModuleDefinition> moduledefinitions;
List<Page> pages = new List<Page>();
string moduleid = "";
List<Module> modules = new List<Module>();
Dictionary<string, string> containers = new Dictionary<string, string>(); Dictionary<string, string> containers = new Dictionary<string, string>();
int pagemanagementmoduleid = -1; int pagemanagementmoduleid = -1;
string moduledefinitionname = ""; string moduledefinitionname = "";
string pane = ""; string pane = "";
string title = ""; string title = "";
string containertype = ""; string containertype = "";
string display = "display: none;";
string buttonclass = "btn-outline-primary";
string cardclass = "text-white bg-secondary";
string message = "";
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
if (!string.IsNullOrEmpty(ButtonClass))
{
buttonclass = ButtonClass;
}
if (!string.IsNullOrEmpty(CardClass))
{
cardclass = CardClass;
}
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions)) if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{ {
foreach(ModuleDefinition moduledefinition in PageState.ModuleDefinitions) foreach (ModuleDefinition moduledefinition in PageState.ModuleDefinitions)
{ {
if (moduledefinition.Categories != "") if (moduledefinition.Categories != "")
{ {
foreach(string category in moduledefinition.Categories.Split(',')) foreach (string category in moduledefinition.Categories.Split(','))
{ {
if (!categories.Contains(category)) if (!categories.Contains(category))
{ {
@ -143,8 +189,15 @@
} }
} }
moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories == "").ToList(); moduledefinitions = PageState.ModuleDefinitions.Where(item => item.Categories == "").ToList();
foreach(Page p in PageState.Pages)
{
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
{
pages.Add(p);
}
}
containers = ThemeService.GetContainerTypes(PageState.Themes); containers = ThemeService.GetContainerTypes(PageState.Themes);
containertype = containers.FirstOrDefault().Key; containertype = PageState.Site.DefaultContainerType;
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule); List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
if (modules.Count > 0) if (modules.Count > 0)
{ {
@ -168,30 +221,65 @@
StateHasChanged(); StateHasChanged();
} }
private async Task PageChanged(ChangeEventArgs e)
{
string pageid = (string)e.Value;
if (pageid != "")
{
foreach(Module module in await ModuleService.GetModulesAsync(int.Parse(pageid)))
{
if (UserSecurity.IsAuthorized(PageState.User, "View", module.Permissions))
{
modules.Add(module);
}
}
}
moduleid = "";
StateHasChanged();
}
private async Task AddModule() private async Task AddModule()
{ {
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions)) if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{ {
Module module = new Module(); if (moduletype == "new")
module.SiteId = PageState.Site.SiteId; {
module.ModuleDefinitionName = moduledefinitionname; Module module = new Module();
module.Permissions = PageState.Page.Permissions; module.SiteId = PageState.Site.SiteId;
module = await ModuleService.AddModuleAsync(module); module.ModuleDefinitionName = moduledefinitionname;
module.Permissions = PageState.Page.Permissions;
module = await ModuleService.AddModuleAsync(module);
moduleid = module.ModuleId.ToString();
}
PageModule pagemodule = new PageModule(); PageModule pagemodule = new PageModule();
pagemodule.PageId = PageState.Page.PageId; pagemodule.PageId = PageState.Page.PageId;
pagemodule.ModuleId = module.ModuleId; pagemodule.ModuleId = int.Parse(moduleid);
if (title == "") if (title == "")
{ {
title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name; if (moduletype == "new")
{
pagemodule.Title = moduledefinitions.Where(item => item.ModuleDefinitionName == moduledefinitionname).FirstOrDefault().Name;
}
else
{
pagemodule.Title = modules.Where(item => item.ModuleId == int.Parse(moduleid)).FirstOrDefault().Title;
}
} }
pagemodule.Title = title;
pagemodule.Pane = pane; pagemodule.Pane = pane;
pagemodule.Order = int.MaxValue; pagemodule.Order = int.MaxValue;
pagemodule.ContainerType = containertype; pagemodule.ContainerType = containertype;
if (pagemodule.ContainerType == PageState.Site.DefaultContainerType)
{
pagemodule.ContainerType = "";
}
await PageModuleService.AddPageModuleAsync(pagemodule); await PageModuleService.AddPageModuleAsync(pagemodule);
await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane); await PageModuleService.UpdatePageModuleOrderAsync(pagemodule.PageId, pagemodule.Pane);
message = "<br /><div class=\"alert alert-success\" role=\"alert\">Module Added To Page</div>";
NavigationManager.NavigateTo(NavigateUrl(Reload.Page)); NavigationManager.NavigateTo(NavigateUrl(Reload.Page));
} }
} }
@ -231,7 +319,37 @@
PageState.EditMode = true; PageState.EditMode = true;
PageState.DesignMode = true; PageState.DesignMode = true;
} }
NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + PageState.EditMode.ToString().ToLower(), Reload.Page)); NavigationManager.NavigateTo(NavigateUrl(PageState.Page.Path, "edit=" + ((PageState.EditMode) ? "1" : "0"), Reload.Page));
}
}
private void ShowControlPanel()
{
message = "";
display = "width: 25%;";
StateHasChanged();
}
private void HideControlPanel()
{
message = "";
display = "width: 0%;";
StateHasChanged();
}
private void Navigate(string location)
{
HideControlPanel();
switch (location)
{
case "Admin":
NavigationManager.NavigateTo(NavigateUrl("admin"));
break;
case "Add":
case "Edit":
case "Delete":
NavigationManager.NavigateTo(PageUrl(location));
break;
} }
} }
} }

View File

@ -1,16 +1,33 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ThemeControlBase @inherits ThemeControlBase
@inject IUserService UserService
@if (menu != "") @if (menu != "")
{ {
@((MarkupString)menu) <div class="app-menu">
@((MarkupString)menu)
</div>
} }
@code { @code {
[Parameter]
public string Orientation { get; set; }
string menu = ""; string menu = "";
protected override void OnParametersSet() protected override void OnParametersSet()
{
switch (Orientation)
{
case "Horizontal":
CreateHorizontalMenu();
break;
default: // Vertical
CreateVerticalMenu();
break;
}
}
private void CreateVerticalMenu()
{ {
int level = -1; int level = -1;
int securitylevel = int.MaxValue; int securitylevel = int.MaxValue;
@ -49,4 +66,33 @@
} }
menu += "</ul>"; menu += "</ul>";
} }
private void CreateHorizontalMenu()
{
menu = "<button class=\"navbar-toggler\" type=\"button\" data-toggle=\"collapse\" data-target=\"#Menu\" aria-controls=\"Menu\" aria-expanded=\"false\" aria-label=\"Toggle navigation\"><span class=\"navbar-toggler-icon\"></span></button>";
menu += "<div class=\"collapse navbar-collapse\" id=\"Menu\">";
menu += "<ul class=\"navbar-nav mr-auto\">";
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation && !item.IsDeleted))
{
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.ParentId == PageState.Page.ParentId && p.Level == PageState.Page.Level)
{
if (p.PageId == PageState.Page.PageId)
{
menu += "<li class=\"nav-item active\">" +
"<a class=\"nav-link\" href=\"" + NavigateUrl(p.Path) + "\">" +
((p.Icon != "") ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : "") +
p.Name + " <span class=\"sr-only\">(current)</span></a></li>";
}
else
{
menu += "<li class=\"nav-item\">" +
"<a class=\"nav-link\" href=\"" + NavigateUrl(p.Path) + "\">" +
((p.Icon != "") ? "<span class=\"oi oi-" + p.Icon + "\" aria-hidden=\"true\"></span> " : "") +
p.Name + "</a></li>";
}
}
}
menu += "</ul>";
menu += "</div>";
}
} }

View File

@ -6,14 +6,19 @@
@if (PageState.DesignMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions)) @if (PageState.DesignMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
{ {
<div class="dropdown"> <a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
<button type="button" class="btn app-actions-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button> <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton"> @foreach (var action in actions)
@foreach (var action in actions) {
{ if (action.Action != "")
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action.Action))">@action.Name</a> {
} <a class="dropdown-item" @onclick="(async () => await ModuleAction(action.Action))">@action.Name</a>
</div> }
else
{
<div class="dropdown-divider"></div>
}
}
</div> </div>
} }
@ -25,6 +30,14 @@
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions)) if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
{ {
actions = new List<ActionViewModel>(); actions = new List<ActionViewModel>();
actions.Add(new ActionViewModel { Action = "settings", Name = "Manage Settings" });
if (ModuleDefinition.ServerAssemblyName != "")
{
actions.Add(new ActionViewModel { Action = "import", Name = "Import Content" });
actions.Add(new ActionViewModel { Action = "export", Name = "Export Content" });
}
actions.Add(new ActionViewModel { Action = "delete", Name = "Delete Module" });
actions.Add(new ActionViewModel { Action = "", Name = "" });
if (ModuleState.PaneModuleIndex > 0) if (ModuleState.PaneModuleIndex > 0)
{ {
actions.Add(new ActionViewModel { Action = "<<", Name = "Move To Top" }); actions.Add(new ActionViewModel { Action = "<<", Name = "Move To Top" });
@ -48,13 +61,6 @@
actions.Add(new ActionViewModel { Action = pane, Name = "Move To " + pane + " Pane" }); actions.Add(new ActionViewModel { Action = pane, Name = "Move To " + pane + " Pane" });
} }
} }
actions.Add(new ActionViewModel { Action = "settings", Name = "Manage Settings" });
if (ModuleDefinition.ServerAssemblyName != "")
{
actions.Add(new ActionViewModel { Action = "import", Name = "Import Content" });
actions.Add(new ActionViewModel { Action = "export", Name = "Export Content" });
}
actions.Add(new ActionViewModel { Action = "delete", Name = "Delete Module" });
} }
} }

View File

@ -1,7 +1,7 @@
@namespace Oqtane.Themes.Controls @namespace Oqtane.Themes.Controls
@inherits ContainerBase @inherits ContainerBase
@title @((MarkupString)title)
@code { @code {
string title = ""; string title = "";

View File

@ -2,6 +2,7 @@
{ {
public interface ILayoutControl public interface ILayoutControl
{ {
string Panes { get; } // identifies all panes in a theme ( delimited by ";" )
} }
} }

View File

@ -3,7 +3,7 @@
<div class="container"> <div class="container">
<div class="row px-4"> <div class="row px-4">
<ModuleActions /><h2><ModuleTitle /></h2> <ModuleActions /><h2><ModuleTitle /></h2>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" /> <hr class="app-rule" />
</div> </div>
<div class="row px-4"> <div class="row px-4">
<div class="container"> <div class="container">

View File

@ -1,30 +1,20 @@
@namespace Oqtane.Themes.OqtaneTheme @namespace Oqtane.Themes.OqtaneTheme
@inherits ThemeBase @inherits ThemeBase
<div class="sidebar"> <main role="main">
<div align="center"><Logo /></div> <nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-top">
<Menu /> <Logo /><Menu Orientation="Horizontal" /><div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel ButtonClass="btn-outline-secondary" CardClass="bg-light" /></div>
</div> </nav>
<div class="main">
<div class="top-row px-4">
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div>
<div class="container"> <div class="container">
<div class="row px-4"> <PaneLayout />
<Pane Name="Top" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div>
<div class="row px-4"> <div class="row px-4">
<Pane Name="Admin" /> <Pane Name="Admin" />
</div> </div>
</div> </div>
</div> </main>
@code { @code {
public override string Panes { get { return "Left;Right"; } } public override string Panes { get { return ""; } }
protected override async Task OnParametersSetAsync() protected override async Task OnParametersSetAsync()
{ {

View File

@ -1,15 +0,0 @@
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<div class="col-sm">
<Pane Name="Left" />
</div>
<div class="col-sm">
<Pane Name="Right" />
</div>
</div>
@code {
public override string Panes { get { return "Left;Right"; } }
}

View File

@ -1,26 +0,0 @@
@namespace Oqtane.Themes.OqtaneTheme
@inherits ThemeBase
<div class="sidebar">
<div align="center"><Logo /></div>
<Menu />
</div>
<div class="main">
<div class="top-row px-4">
<h1>@PageState.Page.Name</h1> <div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel /></div>
</div>
<div class="container">
<PaneLayout />
<div class="row px-4">
<Pane Name="Admin" />
</div>
</div>
</div>
@code {
protected override async Task OnParametersSetAsync()
{
await IncludeCSS("Theme.css");
}
}

View File

@ -0,0 +1,18 @@
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<Pane Name="Top" />
</div>
<div class="row px-4">
<div class="col-sm"><Pane Name="Left" /></div>
<div class="col-sm"><Pane Name="Content" /></div>
<div class="col-sm"><Pane Name="Right" /></div>
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div>
@code {
public override string Panes { get { return "Top;Left;Content;Right;Bottom"; } }
}

View File

@ -0,0 +1,10 @@
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<Pane Name="Content" />
</div>
@code {
public override string Panes { get { return "Content"; } }
}

View File

@ -1,13 +0,0 @@
@namespace Oqtane.Themes.OqtaneTheme
@inherits LayoutBase
<div class="row px-4">
<Pane Name="Top" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div>
@code {
public override string Panes { get { return "Top;Bottom"; } }
}

View File

@ -13,50 +13,33 @@ app {
/* Control Panel */ /* Control Panel */
.app-controlpanel { .app-controlpanel {
height: 100%; height: 100%;
width: 0; width: 0%;
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
right: 0; right: 0;
top: 0; top: 0;
background-color: rgb(0,0,0); /* Black fallback color */
background-color: rgba(0,0,0, 0.9); /* Black w/opacity */
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
transition: 0.5s; /* 0.5 second transition effect to slide in or slide down the overlay (height or width, depending on reveal) */ transition: 0.5s; /* 0.5 second transition effect to slide in or slide down the overlay (height or width, depending on reveal) */
} }
/* Position the content inside the overlay */ /* Position the content inside the overlay */
.app-controlpanel-content { .app-controlpanel .card-body {
position: relative; position: relative;
top: 5%; /* 5% from the top */ width: 100%; /* 100% width */
width: 100%; /* 100% width */
text-align: center; /* Centered text/links */
margin-top: 30px; /* 30px top margin to avoid conflict with the close button on smaller screens */
}
/* Position the close button (top right corner) */
.app-controlpanel .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 40px;
}
/* When the height of the screen is less than 450 pixels, change the font-size of the links and position the close button again, so they don't overlap */
@media screen and (max-height: 450px) {
.app-controlpanel a {
font-size: 20px
} }
.app-controlpanel-close { /* Pad the navigation links */
font-size: 40px; .app-controlpanel .nav-item {
top: 15px; font-size: 0.9rem;
right: 35px; padding-bottom: 0.5rem;
}
.app-controlpanel .card-body .control-label {
color: white;
} }
}
/* Admin Modal */ /* Admin Modal */
.app-admin-modal { .app-admin-modal .modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
left: 0; left: 0;
@ -64,42 +47,21 @@ app {
width: 100%; /* Full width */ width: 100%; /* Full width */
height: 100%; /* Full height */ height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */ overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */ background: rgba(0,0,0,0.3); /* Dim background */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
} }
.app-admin-modal-content { .app-admin-modal .modal-dialog {
background-color: #fefefe; width: 100%; /* Full width */
height: 100%; /* Full height */
max-width: none; /* Override default of 500px */
}
.app-admin-modal .modal-content {
margin: 5% auto; /* 5% from the top and centered */ margin: 5% auto; /* 5% from the top and centered */
padding: 20px; padding: 20px;
border: 1px solid #888;
width: 80%; /* Could be more or less, depending on screen size */ width: 80%; /* Could be more or less, depending on screen size */
} }
.app-admin-modal-close {
position: absolute;
top: 20px;
right: 45px;
font-size: 40px;
}
.app-admin-modal-close:hover,
.app-admin-modal-close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* Action Menu */
.app-actions-toggle {
background-color: transparent;
border-color: #fff;
border-style: hidden;
border-top: none;
border-right: none;
border-left: none;
}
.app-pane-admin-border { .app-pane-admin-border {
width: 100%; width: 100%;
border-width: 1px; border-width: 1px;
@ -122,3 +84,10 @@ app {
left: 0; left: 0;
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
} }
.app-rule {
width: 100%;
color: gray;
height: 1px;
background-color: gray;
}

View File

@ -29,7 +29,7 @@ window.interop = {
} }
}, },
includeCSS: function (id, url) { includeCSS: function (id, url) {
var link = document.getElementById('yourid'); var link = document.getElementById(id);
if (link === null) { if (link === null) {
link = document.createElement("link"); link = document.createElement("link");
link.id = id; link.id = id;

View File

@ -1,10 +1,2 @@
/* Open when someone clicks on the span element */
function openActions() {
document.getElementById("actions").style.width = "25%";
}
/* Close when someone clicks on the "x" symbol inside the overlay */
function closeActions() {
document.getElementById("actions").style.width = "0%";
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -39,8 +39,17 @@ namespace Oqtane.Controllers
List<Models.Module> modulelist = new List<Models.Module>(); List<Models.Module> modulelist = new List<Models.Module>();
foreach (PageModule pagemodule in PageModules.GetPageModules(int.Parse(pageid))) foreach (PageModule pagemodule in PageModules.GetPageModules(int.Parse(pageid)))
{ {
Models.Module module = pagemodule.Module; Models.Module module = new Models.Module();
module.SiteId = pagemodule.Module.SiteId;
module.ModuleDefinitionName = pagemodule.Module.ModuleDefinitionName;
module.Permissions = pagemodule.Module.Permissions;
module.CreatedBy = pagemodule.Module.CreatedBy;
module.CreatedOn = pagemodule.Module.CreatedOn;
module.ModifiedBy = pagemodule.Module.ModifiedBy;
module.ModifiedOn = pagemodule.Module.ModifiedOn;
module.PageModuleId = pagemodule.PageModuleId; module.PageModuleId = pagemodule.PageModuleId;
module.ModuleId = pagemodule.ModuleId;
module.PageId = pagemodule.PageId; module.PageId = pagemodule.PageId;
module.Title = pagemodule.Title; module.Title = pagemodule.Title;
module.Pane = pagemodule.Pane; module.Pane = pagemodule.Pane;

View File

@ -36,13 +36,13 @@ namespace Oqtane.Repository
// define the default site template // define the default site template
SiteTemplate = new List<PageTemplate>(); SiteTemplate = new List<PageTemplate>();
SiteTemplate.Add(new PageTemplate { Name = "Home", Parent = "", Path = "", Order = 1, Icon = "home", IsNavigation = true, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Home", Parent = "", Path = "", Order = 1, Icon = "home", IsNavigation = true, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Welcome To Oqtane...", Pane = "Top", ContainerType = Constants.DefaultContainer, new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "Welcome To Oqtane...", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
Content = "<p><a href=\"https://www.oqtane.org\" target=\"_new\">Oqtane</a> is an open source <b>modular application framework</b> built from the ground up using modern .NET Core technology. It leverages the revolutionary new Blazor component model to create a <b>fully dynamic</b> web development experience which can be executed on a client or server. Whether you are looking for a platform to <b>accelerate your web development</b> efforts, or simply interested in exploring the anatomy of a large-scale Blazor application, Oqtane provides a solid foundation based on proven enterprise architectural principles.</p>" + Content = "<p><a href=\"https://www.oqtane.org\" target=\"_new\">Oqtane</a> is an open source <b>modular application framework</b> built from the ground up using modern .NET Core technology. It leverages the revolutionary new Blazor component model to create a <b>fully dynamic</b> web development experience which can be executed on a client or server. Whether you are looking for a platform to <b>accelerate your web development</b> efforts, or simply interested in exploring the anatomy of a large-scale Blazor application, Oqtane provides a solid foundation based on proven enterprise architectural principles.</p>" +
"<p align=\"center\"><a href=\"https://www.oqtane.org\" target=\"_new\"><img src=\"oqtane.png\"></a><br /><br /><a class=\"btn btn-primary\" href=\"https://www.oqtane.org/Community\" target=\"_new\">Join Our Community</a>&nbsp;&nbsp;<a class=\"btn btn-primary\" href=\"https://github.com/oqtane/oqtane.framework\" target=\"_new\">Clone Our Repo</a><br /><br /></p>" + "<p align=\"center\"><a href=\"https://www.oqtane.org\" target=\"_new\"><img src=\"oqtane.png\"></a><br /><br /><a class=\"btn btn-primary\" href=\"https://www.oqtane.org/Community\" target=\"_new\">Join Our Community</a>&nbsp;&nbsp;<a class=\"btn btn-primary\" href=\"https://github.com/oqtane/oqtane.framework\" target=\"_new\">Clone Our Repo</a><br /><br /></p>" +
"<p><a href=\"https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor\" target=\"_new\">Blazor</a> is a single-page app framework that lets you build interactive web applications using C# instead of JavaScript. Client-side Blazor relies on WebAssembly, an open web standard that does not require plugins or code transpilation in order to run natively in a web browser. Server-side Blazor uses SignalR to host your application on a web server and provide a responsive and robust debugging experience. Blazor applications works in all modern web browsers, including mobile browsers.</p>" + "<p><a href=\"https://dotnet.microsoft.com/apps/aspnet/web-apps/blazor\" target=\"_new\">Blazor</a> is a single-page app framework that lets you build interactive web applications using C# instead of JavaScript. Client-side Blazor relies on WebAssembly, an open web standard that does not require plugins or code transpilation in order to run natively in a web browser. Server-side Blazor uses SignalR to host your application on a web server and provide a responsive and robust debugging experience. Blazor applications works in all modern web browsers, including mobile browsers.</p>" +
"<p>Blazor is a feature of <a href=\"https://dotnet.microsoft.com/apps/aspnet\" target=\"_new\">ASP.NET Core 3.0</a>, the popular cross platform web development framework from Microsoft that extends the <a href=\"https://dotnet.microsoft.com/learn/dotnet/what-is-dotnet\" target=\"_new\" >.NET developer platform</a> with tools and libraries for building web apps.</p>" "<p>Blazor is a feature of <a href=\"https://dotnet.microsoft.com/apps/aspnet\" target=\"_new\">ASP.NET Core 3.0</a>, the popular cross platform web development framework from Microsoft that extends the <a href=\"https://dotnet.microsoft.com/learn/dotnet/what-is-dotnet\" target=\"_new\" >.NET developer platform</a> with tools and libraries for building web apps.</p>"
}, },
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "MIT License", Pane = "Top", ContainerType = Constants.DefaultContainer, new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.HtmlText, Oqtane.Client", Title = "MIT License", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]",
Content = "<p>Copyright (c) 2019 .NET Foundation</p>" + Content = "<p>Copyright (c) 2019 .NET Foundation</p>" +
"<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>" + "<p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>" +
"<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>" + "<p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>" +
@ -51,43 +51,43 @@ namespace Oqtane.Repository
} }
}); });
SiteTemplate.Add(new PageTemplate { Name = "Admin", Parent = "", Path = "admin", Order = 1, Icon = "", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Admin", Parent = "", Path = "admin", Order = 1, Icon = "", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Dashboard, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Administration", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Dashboard, Oqtane.Client", Title = "Administration", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Site Management", Parent = "Admin", Path = "admin/sites", Order = 1, Icon = "globe", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Site Management", Parent = "Admin", Path = "admin/sites", Order = 1, Icon = "globe", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Sites, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Site Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Sites, Oqtane.Client", Title = "Site Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Page Management", Parent = "Admin", Path = "admin/pages", Order = 1, Icon = "layers", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Page Management", Parent = "Admin", Path = "admin/pages", Order = 1, Icon = "layers", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Pages, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Page Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Pages, Oqtane.Client", Title = "Page Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "File Management", Parent = "Admin", Path = "admin/files", Order = 1, Icon = "file", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "File Management", Parent = "Admin", Path = "admin/files", Order = 1, Icon = "file", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Files, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "File Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Files, Oqtane.Client", Title = "File Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "User Management", Parent = "Admin", Path = "admin/users", Order = 1, Icon = "person", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "User Management", Parent = "Admin", Path = "admin/users", Order = 1, Icon = "person", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Users, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Users, Oqtane.Client", Title = "User Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Role Management", Parent = "Admin", Path = "admin/roles", Order = 1, Icon = "lock-locked", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Role Management", Parent = "Admin", Path = "admin/roles", Order = 1, Icon = "lock-locked", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Roles, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Role Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Roles, Oqtane.Client", Title = "Role Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Tenant Management", Parent = "Admin", Path = "admin/tenants", Order = 1, Icon = "list", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Tenant Management", Parent = "Admin", Path = "admin/tenants", Order = 1, Icon = "list", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Tenants, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Tenant Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Tenants, Oqtane.Client", Title = "Tenant Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Module Management", Parent = "Admin", Path = "admin/modules", Order = 1, Icon = "browser", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Module Management", Parent = "Admin", Path = "admin/modules", Order = 1, Icon = "browser", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Module Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.ModuleDefinitions, Oqtane.Client", Title = "Module Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Order = 1, Icon = "brush", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Theme Management", Parent = "Admin", Path = "admin/themes", Order = 1, Icon = "brush", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Themes, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Theme Management", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Themes, Oqtane.Client", Title = "Theme Management", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Upgrade Service", Parent = "Admin", Path = "admin/upgrade", Order = 1, Icon = "aperture", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Upgrade Service", Parent = "Admin", Path = "admin/upgrade", Order = 1, Icon = "aperture", IsNavigation = false, EditMode = true, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Upgrade, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "Upgrade Service", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Upgrade, Oqtane.Client", Title = "Upgrade Service", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Login", Parent = "", Path = "login", Order = 1, Icon = "lock-locked", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Login", Parent = "", Path = "login", Order = 1, Icon = "lock-locked", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Login, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Login", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Login, Oqtane.Client", Title = "User Login", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Register", Parent = "", Path = "register", Order = 1, Icon = "person", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Register", Parent = "", Path = "register", Order = 1, Icon = "person", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Register, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Registration", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Register, Oqtane.Client", Title = "User Registration", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
SiteTemplate.Add(new PageTemplate { Name = "Profile", Parent = "", Path = "profile", Order = 1, Icon = "person", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> { SiteTemplate.Add(new PageTemplate { Name = "Profile", Parent = "", Path = "profile", Order = 1, Icon = "person", IsNavigation = false, EditMode = false, PagePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", PageTemplateModules = new List<PageTemplateModule> {
new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Profile, Oqtane.Client", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Title = "User Profile", Pane = "Top", ContainerType = Constants.DefaultContainer, Content = "" } new PageTemplateModule { ModuleDefinitionName = "Oqtane.Modules.Admin.Profile, Oqtane.Client", Title = "User Profile", Pane = "Content", ModulePermissions = "[{\"PermissionName\":\"View\",\"Permissions\":\"All Users;Administrators\"},{\"PermissionName\":\"Edit\",\"Permissions\":\"Administrators\"}]", Content = "" }
}}); }});
} }
@ -167,14 +167,11 @@ namespace Oqtane.Repository
Order = pagetemplate.Order, Order = pagetemplate.Order,
IsNavigation = pagetemplate.IsNavigation, IsNavigation = pagetemplate.IsNavigation,
EditMode = pagetemplate.EditMode, EditMode = pagetemplate.EditMode,
ThemeType = site.DefaultThemeType, ThemeType = "",
LayoutType = site.DefaultLayoutType, LayoutType = "",
Icon = pagetemplate.Icon, Icon = pagetemplate.Icon,
Permissions = pagetemplate.PagePermissions Permissions = pagetemplate.PagePermissions
}; };
Type type = Type.GetType(page.ThemeType);
System.Reflection.PropertyInfo property = type.GetProperty("Panes");
page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null);
page = PageRepository.AddPage(page); page = PageRepository.AddPage(page);
foreach(PageTemplateModule pagetemplatemodule in pagetemplate.PageTemplateModules) foreach(PageTemplateModule pagetemplatemodule in pagetemplate.PageTemplateModules)
@ -217,7 +214,7 @@ namespace Oqtane.Repository
Title = pagetemplatemodule.Title, Title = pagetemplatemodule.Title,
Pane = pagetemplatemodule.Pane, Pane = pagetemplatemodule.Pane,
Order = 1, Order = 1,
ContainerType = pagetemplatemodule.ContainerType ContainerType = ""
}; };
PageModuleRepository.AddPageModule(pagemodule); PageModuleRepository.AddPageModule(pagemodule);
} }

View File

@ -11,6 +11,7 @@ CREATE TABLE [dbo].[Site](
[Logo] [nvarchar](50) NOT NULL, [Logo] [nvarchar](50) NOT NULL,
[DefaultThemeType] [nvarchar](200) NOT NULL, [DefaultThemeType] [nvarchar](200) NOT NULL,
[DefaultLayoutType] [nvarchar](200) NOT NULL, [DefaultLayoutType] [nvarchar](200) NOT NULL,
[DefaultContainerType] [nvarchar](200) NOT NULL,
[CreatedBy] [nvarchar](256) NOT NULL, [CreatedBy] [nvarchar](256) NOT NULL,
[CreatedOn] [datetime] NOT NULL, [CreatedOn] [datetime] NOT NULL,
[ModifiedBy] [nvarchar](256) NOT NULL, [ModifiedBy] [nvarchar](256) NOT NULL,
@ -32,7 +33,6 @@ CREATE TABLE [dbo].[Page](
[Name] [nvarchar](50) NOT NULL, [Name] [nvarchar](50) NOT NULL,
[ThemeType] [nvarchar](200) NULL, [ThemeType] [nvarchar](200) NULL,
[Icon] [nvarchar](50) NOT NULL, [Icon] [nvarchar](50) NOT NULL,
[Panes] [nvarchar](50) NOT NULL,
[ParentId] [int] NULL, [ParentId] [int] NULL,
[Order] [int] NOT NULL, [Order] [int] NOT NULL,
[IsNavigation] [bit] NOT NULL, [IsNavigation] [bit] NOT NULL,

View File

@ -33,37 +33,37 @@
top: -2px; top: -2px;
} }
.nav-item { .app-menu .nav-item {
font-size: 0.9rem; font-size: 0.9rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
} }
.nav-item:first-of-type { .app-menu .nav-item:first-of-type {
padding-top: 1rem; padding-top: 1rem;
} }
.nav-item:last-of-type { .app-menu .nav-item:last-of-type {
padding-bottom: 1rem; padding-bottom: 1rem;
} }
.nav-item a { .app-menu .nav-item a {
color: #d7d7d7; color: #d7d7d7;
border-radius: 4px; border-radius: 4px;
height: 3rem; height: 3rem;
display: flex; display: flex;
align-items: center; align-items: center;
line-height: 3rem; line-height: 3rem;
} }
.nav-item a.active { .app-menu .nav-item a.active {
background-color: rgba(255,255,255,0.25); background-color: rgba(255,255,255,0.25);
color: white; color: white;
} }
.nav-item a:hover { .app-menu .nav-item a:hover {
background-color: rgba(255,255,255,0.1); background-color: rgba(255,255,255,0.1);
color: white; color: white;
} }
.content { .content {
padding-top: 1.1rem; padding-top: 1.1rem;

File diff suppressed because it is too large Load Diff

View File

@ -13,50 +13,33 @@ app {
/* Control Panel */ /* Control Panel */
.app-controlpanel { .app-controlpanel {
height: 100%; height: 100%;
width: 0; width: 0%;
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
right: 0; right: 0;
top: 0; top: 0;
background-color: rgb(0,0,0); /* Black fallback color */
background-color: rgba(0,0,0, 0.9); /* Black w/opacity */
overflow-x: hidden; /* Disable horizontal scroll */ overflow-x: hidden; /* Disable horizontal scroll */
transition: 0.5s; /* 0.5 second transition effect to slide in or slide down the overlay (height or width, depending on reveal) */ transition: 0.5s; /* 0.5 second transition effect to slide in or slide down the overlay (height or width, depending on reveal) */
} }
/* Position the content inside the overlay */ /* Position the content inside the overlay */
.app-controlpanel-content { .app-controlpanel .card-body {
position: relative; position: relative;
top: 5%; /* 5% from the top */ width: 100%; /* 100% width */
width: 100%; /* 100% width */
text-align: center; /* Centered text/links */
margin-top: 30px; /* 30px top margin to avoid conflict with the close button on smaller screens */
}
/* Position the close button (top right corner) */
.app-controlpanel-close {
position: absolute;
top: 20px;
right: 45px;
font-size: 40px;
}
/* When the height of the screen is less than 450 pixels, change the font-size of the links and position the close button again, so they don't overlap */
@media screen and (max-height: 450px) {
.app-controlpanel a {
font-size: 20px
} }
.app-controlpanel-close { /* Pad the navigation links */
font-size: 40px; .app-controlpanel .nav-item {
top: 15px; font-size: 0.9rem;
right: 35px; padding-bottom: 0.5rem;
}
.app-controlpanel .card-body .control-label {
color: white;
} }
}
/* Admin Modal */ /* Admin Modal */
.app-admin-modal { .app-admin-modal .modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */ position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
left: 0; left: 0;
@ -64,41 +47,20 @@ app {
width: 100%; /* Full width */ width: 100%; /* Full width */
height: 100%; /* Full height */ height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */ overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */ background: rgba(0,0,0,0.3); /* Dim background */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
} }
.app-admin-modal-content { .app-admin-modal .modal-dialog {
background-color: #fefefe; width: 100%; /* Full width */
margin: 5% auto; /* 5% from the top and centered */ height: 100%; /* Full height */
padding: 20px; max-width: none; /* Override default of 500px */
border: 1px solid #888; }
width: 80%; /* Could be more or less, depending on screen size */
}
.app-admin-modal-close { .app-admin-modal .modal-content {
position: absolute; margin: 5% auto; /* 5% from the top and centered */
top: 20px; padding: 20px;
right: 45px; width: 80%; /* Could be more or less, depending on screen size */
font-size: 40px; }
}
.app-admin-modal-close:hover,
.app-admin-modal-close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
/* Action Menu */
.app-actions-toggle {
background-color: transparent;
border-color: #fff;
border-style: hidden;
border-top: none;
border-right: none;
border-left: none;
}
.app-pane-admin-border { .app-pane-admin-border {
width: 100%; width: 100%;
@ -122,3 +84,10 @@ app {
left: 0; left: 0;
z-index: 9999; /* Sit on top */ z-index: 9999; /* Sit on top */
} }
.app-rule {
width: 100%;
color: gray;
height: 1px;
background-color: gray;
}

View File

@ -29,7 +29,7 @@ window.interop = {
} }
}, },
includeCSS: function (id, url) { includeCSS: function (id, url) {
var link = document.getElementById('yourid'); var link = document.getElementById(id);
if (link === null) { if (link === null) {
link = document.createElement("link"); link = document.createElement("link");
link.id = id; link.id = id;

View File

@ -1,10 +1 @@
/* Open when someone clicks on the span element */
function openActions() {
document.getElementById("actions").style.width = "25%";
}
/* Close when someone clicks on the "x" symbol inside the overlay */
function closeActions() {
document.getElementById("actions").style.width = "0%";
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -14,7 +14,6 @@ namespace Oqtane.Models
public string ThemeType { get; set; } public string ThemeType { get; set; }
public string LayoutType { get; set; } public string LayoutType { get; set; }
public string Icon { get; set; } public string Icon { get; set; }
public string Panes { get; set; }
public bool IsNavigation { get; set; } public bool IsNavigation { get; set; }
public bool EditMode { get; set; } public bool EditMode { get; set; }
@ -26,6 +25,8 @@ namespace Oqtane.Models
public DateTime? DeletedOn { get; set; } public DateTime? DeletedOn { get; set; }
public bool IsDeleted { get; set; } public bool IsDeleted { get; set; }
[NotMapped]
public string Panes { get; set; }
[NotMapped] [NotMapped]
public string Permissions { get; set; } public string Permissions { get; set; }
[NotMapped] [NotMapped]

View File

@ -18,10 +18,9 @@ namespace Oqtane.Models
public class PageTemplateModule public class PageTemplateModule
{ {
public string ModuleDefinitionName { get; set; } public string ModuleDefinitionName { get; set; }
public string ModulePermissions { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string Pane { get; set; } public string Pane { get; set; }
public string ContainerType { get; set; } public string ModulePermissions { get; set; }
public string Content { get; set; } public string Content { get; set; }
} }
} }

View File

@ -11,6 +11,7 @@ namespace Oqtane.Models
public string Logo { get; set; } public string Logo { get; set; }
public string DefaultThemeType { get; set; } public string DefaultThemeType { get; set; }
public string DefaultLayoutType { get; set; } public string DefaultLayoutType { get; set; }
public string DefaultContainerType { get; set; }
public string CreatedBy { get; set; } public string CreatedBy { get; set; }

View File

@ -8,8 +8,9 @@
public const string PageComponent = "Oqtane.Shared.ThemeBuilder, Oqtane.Client"; public const string PageComponent = "Oqtane.Shared.ThemeBuilder, Oqtane.Client";
public const string ContainerComponent = "Oqtane.Shared.ContainerBuilder, Oqtane.Client"; public const string ContainerComponent = "Oqtane.Shared.ContainerBuilder, Oqtane.Client";
public const string DefaultTheme = "Oqtane.Themes.OqtaneTheme.Default, Oqtane.Client"; public const string DefaultTheme = "Oqtane.Themes.BlazorTheme.Default, Oqtane.Client";
public const string DefaultContainer = "Oqtane.Themes.OqtaneTheme.Container, Oqtane.Client"; public const string DefaultLayout = "";
public const string DefaultContainer = "Oqtane.Themes.BlazorTheme.Container, Oqtane.Client";
public const string DefaultAdminContainer = "Oqtane.Themes.AdminContainer, Oqtane.Client"; public const string DefaultAdminContainer = "Oqtane.Themes.AdminContainer, Oqtane.Client";
public static readonly string[] DefaultModuleActions = new[] { "Settings", "Import", "Export" }; public static readonly string[] DefaultModuleActions = new[] { "Settings", "Import", "Export" };