diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinInfo.cs b/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinInfo.cs deleted file mode 100644 index cfa0dad141e..00000000000 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinInfo.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Abstractions.Skins; - -/// Represents a skin. -public interface ISkinInfo -{ - /// Gets or sets the ID of the skin. - int SkinId { get; set; } - - /// Gets or sets the ID of the skin package. - int SkinPackageId { get; set; } - - /// Gets or sets the source of the skin. - string SkinSrc { get; set; } -} diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinPackageInfo.cs b/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinPackageInfo.cs deleted file mode 100644 index 78461278248..00000000000 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinPackageInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Abstractions.Skins; - -using System.Collections.Generic; - -using DotNetNuke.Abstractions.Collections; - -/// The skin package info. -public interface ISkinPackageInfo -{ - /// Gets or sets the ID of the package. - int PackageId { get; set; } - - /// Gets or sets the ID of the skin package. - int SkinPackageId { get; set; } - - /// Gets or sets the ID of the portal. - /// If the portal ID is -1, then the skin package is a global skin package. - int PortalId { get; set; } - - /// Gets or sets the name of the skin. - string SkinName { get; set; } - - /// Gets the skins in the skin package. - IObjectList Skins { get; } - - /// Gets or sets the type of the skin. - SkinPackageType SkinType { get; set; } -} diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinService.cs b/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinService.cs deleted file mode 100644 index 358fec6eaef..00000000000 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/ISkinService.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Abstractions.Skins; - -using System.Collections.Generic; - -using DotNetNuke.Abstractions.Portals; - -/// Handles the Business Control Layer for Skins. -public interface ISkinService -{ - /// Gets the folder name for the specified . - /// The type of the skin package. - /// The folder name. - string GetFolderName(SkinPackageType packageType); - - /// Gets the global default skin src. - /// The type of the skin package. - /// The type of the skin. - /// The global default edit skin. - string GetDefaultSkinSrc(SkinPackageType packageType, SkinType skinType); - - /// Gets a skin package by its id. - /// The skin package id. - /// The skin package. - ISkinPackageInfo GetSkinPackageById(int packageId); - - /// Gets a skin package by its id. - /// The portal id. - /// The name of the skin. - /// The type of the skin package. - /// The skin package. - ISkinPackageInfo GetSkinPackage(int portalId, string skinName, SkinPackageType packageType); - - /// Creates a new instance of . - /// The skin. - ISkinInfo CreateSkin(); - - /// Creates a new instance of . - /// The skin package. - ISkinPackageInfo CreateSkinPackage(); - - /// Adds a new skin. - /// The skin to add. - /// The skin id. - int AddSkin(ISkinInfo skin); - - /// Adds a skin package. - /// The skin package to add. - /// The skin package id. - int AddSkinPackage(ISkinPackageInfo skinPackage); - - /// Checks if a skin can be deleted. - /// Path to the skin folder. - /// Path to the portal home directory (). - /// True if the skin can be deleted. - bool CanDeleteSkinFolder(string folderPath, string portalHomeDirMapPath); - - /// Deletes a skin. - /// The skin to delete. - void DeleteSkin(ISkinInfo skin); - - /// Deletes a skin package. - /// The skin package to delete. - void DeleteSkinPackage(ISkinPackageInfo skinPackage); - - /// Gets the skin source path. - /// - /// [G]Skins/Xcillion/Inner.ascx becomes [G]Skins/Xcillion. - /// - /// The input skin source path. - /// The skin source path. - string FormatSkinPath(string skinSrc); - - /// Formats the skin source path. - /// - /// By default the following tokens are replaced:
- /// [G] - Host path (default: '/Portals/_default/').
- /// [S] - Home system directory (default: '/Portals/[PortalID]-System/').
- /// [L] - Home directory (default: '/Portals/[PortalID]/'). - ///
- /// - /// [G]Skins/Xcillion/Inner.ascx becomes /Portals/_default/Skins/Xcillion/Inner.ascx. - /// - /// The input skin source path. - /// The portal settings containing configuration data. - /// The formatted skin source path. - string FormatSkinSrc(string skinSrc, IPortalSettings portalSettings); - - /// Determines if a given skin is defined as a global skin. - /// This is the app relative path and filename of the skin to be checked. - /// True if the skin is located in the HostPath child directories. - /// This function performs a quick check to detect the type of skin that is - /// passed as a parameter. Using this method abstracts knowledge of the actual location - /// of skins in the file system. - /// - bool IsGlobalSkin(string skinSrc); - - /// Sets the skin for the specified and . - /// The type of the skin package. - /// The portal to set the skin for or -1 for the global skin. - /// The type of the skin. - /// The skin source path. - void SetSkin(SkinPackageType packageType, int portalId, SkinType skinType, string skinSrc); - - /// Updates a existing skin. - /// The skin to update. - void UpdateSkin(ISkinInfo skin); - - /// Updates a existing skin package. - /// The skin package to update. - void UpdateSkinPackage(ISkinPackageInfo skinPackage); - - /// Get all skins for the specified within the specified . - /// The portal to get the skins for. - /// The skin type to search for skins. Default: . - /// The scope to search for skins. Default: . - /// A list of skins. - IEnumerable> GetSkinsInFolder(IPortalInfo portalInfo, SkinType skinRoot = SkinType.Site, SkinFolder folder = SkinFolder.All); -} diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinFolder.cs b/DNN Platform/DotNetNuke.Abstractions/Skins/SkinFolder.cs deleted file mode 100644 index bbc09f41be2..00000000000 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinFolder.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Abstractions.Skins; - -using System; - -/// The scope of a skin. -/// This enum is used for . -public enum SkinFolder -{ - /// All scopes are specified. - All = 0, - - /// The skin can be used for all portals. - /// These skins are by default in the folder 'Portals\_default\'. - Host = 1, - - /// The skin can only be used for the given portal. - /// These skins are by default in the folder 'Portals\[PortalId]\' and 'Portals\[PortalId]-System\'. - Portal = 2, -} diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinPackageType.cs b/DNN Platform/DotNetNuke.Abstractions/Skins/SkinPackageType.cs deleted file mode 100644 index 922b9d1738e..00000000000 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinPackageType.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - -namespace DotNetNuke.Abstractions.Skins; - -/// The type of a skin package. -public enum SkinPackageType -{ - /// The skin package is a skin. - Skin = 0, - - /// The skin package is a container. - Container = 1, -} diff --git a/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeInfo.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeInfo.cs new file mode 100644 index 00000000000..cb88b88b85c --- /dev/null +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeInfo.cs @@ -0,0 +1,18 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Abstractions.Themes; + +/// Represents a theme. +public interface IThemeInfo +{ + /// Gets or sets the ID of the theme. + int ThemeId { get; set; } + + /// Gets or sets the ID of the theme package. + int ThemePackageId { get; set; } + + /// Gets or sets the source of the theme. + string ThemeSource { get; set; } +} diff --git a/DNN Platform/DotNetNuke.Abstractions/Themes/IThemePackageInfo.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemePackageInfo.cs new file mode 100644 index 00000000000..369c3167492 --- /dev/null +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemePackageInfo.cs @@ -0,0 +1,30 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Abstractions.Themes; + +using DotNetNuke.Abstractions.Collections; + +/// The theme package info. +public interface IThemePackageInfo +{ + /// Gets or sets the ID of the package. + int PackageId { get; set; } + + /// Gets or sets the ID of the theme package. + int ThemePackageId { get; set; } + + /// Gets or sets the ID of the portal. + /// If the portal ID is -1, then the theme package is a global theme package. + int PortalId { get; set; } + + /// Gets or sets the name of the theme. + string ThemeName { get; set; } + + /// Gets the themes in the theme package. + IObjectList Themes { get; } + + /// Gets or sets the type of the theme. + ThemePackageType ThemeType { get; set; } +} diff --git a/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeService.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeService.cs new file mode 100644 index 00000000000..8b87977119c --- /dev/null +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/IThemeService.cs @@ -0,0 +1,122 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Abstractions.Themes; + +using System.Collections.Generic; + +using DotNetNuke.Abstractions.Portals; + +/// Handles the Business Control Layer for Themes. +public interface IThemeService +{ + /// Gets the folder name for the specified . + /// The type of the theme package. + /// The folder name. + string GetFolderName(ThemePackageType packageType); + + /// Gets the global default theme source. + /// The type of the theme package. + /// The type of the theme. + /// The global default edit theme. + string GetDefaultThemeSource(ThemePackageType packageType, ThemeType themeType); + + /// Gets a theme package by its ID. + /// The theme package ID. + /// The theme package. + IThemePackageInfo GetThemePackageById(int packageId); + + /// Gets a theme package by its ID. + /// The portal ID. + /// The name of the theme. + /// The type of the theme package. + /// The theme package. + IThemePackageInfo GetThemePackage(int portalId, string themeName, ThemePackageType packageType); + + /// Creates a new instance of . + /// The theme. + IThemeInfo CreateTheme(); + + /// Creates a new instance of . + /// The theme package. + IThemePackageInfo CreateThemePackage(); + + /// Adds a new theme. + /// The theme to add. + /// The theme ID. + int AddTheme(IThemeInfo theme); + + /// Adds a theme package. + /// The theme package to add. + /// The theme package ID. + int AddThemePackage(IThemePackageInfo themePackage); + + /// Checks if a theme can be deleted. + /// Path to the theme folder. + /// Path to the portal home directory (). + /// if the theme can be deleted. + bool CanDeleteThemeFolder(string folderPath, string portalHomeDirMapPath); + + /// Deletes a theme. + /// The theme to delete. + void DeleteTheme(IThemeInfo theme); + + /// Deletes a theme package. + /// The theme package to delete. + void DeleteThemePackage(IThemePackageInfo themePackage); + + /// Gets the theme source path. + /// + /// [G]Skins/Xcillion/Inner.ascx becomes [G]Skins/Xcillion. + /// + /// The input theme source path. + /// The theme source path. + string FormatThemePath(string themeSource); + + /// Formats the theme source path. + /// + /// By default the following tokens are replaced:
+ /// [G] - Host path (default: '/Portals/_default/').
+ /// [S] - Home system directory (default: '/Portals/[PortalID]-System/').
+ /// [L] - Home directory (default: '/Portals/[PortalID]/'). + ///
+ /// + /// [G]Skins/Xcillion/Inner.ascx becomes /Portals/_default/Skins/Xcillion/Inner.ascx. + /// + /// The input theme source path. + /// The portal settings containing configuration data. + /// The formatted theme source path. + string FormatThemeSource(string themeSource, IPortalSettings portalSettings); + + /// Determines if a given theme is defined as a global theme. + /// This is the app relative path and filename of the theme to be checked. + /// if the theme is located in the HostPath child directories. + /// This function performs a quick check to detect the type of theme that is + /// passed as a parameter. Using this method abstracts knowledge of the actual location + /// of themes in the file system. + /// + bool IsGlobalTheme(string themeSource); + + /// Sets the theme for the specified and . + /// The type of the theme package. + /// The portal to set the theme for or -1 for the global theme. + /// The type of the theme. + /// The theme source path. + void SetTheme(ThemePackageType packageType, int portalId, ThemeType themeType, string themeSource); + + /// Updates an existing theme. + /// The theme to update. + void UpdateTheme(IThemeInfo theme); + + /// Updates an existing theme package. + /// The theme package to update. + void UpdateThemePackage(IThemePackageInfo themePackage); + + /// Get all themes for the specified within the specified . + /// The portal to get the themes for. + /// The theme type to search for themes. Default: . + /// The scope to search for themes. Default: . + /// A list of themes. + IEnumerable> GetThemesInFolder(IPortalInfo portalInfo, ThemeType themeRoot = ThemeType.Site, ThemeFolder folder = ThemeFolder.All); +} diff --git a/DNN Platform/DotNetNuke.Abstractions/Themes/ThemeFolder.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemeFolder.cs new file mode 100644 index 00000000000..4c202ecb24c --- /dev/null +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemeFolder.cs @@ -0,0 +1,21 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Abstractions.Themes; + +/// The scope of a theme. +/// This enum is used for . +public enum ThemeFolder +{ + /// All scopes are specified. + All = 0, + + /// The theme can be used for all portals. + /// These themes are by default in the folder Portals\_default\. + Host = 1, + + /// The theme can only be used for the given portal. + /// These themes are by default in the folder Portals\[PortalId]\ and Portals\[PortalId]-System\. + Portal = 2, +} diff --git a/DNN Platform/DotNetNuke.Abstractions/Themes/ThemePackageType.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemePackageType.cs new file mode 100644 index 00000000000..2f4f78c5ba6 --- /dev/null +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemePackageType.cs @@ -0,0 +1,15 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + +namespace DotNetNuke.Abstractions.Themes; + +/// The type of a theme package. +public enum ThemePackageType +{ + /// The theme package is a theme. + Theme = 0, + + /// The theme package is a container. + Container = 1, +} diff --git a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinType.cs b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemeType.cs similarity index 52% rename from DNN Platform/DotNetNuke.Abstractions/Skins/SkinType.cs rename to DNN Platform/DotNetNuke.Abstractions/Themes/ThemeType.cs index d976a20d69a..1f58e11209e 100644 --- a/DNN Platform/DotNetNuke.Abstractions/Skins/SkinType.cs +++ b/DNN Platform/DotNetNuke.Abstractions/Themes/ThemeType.cs @@ -2,14 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information -namespace DotNetNuke.Abstractions.Skins; +namespace DotNetNuke.Abstractions.Themes; -/// The type of a skin. -public enum SkinType +/// The type of a theme. +public enum ThemeType { - /// The skin is a site skin. + /// The theme is a site theme. Site = 0, - /// The skin is an edit skin. + /// The theme is an edit theme. Edit = 1, } diff --git a/DNN Platform/Library/Common/Utilities/SkinUtils.cs b/DNN Platform/Library/Common/Utilities/SkinUtils.cs index 92a8ddf09a0..3da94ed6f5e 100644 --- a/DNN Platform/Library/Common/Utilities/SkinUtils.cs +++ b/DNN Platform/Library/Common/Utilities/SkinUtils.cs @@ -6,7 +6,7 @@ namespace DotNetNuke.Common.Utilities; using System; -using DotNetNuke.Abstractions.Skins; +using DotNetNuke.Abstractions.Themes; /// /// Skin utilities. @@ -17,12 +17,12 @@ public class SkinUtils /// The type of the skin package. /// The database name of the skin package type. /// Thrown when is not a valid skin package type. - public static string ToDatabaseName(SkinPackageType type) + public static string ToDatabaseName(ThemePackageType type) { return type switch { - SkinPackageType.Skin => "Skin", - SkinPackageType.Container => "Container", + ThemePackageType.Theme => "Skin", + ThemePackageType.Container => "Container", _ => throw new ArgumentOutOfRangeException(nameof(type), type, "Invalid skin package type."), }; } @@ -31,7 +31,7 @@ public static string ToDatabaseName(SkinPackageType type) /// The database name of the skin package type. /// The skin package type. /// Thrown when is not a valid skin package type database name. - public static SkinPackageType FromDatabaseName(string databaseName) + public static ThemePackageType FromDatabaseName(string databaseName) { if (databaseName == null) { @@ -40,12 +40,12 @@ public static SkinPackageType FromDatabaseName(string databaseName) if (string.Equals(databaseName, "Skin", StringComparison.OrdinalIgnoreCase)) { - return SkinPackageType.Skin; + return ThemePackageType.Theme; } if (string.Equals(databaseName, "Container", StringComparison.OrdinalIgnoreCase)) { - return SkinPackageType.Container; + return ThemePackageType.Container; } throw new ArgumentOutOfRangeException(nameof(databaseName), databaseName, "Invalid skin package type database name."); diff --git a/DNN Platform/Library/Services/Installer/Installers/SkinInstaller.cs b/DNN Platform/Library/Services/Installer/Installers/SkinInstaller.cs index 06045e23a89..f53fab19021 100644 --- a/DNN Platform/Library/Services/Installer/Installers/SkinInstaller.cs +++ b/DNN Platform/Library/Services/Installer/Installers/SkinInstaller.cs @@ -18,8 +18,8 @@ public class SkinInstaller : FileInstaller { private readonly ArrayList skinFiles = new ArrayList(); - private SkinPackageInfo skinPackage; - private SkinPackageInfo tempSkinPackage; + private SkinPackageInfo themePackage; + private SkinPackageInfo tempThemePackage; private string skinName = Null.NullString; /// Gets a list of allowable file extensions (in addition to the Host's List). @@ -58,7 +58,7 @@ protected override string PhysicalBasePath { get { - string physicalBasePath = this.RootPath + this.SkinRoot + "\\" + this.skinPackage.SkinName; + string physicalBasePath = this.RootPath + this.SkinRoot + "\\" + this.themePackage.ThemeName; if (!physicalBasePath.EndsWith("\\")) { physicalBasePath += "\\"; @@ -135,16 +135,16 @@ public override void Install() try { // Attempt to get the Skin Package - this.tempSkinPackage = SkinController.GetSkinPackage(this.skinPackage.PortalID, this.skinPackage.SkinName, this.SkinType); - if (this.tempSkinPackage == null) + this.tempThemePackage = SkinController.GetSkinPackage(this.themePackage.PortalID, this.themePackage.ThemeName, this.SkinType); + if (this.tempThemePackage == null) { bAdd = true; - this.skinPackage.PackageID = this.Package.PackageID; + this.themePackage.PackageID = this.Package.PackageID; } else { - this.skinPackage.SkinPackageID = this.tempSkinPackage.SkinPackageID; - if (this.tempSkinPackage.PackageID != this.Package.PackageID) + this.themePackage.SkinPackageID = this.tempThemePackage.SkinPackageID; + if (this.tempThemePackage.PackageID != this.Package.PackageID) { this.Completed = false; this.Log.AddFailure(Util.SKIN_Installed); @@ -152,23 +152,23 @@ public override void Install() } else { - this.skinPackage.PackageID = this.tempSkinPackage.PackageID; + this.themePackage.PackageID = this.tempThemePackage.PackageID; } } - this.skinPackage.SkinType = this.SkinType; + this.themePackage.SkinType = this.SkinType; if (bAdd) { // Add new skin package - this.skinPackage.SkinPackageID = SkinController.AddSkinPackage(this.skinPackage); + this.themePackage.SkinPackageID = SkinController.AddSkinPackage(this.themePackage); } else { // Update skin package - SkinController.UpdateSkinPackage(this.skinPackage); + SkinController.UpdateSkinPackage(this.themePackage); } - this.Log.AddInfo(string.Format(Util.SKIN_Registered, this.skinPackage.SkinName)); + this.Log.AddInfo(string.Format(Util.SKIN_Registered, this.themePackage.ThemeName)); // install (copy the files) by calling the base class base.Install(); @@ -178,7 +178,7 @@ public override void Install() { this.Log.StartJob(Util.SKIN_BeginProcessing); string strMessage = Null.NullString; - var newSkin = new SkinFileProcessor(this.RootPath, this.SkinRoot, this.skinPackage.SkinName); + var newSkin = new SkinFileProcessor(this.RootPath, this.SkinRoot, this.themePackage.ThemeName); foreach (string skinFile in this.SkinFiles) { strMessage += newSkin.ProcessFile(skinFile, SkinParser.Portable); @@ -186,13 +186,13 @@ public override void Install() switch (Path.GetExtension(skinFile)) { case ".htm": - SkinController.AddSkin(this.skinPackage.SkinPackageID, skinFile.Replace("htm", "ascx")); + SkinController.AddSkin(this.themePackage.SkinPackageID, skinFile.Replace("htm", "ascx")); break; case ".html": - SkinController.AddSkin(this.skinPackage.SkinPackageID, skinFile.Replace("html", "ascx")); + SkinController.AddSkin(this.themePackage.SkinPackageID, skinFile.Replace("html", "ascx")); break; case ".ascx": - SkinController.AddSkin(this.skinPackage.SkinPackageID, skinFile); + SkinController.AddSkin(this.themePackage.SkinPackageID, skinFile); break; } } @@ -221,7 +221,7 @@ public override void Install() public override void Rollback() { // If Temp Skin exists then we need to update the DataStore with this - if (this.tempSkinPackage == null) + if (this.tempThemePackage == null) { // No Temp Skin - Delete newly added Skin this.DeleteSkinPackage(); @@ -229,7 +229,7 @@ public override void Rollback() else { // Temp Skin - Rollback to Temp - SkinController.UpdateSkinPackage(this.tempSkinPackage); + SkinController.UpdateSkinPackage(this.tempThemePackage); } // Call base class to prcoess files @@ -272,11 +272,11 @@ protected override void ProcessFile(InstallFile file, XPathNavigator nav) /// The XPathNavigator representing the node. protected override void ReadCustomManifest(XPathNavigator nav) { - this.skinPackage = new SkinPackageInfo(); - this.skinPackage.PortalID = this.Package.PortalID; + this.themePackage = new SkinPackageInfo(); + this.themePackage.PortalID = this.Package.PortalID; // Get the Skin name - this.skinPackage.SkinName = Util.ReadElement(nav, this.SkinNameNodeName); + this.themePackage.ThemeName = Util.ReadElement(nav, this.SkinNameNodeName); // Call base class base.ReadCustomManifest(nav); @@ -307,13 +307,13 @@ private void DeleteSkinPackage() try { // Attempt to get the Authentication Service - SkinPackageInfo skinPackage = SkinController.GetSkinByPackageID(this.Package.PackageID); - if (skinPackage != null) + SkinPackageInfo themePackage = SkinController.GetSkinByPackageID(this.Package.PackageID); + if (themePackage != null) { - SkinController.DeleteSkinPackage(skinPackage); + SkinController.DeleteSkinPackage(themePackage); } - this.Log.AddInfo(string.Format(Util.SKIN_UnRegistered, skinPackage.SkinName)); + this.Log.AddInfo(string.Format(Util.SKIN_UnRegistered, themePackage.ThemeName)); } catch (Exception ex) { diff --git a/DNN Platform/Library/Services/Installer/LegacyUtil.cs b/DNN Platform/Library/Services/Installer/LegacyUtil.cs index 5662a17fb5c..b9dcd3b087e 100644 --- a/DNN Platform/Library/Services/Installer/LegacyUtil.cs +++ b/DNN Platform/Library/Services/Installer/LegacyUtil.cs @@ -339,15 +339,15 @@ public static partial void ProcessLegacyModule(DesktopModuleInfo desktopModule) } } - private static PackageInfo CreateSkinPackage(SkinPackageInfo skin) + private static PackageInfo CreateSkinPackage(SkinPackageInfo theme) { // Create a Package var package = new PackageInfo(new InstallerInfo()); - package.Name = skin.SkinName; - package.FriendlyName = skin.SkinName; + package.Name = theme.ThemeName; + package.FriendlyName = theme.ThemeName; package.Description = Null.NullString; package.Version = new Version(1, 0, 0); - package.PackageType = skin.SkinType; + package.PackageType = theme.SkinType; package.License = Util.PACKAGE_NoLicense; // See if the Skin is using a Namespace (or is a known skin) @@ -360,7 +360,7 @@ private static void CreateSkinManifest(XmlWriter writer, string skinFolder, stri { string skinName = Path.GetFileNameWithoutExtension(skinFolder); var skin = new SkinPackageInfo(); - skin.SkinName = skinName; + skin.ThemeName = skinName; skin.SkinType = skinType; // Create a Package diff --git a/DNN Platform/Library/Services/Installer/Packages/PackageController.cs b/DNN Platform/Library/Services/Installer/Packages/PackageController.cs index 871ed4ebbe7..f288eb93a60 100644 --- a/DNN Platform/Library/Services/Installer/Packages/PackageController.cs +++ b/DNN Platform/Library/Services/Installer/Packages/PackageController.cs @@ -63,14 +63,14 @@ public static bool CanDeletePackage(PackageInfo package, PortalSettings portalSe case "Container": // Need to get path of skin being deleted so we can call the public CanDeleteSkin function in the SkinController string strRootSkin = package.PackageType.Equals("Skin", StringComparison.OrdinalIgnoreCase) ? SkinController.RootSkin : SkinController.RootContainer; - SkinPackageInfo skinPackageInfo = SkinController.GetSkinByPackageID(package.PackageID); - string strFolderPath = Path.Combine(skinPackageInfo.PortalID == Null.NullInteger ? Path.Combine(Globals.HostMapPath, strRootSkin) : Path.Combine(portalSettings.HomeSystemDirectoryMapPath, strRootSkin), skinPackageInfo.SkinName); + SkinPackageInfo themePackageInfo = SkinController.GetSkinByPackageID(package.PackageID); + string strFolderPath = Path.Combine(themePackageInfo.PortalID == Null.NullInteger ? Path.Combine(Globals.HostMapPath, strRootSkin) : Path.Combine(portalSettings.HomeSystemDirectoryMapPath, strRootSkin), themePackageInfo.ThemeName); bCanDelete = SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeSystemDirectoryMapPath); - if (skinPackageInfo.PortalID != Null.NullInteger) + if (themePackageInfo.PortalID != Null.NullInteger) { // To be compliant with all versions - strFolderPath = Path.Combine(Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), skinPackageInfo.SkinName); + strFolderPath = Path.Combine(Path.Combine(portalSettings.HomeDirectoryMapPath, strRootSkin), themePackageInfo.ThemeName); bCanDelete = bCanDelete && SkinController.CanDeleteSkin(strFolderPath, portalSettings.HomeDirectoryMapPath); } diff --git a/DNN Platform/Library/Services/Installer/Writers/ContainerPackageWriter.cs b/DNN Platform/Library/Services/Installer/Writers/ContainerPackageWriter.cs index e244f44e4c3..60ebbfceb68 100644 --- a/DNN Platform/Library/Services/Installer/Writers/ContainerPackageWriter.cs +++ b/DNN Platform/Library/Services/Installer/Writers/ContainerPackageWriter.cs @@ -1,37 +1,37 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information namespace DotNetNuke.Services.Installer.Writers { using System.Xml; - + using DotNetNuke.Services.Installer.Packages; - using DotNetNuke.UI.Skins; - + using DotNetNuke.UI.Skins; + /// The ContainerPackageWriter class. public class ContainerPackageWriter : SkinPackageWriter - { - /// Initializes a new instance of the class. - /// + { + /// Initializes a new instance of the class. + /// public ContainerPackageWriter(PackageInfo package) : base(package) { - this.BasePath = "Portals\\_default\\Containers\\" + this.SkinPackage.SkinName; - } - - /// Initializes a new instance of the class. - /// - /// - public ContainerPackageWriter(SkinPackageInfo skinPackage, PackageInfo package) - : base(skinPackage, package) + this.BasePath = "Portals\\_default\\Containers\\" + this.SkinPackage.ThemeName; + } + + /// Initializes a new instance of the class. + /// + /// + public ContainerPackageWriter(SkinPackageInfo themePackage, PackageInfo package) + : base(themePackage, package) { - this.BasePath = "Portals\\_default\\Containers\\" + skinPackage.SkinName; - } - - /// + this.BasePath = "Portals\\_default\\Containers\\" + themePackage.ThemeName; + } + + /// protected override void WriteFilesToManifest(XmlWriter writer) { - var containerFileWriter = new ContainerComponentWriter(this.SkinPackage.SkinName, this.BasePath, this.Files, this.Package); + var containerFileWriter = new ContainerComponentWriter(this.SkinPackage.ThemeName, this.BasePath, this.Files, this.Package); containerFileWriter.WriteManifest(writer); } } diff --git a/DNN Platform/Library/Services/Installer/Writers/SkinPackageWriter.cs b/DNN Platform/Library/Services/Installer/Writers/SkinPackageWriter.cs index 3612a4ae127..93d27e22827 100644 --- a/DNN Platform/Library/Services/Installer/Writers/SkinPackageWriter.cs +++ b/DNN Platform/Library/Services/Installer/Writers/SkinPackageWriter.cs @@ -1,65 +1,65 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information namespace DotNetNuke.Services.Installer.Writers { using System; using System.IO; using System.Xml; - + using DotNetNuke.Services.Installer.Packages; - using DotNetNuke.UI.Skins; - + using DotNetNuke.UI.Skins; + /// The SkinPackageWriter class. public class SkinPackageWriter : PackageWriterBase { - private readonly SkinPackageInfo skinPackage; - private readonly string subFolder; - - /// Initializes a new instance of the class. - /// + private readonly SkinPackageInfo themePackage; + private readonly string subFolder; + + /// Initializes a new instance of the class. + /// public SkinPackageWriter(PackageInfo package) : base(package) { - this.skinPackage = SkinController.GetSkinByPackageID(package.PackageID); + this.themePackage = SkinController.GetSkinByPackageID(package.PackageID); this.SetBasePath(); - } - - /// Initializes a new instance of the class. - /// - /// - public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package) + } + + /// Initializes a new instance of the class. + /// + /// + public SkinPackageWriter(SkinPackageInfo themePackage, PackageInfo package) : base(package) { - this.skinPackage = skinPackage; + this.themePackage = themePackage; this.SetBasePath(); - } - - /// Initializes a new instance of the class. - /// - /// - /// - public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package, string basePath) + } + + /// Initializes a new instance of the class. + /// + /// + /// + public SkinPackageWriter(SkinPackageInfo themePackage, PackageInfo package, string basePath) : base(package) { - this.skinPackage = skinPackage; + this.themePackage = themePackage; this.BasePath = basePath; - } - - /// Initializes a new instance of the class. - /// - /// - /// - /// - public SkinPackageWriter(SkinPackageInfo skinPackage, PackageInfo package, string basePath, string subFolder) + } + + /// Initializes a new instance of the class. + /// + /// + /// + /// + public SkinPackageWriter(SkinPackageInfo themePackage, PackageInfo package, string basePath, string subFolder) : base(package) { - this.skinPackage = skinPackage; + this.themePackage = themePackage; this.subFolder = subFolder; this.BasePath = Path.Combine(basePath, subFolder); - } - - /// + } + + /// public override bool IncludeAssemblies { get @@ -72,30 +72,30 @@ protected SkinPackageInfo SkinPackage { get { - return this.skinPackage; + return this.themePackage; } } public void SetBasePath() { - if (this.skinPackage.SkinType == "Skin") + if (this.themePackage.SkinType == "Skin") { - this.BasePath = Path.Combine("Portals\\_default\\Skins", this.SkinPackage.SkinName); + this.BasePath = Path.Combine("Portals\\_default\\Skins", this.SkinPackage.ThemeName); } else { - this.BasePath = Path.Combine("Portals\\_default\\Containers", this.SkinPackage.SkinName); + this.BasePath = Path.Combine("Portals\\_default\\Containers", this.SkinPackage.ThemeName); } - } - - /// + } + + /// protected override void GetFiles(bool includeSource, bool includeAppCode) { // Call base class method with includeAppCode = false base.GetFiles(includeSource, false); - } - - /// + } + + /// protected override void ParseFiles(DirectoryInfo folder, string rootPath) { // Add the Files in the Folder @@ -121,19 +121,19 @@ protected override void ParseFiles(DirectoryInfo folder, string rootPath) } } } - } - - /// + } + + /// protected override void WriteFilesToManifest(XmlWriter writer) { - var skinFileWriter = new SkinComponentWriter(this.SkinPackage.SkinName, this.BasePath, this.Files, this.Package); + var skinFileWriter = new SkinComponentWriter(this.SkinPackage.ThemeName, this.BasePath, this.Files, this.Package); if (this.SkinPackage.SkinType == "Skin") { - skinFileWriter = new SkinComponentWriter(this.SkinPackage.SkinName, this.BasePath, this.Files, this.Package); + skinFileWriter = new SkinComponentWriter(this.SkinPackage.ThemeName, this.BasePath, this.Files, this.Package); } else { - skinFileWriter = new ContainerComponentWriter(this.SkinPackage.SkinName, this.BasePath, this.Files, this.Package); + skinFileWriter = new ContainerComponentWriter(this.SkinPackage.ThemeName, this.BasePath, this.Files, this.Package); } skinFileWriter.WriteManifest(writer); diff --git a/DNN Platform/Library/Startup.cs b/DNN Platform/Library/Startup.cs index dda765073e5..5b3aa24b795 100644 --- a/DNN Platform/Library/Startup.cs +++ b/DNN Platform/Library/Startup.cs @@ -10,7 +10,7 @@ namespace DotNetNuke using DotNetNuke.Abstractions.Logging; using DotNetNuke.Abstractions.Portals; using DotNetNuke.Abstractions.Security.Permissions; - using DotNetNuke.Abstractions.Skins; + using DotNetNuke.Abstractions.Themes; using DotNetNuke.Application; using DotNetNuke.Common; using DotNetNuke.Common.Internal; @@ -44,7 +44,7 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); - services.AddScoped(); + services.AddScoped(); services.AddTransient(x => PortalController.Instance); services.AddScoped(); diff --git a/DNN Platform/Library/UI/Skins/SkinController.cs b/DNN Platform/Library/UI/Skins/SkinController.cs index ab9ff3d3d1b..27d288cc642 100644 --- a/DNN Platform/Library/UI/Skins/SkinController.cs +++ b/DNN Platform/Library/UI/Skins/SkinController.cs @@ -11,7 +11,7 @@ namespace DotNetNuke.UI.Skins using System.Text.RegularExpressions; using DotNetNuke.Abstractions.Portals; - using DotNetNuke.Abstractions.Skins; + using DotNetNuke.Abstractions.Themes; using DotNetNuke.Common; using DotNetNuke.Common.Utilities; using DotNetNuke.Data; @@ -28,7 +28,7 @@ namespace DotNetNuke.UI.Skins /// Class : SkinController /// /// Handles the Business Control Layer for Skins. - public partial class SkinController : ISkinService + public partial class SkinController : IThemeService { private const string GlobalSkinPrefix = "[G]"; private const string PortalSystemSkinPrefix = "[S]"; @@ -38,8 +38,8 @@ public partial class SkinController : ISkinService private static readonly Regex SdirRegex = new Regex("\\[s]", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex LdirRegex = new Regex("\\[l]", RegexOptions.IgnoreCase | RegexOptions.Compiled); - /// - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")] + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(IThemeService.GetFolderName)} instead. Scheduled removal in v12.0.0.")] public static string RootSkin { get @@ -48,8 +48,8 @@ public static string RootSkin } } - /// - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")] + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(IThemeService.GetFolderName)} instead. Scheduled removal in v12.0.0.")] public static string RootContainer { get @@ -58,22 +58,22 @@ public static string RootContainer } } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkin)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.AddTheme)} instead.")] public static partial int AddSkin(int skinPackageID, string skinSrc) { return DataProvider.Instance().AddSkin(skinPackageID, skinSrc); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkinPackage)} instead.")] - public static partial int AddSkinPackage(SkinPackageInfo skinPackage) + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.AddThemePackage)} instead.")] + public static partial int AddSkinPackage(SkinPackageInfo themePackage) { - return AddSkinPackage((ISkinPackageInfo)skinPackage); + return AddSkinPackage((IThemePackageInfo)themePackage); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.CanDeleteSkinFolder)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.CanDeleteThemeFolder)} instead.")] public static partial bool CanDeleteSkin(string folderPath, string portalHomeDirMapPath) { string skinType; @@ -125,18 +125,18 @@ public static partial bool CanDeleteSkin(string folderPath, string portalHomeDir return canDelete; } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkin)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.DeleteTheme)} instead.")] public static partial void DeleteSkin(int skinID) { DataProvider.Instance().DeleteSkin(skinID); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkinPackage)} instead.")] - public static partial void DeleteSkinPackage(SkinPackageInfo skinPackage) + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.DeleteThemePackage)} instead.")] + public static partial void DeleteSkinPackage(SkinPackageInfo themePackage) { - DeleteSkinPackage((ISkinPackageInfo)skinPackage); + DeleteSkinPackage((IThemePackageInfo)themePackage); } public static string FormatMessage(string title, string body, int level, bool isError) @@ -166,8 +166,8 @@ public static string FormatMessage(string title, string body, int level, bool is return message + ": " + body + Environment.NewLine; } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinPath)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.FormatThemePath)} instead.")] public static partial string FormatSkinPath(string skinSrc) { string strSkinSrc = skinSrc; @@ -179,8 +179,8 @@ public static partial string FormatSkinPath(string skinSrc) return strSkinSrc; } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinSrc)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.FormatThemeSource)} instead.")] public static partial string FormatSkinSrc(string skinSrc, PortalSettings portalSettings) { return FormatSkinSrc(skinSrc, (IPortalSettings)portalSettings); @@ -192,7 +192,7 @@ public static partial string FormatSkinSrc(string skinSrc, PortalSettings portal /// To get the default admin container for the portal use instead. /// /// The global default admin container. - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")] + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetDefaultThemeSource)} instead.")] public static partial string GetDefaultAdminContainer() { SkinDefaults defaultContainer = SkinDefaults.GetSkinDefaults(SkinDefaultType.ContainerInfo); @@ -205,7 +205,7 @@ public static partial string GetDefaultAdminContainer() /// To get the default admin skin for the portal use instead. /// /// The global default admin skin. - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")] + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetDefaultThemeSource)} instead.")] public static partial string GetDefaultAdminSkin() { SkinDefaults defaultSkin = SkinDefaults.GetSkinDefaults(SkinDefaultType.SkinInfo); @@ -218,7 +218,7 @@ public static partial string GetDefaultAdminSkin() /// To get the default skin for the portal use instead. /// /// The global default skin. - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")] + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetDefaultThemeSource)} instead.")] public static partial string GetDefaultPortalContainer() { SkinDefaults defaultContainer = SkinDefaults.GetSkinDefaults(SkinDefaultType.ContainerInfo); @@ -231,36 +231,36 @@ public static partial string GetDefaultPortalContainer() /// To get the default skin for the portal use instead. /// /// The global default skin. - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")] + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetDefaultThemeSource)} instead.")] public static partial string GetDefaultPortalSkin() { SkinDefaults defaultSkin = SkinDefaults.GetSkinDefaults(SkinDefaultType.SkinInfo); return "[G]" + RootSkin + defaultSkin.Folder + defaultSkin.DefaultName; } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackageById)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetThemePackageById)} instead.")] public static partial SkinPackageInfo GetSkinByPackageID(int packageID) { return CBO.FillObject(DataProvider.Instance().GetSkinByPackageID(packageID)); } - /// ] - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackage)} instead.")] + /// ] + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetThemePackage)} instead.")] public static partial SkinPackageInfo GetSkinPackage(int portalId, string skinName, string skinType) { return CBO.FillObject(DataProvider.Instance().GetSkinPackage(portalId, skinName, skinType)); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetThemesInFolder)} instead.")] public static partial List> GetSkins(PortalInfo portalInfo, string skinRoot, SkinScope scope) { return GetSkins((IPortalInfo)portalInfo, skinRoot, scope); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.GetThemesInFolder)} instead.")] public static partial List> GetSkins(IPortalInfo portalInfo, string skinRoot, SkinScope scope) { var skins = new List>(); @@ -281,15 +281,15 @@ public static partial List> GetSkins(IPortalInfo po return skins; } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.IsGlobalSkin)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.IsGlobalTheme)} instead.")] public static partial bool IsGlobalSkin(string skinSrc) { return skinSrc.Contains(Globals.HostPath); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.SetSkin)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.SetTheme)} instead.")] public static partial void SetSkin(string skinRoot, int portalId, SkinType skinType, string skinSrc) { var selectedCultureCode = LocaleController.Instance.GetCurrentLocale(portalId).Code; @@ -350,18 +350,18 @@ public static partial void SetSkin(string skinRoot, int portalId, SkinType skinT } } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")] + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.UpdateTheme)} instead.")] public static partial void UpdateSkin(int skinID, string skinSrc) { DataProvider.Instance().UpdateSkin(skinID, skinSrc); } - /// - [DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")] - public static partial void UpdateSkinPackage(SkinPackageInfo skinPackage) + /// + [DnnDeprecated(9, 13, 1, $"Use {nameof(IThemeService)}.{nameof(IThemeService.UpdateTheme)} instead.")] + public static partial void UpdateSkinPackage(SkinPackageInfo themePackage) { - UpdateSkinPackage((ISkinPackageInfo)skinPackage); + UpdateSkinPackage((IThemePackageInfo)themePackage); } [DnnDeprecated(10, 0, 0, "No replacement")] @@ -492,119 +492,119 @@ public static partial string UploadLegacySkin(string rootPath, string skinRoot, } /// - ISkinPackageInfo ISkinService.GetSkinPackageById(int packageId) => GetSkinByPackageID(packageId); + IThemePackageInfo IThemeService.GetThemePackageById(int packageId) => GetSkinByPackageID(packageId); /// - ISkinPackageInfo ISkinService.GetSkinPackage(int portalId, string skinName, SkinPackageType packageType) - => GetSkinPackage(portalId, skinName, SkinUtils.ToDatabaseName(packageType)); + IThemePackageInfo IThemeService.GetThemePackage(int portalId, string themeName, ThemePackageType packageType) + => GetSkinPackage(portalId, themeName, SkinUtils.ToDatabaseName(packageType)); /// - ISkinInfo ISkinService.CreateSkin() => new SkinInfo(); + IThemeInfo IThemeService.CreateTheme() => new SkinInfo(); /// - ISkinPackageInfo ISkinService.CreateSkinPackage() => new SkinPackageInfo(); + IThemePackageInfo IThemeService.CreateThemePackage() => new SkinPackageInfo(); /// - int ISkinService.AddSkin(ISkinInfo skin) => AddSkin(skin.SkinPackageId, skin.SkinSrc); + int IThemeService.AddTheme(IThemeInfo theme) => AddSkin(theme.ThemePackageId, theme.ThemeSource); /// - int ISkinService.AddSkinPackage(ISkinPackageInfo skinPackage) => AddSkinPackage(skinPackage); + int IThemeService.AddThemePackage(IThemePackageInfo themePackage) => AddSkinPackage(themePackage); /// - bool ISkinService.CanDeleteSkinFolder(string folderPath, string portalHomeDirMapPath) + bool IThemeService.CanDeleteThemeFolder(string folderPath, string portalHomeDirMapPath) => CanDeleteSkin(folderPath, portalHomeDirMapPath); /// - void ISkinService.DeleteSkin(ISkinInfo skin) => DeleteSkin(skin.SkinId); + void IThemeService.DeleteTheme(IThemeInfo theme) => DeleteSkin(theme.ThemeId); /// - void ISkinService.DeleteSkinPackage(ISkinPackageInfo skinPackage) => DeleteSkinPackage(skinPackage); + void IThemeService.DeleteThemePackage(IThemePackageInfo themePackage) => DeleteSkinPackage(themePackage); /// - string ISkinService.GetFolderName(SkinPackageType packageType) + string IThemeService.GetFolderName(ThemePackageType packageType) { return packageType switch { - SkinPackageType.Skin => RootSkin, - SkinPackageType.Container => RootContainer, + ThemePackageType.Theme => RootSkin, + ThemePackageType.Container => RootContainer, _ => throw new ArgumentOutOfRangeException(nameof(packageType), packageType, "The skin package type is not supported.") }; } /// - string ISkinService.GetDefaultSkinSrc(SkinPackageType packageType, DotNetNuke.Abstractions.Skins.SkinType skinType) + string IThemeService.GetDefaultThemeSource(ThemePackageType packageType, DotNetNuke.Abstractions.Themes.ThemeType themeType) { - return (packageType, skinType) switch + return (packageType, themeType) switch { - (SkinPackageType.Skin, DotNetNuke.Abstractions.Skins.SkinType.Site) => GetDefaultPortalSkin(), - (SkinPackageType.Skin, DotNetNuke.Abstractions.Skins.SkinType.Edit) => GetDefaultAdminSkin(), - (SkinPackageType.Container, DotNetNuke.Abstractions.Skins.SkinType.Site) => GetDefaultPortalContainer(), - (SkinPackageType.Container, DotNetNuke.Abstractions.Skins.SkinType.Edit) => GetDefaultAdminContainer(), + (ThemePackageType.Theme, DotNetNuke.Abstractions.Themes.ThemeType.Site) => GetDefaultPortalSkin(), + (ThemePackageType.Theme, DotNetNuke.Abstractions.Themes.ThemeType.Edit) => GetDefaultAdminSkin(), + (ThemePackageType.Container, DotNetNuke.Abstractions.Themes.ThemeType.Site) => GetDefaultPortalContainer(), + (ThemePackageType.Container, DotNetNuke.Abstractions.Themes.ThemeType.Edit) => GetDefaultAdminContainer(), _ => throw new ArgumentOutOfRangeException(nameof(packageType), packageType, "The skin package type is not supported.") }; } /// - string ISkinService.FormatSkinPath(string skinSrc) => FormatSkinPath(skinSrc); + string IThemeService.FormatThemePath(string themeSource) => FormatSkinPath(themeSource); /// - string ISkinService.FormatSkinSrc(string skinSrc, IPortalSettings portalSettings) - => FormatSkinSrc(skinSrc, portalSettings); + string IThemeService.FormatThemeSource(string themeSource, IPortalSettings portalSettings) + => FormatSkinSrc(themeSource, portalSettings); /// - bool ISkinService.IsGlobalSkin(string skinSrc) => IsGlobalSkin(skinSrc); + bool IThemeService.IsGlobalTheme(string themeSource) => IsGlobalSkin(themeSource); /// - void ISkinService.SetSkin(SkinPackageType packageType, int portalId, DotNetNuke.Abstractions.Skins.SkinType skinType, string skinSrc) + void IThemeService.SetTheme(ThemePackageType packageType, int portalId, DotNetNuke.Abstractions.Themes.ThemeType themeType, string themeSource) { - var librarySkinType = skinType switch + var librarySkinType = themeType switch { - Abstractions.Skins.SkinType.Site => SkinType.Portal, - Abstractions.Skins.SkinType.Edit => SkinType.Admin, - _ => throw new ArgumentOutOfRangeException(nameof(skinType), skinType, "The skin type is not supported."), + Abstractions.Themes.ThemeType.Site => SkinType.Portal, + Abstractions.Themes.ThemeType.Edit => SkinType.Admin, + _ => throw new ArgumentOutOfRangeException(nameof(themeType), themeType, "The theme type is not supported."), }; var skinRoot = packageType switch { - SkinPackageType.Skin => RootSkin, - SkinPackageType.Container => RootContainer, - _ => throw new ArgumentOutOfRangeException(nameof(packageType), packageType, "The skin package type is not supported."), + ThemePackageType.Theme => RootSkin, + ThemePackageType.Container => RootContainer, + _ => throw new ArgumentOutOfRangeException(nameof(packageType), packageType, "The theme package type is not supported."), }; - SetSkin(skinRoot, portalId, librarySkinType, skinSrc); + SetSkin(skinRoot, portalId, librarySkinType, themeSource); } /// - void ISkinService.UpdateSkin(ISkinInfo skin) => UpdateSkin(skin.SkinId, skin.SkinSrc); + void IThemeService.UpdateTheme(IThemeInfo theme) => UpdateSkin(theme.ThemeId, theme.ThemeSource); /// - void ISkinService.UpdateSkinPackage(ISkinPackageInfo skinPackage) => UpdateSkinPackage(skinPackage); + void IThemeService.UpdateThemePackage(IThemePackageInfo themePackage) => UpdateSkinPackage(themePackage); /// - IEnumerable> ISkinService.GetSkinsInFolder(IPortalInfo portalInfo, DotNetNuke.Abstractions.Skins.SkinType skinType, SkinFolder folder) + IEnumerable> IThemeService.GetThemesInFolder(IPortalInfo portalInfo, DotNetNuke.Abstractions.Themes.ThemeType themeRoot, ThemeFolder folder) { var libraryScope = folder switch { - SkinFolder.All => SkinScope.All, - SkinFolder.Host => SkinScope.Host, - SkinFolder.Portal => SkinScope.Site, + ThemeFolder.All => SkinScope.All, + ThemeFolder.Host => SkinScope.Host, + ThemeFolder.Portal => SkinScope.Site, _ => throw new ArgumentOutOfRangeException(nameof(folder), folder, "The skin scope is not supported."), }; - var skinRoot = skinType switch + var skinRoot = themeRoot switch { - Abstractions.Skins.SkinType.Site => RootSkin, - Abstractions.Skins.SkinType.Edit => RootContainer, - _ => throw new ArgumentOutOfRangeException(nameof(skinType), skinType, "The skin type is not supported."), + Abstractions.Themes.ThemeType.Site => RootSkin, + Abstractions.Themes.ThemeType.Edit => RootContainer, + _ => throw new ArgumentOutOfRangeException(nameof(themeRoot), themeRoot, "The skin type is not supported."), }; return GetSkins(portalInfo, skinRoot, libraryScope); } - /// - private static string FormatSkinSrc(string skinSrc, IPortalSettings portalSettings) + /// + private static string FormatSkinSrc(string themeSource, IPortalSettings portalSettings) { - string strSkinSrc = skinSrc; + string strSkinSrc = themeSource; if (!string.IsNullOrEmpty(strSkinSrc)) { switch (strSkinSrc.Substring(0, 3).ToLowerInvariant()) @@ -624,34 +624,34 @@ private static string FormatSkinSrc(string skinSrc, IPortalSettings portalSettin return strSkinSrc; } - /// - private static void DeleteSkinPackage(ISkinPackageInfo skinPackage) + /// + private static void DeleteSkinPackage(IThemePackageInfo themePackage) { - DataProvider.Instance().DeleteSkinPackage(skinPackage.SkinPackageId); - EventLogController.Instance.AddLog(skinPackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_DELETED); + DataProvider.Instance().DeleteSkinPackage(themePackage.ThemePackageId); + EventLogController.Instance.AddLog(themePackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_DELETED); } - /// - private static int AddSkinPackage(ISkinPackageInfo skinPackage) + /// + private static int AddSkinPackage(IThemePackageInfo themePackage) { - EventLogController.Instance.AddLog(skinPackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_CREATED); - return DataProvider.Instance().AddSkinPackage(skinPackage.PackageId, skinPackage.PortalId, skinPackage.SkinName, SkinUtils.ToDatabaseName(skinPackage.SkinType), UserController.Instance.GetCurrentUserInfo().UserID); + EventLogController.Instance.AddLog(themePackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_CREATED); + return DataProvider.Instance().AddSkinPackage(themePackage.PackageId, themePackage.PortalId, themePackage.ThemeName, SkinUtils.ToDatabaseName(themePackage.ThemeType), UserController.Instance.GetCurrentUserInfo().UserID); } - /// - private static void UpdateSkinPackage(ISkinPackageInfo skinPackage) + /// + private static void UpdateSkinPackage(IThemePackageInfo themePackage) { DataProvider.Instance().UpdateSkinPackage( - skinPackage.SkinPackageId, - skinPackage.PackageId, - skinPackage.PortalId, - skinPackage.SkinName, - SkinUtils.ToDatabaseName(skinPackage.SkinType), + themePackage.ThemePackageId, + themePackage.PackageId, + themePackage.PortalId, + themePackage.ThemeName, + SkinUtils.ToDatabaseName(themePackage.ThemeType), UserController.Instance.GetCurrentUserInfo().UserID); - EventLogController.Instance.AddLog(skinPackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_UPDATED); - foreach (var skin in skinPackage.Skins) + EventLogController.Instance.AddLog(themePackage, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, string.Empty, EventLogController.EventLogType.SKINPACKAGE_UPDATED); + foreach (var skin in themePackage.Themes) { - UpdateSkin(skin.SkinId, skin.SkinSrc); + UpdateSkin(skin.ThemeId, skin.ThemeSource); } } diff --git a/DNN Platform/Library/UI/Skins/SkinInfo.cs b/DNN Platform/Library/UI/Skins/SkinInfo.cs index 7095e509bb3..186774c312a 100644 --- a/DNN Platform/Library/UI/Skins/SkinInfo.cs +++ b/DNN Platform/Library/UI/Skins/SkinInfo.cs @@ -5,14 +5,14 @@ namespace DotNetNuke.UI.Skins { using System; - using DotNetNuke.Abstractions.Skins; + using DotNetNuke.Abstractions.Themes; /// Project : DotNetNuke /// Class : SkinInfo /// /// Handles the Business Object for Skins. [Serializable] - public class SkinInfo : ISkinInfo + public class SkinInfo : IThemeInfo { private int portalId; private int skinId; @@ -21,83 +21,68 @@ public class SkinInfo : ISkinInfo private string skinSrc; private SkinType skinType; + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemeInfo)}.{nameof(IThemeInfo.ThemeId)} instead. Scheduled for removal in v11.0.0.")] public int SkinId { - get - { - return this.skinId; - } + get => this.ThemeId; + set => this.ThemeId = value; + } - set - { - this.skinId = value; - } + /// + public int ThemeId + { + get => this.skinId; + set => this.skinId = value; } + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemeInfo)}.{nameof(IThemeInfo.ThemePackageId)} instead. Scheduled for removal in v11.0.0.")] public int SkinPackageId { - get - { - return this.skinPackageId; - } + get => this.ThemePackageId; + set => this.ThemePackageId = value; + } - set - { - this.skinPackageId = value; - } + /// + public int ThemePackageId + { + get => this.skinPackageId; + set => this.skinPackageId = value; } public int PortalId { - get - { - return this.portalId; - } - - set - { - this.portalId = value; - } + get => this.portalId; + set => this.portalId = value; } public string SkinRoot { - get - { - return this.skinRoot; - } - - set - { - this.skinRoot = value; - } + get => this.skinRoot; + set => this.skinRoot = value; } [Obsolete("Deprecated in DotNetNuke 10.0.0. No replacement. Scheduled removal in v12.0.0.")] public SkinType SkinType { - get - { - return this.skinType; - } - - set - { - this.skinType = value; - } + get => this.skinType; + set => this.skinType = value; } + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemeInfo)}.{nameof(IThemeInfo.ThemeSource)} instead. Scheduled for removal in v11.0.0.")] public string SkinSrc { - get - { - return this.skinSrc; - } + get => this.ThemeSource; + set => this.ThemeSource = value; + } - set - { - this.skinSrc = value; - } + /// + public string ThemeSource + { + get => this.skinSrc; + set => this.skinSrc = value; } } } diff --git a/DNN Platform/Library/UI/Skins/SkinPackageInfo.cs b/DNN Platform/Library/UI/Skins/SkinPackageInfo.cs index a9b54b0cf7d..f54975463fc 100644 --- a/DNN Platform/Library/UI/Skins/SkinPackageInfo.cs +++ b/DNN Platform/Library/UI/Skins/SkinPackageInfo.cs @@ -10,7 +10,7 @@ namespace DotNetNuke.UI.Skins using System.Xml.Serialization; using DotNetNuke.Abstractions.Collections; - using DotNetNuke.Abstractions.Skins; + using DotNetNuke.Abstractions.Themes; using DotNetNuke.Collections; using DotNetNuke.Common.Utilities; using DotNetNuke.Entities; @@ -22,7 +22,7 @@ namespace DotNetNuke.UI.Skins /// /// Handles the Business Object for Skins. [Serializable] - public class SkinPackageInfo : BaseEntityInfo, IHydratable, ISkinPackageInfo + public class SkinPackageInfo : BaseEntityInfo, IHydratable, IThemePackageInfo { private int packageId = Null.NullInteger; private int portalId = Null.NullInteger; @@ -30,72 +30,73 @@ public class SkinPackageInfo : BaseEntityInfo, IHydratable, ISkinPackageInfo private int skinPackageId = Null.NullInteger; private string skinType; private Dictionary skins = new Dictionary(); - private List skinsList = new List(); - private AbstractionList abstractSkins; + private List themes = new List(); + private AbstractionList abstractSkins; - /// - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.PackageId)} instead. Scheduled for removal in v11.0.0.")] + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.PackageId)} instead. Scheduled for removal in v11.0.0.")] public int PackageID { get { - return ((ISkinPackageInfo)this).PackageId; + return ((IThemePackageInfo)this).PackageId; } set { - ((ISkinPackageInfo)this).PackageId = value; + ((IThemePackageInfo)this).PackageId = value; } } - /// - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.SkinPackageId)} instead. Scheduled for removal in v11.0.0.")] + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.ThemePackageId)} instead. Scheduled for removal in v11.0.0.")] public int SkinPackageID { get { - return ((ISkinPackageInfo)this).SkinPackageId; + return ((IThemePackageInfo)this).ThemePackageId; } set { - ((ISkinPackageInfo)this).SkinPackageId = value; + ((IThemePackageInfo)this).ThemePackageId = value; } } - /// - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.PortalId)} instead. Scheduled for removal in v11.0.0.")] + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.PortalId)} instead. Scheduled for removal in v11.0.0.")] public int PortalID { get { - return ((ISkinPackageInfo)this).PortalId; + return ((IThemePackageInfo)this).PortalId; } set { - ((ISkinPackageInfo)this).PortalId = value; + ((IThemePackageInfo)this).PortalId = value; } } - /// + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.ThemeName)} instead. Scheduled for removal in v11.0.0.")] public string SkinName { - get - { - return this.skinName; - } + get => this.ThemeName; + set => this.ThemeName = value; + } - set - { - this.skinName = value; - } + /// + public string ThemeName + { + get => this.skinName; + set => this.skinName = value; } - /// Gets or sets a dictionary mapping from to . + /// Gets or sets a dictionary mapping from to . [XmlIgnore] [JsonIgnore] - [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.Skins)} instead. Scheduled for removal in v11.0.0.")] + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.Themes)} instead. Scheduled for removal in v11.0.0.")] public Dictionary Skins { get @@ -109,23 +110,24 @@ public Dictionary Skins } } - /// + /// [XmlIgnore] [JsonIgnore] - public List SkinsList + public List Themes { get { - return this.skinsList; + return this.themes; } set { - this.skinsList = value; + this.themes = value; } } - /// + /// + [Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(IThemePackageInfo)}.{nameof(IThemePackageInfo.ThemeType)} instead. Scheduled for removal in v11.0.0.")] public string SkinType { get @@ -144,19 +146,19 @@ public int KeyID { get { - return ((ISkinPackageInfo)this).SkinPackageId; + return ((IThemePackageInfo)this).ThemePackageId; } set { - ((ISkinPackageInfo)this).SkinPackageId = value; + ((IThemePackageInfo)this).ThemePackageId = value; } } /// [XmlIgnore] [JsonIgnore] - int ISkinPackageInfo.PackageId + int IThemePackageInfo.PackageId { get => this.packageId; set => this.packageId = value; @@ -165,7 +167,7 @@ int ISkinPackageInfo.PackageId /// [XmlIgnore] [JsonIgnore] - int ISkinPackageInfo.SkinPackageId + int IThemePackageInfo.ThemePackageId { get => this.skinPackageId; set => this.skinPackageId = value; @@ -174,18 +176,18 @@ int ISkinPackageInfo.SkinPackageId /// [XmlIgnore] [JsonIgnore] - IObjectList ISkinPackageInfo.Skins + IObjectList IThemePackageInfo.Themes { get { - return this.abstractSkins ??= new AbstractionList(this.SkinsList); + return this.abstractSkins ??= new AbstractionList(this.Themes); } } /// [XmlIgnore] [JsonIgnore] - SkinPackageType ISkinPackageInfo.SkinType + ThemePackageType IThemePackageInfo.ThemeType { get => SkinUtils.FromDatabaseName(this.SkinType); set => this.SkinType = SkinUtils.ToDatabaseName(value); @@ -194,7 +196,7 @@ SkinPackageType ISkinPackageInfo.SkinType /// [XmlIgnore] [JsonIgnore] - int ISkinPackageInfo.PortalId + int IThemePackageInfo.PortalId { get => this.portalId; set => this.portalId = value; @@ -203,10 +205,10 @@ int ISkinPackageInfo.PortalId /// public void Fill(IDataReader dr) { - var @this = (ISkinPackageInfo)this; - @this.SkinPackageId = Null.SetNullInteger(dr["SkinPackageID"]); + var @this = (IThemePackageInfo)this; + @this.ThemePackageId = Null.SetNullInteger(dr["SkinPackageID"]); @this.PackageId = Null.SetNullInteger(dr["PackageID"]); - @this.SkinName = Null.SetNullString(dr["SkinName"]); + @this.ThemeName = Null.SetNullString(dr["SkinName"]); this.SkinType = Null.SetNullString(dr["SkinType"]); // Call the base classes fill method to populate base class properties @@ -221,16 +223,16 @@ public void Fill(IDataReader dr) { var skinSrc = Null.SetNullString(dr["SkinSrc"]); this.skins[skinId] = skinSrc; - this.skinsList.Add(new SkinInfo + this.themes.Add(new SkinInfo { - SkinId = skinId, - SkinSrc = skinSrc, - SkinPackageId = @this.SkinPackageId, + ThemeId = skinId, + ThemeSource = skinSrc, + ThemePackageId = @this.ThemePackageId, PortalId = @this.PortalId, SkinRoot = SkinUtils.FromDatabaseName(this.SkinType) switch { - SkinPackageType.Container => SkinController.RootContainer, - SkinPackageType.Skin => SkinController.RootSkin, + ThemePackageType.Container => SkinController.RootContainer, + ThemePackageType.Theme => SkinController.RootSkin, _ => throw new ArgumentOutOfRangeException(nameof(this.SkinType), this.SkinType, "Invalid skin type."), }, }); diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs index ba5194ca211..a255f73df09 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Components/Extensions/Editors/SkinPackageEditor.cs @@ -1,37 +1,37 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information - +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information + namespace Dnn.PersonaBar.Extensions.Components.Editors { using System; - + using Dnn.PersonaBar.Extensions.Components.Dto; using Dnn.PersonaBar.Extensions.Components.Dto.Editors; using DotNetNuke.Entities.Users; using DotNetNuke.Instrumentation; using DotNetNuke.Services.Installer.Packages; using DotNetNuke.UI.Skins; - + public class SkinPackageEditor : IPackageEditor { - private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinPackageEditor)); - - /// + private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(SkinPackageEditor)); + + /// public PackageInfoDto GetPackageDetail(int portalId, PackageInfo package) { var isHostUser = UserController.Instance.GetCurrentUserInfo().IsSuperUser; var skin = SkinController.GetSkinByPackageID(package.PackageID); var detail = new SkinPackageDetailDto(portalId, package) { - ThemePackageName = skin.SkinName, + ThemePackageName = skin.ThemeName, ReadOnly = !isHostUser, }; return detail; - } - - /// + } + + /// public bool SavePackageSettings(PackageSettingsDto packageSettings, out string errorMessage) { errorMessage = string.Empty; @@ -48,7 +48,7 @@ public bool SavePackageSettings(PackageSettingsDto packageSettings, out string e if (packageSettings.EditorActions.TryGetValue("themePackageName", out value) && !string.IsNullOrEmpty(value)) { - skin.SkinName = value; + skin.ThemeName = value; SkinController.UpdateSkinPackage(skin); } } diff --git a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs index 91425ba7737..c3c0ceb885e 100644 --- a/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs +++ b/Dnn.AdminExperience/Dnn.PersonaBar.Extensions/Services/ExtensionsController.cs @@ -774,7 +774,7 @@ public HttpResponseMessage CreateExtension(PackageSettingsDto packageSettings) case PackageTypes.Skin: var skinPackage = new SkinPackageInfo { - SkinName = package.Name, + ThemeName = package.Name, PackageID = package.PackageID, SkinType = package.PackageType, };