示例#1
0
        private static void AddConsoleModuleSettings(int tabID, int moduleID)
        {
            ModuleController modCtrl = new ModuleController();

            modCtrl.UpdateModuleSetting(moduleID, "DefaultSize", "IconFileLarge");
            modCtrl.UpdateModuleSetting(moduleID, "AllowSizeChange", "False");
            modCtrl.UpdateModuleSetting(moduleID, "DefaultView", "Hide");
            modCtrl.UpdateModuleSetting(moduleID, "AllowViewChange", "False");
            modCtrl.UpdateModuleSetting(moduleID, "ShowTooltip", "True");
        }
 public void ImportModule(int ModuleID, string Content, string Version, int UserId)
 {
     XmlNode xmlSettings = Globals.GetContent(Content, "ConsoleSettings");
     ModuleController moduleCtrl = new ModuleController();
     foreach (string key in _SettingKeys)
     {
         XmlNode node = xmlSettings.SelectSingleNode(key);
         bool doUpdate = true;
         string value = string.Empty;
         try
         {
             if ((node == null))
             {
                 doUpdate = false;
             }
             else
             {
                 value = node.InnerText;
                 switch (key)
                 {
                     case "ParentTabID":
                         int parentTabID = int.Parse(value);
                         TabInfo tabInfo = new TabController().GetTab(parentTabID, PortalController.GetCurrentPortalSettings().PortalId, false);
                         break;
                     case "DefaultSize":
                         doUpdate = GetSizeValues().Contains(value);
                         break;
                     case "DefaultView":
                         doUpdate = GetViewValues().Contains(value);
                         break;
                     case "AllowSizeChange":
                     case "AllowViewChange":
                     case "ShowTooltip":
                         bool.Parse(value);
                         break;
                 }
             }
         }
         catch (Exception ex)
         {
             ex.ToString();
             Exceptions.LogException(new Exception("Unable to import value [" + key + "] for Console Module moduleid [" + ModuleID.ToString() + "]"));
             doUpdate = false;
         }
         if ((doUpdate))
         {
             moduleCtrl.UpdateModuleSetting(ModuleID, key, value);
         }
     }
 }
示例#3
0
        private static void UpgradeToVersion_510()
        {
            //Upgrade to .NET 3.5
            TryUpgradeNETFramework();

            PortalController objPortalController = new PortalController();
            TabController objTabController = new TabController();
            ModuleController objModuleController = new ModuleController();
            int ModuleDefID = 0;
            int ModuleID = 0;

            //add Dashboard module and tab
            if (HostTabExists("Dashboard") == false)
            {
                ModuleDefID = AddModuleDefinition("Dashboard", "Provides a snapshot of your DotNetNuke Application.", "Dashboard", true, true);
                AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Dashboard/Dashboard.ascx", "icon_dashboard_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "Export", "", "DesktopModules/Admin/Dashboard/Export.ascx", "", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "DashboardControls", "", "DesktopModules/Admin/Dashboard/DashboardControls.ascx", "", SecurityAccessLevel.Host, 0);

                //Create New Host Page (or get existing one)
                TabInfo dashboardPage = AddHostPage("Dashboard", "Summary view of application and site settings.", "~/images/icon_dashboard_16px.gif", "~/images/icon_dashboard_32px.gif", true);

                //Add Module To Page
                AddModuleToPage(dashboardPage, ModuleDefID, "Dashboard", "~/images/icon_dashboard_32px.gif");
            }
            else
            {
                //Module was incorrectly assigned as "IsPremium=False"
                RemoveModuleFromPortals("Dashboard");
                //fix path for dashboarcontrols
                ModuleDefID = GetModuleDefinition("Dashboard", "Dashboard");
                RemoveModuleControl(ModuleDefID, "DashboardControls");
                AddModuleControl(ModuleDefID, "DashboardControls", "", "DesktopModules/Admin/Dashboard/DashboardControls.ascx", "", SecurityAccessLevel.Host, 0);
            }

            //Add the Extensions Module
            if (CoreModuleExists("Extensions") == false)
            {
                ModuleDefID = AddModuleDefinition("Extensions", "", "Extensions");
                AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Extensions/Extensions.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.View, 0);
                AddModuleControl(ModuleDefID, "Edit", "Edit Feature", "DesktopModules/Admin/Extensions/EditExtension.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Edit, 0);
                AddModuleControl(ModuleDefID, "PackageWriter", "Package Writer", "DesktopModules/Admin/Extensions/PackageWriter.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "EditControl", "Edit Control", "DesktopModules/Admin/Extensions/Editors/EditModuleControl.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "ImportModuleDefinition", "Import Module Definition", "DesktopModules/Admin/Extensions/Editors/ImportModuleDefinition.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "BatchInstall", "Batch Install", "DesktopModules/Admin/Extensions/BatchInstall.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "NewExtension", "New Extension Wizard", "DesktopModules/Admin/Extensions/ExtensionWizard.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0);
                AddModuleControl(ModuleDefID, "UsageDetails", "Usage Information", "DesktopModules/Admin/Extensions/UsageDetails.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0, "", true);
            }
            else
            {
                ModuleDefID = GetModuleDefinition("Extensions", "Extensions");
                RemoveModuleControl(ModuleDefID, "EditLanguage");
                RemoveModuleControl(ModuleDefID, "TimeZone");
                RemoveModuleControl(ModuleDefID, "Verify");
                RemoveModuleControl(ModuleDefID, "LanguageSettings");
                RemoveModuleControl(ModuleDefID, "EditResourceKey");
                RemoveModuleControl(ModuleDefID, "EditSkins");
                AddModuleControl(ModuleDefID, "UsageDetails", "Usage Information", "DesktopModules/Admin/Extensions/UsageDetails.ascx", "~/images/icon_extensions_32px.gif", SecurityAccessLevel.Host, 0, "", true);

                //Module was incorrectly assigned as "IsPremium=False"
                RemoveModuleFromPortals("Extensions");
            }

            //Remove Module Definitions Module from Host Page (if present)
            RemoveCoreModule("Module Definitions", "Host", "Module Definitions", false);

            //Remove old Module Definition Validator module
            DesktopModuleController.DeleteDesktopModule("Module Definition Validator");

            //Get Module Definitions
            TabInfo definitionsPage = objTabController.GetTabByName("Module Definitions", Null.NullInteger);

            //Add Module To Page if not present
            ModuleID = AddModuleToPage(definitionsPage, ModuleDefID, "Module Definitions", "~/images/icon_moduledefinitions_32px.gif");
            objModuleController.UpdateModuleSetting(ModuleID, "Extensions_Mode", "Module");

            //Add Extensions Host Page
            TabInfo extensionsPage = AddHostPage("Extensions", "Install, add, modify and delete extensions, such as modules, skins and language packs.", "~/images/icon_extensions_16px.gif", "~/images/icon_extensions_32px.gif", true);

            ModuleID = AddModuleToPage(extensionsPage, ModuleDefID, "Extensions", "~/images/icon_extensions_32px.gif");
            objModuleController.UpdateModuleSetting(ModuleID, "Extensions_Mode", "All");

            //Add Extensions Module to Admin Page for all Portals
            AddAdminPages("Extensions", "Install, add, modify and delete extensions, such as modules, skins and language packs.", "~/images/icon_extensions_16px.gif", "~/images/icon_extensions_32px.gif", true, ModuleDefID, "Extensions", "~/images/icon_extensions_32px.gif");

            //Remove Host Languages Page
            RemoveHostPage("Languages");

            //Remove Admin > Authentication Pages
            RemoveAdminPages("//Admin//Authentication");

            //Remove old Languages module
            DesktopModuleController.DeleteDesktopModule("Languages");

            //Add new Languages module
            ModuleDefID = AddModuleDefinition("Languages", "", "Languages", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Languages/languageeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.View, 0);
            AddModuleControl(ModuleDefID, "Edit", "Edit Language", "DesktopModules/Admin/Languages/EditLanguage.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "EditResourceKey", "Full Language Editor", "DesktopModules/Admin/Languages/languageeditorext.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "LanguageSettings", "Language Settings", "DesktopModules/Admin/Languages/LanguageSettings.ascx", "", SecurityAccessLevel.Edit, 0);
            AddModuleControl(ModuleDefID, "TimeZone", "TimeZone Editor", "DesktopModules/Admin/Languages/timezoneeditor.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Host, 0);
            AddModuleControl(ModuleDefID, "Verify", "Resource File Verifier", "DesktopModules/Admin/Languages/resourceverifier.ascx", "", SecurityAccessLevel.Host, 0);
            AddModuleControl(ModuleDefID, "PackageWriter", "Language Pack Writer", "DesktopModules/Admin/Languages/LanguagePackWriter.ascx", "", SecurityAccessLevel.Host, 0);

            //Add Module to Admin Page for all Portals
            AddAdminPages("Languages", "Manage Language Resources.", "~/images/icon_language_16px.gif", "~/images/icon_language_32px.gif", true, ModuleDefID, "Language Editor", "~/images/icon_language_32px.gif");

            //Remove Host Skins Page
            RemoveHostPage("Skins");

            //Remove old Skins module
            DesktopModuleController.DeleteDesktopModule("Skins");

            //Add new Skins module
            ModuleDefID = AddModuleDefinition("Skins", "", "Skins", false, false);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/Skins/editskins.ascx", "~/images/icon_skins_32px.gif", SecurityAccessLevel.View, 0);

            //Add Module to Admin Page for all Portals
            AddAdminPages("Skins", "Manage Skin Resources.", "~/images/icon_skins_16px.gif", "~/images/icon_skins_32px.gif", true, ModuleDefID, "Skin Editor", "~/images/icon_skins_32px.gif");

            //Remove old Skin Designer module
            DesktopModuleController.DeleteDesktopModule("Skin Designer");
            DesktopModuleController.DeleteDesktopModule("SkinDesigner");

            //Add new Skin Designer module
            ModuleDefID = AddModuleDefinition("Skin Designer", "Allows you to modify skin attributes.", "Skin Designer", true, true);
            AddModuleControl(ModuleDefID, "", "", "DesktopModules/Admin/SkinDesigner/Attributes.ascx", "~/images/icon_skins_32px.gif", SecurityAccessLevel.Host, 0);

            //Add new Skin Designer to every Admin Skins Tab
            AddModuleToPages("//Admin//Skins", ModuleDefID, "Skin Designer", "~/images/icon_skins_32px.gif", true);

            //Remove Admin Whats New Page
            RemoveAdminPages("//Admin//WhatsNew");

            //WhatsNew needs to be set to IsPremium and removed from all portals
            RemoveModuleFromPortals("WhatsNew");

            //Create New WhatsNew Host Page (or get existing one)
            TabInfo newPage = AddHostPage("What's New", "Provides a summary of the major features for each release.", "~/images/icon_whatsnew_16px.gif", "~/images/icon_whatsnew_32px.gif", true);

            //Add WhatsNew Module To Page
            ModuleDefID = GetModuleDefinition("WhatsNew", "WhatsNew");
            AddModuleToPage(newPage, ModuleDefID, "What's New", "~/images/icon_whatsnew_32px.gif");

            //add console module
            ModuleDefID = AddModuleDefinition("Console", "Display children pages as icon links for navigation.", "Console", "DotNetNuke.Modules.Console.Components.ConsoleController", true, false, false);
            AddModuleControl(ModuleDefID, "", "Console", "DesktopModules/Admin/Console/ViewConsole.ascx", "", SecurityAccessLevel.Anonymous, 0);
            AddModuleControl(ModuleDefID, "Settings", "Console Settings", "DesktopModules/Admin/Console/Settings.ascx", "", SecurityAccessLevel.Admin, 0);

            //add console module to host page
            ModuleID = AddModuleToPage("//Host", Null.NullInteger, ModuleDefID, "Basic Features", "", true);
            int tabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host");
            TabInfo tab = null;

            //add console settings for host page
            if ((tabID != Null.NullInteger))
            {
                tab = objTabController.GetTab(tabID, Null.NullInteger, true);
                if (((tab != null)))
                {
                    AddConsoleModuleSettings(tabID, ModuleID);
                }
            }

            //add module to all admin pages
            foreach (PortalInfo portal in objPortalController.GetPortals())
            {
                tabID = TabController.GetTabByTabPath(portal.PortalID, "//Admin");
                if ((tabID != Null.NullInteger))
                {
                    tab = objTabController.GetTab(tabID, portal.PortalID, true);
                    if (((tab != null)))
                    {
                        ModuleID = AddModuleToPage(tab, ModuleDefID, "Basic Features", "", true);
                        AddConsoleModuleSettings(tabID, ModuleID);
                    }
                }
            }

            //Add Google Analytics module
            ModuleDefID = AddModuleDefinition("Google Analytics", "Configure portal Google Analytics settings.", "GoogleAnalytics", false, false);
            AddModuleControl(ModuleDefID, "", "Google Analytics", "DesktopModules/Admin/Analytics/GoogleAnalyticsSettings.ascx", "", SecurityAccessLevel.Admin, 0);
            AddAdminPages("Google Analytics", "Configure portal Google Analytics settings.", "~/images/icon_analytics_16px.gif", "~/images/icon_analytics_32px.gif", true, ModuleDefID, "Google Analytics", "~/images/icon_analytics_32px.gif");
        }