Support for user personalizable pages
This commit is contained in:
@ -4,148 +4,159 @@
|
||||
@inject IPageService PageService
|
||||
@inject IThemeService ThemeService
|
||||
|
||||
<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">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Parent: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
@foreach (Page page in pages)
|
||||
{
|
||||
if (page.PageId.ToString() == parentid)
|
||||
{
|
||||
<option value="@(page.PageId)" selected>@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Move : </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@insert">
|
||||
@if (parentid == currentparentid)
|
||||
{
|
||||
<option value="="><Maintain Current Location></option>
|
||||
}
|
||||
<option value="<<">To Beginning</option>
|
||||
@if (children != null && children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
}
|
||||
<option value=">>">To End</option>
|
||||
</select>
|
||||
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
|
||||
<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">Path: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@path" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Parent: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ParentChanged(e))">
|
||||
<option value="-1"><Site Root></option>
|
||||
@foreach (Page page in pages)
|
||||
{
|
||||
<select class="form-control" @bind="@childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
@foreach (Page page in children)
|
||||
{
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
}
|
||||
</select>
|
||||
if (page.PageId.ToString() == parentid)
|
||||
{
|
||||
<option value="@(page.PageId)" selected>@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@(page.PageId)">@(new string('-', page.Level * 2))@(page.Name)</option>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Default Mode? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@mode">
|
||||
<option value="view">View Mode</option>
|
||||
<option value="edit">Edit Mode</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Theme: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Move : </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@insert">
|
||||
@if (parentid == currentparentid)
|
||||
{
|
||||
<option value="="><Maintain Current Location></option>
|
||||
}
|
||||
<option value="<<">To Beginning</option>
|
||||
@if (children != null && children.Count > 0)
|
||||
{
|
||||
<option value="<">Before</option>
|
||||
<option value=">">After</option>
|
||||
}
|
||||
<option value=">>">To End</option>
|
||||
</select>
|
||||
@if (children != null && children.Count > 0 && (insert == "<" || insert == ">"))
|
||||
{
|
||||
<select class="form-control" @bind="@childid">
|
||||
<option value="-1"><Select Page></option>
|
||||
@foreach (Page page in children)
|
||||
{
|
||||
if (item.Key == themetype)
|
||||
{
|
||||
<option value="@item.Key" selected>@item.Value</option>
|
||||
}
|
||||
else
|
||||
{
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
}
|
||||
<option value="@(page.PageId)">@(page.Name)</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Navigation? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@isnavigation">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Personalizable? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@ispersonalizable">
|
||||
<option value="True">Yes</option>
|
||||
<option value="False">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Default Mode? </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@mode">
|
||||
<option value="view">View Mode</option>
|
||||
<option value="edit">Edit Mode</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Theme: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @onchange="(e => ThemeChanged(e))">
|
||||
<option value=""><Select Theme></option>
|
||||
@foreach (KeyValuePair<string, string> item in themes)
|
||||
{
|
||||
if (item.Key == themetype)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
<option value="@item.Key" selected>@item.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Icon: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@icon" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
else
|
||||
{
|
||||
<option value="@item.Key">@item.Value</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Layout: </label>
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-control" @bind="@layouttype">
|
||||
<option value=""><Select Layout></option>
|
||||
@foreach (KeyValuePair<string, string> panelayout in panelayouts)
|
||||
{
|
||||
<option value="@panelayout.Key">@panelayout.Value</option>
|
||||
}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Icon: </label>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" @bind="@icon" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="Name" class="control-label">Permissions: </label>
|
||||
</td>
|
||||
<td>
|
||||
<PermissionGrid EntityName="Page" Permissions="@permissions" @ref="permissiongrid" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<button type="button" class="btn btn-success" @onclick="SavePage">Save</button>
|
||||
<NavLink class="btn btn-secondary" href="@NavigateUrl()">Cancel</NavLink>
|
||||
<br />
|
||||
@ -168,6 +179,7 @@
|
||||
List<Page> children;
|
||||
int childid = -1;
|
||||
string isnavigation;
|
||||
string ispersonalizable;
|
||||
string mode;
|
||||
string themetype;
|
||||
string layouttype;
|
||||
@ -211,6 +223,7 @@
|
||||
}
|
||||
currentparentid = parentid;
|
||||
isnavigation = page.IsNavigation.ToString();
|
||||
ispersonalizable = page.IsPersonalizable.ToString();
|
||||
mode = (page.EditMode) ? "edit" : "view";
|
||||
themetype = page.ThemeType;
|
||||
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes, themetype);
|
||||
@ -357,16 +370,18 @@
|
||||
{
|
||||
page.LayoutType = "";
|
||||
}
|
||||
page.IsPersonalizable = (ispersonalizable == null ? false : Boolean.Parse(ispersonalizable));
|
||||
page.UserId = null;
|
||||
|
||||
await PageService.UpdatePageAsync(page);
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, page.ParentId);
|
||||
if (currentparentid == "")
|
||||
{
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, null);
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, int.Parse(currentparentid));
|
||||
await PageService.UpdatePageOrderAsync(page.SiteId, page.PageId, int.Parse(currentparentid));
|
||||
}
|
||||
|
||||
// update child paths
|
||||
|
Reference in New Issue
Block a user