diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Components/PagesControllerImpl.cs b/Extensions/Content/Dnn.PersonaBar.Pages/Components/PagesControllerImpl.cs index 13db21ff5..7ce7c7e5e 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Components/PagesControllerImpl.cs +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Components/PagesControllerImpl.cs @@ -797,6 +797,25 @@ protected virtual void UpdateTabInfoFromPageSettings(TabInfo tab, PageSettings p } } } + + // icons + if (pageSettings.IconFile != null && pageSettings.IconFile.fileId > 0) + { + tab.IconFile = FileManager.Instance.GetFile(pageSettings.IconFile.fileId).RelativePath; + } + else + { + tab.IconFile = null; + } + if (pageSettings.IconFileLarge != null && pageSettings.IconFileLarge.fileId > 0) + { + tab.IconFileLarge = FileManager.Instance.GetFile(pageSettings.IconFileLarge.fileId).RelativePath; + } + else + { + tab.IconFileLarge = null; + } + } private string GetContainerSrc(PageSettings pageSettings) @@ -1047,6 +1066,30 @@ public PageSettings GetPageSettings(int pageId, PortalSettings requestPortalSett page.PrimaryAliasId = GetPrimaryAliasId(portalSettings.PortalId, portalSettings.CultureCode); page.Locales = GetLocales(portalSettings.PortalId); page.HasParent = tab.ParentId > -1; + + // icons + var iconFile = string.IsNullOrEmpty(tab.IconFile) ? null : FileManager.Instance.GetFile(tab.PortalID, tab.IconFileRaw); + if (iconFile != null) { + page.IconFile = new FileDto + { + fileId = iconFile.FileId, + fileName = iconFile.FileName, + folderId = iconFile.FolderId, + folderPath = iconFile.Folder + }; + } + var iconFileLarge = string.IsNullOrEmpty(tab.IconFileLarge) ? null : FileManager.Instance.GetFile(tab.PortalID, tab.IconFileLargeRaw); + if (iconFileLarge != null) + { + page.IconFileLarge = new FileDto + { + fileId = iconFileLarge.FileId, + fileName = iconFileLarge.FileName, + folderId = iconFileLarge.FolderId, + folderPath = iconFileLarge.Folder + }; + } + return page; } diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Dnn.PersonaBar.Pages.csproj b/Extensions/Content/Dnn.PersonaBar.Pages/Dnn.PersonaBar.Pages.csproj index fc3e81b8b..54a933dec 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Dnn.PersonaBar.Pages.csproj +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Dnn.PersonaBar.Pages.csproj @@ -157,6 +157,7 @@ + diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/.eslintskipwords.js b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/.eslintskipwords.js index e4fbb139b..8515ac20e 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/.eslintskipwords.js +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/.eslintskipwords.js @@ -150,5 +150,8 @@ module.exports = [ "flyout", "Flyout", "interactor", - "cloneDeep" + "cloneDeep", + "bmp", + "xml", + "filesystem" ] diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageDetails.jsx b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageDetails.jsx index 1c78337ad..d788b74c1 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageDetails.jsx +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageDetails.jsx @@ -4,6 +4,7 @@ import {connect} from "react-redux"; import PageStandard from "./PageStandard/PageStandard"; import PageUrl from "./PageUrl/PageUrl"; import PageDetailsFooter from "./PageDetailsFooter/PageDetailsFooter"; +import PageIcons from "./PageIcons/PageIcons"; class PageDetail extends Component { @@ -27,6 +28,7 @@ class PageDetail extends Component { return (
+
); @@ -43,7 +45,7 @@ PageDetail.propTypes = { const mapStateToProps = (state) => { return { - page: state.pages.selectedPage + page: state.pages.selectedPage }; }; diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/PageIcons.jsx b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/PageIcons.jsx new file mode 100644 index 000000000..bc5f07f75 --- /dev/null +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/PageIcons.jsx @@ -0,0 +1,100 @@ +import React, {Component} from "react"; +import PropTypes from "prop-types"; +import FileUpload from 'dnn-file-upload'; +import GridSystem from "dnn-grid-system"; +import GridCell from "dnn-grid-cell"; +import Label from 'dnn-label'; +import Localization from '../../../localization'; +import util from '../../../utils'; +import styles from './styles.less'; + +export default class PageIcons extends Component { + constructor(props) { + super(props); + } + + onChangeIcon(key, fileInfo) { + const {onChangeField} = this.props; + onChangeField(key, fileInfo); + } + + render() { + const {props} = this; + util.utilities = util.getUtilities(); + return ( +
+ + + + + + +
+ ); + } +} + +PageIcons.propTypes = { + page: PropTypes.object.isRequired, + errors: PropTypes.object.isRequired, + onChangeField: PropTypes.func.isRequired, + components: PropTypes.func.isRequired +}; \ No newline at end of file diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/styles.less b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/styles.less new file mode 100644 index 000000000..9e7abdb99 --- /dev/null +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/components/PageDetails/PageIcons/styles.less @@ -0,0 +1,25 @@ +@import "../../../less/globals.less"; +@import "~dnn-global-styles/index"; +:local(.pageIcons) { + .dnn-file-upload{ + width:100%; + .file-upload-container{ + .drop-down{ + margin-bottom: 7px; + } + } + } + .dnn-grid-system { + margin-top:15px; + margin-bottom:15px; + .left-column{ + padding-right:15px; + } + .right-column{ + padding-left:15px; + } + } + .dnn-label{ + padding-bottom:10px; + } +} \ No newline at end of file diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/services/pageService.js b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/services/pageService.js index 773fa21ea..9f584b3f7 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/services/pageService.js +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Pages.Web/src/services/pageService.js @@ -91,6 +91,8 @@ const PageService = function () { page.hasParent = parentPage && typeof parentPage !== "function" && parentPage.id || page.hasParent; page.hierarchy = parentPage && typeof parentPage !== "function" && parentPage.id && parentPage.name || page.hierarchy; page.parentId = parentPage && typeof parentPage !== "function" && parentPage.id || page.parentId; + page.iconFile = null; + page.iconFileLarge = null; return page; }); }; diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/FileDto.cs b/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/FileDto.cs new file mode 100644 index 000000000..b5fd3bc9c --- /dev/null +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/FileDto.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Dnn.PersonaBar.Pages.Services.Dto +{ + [JsonObject] + public class FileDto + { + public int fileId { get; set; } + public string fileName { get; set; } + public int folderId { get; set; } + public string folderPath { get; set; } + } +} \ No newline at end of file diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/PageSettings.cs b/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/PageSettings.cs index e5cc82aed..73fbcc7a8 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/PageSettings.cs +++ b/Extensions/Content/Dnn.PersonaBar.Pages/Services/Dto/PageSettings.cs @@ -175,5 +175,11 @@ public class PageSettings [DataMember(Name = "isspecial")] public bool IsSpecial { get; set; } + + [DataMember(Name = "iconFile")] + public FileDto IconFile { get; set; } + + [DataMember(Name = "iconFileLarge")] + public FileDto IconFileLarge { get; set; } } } \ No newline at end of file diff --git a/Extensions/Content/Dnn.PersonaBar.Pages/admin/personaBar/App_LocalResources/Pages.resx b/Extensions/Content/Dnn.PersonaBar.Pages/admin/personaBar/App_LocalResources/Pages.resx index a965e060a..9af07c737 100644 --- a/Extensions/Content/Dnn.PersonaBar.Pages/admin/personaBar/App_LocalResources/Pages.resx +++ b/Extensions/Content/Dnn.PersonaBar.Pages/admin/personaBar/App_LocalResources/Pages.resx @@ -1690,4 +1690,16 @@ Edit Content + + The page icon is an image that may be used by your theme or menu system for each page + + + Small Icon + + + The page icon is an image that may be used by your theme or menu system for each page + + + Large Icon + \ No newline at end of file