diff --git a/Oqtane.Client/Modules/Admin/Pages/Add.razor b/Oqtane.Client/Modules/Admin/Pages/Add.razor index 999b14e2..469fb51a 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Add.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Add.razor @@ -47,7 +47,7 @@ } - + @if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) { @@ -74,12 +74,12 @@ - + - + + @@ -145,7 +145,7 @@ List children; int childid = -1; string isnavigation = "True"; - string editmode = "False"; + string mode = "view"; string themetype = ""; string layouttype = ""; string icon = ""; @@ -250,7 +250,7 @@ break; } page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); - page.EditMode = (editmode == null ? true : Boolean.Parse(editmode)); + page.EditMode = (mode == "edit" ? true : false); page.ThemeType = themetype; page.LayoutType = (layouttype == null ? "" : layouttype); page.Icon = (icon == null ? "" : icon); diff --git a/Oqtane.Client/Modules/Admin/Pages/Delete.razor b/Oqtane.Client/Modules/Admin/Pages/Delete.razor index b199f6c8..6b01b72c 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Delete.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Delete.razor @@ -4,104 +4,104 @@ @inject IPageService PageService @inject IThemeService ThemeService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
Cancel
@@ -119,7 +119,7 @@ string path; string parentid = ""; string isnavigation; - string editmode; + string mode; string themetype; string layouttype; string icon; @@ -145,7 +145,7 @@ name = page.Name; path = page.Path; isnavigation = page.IsNavigation.ToString(); - editmode = page.EditMode.ToString(); + mode = (page.EditMode) ? "edit" : "view"; themetype = page.ThemeType; layouttype = page.LayoutType; icon = page.Icon; diff --git a/Oqtane.Client/Modules/Admin/Pages/Edit.razor b/Oqtane.Client/Modules/Admin/Pages/Edit.razor index 32954007..a40fa3b3 100644 --- a/Oqtane.Client/Modules/Admin/Pages/Edit.razor +++ b/Oqtane.Client/Modules/Admin/Pages/Edit.razor @@ -4,141 +4,141 @@ @inject IPageService PageService @inject IThemeService ThemeService - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
- - - -
- - - -
- - - + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + - - - - - - - - - - - - - -
+ + + +
+ + + +
+ + + -
- - - - @if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) - { - - } -
- - - -
- - - -
- - -
+ + + + @if (children != null && children.Count > 0 && (insert == "<" || insert == ">")) { - + } - -
- - - -
- - - -
- - - -
+
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
Cancel
@@ -157,11 +157,11 @@ string path; string currentparentid; string parentid; - string insert = ""; + string insert = "="; List children; int childid = -1; string isnavigation; - string editmode; + string mode; string themetype; string layouttype; string icon; @@ -203,7 +203,7 @@ } currentparentid = parentid; isnavigation = page.IsNavigation.ToString(); - editmode = page.EditMode.ToString(); + mode = (page.EditMode) ? "edit" : "view"; themetype = page.ThemeType; layouttype = page.LayoutType; icon = page.Icon; @@ -235,7 +235,7 @@ } if (parentid == currentparentid) { - insert = ""; + insert = "="; } else { @@ -283,7 +283,7 @@ page.Path = parent.Path + "/" + Utilities.GetFriendlyUrl(path); } } - if (insert != "") + if (insert != "=") { Page child; switch (insert) @@ -305,7 +305,7 @@ } } page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); - page.EditMode = (editmode == null ? true : Boolean.Parse(editmode)); + page.EditMode = (mode == "edit" ? true : false); page.ThemeType = themetype; page.LayoutType = (layouttype == null ? "" : layouttype); page.Icon = (icon == null ? "" : icon); diff --git a/Oqtane.Client/Oqtane.Client.csproj b/Oqtane.Client/Oqtane.Client.csproj index 06a67d09..835a22a9 100644 --- a/Oqtane.Client/Oqtane.Client.csproj +++ b/Oqtane.Client/Oqtane.Client.csproj @@ -3,6 +3,7 @@ netstandard2.0 Exe + false https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; https://dotnet.myget.org/F/blazor-dev/api/v3/index.json; diff --git a/Oqtane.Client/wwwroot/js/interop.js b/Oqtane.Client/wwwroot/js/interop.js index 09994e57..0832cee0 100644 --- a/Oqtane.Client/wwwroot/js/interop.js +++ b/Oqtane.Client/wwwroot/js/interop.js @@ -28,23 +28,21 @@ window.interop = { return ""; } }, - addCSS: function (fileName) { - var head = document.head; - var link = document.createElement("link"); - - link.type = "text/css"; - link.rel = "stylesheet"; - link.href = fileName; - - head.appendChild(link); + addCSS: function (id, url) { + if (document.getElementById(id) === null) { + var link = document.createElement("link"); + link.id = id; + link.type = "text/css"; + link.rel = "stylesheet"; + link.href = url; + document.head.appendChild(link); + } }, - removeCSS: function (filePattern) { - var head = document.head; + removeCSS: function (pattern) { var links = document.getElementsByTagName("link"); for (var i = 0; i < links.length; i++) { - var link = links[i]; - if (link.rel === 'stylesheet' && link.href.includes(filePattern)) { - head.removeChild(link); + if (links[i].id.includes(pattern)) { + document.head.removeChild(links[i]); } } }, diff --git a/Oqtane.Server/Infrastructure/InstallationManager.cs b/Oqtane.Server/Infrastructure/InstallationManager.cs index 04d7c768..32ffd323 100644 --- a/Oqtane.Server/Infrastructure/InstallationManager.cs +++ b/Oqtane.Server/Infrastructure/InstallationManager.cs @@ -57,7 +57,12 @@ namespace Oqtane.Infrastructure case ".svg": case ".js": case ".css": - entry.ExtractToFile(folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/","\\"), true); + filename = folder + "\\" + entry.FullName.Replace("wwwroot", name).Replace("/", "\\"); + if (!Directory.Exists(Path.GetDirectoryName(filename))) + { + Directory.CreateDirectory(Path.GetDirectoryName(filename)); + } + entry.ExtractToFile(filename, true); break; } } diff --git a/Oqtane.Server/Startup.cs b/Oqtane.Server/Startup.cs index 026bc3ca..ee6343c7 100644 --- a/Oqtane.Server/Startup.cs +++ b/Oqtane.Server/Startup.cs @@ -276,6 +276,16 @@ namespace Oqtane.Server // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940 public void ConfigureServices(IServiceCollection services) { + // register authorization services + services.AddAuthorizationCore(options => + { + options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View"))); + options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit"))); + options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View"))); + options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit"))); + }); + services.AddScoped(); + services.AddSingleton(); services.AddDbContext(options => @@ -307,15 +317,8 @@ namespace Oqtane.Server options.User.RequireUniqueEmail = false; }); - // register authorization services - services.AddAuthorizationCore(options => - { - options.AddPolicy("ViewPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "View"))); - options.AddPolicy("EditPage", policy => policy.Requirements.Add(new PermissionRequirement("Page", "Edit"))); - options.AddPolicy("ViewModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "View"))); - options.AddPolicy("EditModule", policy => policy.Requirements.Add(new PermissionRequirement("Module", "Edit"))); - }); - services.AddScoped(); + services.AddAuthentication(IdentityConstants.ApplicationScheme) + .AddCookie(IdentityConstants.ApplicationScheme); services.ConfigureApplicationCookie(options => { diff --git a/Oqtane.Server/wwwroot/Tenants/1/Sites/2/oqtane.png b/Oqtane.Server/wwwroot/Tenants/1/Sites/2/oqtane.png deleted file mode 100644 index 94454bf6..00000000 Binary files a/Oqtane.Server/wwwroot/Tenants/1/Sites/2/oqtane.png and /dev/null differ