@using Microsoft.AspNetCore.Components.Routing @using Oqtane.Models @using Oqtane.Services @using Oqtane.Modules @using Oqtane.Shared @inherits ModuleBase @inject IUriHelper UriHelper @inject IPageService PageService @inject IThemeService ThemeService
Cancel @functions { public override SecurityAccessLevelEnum SecurityAccessLevel { get { return SecurityAccessLevelEnum.Admin; } } Dictionary themes = new Dictionary(); Dictionary panelayouts = new Dictionary(); string name; string path; string parentid; string order = ""; string isnavigation = "True"; string themetype; string layouttype = ""; string icon = ""; string viewpermissions = "All Users"; string editpermissions = "Administrators"; protected override void OnInit() { themes = ThemeService.GetThemeTypes(PageState.Themes); panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes); } private async Task SavePage() { Page p = new Page(); p.SiteId = PageState.Page.SiteId; if (string.IsNullOrEmpty(parentid)) { p.ParentId = null; } else { p.ParentId = Int32.Parse(parentid); } p.Name = name; p.Path = path; p.Order = (order == null ? 1 : Int32.Parse(order)); p.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); p.ThemeType = themetype; p.LayoutType = (layouttype == null ? "" : layouttype); p.Icon = (icon == null ? "" : icon); Type type; if (!string.IsNullOrEmpty(layouttype)) { type = Type.GetType(layouttype); } else { type = Type.GetType(themetype); } System.Reflection.PropertyInfo property = type.GetProperty("Panes"); p.Panes = (string)property.GetValue(Activator.CreateInstance(type), null); p.ViewPermissions = viewpermissions; p.EditPermissions = editpermissions; await PageService.AddPageAsync(p); UriHelper.NavigateTo(NavigateUrl(path, true)); } }