Ejemplo n.º 1
0
        /// <summary>Called when a module is upgraded.</summary>
        /// <param name="version">The version.</param>
        /// <returns>Success if all goes well, otherwise, Failed</returns>
        public string UpgradeModule(string version)
        {
            try
            {
                switch (version)
                {
                case "07.04.00":
                    const string ResourceFile    = ModuleFolder + "/App_LocalResources/ProviderConfiguration.ascx.resx";
                    string       pageName        = Localization.GetString("HTMLEditorPageName", ResourceFile);
                    string       pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile);

                    // Create HTML Editor Config Page (or get existing one)
                    TabInfo editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", false);

                    // Find the RadEditor control and remove it
                    Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false);

                    // Add Module To Page
                    int moduleDefId = this.GetModuleDefinitionID("DotNetNuke.HtmlEditorManager", "Html Editor Management");
                    Upgrade.AddModuleToPage(editorPage, moduleDefId, pageName, ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.HtmlEditorManager")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }

                    break;

                case "09.01.01":
                    if (RadEditorProviderInstalled())
                    {
                        UpdateRadCfgFiles();
                    }
                    if (TelerikAssemblyExists())
                    {
                        UpdateWebConfigFile();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                var xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
        private void AddHostPage()
        {
            var hostTab = Upgrade.AddHostPage(
                "Hotcakes Administration",
                "Hotcakes Administration",
                "~/Icons/Sigma/Configuration_16X16_Standard.png",
                "~/Icons/Sigma/Configuration_32X32_Standard.png",
                true);

            hostTab.Url = VirtualPathUtility.ToAbsolute("~/DesktopModules/Hotcakes/Core/Admin/Default.aspx");
            new TabController().UpdateTab(hostTab);
        }
Ejemplo n.º 3
0
        public string UpgradeModule(string version)
        {
            try
            {
                switch (version)
                {
                case "07.01.00":
                    ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Digital Asset Management");

                    // Add tab to Admin Menu
                    if (mDef != null)
                    {
                        var hostPage = Upgrade.AddHostPage(
                            "File Management",
                            "Manage assets.",
                            "~/Icons/Sigma/Files_16X16_Standard.png",
                            "~/Icons/Sigma/Files_32X32_Standard.png",
                            true);

                        // Add module to page
                        Upgrade.AddModuleToPage(hostPage, mDef.ModuleDefID, "File Management", "~/Icons/Sigma/Files_32X32_Standard.png", true);

                        Upgrade.AddAdminPages(
                            "File Management",
                            "Manage assets within the portal",
                            "~/Icons/Sigma/Files_16X16_Standard.png",
                            "~/Icons/Sigma/Files_32X32_Standard.png",
                            true,
                            mDef.ModuleDefID,
                            "File Management",
                            "~/Icons/Sigma/Files_16X16_Standard.png",
                            true);
                    }

                    // Remove Host File Manager page
                    Upgrade.RemoveHostPage("File Manager");

                    // Remove Admin File Manager Pages
                    Upgrade.RemoveAdminPages("//Admin//FileManager");

                    break;
                }

                return("Success");
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Version"></param>
        /// <returns></returns>
        /// <remarks>This is not localizing Page Name or description.</remarks>
        public string UpgradeModule(string Version)
        {
            try
            {
                switch (Version)
                {
                case "06.00.00":
                    string resourceFile    = ModuleFolder + "/App_LocalResources/ProviderConfig.ascx.resx";
                    string pageName        = Localization.GetString("HTMLEditorPageName", resourceFile);
                    string pageDescription = Localization.GetString("HTMLEditorPageDescription", resourceFile);

                    //Create Rad Editor Config Page (or get existing one)
                    TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true);

                    //Add Module To Page
                    int moduleDefId = GetModuleDefinitionID();
                    Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }
                    break;

                case "07.00.06":
                    UpdateConfigOfLinksType();
                    break;

                case "07.03.00":
                    UpdateConfigFilesName();
                    UpdateToolsFilesName();
                    break;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogController xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <param name="ModuleID">The Id of the module to be exported</param>
        /// -----------------------------------------------------------------------------
        //public string ExportModule(int ModuleID)
        //{
        //string strXML = "";

        //List<OpenBlocksInfo> colOpenBlockss = GetOpenBlockss(ModuleID);
        //if (colOpenBlockss.Count != 0)
        //{
        //    strXML += "<OpenBlockss>";

        //    foreach (OpenBlocksInfo objOpenBlocks in colOpenBlockss)
        //    {
        //        strXML += "<OpenBlocks>";
        //        strXML += "<content>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objOpenBlocks.Content) + "</content>";
        //        strXML += "</OpenBlocks>";
        //    }
        //    strXML += "</OpenBlockss>";
        //}

        //return strXML;

        //	throw new System.NotImplementedException("The method or operation is not implemented.");
        //}

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ImportModule implements the IPortable ImportModule Interface
        /// </summary>
        /// <param name="ModuleID">The Id of the module to be imported</param>
        /// <param name="Content">The content to be imported</param>
        /// <param name="Version">The version of the module to be imported</param>
        /// <param name="UserId">The Id of the user performing the import</param>
        /// -----------------------------------------------------------------------------
        //public void ImportModule(int ModuleID, string Content, string Version, int UserID)
        //{
        //XmlNode xmlOpenBlockss = DotNetNuke.Common.Globals.GetContent(Content, "OpenBlockss");
        //foreach (XmlNode xmlOpenBlocks in xmlOpenBlockss.SelectNodes("OpenBlocks"))
        //{
        //    OpenBlocksInfo objOpenBlocks = new OpenBlocksInfo();
        //    objOpenBlocks.ModuleId = ModuleID;
        //    objOpenBlocks.Content = xmlOpenBlocks.SelectSingleNode("content").InnerText;
        //    objOpenBlocks.CreatedByUser = UserID;
        //    AddOpenBlocks(objOpenBlocks);
        //}

        //	throw new System.NotImplementedException("The method or operation is not implemented.");
        //}

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// GetSearchItems implements the ISearchable Interface
        /// </summary>
        /// <param name="ModInfo">The ModuleInfo for the module to be Indexed</param>
        /// -----------------------------------------------------------------------------
        //public DotNetNuke.Services.Search.SearchItemInfoCollection GetSearchItems(DotNetNuke.Entities.Modules.ModuleInfo ModInfo)
        //{
        //SearchItemInfoCollection SearchItemCollection = new SearchItemInfoCollection();

        //List<OpenBlocksInfo> colOpenBlockss = GetOpenBlockss(ModInfo.ModuleID);

        //foreach (OpenBlocksInfo objOpenBlocks in colOpenBlockss)
        //{
        //    SearchItemInfo SearchItem = new SearchItemInfo(ModInfo.ModuleTitle, objOpenBlocks.Content, objOpenBlocks.CreatedByUser, objOpenBlocks.CreatedDate, ModInfo.ModuleID, objOpenBlocks.ItemId.ToString(), objOpenBlocks.Content, "ItemId=" + objOpenBlocks.ItemId.ToString());
        //    SearchItemCollection.Add(SearchItem);
        //}

        //return SearchItemCollection;

        //	throw new System.NotImplementedException("The method or operation is not implemented.");
        //}

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// UpgradeModule implements the IUpgradeable Interface
        /// </summary>
        /// <param name="Version">The current version of the module</param>
        /// -----------------------------------------------------------------------------
        public string UpgradeModule(string Version)
        {
            string result = "";

            try
            {
                switch (Version)
                {
                case "00.00.01":


                    ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("OpenTemplateStudio");

                    //Add tab to Admin Menu
                    if (mDef != null)
                    {
                        var hostPage = Upgrade.AddHostPage("Template Studio",
                                                           "Open Template Studio",
                                                           "~/DesktopModules/OpenBlocks/Files_16X16_Standard.png",
                                                           "~/Icons/Sigma/Files_32X32_Standard.png",
                                                           true);

                        //Add module to page
                        Upgrade.AddModuleToPage(hostPage, mDef.ModuleDefID, "Open Template Studio", "~/Icons/Sigma/Files_32X32_Standard.png", true);

                        /*
                         * Upgrade.AddAdminPages("File Management",
                         *                   "Manage assets within the portal",
                         *                   "~/Icons/Sigma/Files_16X16_Standard.png",
                         *                   "~/Icons/Sigma/Files_32X32_Standard.png",
                         *                   true,
                         *                   mDef.ModuleDefID,
                         *                   "File Management",
                         *                   "~/Icons/Sigma/Files_16X16_Standard.png",
                         *                   true);
                         */
                        result = hostPage == null ? "host page null" : "host page created";
                    }

                    break;
                }
                return("Success : " + result);
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Ejemplo n.º 6
0
        public string UpgradeModule(string version)
        {
            try
            {
                var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(Globals.ModuleFriendlyName);
                if (moduleDefinition == null)
                {
                    return("Success");
                }

                const string tabName          = "DNN Dev Tools";
                const string description      = "Manage DNN Dev Tools";
                const string moduleTitle      = "DNN Dev Tools";
                const string tabIconFile      = "~/Icons/Sigma/Files_16X16_Standard.png";
                const string tabIconFileLarge = "~/Icons/Sigma/Files_32X32_Standard.png";

                // Add host page
                var hostPage = Upgrade.AddHostPage(
                    tabName,
                    description,
                    tabIconFile,
                    tabIconFileLarge,
                    true);

                // Restore host page (if it has been deleted)
                if (hostPage.IsDeleted)
                {
                    hostPage.IsDeleted = false;
                    new TabController().UpdateTab(hostPage);
                }

                // Add module to host page
                Upgrade.AddModuleToPage(
                    hostPage,
                    moduleDefinition.ModuleDefID,
                    moduleTitle,
                    tabIconFile,
                    true
                    );

                return("Success");
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Upgrades the module.
        /// </summary>
        /// <param name="version">The <paramref name="version"/> number string.</param>
        /// <returns>Returns if Upgrade was Success fully or not</returns>
        public string UpgradeModule(string version)
        {
            try
            {
                const string ResourceFile =
                    "~/Providers/HtmlEditorProviders/CKEditor/Module/App_LocalResources/EditorConfigManager.ascx.resx";

                var pageName        = Localization.GetString("EditorMangerPageName.Text", ResourceFile);
                var moduleTitle     = Localization.GetString("EditorMangerName.Text", ResourceFile);
                var pageDescription = Localization.GetString("EditorMangerPageDescription.Text", ResourceFile);

                // Remove wrongly created Host Page
                Upgrade.RemoveHostPage(moduleTitle);

                // Create Config Page (or get existing one)
                var editorManagerPage = Upgrade.AddHostPage(
                    pageName,
                    pageDescription,
                    "~/Providers/HtmlEditorProviders/CKEditor/images/editor_config_small.png",
                    "~/Providers/HtmlEditorProviders/CKEditor/images/editor_config_large.png",
                    true);

                // Add Module To Page
                var moduleDefId = GetModuleDefinitionID();

                Upgrade.AddModuleToPage(
                    editorManagerPage,
                    moduleDefId,
                    moduleTitle,
                    "~/Providers/HtmlEditorProviders/CKEditor/CKEditorConfig.png",
                    true);
            }
            catch (Exception ex)
            {
                new ExceptionLogController().AddLog(ex);

                return("Failed");
            }

            return("Success");
        }
        internal static void AddDesktopModulePageToPortal(DesktopModuleInfo desktopModule, string pageName, int portalId, ref bool createdNewPage, ref bool addedNewModule)
        {
            var     tabPath  = string.Format("//{0}//{1}", portalId == Null.NullInteger ? "Host" : "Admin", pageName);
            var     tabId    = TabController.GetTabByTabPath(portalId, tabPath, Null.NullString);
            TabInfo existTab = TabController.Instance.GetTab(tabId, portalId);

            if (existTab == null)
            {
                if (portalId == Null.NullInteger)
                {
                    existTab = Upgrade.AddHostPage(
                        pageName,
                        desktopModule.Page.Description,
                        desktopModule.Page.Icon,
                        desktopModule.Page.LargeIcon,
                        true);
                }
                else
                {
                    existTab = Upgrade.AddAdminPage(
                        PortalController.Instance.GetPortal(portalId),
                        pageName,
                        desktopModule.Page.Description,
                        desktopModule.Page.Icon,
                        desktopModule.Page.LargeIcon,
                        true);
                }

                createdNewPage = true;
            }

            if (existTab != null)
            {
                if (desktopModule.Page.IsCommon)
                {
                    TabController.Instance.UpdateTabSetting(existTab.TabID, "ControlBar_CommonTab", "Y");
                }

                AddDesktopModuleToPage(desktopModule, existTab, ref addedNewModule);
            }
        }
        private static void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon, bool isVisible = true)
        {
            var     tabController    = new TabController();
            var     moduleController = new ModuleController();
            TabInfo hostTab;

            // Get the module definition
            var moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);

            // Add pages
            var tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);

            if (tabId == Null.NullInteger)
            {
                //Add host page
                hostTab          = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, isVisible);
                hostTab.ParentId = parentId;
                tabController.UpdateTab(hostTab);

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
            else
            {
                hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
                foreach (
                    var kvp in
                    moduleController.GetTabModules(tabId)
                    .Where(kvp => kvp.Value.DesktopModule.ModuleName == moduleFriendlyName))
                {
                    // Remove previous module instance
                    moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
                    break;
                }

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="version"></param>
        /// <returns></returns>
        public string UpgradeModule(string version)
        {
            try
            {
                switch (version)
                {
                case "08.00.00":
                    ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Vendors");
                    if (moduleDefinition != null)
                    {
                        var hostPage = Upgrade.AddHostPage("Vendors",
                                                           "Manage vendor accounts, banner advertising and affiliate referrals within the portal.",
                                                           "~/Icons/Sigma/Vendors_16X16_Standard.png",
                                                           "~/Icons/Sigma/Vendors_32X32_Standard.png",
                                                           true);

                        //Add module to page
                        Upgrade.AddModuleToPage(hostPage, moduleDefinition.ModuleDefID, "Vendors", "~/Icons/Sigma/Vendors_32X32_Standard.png", true);

                        //Add Module to Admin Page for all Portals
                        Upgrade.AddAdminPages("Vendors",
                                              "Manage vendor accounts, banner advertising and affiliate referrals within the portal.",
                                              "~/Icons/Sigma/Vendors_16X16_Standard.png",
                                              "~/Icons/Sigma/Vendors_32X32_Standard.png",
                                              true,
                                              moduleDefinition.ModuleDefID,
                                              "Vendors",
                                              "~/Icons/Sigma/Vendors_32X32_Standard.png",
                                              true);
                    }
                    break;
                }
                return("Success");
            }
            catch (Exception)
            {
                return("Failed");
            }
        }
Ejemplo n.º 11
0
        public void AddHostPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon)
        {
            var     tabController    = new TabController();
            var     moduleController = new ModuleController();
            TabInfo hostTab;

            //Get web servers module
            ModuleDefinitionInfo moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName);

            //Add Pages under Advanced Features Tab
            int tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString);

            if (tabId == Null.NullInteger)
            {
                //Add host page
                hostTab          = Upgrade.AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true);
                hostTab.ParentId = parentId;
                tabController.UpdateTab(hostTab);

                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
            else
            {
                hostTab = tabController.GetTab(tabId, Null.NullInteger, false);
                foreach (var kvp in moduleController.GetTabModules(tabId))
                {
                    if (kvp.Value.DesktopModule.ModuleName == "ProfessionalPreview")
                    {
                        //Preview module so hard delete
                        moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false);
                        break;
                    }
                }
                //Add module to page
                Upgrade.AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true);
            }
        }
Ejemplo n.º 12
0
        private static void AddClientResourceAdminHostPage()
        {
            DesktopModuleInfo    desktopModule    = DesktopModuleController.GetDesktopModuleByModuleName(Constants.ModuleName, Null.NullInteger);
            ModuleDefinitionInfo moduleDefinition = desktopModule.ModuleDefinitions[Constants.ModuleDefinitionName];

            // Remove the page if it already exists to ensure the page can be added.
            // Handles cases where the page has been removed by the user.
            try
            {
                Upgrade.RemoveHostPage(Localization.GetString("PageName", ResourceFileRelativePath));
            }
            catch
            {
                // Do nothing.
            }

            TabInfo hostPage = Upgrade.AddHostPage(Localization.GetString("PageName", ResourceFileRelativePath),
                                                   Localization.GetString("PageDescription", ResourceFileRelativePath),
                                                   Constants.ConfigIconFileThumbNail,
                                                   Constants.ConfigIconFileLarge, true);

            Upgrade.AddModuleToPage(hostPage, moduleDefinition.ModuleDefID, Localization.GetString("ModuleTitle", ResourceFileRelativePath), Constants.ConfigIconFileLarge, true);
        }
Ejemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Version"></param>
        /// <returns></returns>
        /// <remarks>This is not localizing Page Name or description.</remarks>
        public string UpgradeModule(string Version)
        {
            try
            {
                var pageName        = Localization.GetString("HTMLEditorPageName", ResourceFile);
                var pageDescription = Localization.GetString("HTMLEditorPageDescription", ResourceFile);

                switch (Version)
                {
                case "06.00.00":

                    //Create Rad Editor Config Page (or get existing one)
                    TabInfo newPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/radeditor_config_small.png", ModuleFolder + "/images/radeditor_config_large.png", true);

                    //Add Module To Page
                    int moduleDefId = GetModuleDefinitionID();
                    Upgrade.AddModuleToPage(newPage, moduleDefId, pageName, ModuleFolder + "/images/radeditor_config_large.png", true);

                    foreach (var item in DesktopModuleController.GetDesktopModules(Null.NullInteger))
                    {
                        DesktopModuleInfo moduleInfo = item.Value;

                        if (moduleInfo.ModuleName == "DotNetNuke.RadEditorProvider")
                        {
                            moduleInfo.Category = "Host";
                            DesktopModuleController.SaveDesktopModule(moduleInfo, false, false);
                        }
                    }
                    break;

                case "07.00.06":
                    UpdateConfigOfLinksType();
                    break;

                case "07.03.00":
                    UpdateConfigFilesName();
                    UpdateToolsFilesName();
                    break;

                case "07.04.00":
                    // Find the RadEditor page.  It should already exist and this will return it's reference.
                    var editorPage = Upgrade.AddHostPage(pageName, pageDescription, ModuleFolder + "/images/HtmlEditorManager_Standard_16x16.png", ModuleFolder + "/images/HtmlEditorManager_Standard_32x32.png", true);

                    // If the Html Editor Manager is installed, then remove the old RadEditor Manager
                    var htmlEditorManager = DesktopModuleController.GetDesktopModuleByModuleName("DotNetNuke.HtmlEditorManager", Null.NullInteger);
                    if (htmlEditorManager != null)
                    {
                        Upgrade.RemoveModule("RadEditor Manager", editorPage.TabName, editorPage.ParentId, false);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ExceptionLogController xlc = new ExceptionLogController();
                xlc.AddLog(ex);

                return("Failed");
            }

            return("Success");
        }