Skip to content

Commit

Permalink
Update deprecations for 9.13.1
Browse files Browse the repository at this point in the history
Deprecate SkinPackageInfo.Skins, rename list to SkinPackageInfo.SkinsList
  • Loading branch information
bdukes committed Oct 24, 2023
1 parent b9eb1ac commit c70a8ba
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 53 deletions.
42 changes: 21 additions & 21 deletions DNN Platform/Library/UI/Skins/SkinController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public partial class SkinController : ISkinService
private static readonly Regex LdirRegex = new Regex("\\[l]", RegexOptions.IgnoreCase | RegexOptions.Compiled);

/// <inheritdoc cref="ISkinService.RootSkin" />
[Obsolete($"Deprecated in DotNetNuke 10.0.0. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")]
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")]
public static string RootSkin
{
get
Expand All @@ -49,7 +49,7 @@ public static string RootSkin
}

/// <inheritdoc cref="ISkinService.RootContainer" />
[Obsolete($"Deprecated in DotNetNuke 10.0.0. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")]
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(SkinType)}.{nameof(ISkinService.GetFolderName)} instead. Scheduled removal in v12.0.0.")]
public static string RootContainer
{
get
Expand All @@ -59,21 +59,21 @@ public static string RootContainer
}

/// <inheritdoc cref="ISkinService.AddSkin" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkin)} instead.")]
public static partial int AddSkin(int skinPackageID, string skinSrc)
{
return DataProvider.Instance().AddSkin(skinPackageID, skinSrc);
}

/// <inheritdoc cref="ISkinService.AddSkinPackage" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkinPackage)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.AddSkinPackage)} instead.")]
public static partial int AddSkinPackage(SkinPackageInfo skinPackage)
{
return AddSkinPackage((ISkinPackageInfo)skinPackage);
}

/// <inheritdoc cref="ISkinService.CanDeleteSkinFolder" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.CanDeleteSkinFolder)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.CanDeleteSkinFolder)} instead.")]
public static partial bool CanDeleteSkin(string folderPath, string portalHomeDirMapPath)
{
string skinType;
Expand Down Expand Up @@ -126,14 +126,14 @@ public static partial bool CanDeleteSkin(string folderPath, string portalHomeDir
}

/// <inheritdoc cref="ISkinService.DeleteSkin" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkin)} instead.")]
public static partial void DeleteSkin(int skinID)
{
DataProvider.Instance().DeleteSkin(skinID);
}

/// <inheritdoc cref="ISkinService.DeleteSkinPackage" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkinPackage)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.DeleteSkinPackage)} instead.")]
public static partial void DeleteSkinPackage(SkinPackageInfo skinPackage)
{
DeleteSkinPackage((ISkinPackageInfo)skinPackage);
Expand Down Expand Up @@ -167,7 +167,7 @@ public static string FormatMessage(string title, string body, int level, bool is
}

/// <inheritdoc cref="ISkinService.FormatSkinPath" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinPath)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinPath)} instead.")]
public static partial string FormatSkinPath(string skinSrc)
{
string strSkinSrc = skinSrc;
Expand All @@ -180,7 +180,7 @@ public static partial string FormatSkinPath(string skinSrc)
}

/// <inheritdoc cref="ISkinService.FormatSkinSrc" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinSrc)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.FormatSkinSrc)} instead.")]
public static partial string FormatSkinSrc(string skinSrc, PortalSettings portalSettings)
{
return FormatSkinSrc(skinSrc, (IPortalSettings)portalSettings);
Expand All @@ -192,7 +192,7 @@ public static partial string FormatSkinSrc(string skinSrc, PortalSettings portal
/// To get the default admin container for the portal use <see cref="IPortalSettings.DefaultAdminContainer"/> instead.
/// </remarks>
/// <returns>The global default admin container.</returns>
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
public static partial string GetDefaultAdminContainer()
{
SkinDefaults defaultContainer = SkinDefaults.GetSkinDefaults(SkinDefaultType.ContainerInfo);
Expand All @@ -205,7 +205,7 @@ public static partial string GetDefaultAdminContainer()
/// To get the default admin skin for the portal use <see cref="IPortalSettings.DefaultAdminSkin"/> instead.
/// </remarks>
/// <returns>The global default admin skin.</returns>
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
public static partial string GetDefaultAdminSkin()
{
SkinDefaults defaultSkin = SkinDefaults.GetSkinDefaults(SkinDefaultType.SkinInfo);
Expand All @@ -218,7 +218,7 @@ public static partial string GetDefaultAdminSkin()
/// To get the default skin for the portal use <see cref="IPortalSettings.DefaultPortalSkin"/> instead.
/// </remarks>
/// <returns>The global default skin.</returns>
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
public static partial string GetDefaultPortalContainer()
{
SkinDefaults defaultContainer = SkinDefaults.GetSkinDefaults(SkinDefaultType.ContainerInfo);
Expand All @@ -231,36 +231,36 @@ public static partial string GetDefaultPortalContainer()
/// To get the default skin for the portal use <see cref="IPortalSettings.DefaultPortalSkin"/> instead.
/// </remarks>
/// <returns>The global default skin.</returns>
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetDefaultSkinSrc)} instead.")]
public static partial string GetDefaultPortalSkin()
{
SkinDefaults defaultSkin = SkinDefaults.GetSkinDefaults(SkinDefaultType.SkinInfo);
return "[G]" + RootSkin + defaultSkin.Folder + defaultSkin.DefaultName;
}

/// <inheritdoc cref="ISkinService.GetSkinByPackageID" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackageById)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackageById)} instead.")]
public static partial SkinPackageInfo GetSkinByPackageID(int packageID)
{
return CBO.FillObject<SkinPackageInfo>(DataProvider.Instance().GetSkinByPackageID(packageID));
}

/// <inheritdoc cref="ISkinService.GetSkinPackage" />]
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackage)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinPackage)} instead.")]
public static partial SkinPackageInfo GetSkinPackage(int portalId, string skinName, string skinType)
{
return CBO.FillObject<SkinPackageInfo>(DataProvider.Instance().GetSkinPackage(portalId, skinName, skinType));
}

/// <inheritdoc cref="ISkinService.GetSkinsInFolder" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")]
public static partial List<KeyValuePair<string, string>> GetSkins(PortalInfo portalInfo, string skinRoot, SkinScope scope)
{
return GetSkins((IPortalInfo)portalInfo, skinRoot, scope);
}

/// <inheritdoc cref="ISkinService.GetSkinsInFolder" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.GetSkinsInFolder)} instead.")]
public static partial List<KeyValuePair<string, string>> GetSkins(IPortalInfo portalInfo, string skinRoot, SkinScope scope)
{
var skins = new List<KeyValuePair<string, string>>();
Expand All @@ -282,14 +282,14 @@ public static partial List<KeyValuePair<string, string>> GetSkins(IPortalInfo po
}

/// <inheritdoc cref="ISkinService.IsGlobalSkin" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.IsGlobalSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.IsGlobalSkin)} instead.")]
public static partial bool IsGlobalSkin(string skinSrc)
{
return skinSrc.Contains(Globals.HostPath);
}

/// <inheritdoc cref="ISkinService.SetSkin" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.SetSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.SetSkin)} instead.")]
public static partial void SetSkin(string skinRoot, int portalId, SkinType skinType, string skinSrc)
{
var selectedCultureCode = LocaleController.Instance.GetCurrentLocale(portalId).Code;
Expand Down Expand Up @@ -351,14 +351,14 @@ public static partial void SetSkin(string skinRoot, int portalId, SkinType skinT
}

/// <inheritdoc cref="ISkinService.UpdateSkin" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")]
public static partial void UpdateSkin(int skinID, string skinSrc)
{
DataProvider.Instance().UpdateSkin(skinID, skinSrc);
}

/// <inheritdoc cref="ISkinService.UpdateSkinPackage" />
[DnnDeprecated(10, 0, 0, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")]
[DnnDeprecated(9, 13, 1, $"Use {nameof(ISkinService)}.{nameof(ISkinService.UpdateSkin)} instead.")]
public static partial void UpdateSkinPackage(SkinPackageInfo skinPackage)
{
UpdateSkinPackage((ISkinPackageInfo)skinPackage);
Expand Down
1 change: 0 additions & 1 deletion DNN Platform/Library/UI/Skins/SkinInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace DotNetNuke.UI.Skins
using System;

using DotNetNuke.Abstractions.Skins;
using DotNetNuke.Internal.SourceGenerators;

/// Project : DotNetNuke
/// Class : SkinInfo
Expand Down
86 changes: 55 additions & 31 deletions DNN Platform/Library/UI/Skins/SkinPackageInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,53 +24,57 @@ namespace DotNetNuke.UI.Skins
[Serializable]
public class SkinPackageInfo : BaseEntityInfo, IHydratable, ISkinPackageInfo
{
private int packageID = Null.NullInteger;
private int portalID = Null.NullInteger;
private int packageId = Null.NullInteger;
private int portalId = Null.NullInteger;
private string skinName;
private int skinPackageID = Null.NullInteger;
private int skinPackageId = Null.NullInteger;
private string skinType;
private List<SkinInfo> skins = new List<SkinInfo>();
private Dictionary<int, string> skins = new Dictionary<int, string>();
private List<SkinInfo> skinsList = new List<SkinInfo>();
private AbstractionList<ISkinInfo, SkinInfo> abstractSkins;

/// <inheritdoc cref="ISkinPackageInfo.PackageId"/>
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.PackageId)} instead. Scheduled for removal in v11.0.0.")]
public int PackageID
{
get
{
return this.packageID;
return ((ISkinPackageInfo)this).PackageId;
}

set
{
this.packageID = value;
((ISkinPackageInfo)this).PackageId = value;
}
}

/// <inheritdoc cref="ISkinPackageInfo.SkinPackageId"/>
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.SkinPackageId)} instead. Scheduled for removal in v11.0.0.")]
public int SkinPackageID
{
get
{
return this.skinPackageID;
return ((ISkinPackageInfo)this).SkinPackageId;
}

set
{
this.skinPackageID = value;
((ISkinPackageInfo)this).SkinPackageId = value;
}
}

/// <inheritdoc cref="ISkinPackageInfo.PortalId"/>
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.PortalId)} instead. Scheduled for removal in v11.0.0.")]
public int PortalID
{
get
{
return this.portalID;
return ((ISkinPackageInfo)this).PortalId;
}

set
{
this.portalID = value;
((ISkinPackageInfo)this).PortalId = value;
}
}

Expand All @@ -88,10 +92,11 @@ public string SkinName
}
}

/// <inheritdoc cref="ISkinPackageInfo.Skins"/>
/// <summary>Gets or sets a dictionary mapping from <see cref="SkinInfo.SkinId"/> to <see cref="SkinInfo.SkinSrc"/>.</summary>
[XmlIgnore]
[JsonIgnore]
public List<SkinInfo> Skins
[Obsolete($"Deprecated in DotNetNuke 9.13.1. Use {nameof(ISkinPackageInfo)}.{nameof(ISkinPackageInfo.Skins)} instead. Scheduled for removal in v11.0.0.")]
public Dictionary<int, string> Skins
{
get
{
Expand All @@ -104,6 +109,22 @@ public List<SkinInfo> Skins
}
}

/// <inheritdoc cref="ISkinPackageInfo.Skins"/>
[XmlIgnore]
[JsonIgnore]
public List<SkinInfo> SkinsList
{
get
{
return this.skinsList;
}

set
{
this.skinsList = value;
}
}

/// <inheritdoc cref="ISkinPackageInfo.SkinType"/>
public string SkinType
{
Expand All @@ -123,12 +144,12 @@ public int KeyID
{
get
{
return this.SkinPackageID;
return ((ISkinPackageInfo)this).SkinPackageId;
}

set
{
this.SkinPackageID = value;
((ISkinPackageInfo)this).SkinPackageId = value;
}
}

Expand All @@ -137,17 +158,17 @@ public int KeyID
[JsonIgnore]
int ISkinPackageInfo.PackageId
{
get => this.PackageID;
set => this.PackageID = value;
get => this.packageId;
set => this.packageId = value;
}

/// <inheritdoc/>
[XmlIgnore]
[JsonIgnore]
int ISkinPackageInfo.SkinPackageId
{
get => this.SkinPackageID;
set => this.SkinPackageID = value;
get => this.skinPackageId;
set => this.skinPackageId = value;
}

/// <inheritdoc/>
Expand All @@ -157,7 +178,7 @@ IObjectList<ISkinInfo> ISkinPackageInfo.Skins
{
get
{
return this.abstractSkins ??= new AbstractionList<ISkinInfo, SkinInfo>(this.Skins);
return this.abstractSkins ??= new AbstractionList<ISkinInfo, SkinInfo>(this.SkinsList);
}
}

Expand All @@ -175,16 +196,17 @@ SkinPackageType ISkinPackageInfo.SkinType
[JsonIgnore]
int ISkinPackageInfo.PortalId
{
get => this.PortalID;
set => this.PortalID = value;
get => this.portalId;
set => this.portalId = value;
}

/// <inheritdoc/>
public void Fill(IDataReader dr)
{
this.SkinPackageID = Null.SetNullInteger(dr["SkinPackageID"]);
this.PackageID = Null.SetNullInteger(dr["PackageID"]);
this.SkinName = Null.SetNullString(dr["SkinName"]);
var @this = (ISkinPackageInfo)this;
@this.SkinPackageId = Null.SetNullInteger(dr["SkinPackageID"]);
@this.PackageId = Null.SetNullInteger(dr["PackageID"]);
@this.SkinName = Null.SetNullString(dr["SkinName"]);
this.SkinType = Null.SetNullString(dr["SkinType"]);

// Call the base classes fill method to populate base class properties
Expand All @@ -194,15 +216,17 @@ public void Fill(IDataReader dr)
{
while (dr.Read())
{
int skinID = Null.SetNullInteger(dr["SkinID"]);
if (skinID > Null.NullInteger)
int skinId = Null.SetNullInteger(dr["SkinID"]);
if (skinId > Null.NullInteger)
{
this.skins.Add(new SkinInfo
var skinSrc = Null.SetNullString(dr["SkinSrc"]);
this.skins[skinId] = skinSrc;
this.skinsList.Add(new SkinInfo
{
SkinId = skinID,
SkinSrc = Null.SetNullString(dr["SkinSrc"]),
SkinPackageId = this.SkinPackageID,
PortalId = this.PortalID,
SkinId = skinId,
SkinSrc = skinSrc,
SkinPackageId = @this.SkinPackageId,
PortalId = @this.PortalId,
SkinRoot = SkinUtils.FromDatabaseName(this.SkinType) switch
{
SkinPackageType.Container => SkinController.RootContainer,
Expand Down

0 comments on commit c70a8ba

Please sign in to comment.