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)
{
<hr />
<hr class="app-rule" />
<div class="mx-auto text-center"><h2>Available Modules</h2></div>
<Pager Items="@packages">

View File

@ -88,7 +88,7 @@
<label for="Name" class="control-label">Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype">
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
{
@ -161,9 +161,9 @@
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
themetype = PageState.Site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = PageState.Site.DefaultLayoutType;
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()
{
try
{
Page page = new Page();
page.SiteId = PageState.Page.SiteId;
page.Name = name;
if (path == "")
if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
{
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 page = new Page();
page.SiteId = PageState.Page.SiteId;
page.Name = name;
if (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
{
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;
switch (insert)
{
case "<<":
page.Order = 0;
break;
case "<":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order - 1;
break;
case ">":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order + 1;
break;
case ">>":
page.Order = int.MaxValue;
break;
}
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon);
Type type;
if (!string.IsNullOrEmpty(layouttype))
{
type = Type.GetType(layouttype);
Page child;
switch (insert)
{
case "<<":
page.Order = 0;
break;
case "<":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order - 1;
break;
case ">":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order + 1;
break;
case ">>":
page.Order = int.MaxValue;
break;
}
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon);
page.Permissions = permissiongrid.GetPermissions();
if (page.ThemeType == PageState.Site.DefaultThemeType)
{
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
{
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)
{

View File

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

View File

@ -99,11 +99,18 @@
<label for="Name" class="control-label">Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype">
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@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>
</td>
@ -195,7 +202,6 @@
children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
PageId = Int32.Parse(PageState.QueryString["id"]);
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
@ -219,6 +225,7 @@
isnavigation = page.IsNavigation.ToString();
mode = (page.EditMode) ? "edit" : "view";
themetype = page.ThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = page.LayoutType;
icon = page.Icon;
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()
{
try
{
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
string currentpath = page.Path;
if (name != "" && !string.IsNullOrEmpty(themetype) && (panelayouts.Count == 0 || !string.IsNullOrEmpty(layouttype)))
{
Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault();
string currentpath = page.Path;
page.Name = name;
if (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
{
page.ParentId = Int32.Parse(parentid);
Page parent = PageState.Pages.Where(item => item.PageId == page.ParentId).FirstOrDefault();
if (parent.Path == "")
page.Name = name;
if (path == "" && name.ToLower() != "home")
{
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
{
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 != "=")
{
Page child;
switch (insert)
if (insert != "=")
{
case "<<":
page.Order = 0;
break;
case "<":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order - 1;
break;
case ">":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order + 1;
break;
case ">>":
page.Order = int.MaxValue;
break;
Page child;
switch (insert)
{
case "<<":
page.Order = 0;
break;
case "<":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order - 1;
break;
case ">":
child = PageState.Pages.Where(item => item.PageId == childid).FirstOrDefault();
page.Order = child.Order + 1;
break;
case ">>":
page.Order = int.MaxValue;
break;
}
}
}
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon);
Type type;
if (!string.IsNullOrEmpty(layouttype))
{
type = Type.GetType(layouttype);
page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation));
page.EditMode = (mode == "edit" ? true : false);
page.ThemeType = themetype;
page.LayoutType = (layouttype == null ? "" : layouttype);
page.Icon = (icon == null ? "" : icon);
page.Permissions = permissiongrid.GetPermissions();
page.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
if (page.ThemeType == PageState.Site.DefaultThemeType)
{
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
{
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)
{

View File

@ -57,7 +57,7 @@ else
<label for="Name" class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype">
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
{
@ -80,6 +80,20 @@ else
</select>
</td>
</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)
{
<tr>
@ -109,6 +123,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
List<Tenant> tenants;
string tenantid = "-1";
@ -117,6 +132,7 @@ else
string logo = "";
string themetype = "";
string layouttype = "";
string containertype = "";
bool isinitialized = true;
string username = "";
string password = "";
@ -126,7 +142,7 @@ else
tenants = await TenantService.GetTenantsAsync();
urls = PageState.Alias.Name;
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
containers = ThemeService.GetContainerTypes(PageState.Themes);
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()
{
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;
@ -187,6 +224,7 @@ else
site.Logo = (logo == null ? "" : logo);
site.DefaultThemeType = themetype;
site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
site.DefaultContainerType = containertype;
site = await SiteService.AddSiteAsync(site, aliases[0]);
foreach(Alias alias in aliases)
@ -223,7 +261,7 @@ 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
{
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Aliases: </label>
</td>
<td>
<textarea class="form-control" @bind="@urls" rows="3" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Logo: </label>
</td>
<td>
<input class="form-control" @bind="@logo" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype" disabled>
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Aliases: </label>
</td>
<td>
<textarea class="form-control" @bind="@urls" rows="3" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Logo: </label>
</td>
<td>
<input class="form-control" @bind="@logo" disabled />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype" disabled>
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
{
if (item.Key == themetype)
{
<option value="@item.Key" selected>@item.Value</option>
}
else
{
<option value="@item.Key">@item.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Layout: </label>
</td>
<td>
<select class="form-control" @bind="@layouttype" disabled>
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">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>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Layout: </label>
</td>
<td>
<select class="form-control" @bind="@layouttype" disabled>
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Container: </label>
</td>
<td>
<select class="form-control" @bind="@containertype" disabled>
<option value="">&lt;Select Container&gt;</option>
@foreach (KeyValuePair<string, string> container in containers)
{
<option value="@container.Key">@container.Value</option>
}
</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>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br />
@ -87,6 +108,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
Alias Alias;
int siteid;
@ -96,6 +118,8 @@ else
string logo = "";
string themetype;
string layouttype;
string containertype;
string createdby;
DateTime createdon;
string modifiedby;
@ -109,7 +133,7 @@ else
try
{
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();
siteid = Alias.SiteId;
@ -124,7 +148,9 @@ else
}
logo = site.Logo;
themetype = site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = site.DefaultLayoutType;
containertype = site.DefaultContainerType;
createdby = site.CreatedBy;
createdon = site.CreatedOn;

View File

@ -11,71 +11,92 @@
}
else
{
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Aliases: </label>
</td>
<td>
<textarea class="form-control" @bind="@urls" rows="3" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Logo: </label>
</td>
<td>
<input class="form-control" @bind="@logo" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @bind="@themetype">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
<table class="table table-borderless">
<tr>
<td>
<label for="Name" class="control-label">Name: </label>
</td>
<td>
<input class="form-control" @bind="@name" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Aliases: </label>
</td>
<td>
<textarea class="form-control" @bind="@urls" rows="3" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Logo: </label>
</td>
<td>
<input class="form-control" @bind="@logo" />
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Theme: </label>
</td>
<td>
<select class="form-control" @onchange="(e => ThemeChanged(e))">
<option value="">&lt;Select Theme&gt;</option>
@foreach (KeyValuePair<string, string> item in themes)
{
if (item.Key == themetype)
{
<option value="@item.Key" selected>@item.Value</option>
}
else
{
<option value="@item.Key">@item.Value</option>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Layout: </label>
</td>
<td>
<select class="form-control" @bind="@layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
</select>
</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>
}
</select>
</td>
</tr>
<tr>
<td>
<label for="Name" class="control-label">Default Layout: </label>
</td>
<td>
<select class="form-control" @bind="@layouttype">
<option value="">&lt;Select Layout&gt;</option>
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
{
<option value="@panelayout.Key">@panelayout.Value</option>
}
</select>
</td>
</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>
<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>
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
<br />
@ -88,6 +109,7 @@ else
Dictionary<string, string> themes = new Dictionary<string, string>();
Dictionary<string, string> panelayouts = new Dictionary<string, string>();
Dictionary<string, string> containers = new Dictionary<string, string>();
Alias Alias;
int siteid;
@ -97,6 +119,7 @@ else
string logo = "";
string themetype;
string layouttype;
string containertype;
string createdby;
DateTime createdon;
@ -111,7 +134,7 @@ else
try
{
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();
siteid = Alias.SiteId;
@ -126,7 +149,9 @@ else
}
logo = site.Logo;
themetype = site.DefaultThemeType;
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
layouttype = site.DefaultLayoutType;
containertype = site.DefaultContainerType;
createdby = site.CreatedBy;
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()
{
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);
if (site != null)
@ -156,6 +202,7 @@ else
site.Logo = (logo == null ? "" : logo);
site.DefaultThemeType = themetype;
site.DefaultLayoutType = (layouttype == null ? "" : layouttype);
site.DefaultContainerType = containertype;
site.IsDeleted = (isdeleted == null ? true : Boolean.Parse(isdeleted));
site = await SiteService.UpdateSiteAsync(site, Alias);
@ -181,12 +228,12 @@ else
}
}
NavigationManager.NavigateTo(NavigateUrl());
NavigationManager.NavigateTo(NavigateUrl(Reload.Site));
}
}
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)

View File

@ -40,6 +40,20 @@
string connectionstring = "";
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()
{
ShowProgressIndicator();

View File

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

View File

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

View File

@ -26,7 +26,7 @@ else
@if (upgradeavailable)
{
<hr />
<hr class="app-rule" />
<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>

View File

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

View File

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

View File

@ -8,7 +8,7 @@ namespace Oqtane.Services
{
Task<List<Theme>> GetThemesAsync();
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);
Task InstallThemesAsync();
Task DeleteThemeAsync(string ThemeName);

View File

@ -74,14 +74,17 @@ namespace Oqtane.Services
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>();
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;

View File

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

View File

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

View File

@ -218,6 +218,8 @@
if (page != null)
{
page = ProcessPage(page, site);
// check if user is authorized to view page
if (UserSecurity.IsAuthorized(user, "View", page.Permissions))
{
@ -243,7 +245,7 @@
if (PageState == null || reload >= Reload.Page)
{
modules = await ModuleService.GetModulesAsync(page.PageId);
modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes);
modules = ProcessModules(modules, moduledefinitions, pagestate.Control, page.Panes, site);
}
else
{
@ -311,7 +313,35 @@
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;
@ -374,6 +404,11 @@
paneindex.Add(module.Pane, 0);
}
module.PaneModuleIndex = paneindex[module.Pane];
if (string.IsNullOrEmpty(module.ContainerType))
{
module.ContainerType = site.DefaultContainerType;
}
}
foreach (Module module in modules)

View File

@ -1,15 +1,18 @@
@namespace Oqtane.Themes
@inherits ContainerBase
<div id="modal" class="app-admin-modal" style="display: block">
<div class="app-admin-modal-content">
<a href="@closeurl" class="app-admin-modal-close">x</a>
<div class="container">
<div class="row px-4">
<h2><ModuleTitle /></h2>
<hr style="width: 100%; color: gray; height: 1px; background-color:gray;" />
</div>
<div class="row px-4">
<div class="container">
@inject NavigationManager NavigationManager
<div class="app-admin-modal">
<div class="modal" style="display: block">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title"><ModuleTitle /></h5>
<button type="button" class="close" @onclick="CloseModal" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<ModuleInstance />
</div>
</div>
@ -18,11 +21,9 @@
</div>
@code {
string closeurl;
protected override void OnInitialized()
private void CloseModal()
{
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 align="center"><Logo /></div>
<Menu />
<Menu Orientation="Vertical" />
</div>
<div class="main">
<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 class="container">
<div class="row px-4">
<Pane Name="Top" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
<Pane Name="Content" />
</div>
<div class="row px-4">
<Pane Name="Admin" />
@ -24,7 +21,7 @@
</div>
@code {
public override string Panes { get { return "Top;Bottom"; } }
public override string Panes { get { return "Content"; } }
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))
{
<div id="actions" class="app-controlpanel">
<a href="javascript:void(0)" class="app-controlpanel-close" onclick="closeActions()">x</a>
<div class="app-controlpanel-content">
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="btn btn-primary mx-auto" href="@NavigateUrl("admin")">Admin Dashboard</NavLink>
</li>
</ul>
<ul class="nav flex-column">
<li class="nav-item px-3">
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Add")">Add Page</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Edit")">Edit Page</NavLink>
</li>
<li class="nav-item px-3">
<NavLink class="btn btn-primary mx-auto" href="@PageUrl("Delete")">Delete Page</NavLink>
</li>
</ul>
<hr style="width: 100%; color: white; height: 1px; background-color:white;" />
<div class="container">
<div class="app-controlpanel" style="@display">
<div class="card @cardclass mb-3">
<div class="card-header">
Control Panel
<button type="button" class="close" @onclick="HideControlPanel" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="card-body">
<ul class="nav flex-column">
<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 class="nav-item px-3">&nbsp;</li>
<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>
<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 class="nav-item px-3"><button type="button" class="btn btn-primary btn-block mx-auto" @onclick=@(async () => Navigate("Delete"))>Delete Page</button></li>
</ul>
<hr class="app-rule" />
<table class="table table-borderless">
<tr>
<td>
<label for="Module" class="control-label" style="color: white !important;">Module: </label>
<label for="Module" class="control-label">Module: </label>
</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))">
<option value="-">&lt;Common Modules&gt;</option>
@foreach (var category in categories)
{
<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))
@if (moduledefinitions != null)
{
<select class="form-control" @onchange="(e => CategoryChanged(e))">
<option value="-">&lt;Common Modules&gt;</option>
@foreach (var category in categories)
{
<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 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>
</tr>
<tr>
<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>
<select class="form-control" @bind="@pane">
@ -74,15 +103,7 @@
</tr>
<tr>
<td>
<label for="Title" class="control-label" style="color: white !important;">Title: </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>
<label for="Container" class="control-label">Container: </label>
</td>
<td>
<select class="form-control" @bind="@containertype">
@ -94,46 +115,71 @@
</td>
</tr>
</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>
@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>
</button>
}
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>
</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 {
[Parameter]
public string ButtonClass { get; set; }
[Parameter]
public string CardClass { get; set; }
string moduletype = "new";
List<string> categories = new List<string>();
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>();
int pagemanagementmoduleid = -1;
string moduledefinitionname = "";
string pane = "";
string title = "";
string containertype = "";
string display = "display: none;";
string buttonclass = "btn-outline-primary";
string cardclass = "text-white bg-secondary";
string message = "";
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))
{
foreach(ModuleDefinition moduledefinition in PageState.ModuleDefinitions)
foreach (ModuleDefinition moduledefinition in PageState.ModuleDefinitions)
{
if (moduledefinition.Categories != "")
{
foreach(string category in moduledefinition.Categories.Split(','))
foreach (string category in moduledefinition.Categories.Split(','))
{
if (!categories.Contains(category))
{
@ -143,8 +189,15 @@
}
}
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);
containertype = containers.FirstOrDefault().Key;
containertype = PageState.Site.DefaultContainerType;
List<Module> modules = await ModuleService.GetModulesAsync(PageState.Site.SiteId, Constants.PageManagementModule);
if (modules.Count > 0)
{
@ -168,30 +221,65 @@
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()
{
if (UserSecurity.IsAuthorized(PageState.User, "Edit", PageState.Page.Permissions))
{
Module module = new Module();
module.SiteId = PageState.Site.SiteId;
module.ModuleDefinitionName = moduledefinitionname;
module.Permissions = PageState.Page.Permissions;
module = await ModuleService.AddModuleAsync(module);
if (moduletype == "new")
{
Module module = new Module();
module.SiteId = PageState.Site.SiteId;
module.ModuleDefinitionName = moduledefinitionname;
module.Permissions = PageState.Page.Permissions;
module = await ModuleService.AddModuleAsync(module);
moduleid = module.ModuleId.ToString();
}
PageModule pagemodule = new PageModule();
pagemodule.PageId = PageState.Page.PageId;
pagemodule.ModuleId = module.ModuleId;
pagemodule.ModuleId = int.Parse(moduleid);
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.Order = int.MaxValue;
pagemodule.ContainerType = containertype;
if (pagemodule.ContainerType == PageState.Site.DefaultContainerType)
{
pagemodule.ContainerType = "";
}
await PageModuleService.AddPageModuleAsync(pagemodule);
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));
}
}
@ -231,7 +319,37 @@
PageState.EditMode = 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
@inherits ThemeControlBase
@inject IUserService UserService
@if (menu != "")
{
@((MarkupString)menu)
<div class="app-menu">
@((MarkupString)menu)
</div>
}
@code {
[Parameter]
public string Orientation { get; set; }
string menu = "";
protected override void OnParametersSet()
{
switch (Orientation)
{
case "Horizontal":
CreateHorizontalMenu();
break;
default: // Vertical
CreateVerticalMenu();
break;
}
}
private void CreateVerticalMenu()
{
int level = -1;
int securitylevel = int.MaxValue;
@ -49,4 +66,33 @@
}
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))
{
<div class="dropdown">
<button type="button" class="btn app-actions-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"></button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
@foreach (var action in actions)
{
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action.Action))">@action.Name</a>
}
</div>
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"></a>
<div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 37px, 0px);">
@foreach (var action in actions)
{
if (action.Action != "")
{
<a class="dropdown-item" @onclick="(async () => await ModuleAction(action.Action))">@action.Name</a>
}
else
{
<div class="dropdown-divider"></div>
}
}
</div>
}
@ -25,6 +30,14 @@
if (PageState.EditMode && UserSecurity.IsAuthorized(PageState.User, "Edit", ModuleState.Permissions))
{
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)
{
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 = "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
@inherits ContainerBase
@title
@((MarkupString)title)
@code {
string title = "";

View File

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

View File

@ -1,33 +1,23 @@
@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>
<main role="main">
<nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-top">
<Logo /><Menu Orientation="Horizontal" /><div class="ml-md-auto"><UserProfile /> <Login /> <ControlPanel ButtonClass="btn-outline-secondary" CardClass="bg-light" /></div>
</nav>
<div class="container">
<div class="row px-4">
<Pane Name="Top" />
</div>
<div class="row px-4">
<Pane Name="Bottom" />
</div>
<PaneLayout />
<div class="row px-4">
<Pane Name="Admin" />
</div>
</div>
</div>
</main>
@code {
public override string Panes { get { return "Left;Right"; } }
public override string Panes { get { return ""; } }
protected override async Task OnParametersSetAsync()
{
await IncludeCSS("Theme.css");
}
}
}

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 */
.app-controlpanel {
height: 100%;
width: 0;
width: 0%;
position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */
right: 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 */
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 */
.app-controlpanel-content {
position: relative;
top: 5%; /* 5% from the top */
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
/* Position the content inside the overlay */
.app-controlpanel .card-body {
position: relative;
width: 100%; /* 100% width */
}
.app-controlpanel-close {
font-size: 40px;
top: 15px;
right: 35px;
/* Pad the navigation links */
.app-controlpanel .nav-item {
font-size: 0.9rem;
padding-bottom: 0.5rem;
}
.app-controlpanel .card-body .control-label {
color: white;
}
}
/* Admin Modal */
.app-admin-modal {
display: none; /* Hidden by default */
.app-admin-modal .modal {
position: fixed; /* Stay in place */
z-index: 9999; /* Sit on top */
left: 0;
@ -64,42 +47,21 @@ app {
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
background: rgba(0,0,0,0.3); /* Dim background */
}
.app-admin-modal-content {
background-color: #fefefe;
.app-admin-modal .modal-dialog {
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 */
padding: 20px;
border: 1px solid #888;
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 {
width: 100%;
border-width: 1px;
@ -121,4 +83,11 @@ app {
top: 0;
left: 0;
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) {
var link = document.getElementById('yourid');
var link = document.getElementById(id);
if (link === null) {
link = document.createElement("link");
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