diff --git a/Oqtane.Client/Modules/Admin/Dashboard/Index.razor b/Oqtane.Client/Modules/Admin/Dashboard/Index.razor
index 18a5a921..f2eb40b9 100644
--- a/Oqtane.Client/Modules/Admin/Dashboard/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Dashboard/Index.razor
@@ -12,7 +12,7 @@
@foreach (var p in pages)
{
- if (p.IsNavigation && UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
+ if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
{
string url = NavigateUrl(p.Path);
diff --git a/Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor b/Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor
index ca7ac200..26c7ebfe 100644
--- a/Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor
+++ b/Oqtane.Client/Modules/Admin/ModuleSettings/Index.razor
@@ -44,7 +44,7 @@
Permissions:
-
+
diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor
index 82c2dc0c..bcf77cf5 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Add.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor
@@ -23,6 +23,14 @@
+
+
+ Path:
+
+
+
+
+
Parent:
@@ -126,7 +134,7 @@
Permissions:
-
+
@@ -142,7 +150,8 @@
Dictionary panelayouts = new Dictionary();
List pages;
- string name = "";
+ string name;
+ string path = "";
string parentid;
string insert = ">>";
List children;
@@ -160,8 +169,8 @@
{
try
{
- pages = PageState.Pages.Where(item => item.IsNavigation).ToList();
- children = PageState.Pages.Where(item => item.ParentId == null && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ pages = PageState.Pages;
+ children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
@@ -184,11 +193,11 @@
parentid = (string)e.Value;
if (string.IsNullOrEmpty(parentid))
{
- children = PageState.Pages.Where(item => item.ParentId == null && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ children = PageState.Pages.Where(item => item.ParentId == null).ToList();
}
else
{
- children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid) && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid)).ToList();
}
StateHasChanged();
}
@@ -205,16 +214,31 @@
Page page = new Page();
page.SiteId = PageState.Page.SiteId;
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 = page.Name.ToLower();
+ page.Path = Utilities.GetFriendlyUrl(path);
}
else
{
page.ParentId = Int32.Parse(parentid);
- Page parent = PageState.Pages.Where(item => item.ParentId == page.ParentId).FirstOrDefault();
- page.Path = parent.Path + "/" + page.Name.ToLower();
+ 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)
@@ -255,7 +279,7 @@
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
PageState.Reload = Constants.ReloadSite;
- NavigationManager.NavigateTo(NavigateUrl());
+ NavigationManager.NavigateTo(NavigateUrl(page.Path));
}
catch (Exception ex)
{
diff --git a/Oqtane.Client/Modules/Admin/Pages/Delete.razor b/Oqtane.Client/Modules/Admin/Pages/Delete.razor
index ba85c106..37075775 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Delete.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Delete.razor
@@ -108,7 +108,7 @@
Permissions:
-
+
diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
index 83aacea5..65107ecc 100644
--- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor
+++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor
@@ -28,7 +28,7 @@
Path:
-
+
@@ -40,7 +40,14 @@
<Site Root>
@foreach (Page page in pages)
{
- @(new string('-', page.Level * 2))@(page.Name)
+ if (page.PageId.ToString() == parentid)
+ {
+ @(new string('-', page.Level * 2))@(page.Name)
+ }
+ else
+ {
+ @(new string('-', page.Level * 2))@(page.Name)
+ }
}
@@ -51,7 +58,10 @@
- <Maintain Current Location>
+ @if (parentid == currentparentid)
+ {
+ <Maintain Current Location>
+ }
To Beginning
@if (children != null && children.Count > 0)
{
@@ -135,7 +145,7 @@
Permissions:
-
+
@@ -157,6 +167,7 @@
int PageId;
string name;
string path;
+ string currentparentid;
string parentid;
string insert = "";
List children;
@@ -178,8 +189,8 @@
{
try
{
- pages = PageState.Pages.Where(item => item.IsNavigation).ToList();
- children = PageState.Pages.Where(item => item.ParentId == null && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ pages = PageState.Pages;
+ children = PageState.Pages.Where(item => item.ParentId == null).ToList();
themes = ThemeService.GetThemeTypes(PageState.Themes);
panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes);
@@ -190,6 +201,10 @@
{
name = page.Name;
path = page.Path;
+ if (path.Contains("/"))
+ {
+ path = path.Substring(path.LastIndexOf("/") + 1);
+ }
if (page.ParentId == null)
{
parentid = "";
@@ -198,6 +213,7 @@
{
parentid = page.ParentId.ToString();
}
+ currentparentid = parentid;
isnavigation = page.IsNavigation.ToString();
editmode = page.EditMode.ToString();
themetype = page.ThemeType;
@@ -223,11 +239,19 @@
parentid = (string)e.Value;
if (string.IsNullOrEmpty(parentid))
{
- children = PageState.Pages.Where(item => item.ParentId == null && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ children = PageState.Pages.Where(item => item.ParentId == null).ToList();
}
else
{
- children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid) && item.IsNavigation).OrderBy(item => item.Order).ToList();
+ children = PageState.Pages.Where(item => item.ParentId == int.Parse(parentid)).ToList();
+ }
+ if (parentid == currentparentid)
+ {
+ insert = "";
+ }
+ else
+ {
+ insert = ">>";
}
StateHasChanged();
}
@@ -241,20 +265,35 @@
{
try
{
- Page page = PageState.Page;
- int? currentparentid = page.ParentId;
- page.PageId = Int32.Parse(PageState.QueryString["id"]);
+ 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 = page.Name.ToLower();
+ page.Path = Utilities.GetFriendlyUrl(path);
}
else
{
page.ParentId = Int32.Parse(parentid);
- Page parent = PageState.Pages.Where(item => item.ParentId == page.ParentId).FirstOrDefault();
- page.Path = parent.Path + "/" + page.Name.ToLower();
+ 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 != "")
{
@@ -296,10 +335,27 @@
page.Permissions = permissiongrid.GetPermissions();
await PageService.UpdatePageAsync(page);
await PageService.UpdatePageOrderAsync(page.SiteId, page.ParentId);
- await PageService.UpdatePageOrderAsync(page.SiteId, currentparentid);
+ 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);
+ }
+ }
PageState.Reload = Constants.ReloadSite;
- NavigationManager.NavigateTo(NavigateUrl());
+ NavigationManager.NavigateTo(NavigateUrl(page.Path));
}
catch (Exception ex)
{
diff --git a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
index 389babf9..d3c602c7 100644
--- a/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
+++ b/Oqtane.Client/Modules/HtmlText/Services/HtmlTextService.cs
@@ -24,7 +24,7 @@ namespace Oqtane.Modules.HtmlText.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "HtmlText"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "HtmlText"); }
}
public async Task GetHtmlTextAsync(int ModuleId)
diff --git a/Oqtane.Client/Oqtane.Client.csproj b/Oqtane.Client/Oqtane.Client.csproj
index 3108d4ff..8e2d7039 100644
--- a/Oqtane.Client/Oqtane.Client.csproj
+++ b/Oqtane.Client/Oqtane.Client.csproj
@@ -1,12 +1,13 @@
- netcoreapp3.0
-
-
+
+ 7.3
3.0
Debug;Release;Wasm
0.0.1
@@ -36,8 +37,4 @@
-
-
- false
-
diff --git a/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs b/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
index 0a83b3c4..d09025b2 100644
--- a/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
+++ b/Oqtane.Client/Providers/IdentityAuthenticationStateProvider.cs
@@ -25,7 +25,7 @@ namespace Oqtane.Providers
{
// hack: create a new HttpClient rather than relying on the registered service as the AuthenticationStateProvider is initialized prior to NavigationManager ( https://github.com/aspnet/AspNetCore/issues/11867 )
HttpClient http = new HttpClient();
- string apiurl = ServiceBase.CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "User") + "/authenticate";
+ string apiurl = ServiceBase.CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "User") + "/authenticate";
User user = await http.GetJsonAsync(apiurl);
ClaimsIdentity identity = new ClaimsIdentity();
diff --git a/Oqtane.Client/Services/AliasService.cs b/Oqtane.Client/Services/AliasService.cs
index 10d24df8..6fa109b5 100644
--- a/Oqtane.Client/Services/AliasService.cs
+++ b/Oqtane.Client/Services/AliasService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Alias"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Alias"); }
}
public async Task> GetAliasesAsync()
diff --git a/Oqtane.Client/Services/FileService.cs b/Oqtane.Client/Services/FileService.cs
index 5bb68325..6a567205 100644
--- a/Oqtane.Client/Services/FileService.cs
+++ b/Oqtane.Client/Services/FileService.cs
@@ -20,7 +20,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "File"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "File"); }
}
public async Task UploadFilesAsync(string Folder)
diff --git a/Oqtane.Client/Services/Interfaces/InstallationService.cs b/Oqtane.Client/Services/Interfaces/InstallationService.cs
index e198e1b4..677354ab 100644
--- a/Oqtane.Client/Services/Interfaces/InstallationService.cs
+++ b/Oqtane.Client/Services/Interfaces/InstallationService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Installation"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Installation"); }
}
public async Task IsInstalled()
diff --git a/Oqtane.Client/Services/ModuleDefinitionService.cs b/Oqtane.Client/Services/ModuleDefinitionService.cs
index 1db1cd83..a75e94e2 100644
--- a/Oqtane.Client/Services/ModuleDefinitionService.cs
+++ b/Oqtane.Client/Services/ModuleDefinitionService.cs
@@ -25,7 +25,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "ModuleDefinition"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "ModuleDefinition"); }
}
public async Task> GetModuleDefinitionsAsync()
diff --git a/Oqtane.Client/Services/ModuleService.cs b/Oqtane.Client/Services/ModuleService.cs
index 40162015..515b8f58 100644
--- a/Oqtane.Client/Services/ModuleService.cs
+++ b/Oqtane.Client/Services/ModuleService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Module"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Module"); }
}
public async Task> GetModulesAsync(int PageId)
diff --git a/Oqtane.Client/Services/PageModuleService.cs b/Oqtane.Client/Services/PageModuleService.cs
index d4af4fa6..cb20faed 100644
--- a/Oqtane.Client/Services/PageModuleService.cs
+++ b/Oqtane.Client/Services/PageModuleService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "PageModule"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "PageModule"); }
}
public async Task> GetPageModulesAsync()
diff --git a/Oqtane.Client/Services/PageService.cs b/Oqtane.Client/Services/PageService.cs
index 78253b72..af806412 100644
--- a/Oqtane.Client/Services/PageService.cs
+++ b/Oqtane.Client/Services/PageService.cs
@@ -24,7 +24,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Page"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Page"); }
}
public async Task> GetPagesAsync(int SiteId)
diff --git a/Oqtane.Client/Services/ProfileService.cs b/Oqtane.Client/Services/ProfileService.cs
index ecb8bbef..cffc2f52 100644
--- a/Oqtane.Client/Services/ProfileService.cs
+++ b/Oqtane.Client/Services/ProfileService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Profile"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Profile"); }
}
public async Task> GetProfilesAsync()
diff --git a/Oqtane.Client/Services/RoleService.cs b/Oqtane.Client/Services/RoleService.cs
index b87e609f..3e09d677 100644
--- a/Oqtane.Client/Services/RoleService.cs
+++ b/Oqtane.Client/Services/RoleService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Role"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Role"); }
}
public async Task> GetRolesAsync()
diff --git a/Oqtane.Client/Services/SettingService.cs b/Oqtane.Client/Services/SettingService.cs
index c74e48e6..e92de5da 100644
--- a/Oqtane.Client/Services/SettingService.cs
+++ b/Oqtane.Client/Services/SettingService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Setting"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Setting"); }
}
public async Task> GetHostSettingsAsync()
diff --git a/Oqtane.Client/Services/SiteService.cs b/Oqtane.Client/Services/SiteService.cs
index 194ce482..244cc263 100644
--- a/Oqtane.Client/Services/SiteService.cs
+++ b/Oqtane.Client/Services/SiteService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Site"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Site"); }
}
public async Task> GetSitesAsync()
diff --git a/Oqtane.Client/Services/TenantService.cs b/Oqtane.Client/Services/TenantService.cs
index 92110518..cfd868c4 100644
--- a/Oqtane.Client/Services/TenantService.cs
+++ b/Oqtane.Client/Services/TenantService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Tenant"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Tenant"); }
}
public async Task> GetTenantsAsync()
diff --git a/Oqtane.Client/Services/ThemeService.cs b/Oqtane.Client/Services/ThemeService.cs
index 84fa66bf..46a75c9e 100644
--- a/Oqtane.Client/Services/ThemeService.cs
+++ b/Oqtane.Client/Services/ThemeService.cs
@@ -25,7 +25,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "Theme"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "Theme"); }
}
public async Task> GetThemesAsync()
diff --git a/Oqtane.Client/Services/UserRoleService.cs b/Oqtane.Client/Services/UserRoleService.cs
index baa44836..148173bf 100644
--- a/Oqtane.Client/Services/UserRoleService.cs
+++ b/Oqtane.Client/Services/UserRoleService.cs
@@ -23,7 +23,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "UserRole"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "UserRole"); }
}
public async Task> GetUserRolesAsync()
diff --git a/Oqtane.Client/Services/UserService.cs b/Oqtane.Client/Services/UserService.cs
index 2343d6cf..ecf3ed7a 100644
--- a/Oqtane.Client/Services/UserService.cs
+++ b/Oqtane.Client/Services/UserService.cs
@@ -24,7 +24,7 @@ namespace Oqtane.Services
private string apiurl
{
- get { return CreateApiUrl(sitestate.Alias, NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri, "User"); }
+ get { return CreateApiUrl(sitestate.Alias, NavigationManager.Uri, "User"); }
}
public async Task> GetUsersAsync(int SiteId)
diff --git a/Oqtane.Client/Shared/SiteRouter.razor b/Oqtane.Client/Shared/SiteRouter.razor
index da4f4e7e..e4c9d1d1 100644
--- a/Oqtane.Client/Shared/SiteRouter.razor
+++ b/Oqtane.Client/Shared/SiteRouter.razor
@@ -41,7 +41,7 @@
protected override void OnInitialized()
{
- _absoluteUri = NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri;
+ _absoluteUri = NavigationManager.Uri;
NavigationManager.LocationChanged += LocationChanged;
DynamicComponent = builder =>
@@ -140,8 +140,12 @@
pages = PageState.Pages;
}
- // get Url path and querystring
+ // get Url path and querystring ( and remove anchors )
string path = new Uri(_absoluteUri).PathAndQuery.Substring(1);
+ if (path.IndexOf("#") != -1)
+ {
+ path = path.Substring(0, path.IndexOf("#"));
+ }
// parse querystring and remove
Dictionary querystring = new Dictionary();
@@ -189,6 +193,13 @@
{
page = PageState.Page;
}
+ // failsafe in case router cannot locate the home page for the site
+ if (page == null && path == "")
+ {
+ page = pages.FirstOrDefault();
+ path = page.Path;
+ }
+
// check if page has changed
if (page.Path != path)
{
diff --git a/Oqtane.Client/Shared/Utilities.cs b/Oqtane.Client/Shared/Utilities.cs
index f25ead1c..b4775f6d 100644
--- a/Oqtane.Client/Shared/Utilities.cs
+++ b/Oqtane.Client/Shared/Utilities.cs
@@ -1,7 +1,5 @@
-using Oqtane.Models;
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Globalization;
+using System.Text;
namespace Oqtane.Shared
{
@@ -66,5 +64,128 @@ namespace Oqtane.Shared
string[] fragments = typename.Split('.');
return fragments[fragments.Length - 1];
}
+
+ public static string GetFriendlyUrl(string text)
+ {
+ string result = "";
+ if (text != null)
+ {
+ var normalizedString = text.ToLowerInvariant().Normalize(NormalizationForm.FormD);
+ var stringBuilder = new StringBuilder();
+ var stringLength = normalizedString.Length;
+ var prevdash = false;
+ char c;
+ for (int i = 0; i < stringLength; i++)
+ {
+ c = normalizedString[i];
+ switch (CharUnicodeInfo.GetUnicodeCategory(c))
+ {
+ case UnicodeCategory.LowercaseLetter:
+ case UnicodeCategory.UppercaseLetter:
+ case UnicodeCategory.DecimalDigitNumber:
+ if (c < 128)
+ stringBuilder.Append(c);
+ else
+ stringBuilder.Append(RemapInternationalCharToAscii(c));
+ prevdash = false;
+ break;
+ case UnicodeCategory.SpaceSeparator:
+ case UnicodeCategory.ConnectorPunctuation:
+ case UnicodeCategory.DashPunctuation:
+ case UnicodeCategory.OtherPunctuation:
+ case UnicodeCategory.MathSymbol:
+ if (!prevdash)
+ {
+ stringBuilder.Append('-');
+ prevdash = true;
+ }
+ break;
+ }
+ }
+ result = stringBuilder.ToString().Trim('-');
+ }
+ return result;
+ }
+
+ private static string RemapInternationalCharToAscii(char c)
+ {
+ string s = c.ToString().ToLowerInvariant();
+ if ("àåáâäãåą".Contains(s))
+ {
+ return "a";
+ }
+ else if ("èéêëę".Contains(s))
+ {
+ return "e";
+ }
+ else if ("ìíîïı".Contains(s))
+ {
+ return "i";
+ }
+ else if ("òóôõöøőð".Contains(s))
+ {
+ return "o";
+ }
+ else if ("ùúûüŭů".Contains(s))
+ {
+ return "u";
+ }
+ else if ("çćčĉ".Contains(s))
+ {
+ return "c";
+ }
+ else if ("żźž".Contains(s))
+ {
+ return "z";
+ }
+ else if ("śşšŝ".Contains(s))
+ {
+ return "s";
+ }
+ else if ("ñń".Contains(s))
+ {
+ return "n";
+ }
+ else if ("ýÿ".Contains(s))
+ {
+ return "y";
+ }
+ else if ("ğĝ".Contains(s))
+ {
+ return "g";
+ }
+ else if (c == 'ř')
+ {
+ return "r";
+ }
+ else if (c == 'ł')
+ {
+ return "l";
+ }
+ else if (c == 'đ')
+ {
+ return "d";
+ }
+ else if (c == 'ß')
+ {
+ return "ss";
+ }
+ else if (c == 'þ')
+ {
+ return "th";
+ }
+ else if (c == 'ĥ')
+ {
+ return "h";
+ }
+ else if (c == 'ĵ')
+ {
+ return "j";
+ }
+ else
+ {
+ return "";
+ }
+ }
}
}
diff --git a/Oqtane.Client/Themes/Controls/ControlPanel.razor b/Oqtane.Client/Themes/Controls/ControlPanel.razor
index ce7e4659..3d95a44f 100644
--- a/Oqtane.Client/Themes/Controls/ControlPanel.razor
+++ b/Oqtane.Client/Themes/Controls/ControlPanel.razor
@@ -21,56 +21,80 @@
- Add Page
+ Add Page
- Edit Page
+ Edit Page
- Delete Page
+ Delete Page
diff --git a/Oqtane.Client/Themes/Controls/Menu.razor b/Oqtane.Client/Themes/Controls/Menu.razor
index f2a639a5..7aca05a8 100644
--- a/Oqtane.Client/Themes/Controls/Menu.razor
+++ b/Oqtane.Client/Themes/Controls/Menu.razor
@@ -6,57 +6,53 @@
@using Oqtane.Security
@namespace Oqtane.Themes.Controls
@inherits ThemeObjectBase
-@inject IPageService PageService
@inject IUserService UserService
-
- @if (parent != null)
- {
- string url = NavigateUrl();
-
-
- Back
-
-
- }
- @foreach (var p in pages)
- {
- if (p.IsNavigation && UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions))
- {
- string url = NavigateUrl(p.Path);
-
-
- @p.Name
-
-
- }
- }
-
+@if (menu != "")
+{
+ @((MarkupString)menu)
+}
@code {
- List pages;
- Page parent = null;
+ string menu = "";
- protected override Task OnParametersSetAsync()
+ protected override void OnInitialized()
{
- // if current page has no children
- if (PageState.Pages.Where(item => item.ParentId == PageState.Page.PageId).FirstOrDefault() == null)
+ int level = -1;
+ int securitylevel = int.MaxValue;
+
+ menu = "\n";
+
+ foreach (Page p in PageState.Pages.Where(item => item.IsNavigation))
{
- // display list of pages which have same parent as current page
- pages = PageState.Pages.Where(item => item.ParentId == PageState.Page.ParentId).OrderBy(item => item.Order).ToList();
- // if current page has parent
- if (PageState.Page.ParentId != null)
+ if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.Level <= securitylevel)
{
- parent = PageState.Pages.Where(item => item.PageId == PageState.Page.ParentId).FirstOrDefault();
+ securitylevel = int.MaxValue;
+
+ menu += "";
+ menu += "";
+ if (p.HasChildren)
+ {
+ menu += " ";
+ }
+ if (p.Icon != "")
+ {
+ menu += " ";
+ }
+ menu += p.Name;
+ menu += " \n";
+ menu += " \n";
+
+ level = p.Level;
+ }
+ else
+ {
+ if (securitylevel == int.MaxValue)
+ {
+ securitylevel = p.Level;
+ }
}
}
- else
- {
- // display list of pages which are children of current page
- pages = PageState.Pages.Where(item => item.ParentId == PageState.Page.PageId).OrderBy(item => item.Order).ToList();
- // current page is parent
- parent = PageState.Pages.Where(item => item.ParentId == PageState.Page.ParentId).FirstOrDefault();
- }
- return Task.CompletedTask;
+ menu += " ";
}
}
diff --git a/Oqtane.Client/Themes/Controls/Menu2.razor b/Oqtane.Client/Themes/Controls/Menu2.razor
deleted file mode 100644
index 5170210f..00000000
--- a/Oqtane.Client/Themes/Controls/Menu2.razor
+++ /dev/null
@@ -1,69 +0,0 @@
-@using Microsoft.AspNetCore.Components.Routing
-@using Microsoft.AspNetCore.Components.Web
-@using Oqtane.Themes
-@using Oqtane.Services
-@using Oqtane.Models;
-@using Oqtane.Security
-@namespace Oqtane.Themes.Controls
-@inherits ThemeObjectBase
-@inject IUserService UserService
-
-@if (menu != "")
-{
- @((MarkupString)menu)
-}
-
-@code {
- string menu = "";
-
- protected override void OnInitialized()
- {
- int level = -1;
- int securitylevel = int.MaxValue;
-
- menu = "\n";
- foreach (Page p in PageState.Pages.Where(item => item.IsNavigation))
- {
- for (int l = p.Level; l < level; l++)
- {
- menu += " \n";
- menu += "\n";
- }
- if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.Level <= securitylevel)
- {
- securitylevel = int.MaxValue;
- if (p.HasChildren)
- {
- menu += "\n";
- menu += "";
- menu += " " + p.Name;
- menu += " \n";
- menu += "\n";
- }
- menu += "
";
- }
-}
diff --git a/Oqtane.Server/Oqtane.Server.csproj b/Oqtane.Server/Oqtane.Server.csproj
index 55f2106e..94f97e2f 100644
--- a/Oqtane.Server/Oqtane.Server.csproj
+++ b/Oqtane.Server/Oqtane.Server.csproj
@@ -2,10 +2,11 @@
netcoreapp3.0
-
+
true
Debug;Release;Wasm
0.0.1
diff --git a/Oqtane.Server/Scripts/00.00.00.sql b/Oqtane.Server/Scripts/00.00.00.sql
index c71ec72f..3c6c6b7f 100644
--- a/Oqtane.Server/Scripts/00.00.00.sql
+++ b/Oqtane.Server/Scripts/00.00.00.sql
@@ -439,49 +439,49 @@ GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 3, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (4, 1, N'Admin', N'admin', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 7, 1, N'', '', 1, getdate(), '', getdate())
+VALUES (4, 1, N'Admin', N'admin', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'oi-home', N'Top;Bottom', NULL, 7, 0, N'', '', 1, getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 4, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (8, 1, N'Site Management', N'admin/sites', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 1, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (8, 1, N'Site Management', N'admin/sites', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 1, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 8, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (5, 1, N'Page Management', N'admin/pages', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 3, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (5, 1, N'Page Management', N'admin/pages', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 3, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 5, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (10, 1, N'Module Management', N'admin/modules', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 5, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (10, 1, N'Module Management', N'admin/modules', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 5, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 10, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (11, 1, N'Theme Management', N'admin/themes', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 7, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (11, 1, N'Theme Management', N'admin/themes', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 7, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 11, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (9, 1, N'User Management', N'admin/users', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 9, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (9, 1, N'User Management', N'admin/users', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 9, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 9, 'Edit', 1, null, 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Page] ([PageId], [SiteId], [Name], [Path], [ThemeType], [Icon], [Panes], [ParentId], [Order], [IsNavigation], [LayoutType], [EditMode], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn])
-VALUES (16, 1, N'Role Management', N'admin/roles', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 11, 1, N'', 1, '', getdate(), '', getdate())
+VALUES (16, 1, N'Role Management', N'admin/roles', N'Oqtane.Themes.Theme2.Theme2, Oqtane.Client', N'', N'Top;Bottom', 4, 11, 0, N'', 1, '', getdate(), '', getdate())
GO
INSERT [dbo].[Permission] ([SiteId], [EntityName], [EntityId], [PermissionName], [RoleId], [UserId], [IsAuthorized], [CreatedBy], [CreatedOn], [ModifiedBy], [ModifiedOn]) VALUES (1, 'Page', 16, 'View', 1, null, 1, '', getdate(), '', getdate())
GO
diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs
index 6f6ddf7a..9f7a77bf 100644
--- a/Oqtane.Server/Startup.cs
+++ b/Oqtane.Server/Startup.cs
@@ -64,7 +64,7 @@ namespace Oqtane.Server
{
client.DefaultRequestHeaders.Add("Cookie", ".AspNetCore.Identity.Application=" + authToken);
}
- client.BaseAddress = new Uri(NavigationManager.ToAbsoluteUri(NavigationManager.Uri).AbsoluteUri);
+ client.BaseAddress = new Uri(NavigationManager.Uri);
return client;
});
}
diff --git a/Oqtane.Server/wwwroot/css/site.css b/Oqtane.Server/wwwroot/css/site.css
index b4bdaf08..193ec6f0 100644
--- a/Oqtane.Server/wwwroot/css/site.css
+++ b/Oqtane.Server/wwwroot/css/site.css
@@ -76,14 +76,6 @@ app {
color: white;
}
-.nav-link[data-toggle].collapsed:after {
- content: "▾";
-}
-
-.nav-link[data-toggle]:not(.collapsed):after {
- content: "▴";
-}
-
.content {
padding-top: 1.1rem;
}
diff --git a/Oqtane.Shared/Oqtane.Shared.csproj b/Oqtane.Shared/Oqtane.Shared.csproj
index 08c5ff79..080a5c8c 100644
--- a/Oqtane.Shared/Oqtane.Shared.csproj
+++ b/Oqtane.Shared/Oqtane.Shared.csproj
@@ -1,7 +1,8 @@
- netstandard2.1
+ netstandard2.0
+ 7.3
Debug;Release;Wasm
0.0.1
Oqtane