internal static void AddModuleToPage(DesktopModuleInfo desktopModule, TabInfo tab) { try { if (tab.PortalID != Null.NullInteger) { AddDesktopModuleToPortal(tab.PortalID, desktopModule.DesktopModuleID, !desktopModule.IsAdmin, false); } var moduleDefinitions = ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModule.DesktopModuleID).Values; var tabModules = ModuleController.Instance.GetTabModules(tab.TabID).Values; foreach (var moduleDefinition in moduleDefinitions) { if (tabModules.All(m => m.ModuleDefinition.ModuleDefID != moduleDefinition.ModuleDefID)) { Upgrade.AddModuleToPage( tab, moduleDefinition.ModuleDefID, desktopModule.FriendlyName, "~/Icons/Sigma/Configuration_16X16_Standard.png", true); } } } catch (Exception e) { LogError(e); throw; } }
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"); } } } }
internal static void AddDesktopModuleToPage(DesktopModuleInfo desktopModule, TabInfo tab, ref bool addedNewModule) { if (tab.PortalID != Null.NullInteger) { AddDesktopModuleToPortal(tab.PortalID, desktopModule.DesktopModuleID, !desktopModule.IsAdmin, false); } var moduleDefinitions = ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModule.DesktopModuleID).Values; var tabModules = ModuleController.Instance.GetTabModules(tab.TabID).Values; foreach (var moduleDefinition in moduleDefinitions) { if (tabModules.All(m => m.ModuleDefinition.ModuleDefID != moduleDefinition.ModuleDefID)) { Upgrade.AddModuleToPage( tab, moduleDefinition.ModuleDefID, desktopModule.Page.Description, desktopModule.Page.Icon, true); addedNewModule = true; } } }
/// <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"); }
public string UpgradeModule(string Version) { try { switch (Version) { case "06.02.00": var portalController = new PortalController(); var moduleController = new ModuleController(); var tabController = new TabController(); var moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Message Center"); if (moduleDefinition != null) { var portals = portalController.GetPortals(); foreach (PortalInfo portal in portals) { if (portal.UserTabId > Null.NullInteger) { //Find TabInfo var tab = tabController.GetTab(portal.UserTabId, portal.PortalID, true); if (tab != null) { foreach (var module in moduleController.GetTabModules(portal.UserTabId).Values) { if (module.DesktopModule.FriendlyName == "Messaging") { //Delete the Module from the Modules list moduleController.DeleteTabModule(module.TabID, module.ModuleID, false); //Add new module to the page Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "Message Center", "", true); break; } } } } } } break; } return("Success"); } catch (Exception exc) { Logger.Error(exc); return("Failed"); } }
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"); } }
/// <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"); } }
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"); } }
/// <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"); }
/// <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"); } }
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); } }
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); } }
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); }
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); } }
/// <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"); }
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); } }
private void AddUserProfilePage(int portalId, bool setAsPortalUserProfile) { var tabController = new TabController(); var moduleController = new ModuleController(); // Get Azure AD B2C User profile module var moduleFriendlyName = "AzureAD.B2C.UserProfile"; var moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName); //Add User Profile page under root var parentId = TabController.GetTabByTabPath(PortalId, "//", Null.NullString); var tabId = TabController.GetTabByTabPath(PortalId, "//UserProfile", Null.NullString); int moduleId; TabInfo tabInfo; if (tabId == Null.NullInteger) { tabInfo = new TabInfo() { PortalID = PortalId, TabName = "UserProfile", Title = "User Profile", Description = "Manage Azure AD B2C User profile", KeyWords = "profile", IsDeleted = false, IsSuperTab = false, IsVisible = false, DisableLink = false, IconFile = null, SiteMapPriority = 0, Url = null, ParentId = parentId }; tabInfo.TabSettings.Add("AllowIndex", "False"); // Add User Profile page tabId = tabController.AddTab(tabInfo); // Allow access to "Registered Users" role var permissions = new TabPermissionInfo() { AllowAccess = true, RoleID = PortalSettings.RegisteredRoleId, RoleName = PortalSettings.RegisteredRoleName, TabID = tabId, PermissionID = 3 // View }; tabInfo.TabPermissions.Add(permissions, true); PermissionProvider.Instance().SaveTabPermissions(tabInfo); } else { tabInfo = tabController.GetTab(tabId, PortalId, false); foreach (var kvp in moduleController.GetTabModules(tabId)) { if (kvp.Value.DesktopModule.ModuleName == moduleFriendlyName) { // Preview module so hard delete moduleController.DeleteTabModule(tabId, kvp.Value.ModuleID, false); break; } } } //Add module to page moduleId = Upgrade.AddModuleToPage(tabInfo, moduleDef.ModuleDefID, "User Profile", "", true); var moduleTab = moduleController.GetTabModules(tabInfo.TabID) .FirstOrDefault(x => x.Value.ModuleID == moduleId); if (moduleTab.Value != null) { moduleController.UpdateTabModuleSetting(moduleTab.Value.TabModuleID, "hideadminborder", "True"); } // Change User profile page on the Portal settings var portalInfo = PortalController.Instance.GetPortal(PortalId); portalInfo.UserTabId = setAsPortalUserProfile ? tabId : Null.NullInteger; PortalController.Instance.UpdatePortalInfo(portalInfo); }
public string UpgradeModule(string Version) { try { switch (Version) { case "01.00.00": ModuleDefinitionInfo moduleDefinition = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Messaging"); if (moduleDefinition != null) { //Add Module to User Profile Page for all Portals var objPortalController = new PortalController(); var objTabController = new TabController(); var objModuleController = new ModuleController(); ArrayList portals = objPortalController.GetPortals(); foreach (PortalInfo portal in portals) { int tabID = TabController.GetTabByTabPath(portal.PortalID, "//UserProfile", Null.NullString); if ((tabID != Null.NullInteger)) { TabInfo tab = objTabController.GetTab(tabID, portal.PortalID, true); if ((tab != null)) { int moduleId = Upgrade.AddModuleToPage(tab, moduleDefinition.ModuleDefID, "My Inbox", "", true); ModuleInfo objModule = objModuleController.GetModule(moduleId, tabID, false); var settings = new PortalSettings(portal); var modulePermission = (from ModulePermissionInfo p in objModule.ModulePermissions where p.ModuleID == moduleId && p.RoleID == settings.RegisteredRoleId && p.UserID == Null.NullInteger && p.PermissionKey == "EDIT" select p).SingleOrDefault(); if (modulePermission == null) { ArrayList permissions = new PermissionController().GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "EDIT"); PermissionInfo permission = null; if (permissions.Count == 1) { permission = permissions[0] as PermissionInfo; } if (permission != null) { modulePermission = new ModulePermissionInfo(permission) { ModuleID = moduleId, RoleID = settings.RegisteredRoleId, UserID = Null.NullInteger, AllowAccess = true }; objModule.ModulePermissions.Add(modulePermission); ModulePermissionController.SaveModulePermissions(objModule); } } } } } } break; } return("Success"); } catch (Exception exc) { DnnLog.Error(exc); return("Failed"); } }