Example #1
0
        internal static void AddAdminPage(TabController tabCtl, PortalInfo portal)
        {
            try
            {
                var desktopModule = DesktopModuleController.GetDesktopModuleByFriendlyName("CloudFlareClearCache Module");
                var pageName      = "CloudFlare Cache";
                var tabPath       = string.Format("//{0}//{1}", portal.PortalID == Null.NullInteger ? "Host" : "Admin", pageName);
                var tabId         = TabController.GetTabByTabPath(portal.PortalID, tabPath, Null.NullString);
                var existTab      = TabController.Instance.GetTab(tabId, portal.PortalID);

                if (existTab == null || existTab.TabID == Null.NullInteger)
                {
                    existTab = Upgrade.AddAdminPage(
                        PortalController.Instance.GetPortal(portal.PortalID),
                        pageName,
                        pageName,
                        "~/Icons/Sigma/Configuration_16X16_Standard.png",
                        "~/Icons/Sigma/Configuration_32X32_Standard.png",
                        true);
                }

                AddModuleToPage(desktopModule, existTab);
            }
            catch (Exception e)
            {
                LogError(e);
                throw;
            }
        }
Example #2
0
        public static void AddAdminPages(string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions)
        {
            var       portalController = new PortalController();
            ArrayList portals          = portalController.GetPortals();

            //Add Page to Admin Menu of all configured Portals
            for (int intPortal = 0; intPortal <= portals.Count - 1; intPortal++)
            {
                var portal = (PortalInfo)portals[intPortal];

                //Create New Admin Page (or get existing one)
                TabInfo newPage = Upgrade.AddAdminPage(portal, tabName, description, tabIconFile, tabIconFileLarge, isVisible);

                //Add Module To Page
                Upgrade.AddModuleToPage(newPage, moduleDefId, moduleTitle, moduleIconFile, inheritPermissions);
                var moduleController = new ModuleController();

                if (newPage != null)
                {
                    foreach (var module in moduleController.GetTabModules(newPage.TabID).Values)
                    {
                        moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true");
                    }
                }
            }
        }
        private static void AddAdminPage(TabController tabCtl, PortalInfo portal)
        {
            var tab = Upgrade.AddAdminPage(
                portal,
                "Hotcakes Administration",
                "Hotcakes Administration",
                "~/Icons/Sigma/Configuration_16X16_Standard.png",
                "~/Icons/Sigma/Configuration_32X32_Standard.png",
                true);

            tab.Url = VirtualPathUtility.ToAbsolute("~/DesktopModules/Hotcakes/Core/Admin/Default.aspx");
            tabCtl.UpdateTab(tab);
        }
        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 void RemoveProVersion()
        {
            //update the tab module to use CE version
            var     tabController    = new TabController();
            var     moduleController = new ModuleController();
            TabInfo newTab;

            var portalController = new PortalController();

            foreach (PortalInfo portal in portalController.GetPortals())
            {
                //Update Site Redirection management page
                var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//SiteRedirectionManagement", Null.NullString);
                if (tabId == Null.NullInteger)
                {
                    newTab = Upgrade.AddAdminPage(portal,
                                                  "Site Redirection Management",
                                                  "Site Redirection Management.",
                                                  "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png",
                                                  "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png",
                                                  true);
                }
                else
                {
                    newTab               = tabController.GetTab(tabId, portal.PortalID, true);
                    newTab.IconFile      = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_16x16.png";
                    newTab.IconFileLarge = "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png";
                    tabController.UpdateTab(newTab);
                }

                //Remove Pro edition module
                int moduleID = Null.NullInteger;
                IDictionary <int, ModuleInfo> modules = moduleController.GetTabModules(newTab.TabID);

                if (modules != null)
                {
                    foreach (ModuleInfo m in modules.Values)
                    {
                        if (m.DesktopModule.FriendlyName == "Site Redirection Management")
                        {
                            moduleID = m.ModuleID;
                            break;
                        }
                    }
                }

                if (moduleID != Null.NullInteger)
                {
                    moduleController.DeleteTabModule(newTab.TabID, moduleID, false);
                }

                //Add community edition module
                ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Site Redirection Management");
                if (mDef != null)
                {
                    Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Site Redirection Management", "~/desktopmodules/MobileManagement/images/MobileManagement_Standard_32x32.png", true);
                }
            }

            var package = PackageController.GetPackageByName("DotNetNuke.Professional.MobileManagement");

            if (package != null)
            {
                var installer = new Installer(package, Globals.ApplicationMapPath);
                installer.UnInstall(true);
            }
        }
        private void RemoveProVersion()
        {
            //update the tab module to use CE version
            var     tabController    = new TabController();
            var     moduleController = new ModuleController();
            TabInfo newTab;

            var portalController = new PortalController();

            foreach (PortalInfo portal in portalController.GetPortals())
            {
                //Update Site Redirection management page
                var tabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//DevicePreviewManagement", Null.NullString);
                if (tabId == Null.NullInteger)
                {
                    newTab = Upgrade.AddAdminPage(portal,
                                                  "Device Preview Management",
                                                  "Device Preview Management.",
                                                  "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png",
                                                  "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png",
                                                  true);
                }
                else
                {
                    newTab               = tabController.GetTab(tabId, portal.PortalID, true);
                    newTab.IconFile      = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_16X16.png";
                    newTab.IconFileLarge = "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png";
                    tabController.UpdateTab(newTab);
                }

                //Remove Pro edition module
                int moduleID = Null.NullInteger;
                IDictionary <int, ModuleInfo> modules = moduleController.GetTabModules(newTab.TabID);

                if (modules != null)
                {
                    foreach (ModuleInfo m in modules.Values)
                    {
                        if (m.DesktopModule.FriendlyName == "Device Preview Management")
                        {
                            moduleID = m.ModuleID;
                            break;
                        }
                    }
                }

                if (moduleID != Null.NullInteger)
                {
                    moduleController.DeleteTabModule(newTab.TabID, moduleID, false);
                }

                //Add community edition module
                ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("DNN Device Preview Management");
                if (mDef != null)
                {
                    Upgrade.AddModuleToPage(newTab, mDef.ModuleDefID, "Device Preview Management", "~/desktopmodules/DevicePreviewManagement/images/DevicePreview_Standard_32X32.png", true);
                }

                //reset default devices created flag
                string defaultPreviewProfiles;
                var    settings = PortalController.GetPortalSettingsDictionary(portal.PortalID);
                if (settings.TryGetValue("DefPreviewProfiles_Created", out defaultPreviewProfiles) && defaultPreviewProfiles == "DNNCORP.CE")
                {
                    PortalController.DeletePortalSetting(portal.PortalID, "DefPreviewProfiles_Created");
                }
            }

            var package = PackageController.Instance.GetExtensionPackage(Null.NullInteger, p => p.Name == "DotNetNuke.Professional.PreviewProfileManagement");

            if (package != null)
            {
                var installer = new Installer(package, Globals.ApplicationMapPath);
                installer.UnInstall(true);
            }
        }