|
| 1 | +// Licensed to the .NET Foundation under one or more agreements. |
| 2 | +// The .NET Foundation licenses this file to you under the MIT license. |
| 3 | +// See the LICENSE file in the project root for more information |
| 4 | + |
| 5 | +namespace DotNetNuke.Abstractions.Skins; |
| 6 | + |
| 7 | +using System.Collections.Generic; |
| 8 | + |
| 9 | +using DotNetNuke.Abstractions.Portals; |
| 10 | + |
| 11 | +/// <summary>Handles the Business Control Layer for Skins.</summary> |
| 12 | +public interface ISkinService |
| 13 | +{ |
| 14 | + /// <summary>Gets the folder name for the specified <paramref name="packageType"/>.</summary> |
| 15 | + /// <param name="packageType">The type of the skin package.</param> |
| 16 | + /// <returns>The folder name.</returns> |
| 17 | + string GetFolderName(SkinPackageType packageType); |
| 18 | + |
| 19 | + /// <summary>Gets the global default skin src.</summary> |
| 20 | + /// <param name="packageType">The type of the skin package.</param> |
| 21 | + /// <param name="skinType">The type of the skin.</param> |
| 22 | + /// <returns>The global default edit skin.</returns> |
| 23 | + string GetDefaultSkinSrc(SkinPackageType packageType, SkinType skinType); |
| 24 | + |
| 25 | + /// <summary>Gets a skin package by its id.</summary> |
| 26 | + /// <param name="packageId">The skin package id.</param> |
| 27 | + /// <returns>The skin package.</returns> |
| 28 | + ISkinPackageInfo GetSkinPackageById(int packageId); |
| 29 | + |
| 30 | + /// <summary>Gets a skin package by its id.</summary> |
| 31 | + /// <param name="portalId">The portal id.</param> |
| 32 | + /// <param name="skinName">The name of the skin.</param> |
| 33 | + /// <param name="packageType">The type of the skin package.</param> |
| 34 | + /// <returns>The skin package.</returns> |
| 35 | + ISkinPackageInfo GetSkinPackage(int portalId, string skinName, SkinPackageType packageType); |
| 36 | + |
| 37 | + /// <summary>Creates a new instance of <see cref="ISkinInfo"/>.</summary> |
| 38 | + /// <returns>The skin.</returns> |
| 39 | + ISkinInfo CreateSkin(); |
| 40 | + |
| 41 | + /// <summary>Creates a new instance of <see cref="ISkinPackageInfo"/>.</summary> |
| 42 | + /// <returns>The skin package.</returns> |
| 43 | + ISkinPackageInfo CreateSkinPackage(); |
| 44 | + |
| 45 | + /// <summary>Adds a new skin.</summary> |
| 46 | + /// <param name="skin">The skin to add.</param> |
| 47 | + /// <returns>The skin id.</returns> |
| 48 | + int AddSkin(ISkinInfo skin); |
| 49 | + |
| 50 | + /// <summary>Adds a skin package.</summary> |
| 51 | + /// <param name="skinPackage">The skin package to add.</param> |
| 52 | + /// <returns>The skin package id.</returns> |
| 53 | + int AddSkinPackage(ISkinPackageInfo skinPackage); |
| 54 | + |
| 55 | + /// <summary>Checks if a skin can be deleted.</summary> |
| 56 | + /// <param name="folderPath">Path to the skin folder.</param> |
| 57 | + /// <param name="portalHomeDirMapPath">Path to the portal home directory (<see cref="IPortalSettings.HomeDirectoryMapPath"/>).</param> |
| 58 | + /// <returns>True if the skin can be deleted.</returns> |
| 59 | + bool CanDeleteSkinFolder(string folderPath, string portalHomeDirMapPath); |
| 60 | + |
| 61 | + /// <summary>Deletes a skin.</summary> |
| 62 | + /// <param name="skin">The skin to delete.</param> |
| 63 | + void DeleteSkin(ISkinInfo skin); |
| 64 | + |
| 65 | + /// <summary>Deletes a skin package.</summary> |
| 66 | + /// <param name="skinPackage">The skin package to delete.</param> |
| 67 | + void DeleteSkinPackage(ISkinPackageInfo skinPackage); |
| 68 | + |
| 69 | + /// <summary>Gets the skin source path.</summary> |
| 70 | + /// <example> |
| 71 | + /// <c>[G]Skins/Xcillion/Inner.ascx</c> becomes <c>[G]Skins/Xcillion</c>. |
| 72 | + /// </example> |
| 73 | + /// <param name="skinSrc">The input skin source path.</param> |
| 74 | + /// <returns>The skin source path.</returns> |
| 75 | + string FormatSkinPath(string skinSrc); |
| 76 | + |
| 77 | + /// <summary>Formats the skin source path.</summary> |
| 78 | + /// <remarks> |
| 79 | + /// By default the following tokens are replaced:<br /> |
| 80 | + /// <c>[G]</c> - Host path (default: '/Portals/_default/').<br /> |
| 81 | + /// <c>[S]</c> - Home system directory (default: '/Portals/[PortalID]-System/').<br /> |
| 82 | + /// <c>[L]</c> - Home directory (default: '/Portals/[PortalID]/'). |
| 83 | + /// </remarks> |
| 84 | + /// <example> |
| 85 | + /// <c>[G]Skins/Xcillion/Inner.ascx</c> becomes <c>/Portals/_default/Skins/Xcillion/Inner.ascx</c>. |
| 86 | + /// </example> |
| 87 | + /// <param name="skinSrc">The input skin source path.</param> |
| 88 | + /// <param name="portalSettings">The portal settings containing configuration data.</param> |
| 89 | + /// <returns>The formatted skin source path.</returns> |
| 90 | + string FormatSkinSrc(string skinSrc, IPortalSettings portalSettings); |
| 91 | + |
| 92 | + /// <summary>Determines if a given skin is defined as a global skin.</summary> |
| 93 | + /// <param name="skinSrc">This is the app relative path and filename of the skin to be checked.</param> |
| 94 | + /// <returns>True if the skin is located in the HostPath child directories.</returns> |
| 95 | + /// <remarks>This function performs a quick check to detect the type of skin that is |
| 96 | + /// passed as a parameter. Using this method abstracts knowledge of the actual location |
| 97 | + /// of skins in the file system. |
| 98 | + /// </remarks> |
| 99 | + bool IsGlobalSkin(string skinSrc); |
| 100 | + |
| 101 | + /// <summary>Sets the skin for the specified <paramref name="portalId"/> and <paramref name="skinType"/>.</summary> |
| 102 | + /// <param name="packageType">The type of the skin package.</param> |
| 103 | + /// <param name="portalId">The portal to set the skin for or <c>-1</c> for the global skin.</param> |
| 104 | + /// <param name="skinType">The type of the skin.</param> |
| 105 | + /// <param name="skinSrc">The skin source path.</param> |
| 106 | + void SetSkin(SkinPackageType packageType, int portalId, SkinType skinType, string skinSrc); |
| 107 | + |
| 108 | + /// <summary>Updates a existing skin.</summary> |
| 109 | + /// <param name="skin">The skin to update.</param> |
| 110 | + void UpdateSkin(ISkinInfo skin); |
| 111 | + |
| 112 | + /// <summary>Updates a existing skin package.</summary> |
| 113 | + /// <param name="skinPackage">The skin package to update.</param> |
| 114 | + void UpdateSkinPackage(ISkinPackageInfo skinPackage); |
| 115 | + |
| 116 | + /// <summary>Get all skins for the specified <paramref name="portalInfo"/> within the specified <paramref name="folder"/>.</summary> |
| 117 | + /// <param name="portalInfo">The portal to get the skins for.</param> |
| 118 | + /// <param name="skinRoot">The skin type to search for skins. Default: <see cref="SkinPackageType.Skin"/>.</param> |
| 119 | + /// <param name="folder">The scope to search for skins. Default: <see cref="SkinFolder.All"/>.</param> |
| 120 | + /// <returns>A list of skins.</returns> |
| 121 | + IEnumerable<KeyValuePair<string, string>> GetSkinsInFolder(IPortalInfo portalInfo, SkinType skinRoot = SkinType.Site, SkinFolder folder = SkinFolder.All); |
| 122 | +} |
0 commit comments