当前位置: 首页>>代码示例>>C#>>正文


C# ModuleController.DeleteTabModule方法代码示例

本文整理汇总了C#中DotNetNuke.Entities.Modules.ModuleController.DeleteTabModule方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleController.DeleteTabModule方法的具体用法?C# ModuleController.DeleteTabModule怎么用?C# ModuleController.DeleteTabModule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Entities.Modules.ModuleController的用法示例。


在下文中一共展示了ModuleController.DeleteTabModule方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnEmptyBinClick

        /// <summary>
        /// Permanently removes all deleted tabs and modules
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <remarks>
        /// Parent tabs will not be deleted. To delete a parent tab all child tabs need to be deleted before.
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	18/08/2004	Created
        /// </history>
        protected void OnEmptyBinClick(Object sender, EventArgs e)
        {
            var objEventLog = new EventLogController();

            foreach (ListItem item in lstModules.Items)
            {
                var objModules = new ModuleController();
                var values = item.Value.Split('-');
                var tabId = int.Parse(values[0]);
                var moduleId = int.Parse(values[1]);

                //delete module
                var objModule = objModules.GetModule(moduleId, tabId, false);
                if (objModule != null)
                {
                    //hard-delete Tab Module Instance
                    objModules.DeleteTabModule(tabId, moduleId, false);
                    objEventLog.AddLog(objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED);
                }
            }
            foreach (ListItem item in lstTabs.Items)
            {
                var intTabId = int.Parse(item.Value);
                var objTabs = new TabController();
                var objTab = objTabs.GetTab(intTabId, PortalId, false);
                if (objTab != null)
                {
                    DeleteTab(objTab, true);
                }
            }
            BindData();
        }
开发者ID:rickfox,项目名称:Steves,代码行数:43,代码来源:RecycleBin.ascx.cs

示例2: UpgradeModule

        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";
            }
        }
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:51,代码来源:CoreMessagingBusinessController.cs

示例3: AddHostPage

        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);
            }
        }
开发者ID:davidjrh,项目名称:dnn.appinsights,代码行数:39,代码来源:FeatureController.cs

示例4: AddHostPage

        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);
            }
        }
开发者ID:jbrinkman,项目名称:dnnGlimpse,代码行数:38,代码来源:FeatureController.cs

示例5: RemoveProVersion

        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);
            }
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:74,代码来源:PreviewProfileManagementController.cs

示例6: ParseTemplate


//.........这里部分代码省略.........
            }
            node = xmlPortal.SelectSingleNode("//portal/roles");
            if (node != null)
            {
                ParseRoles(node.CreateNavigator(), PortalId, AdministratorId);
            }
            node = xmlPortal.SelectSingleNode("//portal/portalDesktopModules");
            if (node != null)
            {
                ParsePortalDesktopModules(node.CreateNavigator(), PortalId);
            }
            node = xmlPortal.SelectSingleNode("//portal/folders");
            if (node != null)
            {
                ParseFolders(node, PortalId);
            }

            var defaultFolderMapping = FolderMappingController.Instance.GetDefaultFolderMapping(PortalId);

            if (FolderManager.Instance.GetFolder(PortalId, "") == null)
            {
                objFolder = FolderManager.Instance.AddFolder(defaultFolderMapping, "");
                objFolder.IsProtected = true;
                FolderManager.Instance.UpdateFolder(objFolder);

                AddFolderPermissions(PortalId, objFolder.FolderID);
            }

            if (FolderManager.Instance.GetFolder(PortalId, "Templates/") == null)
            {
                objFolder = FolderManager.Instance.AddFolder(defaultFolderMapping, "Templates/");
                objFolder.IsProtected = true;
                FolderManager.Instance.UpdateFolder(objFolder);

                //AddFolderPermissions(PortalId, objFolder.FolderID);
            }

            // force creation of users folder if not present on template
            if (FolderManager.Instance.GetFolder(PortalId, "Users/") == null)
            {
                objFolder = FolderManager.Instance.AddFolder(defaultFolderMapping, "Users/");
                objFolder.IsProtected = true;
                FolderManager.Instance.UpdateFolder(objFolder);

                //AddFolderPermissions(PortalId, objFolder.FolderID);
            }
            
            if (mergeTabs == PortalTemplateModuleAction.Replace)
            {
                TabController objTabs = new TabController();
                TabInfo objTab;
                foreach (KeyValuePair<int, TabInfo> tabPair in objTabs.GetTabsByPortal(PortalId))
                {
                    objTab = tabPair.Value;
                    objTab.TabName = objTab.TabName + "_old";
                    objTab.TabPath = Globals.GenerateTabPath(objTab.ParentId, objTab.TabName);
                    objTab.IsDeleted = true;
                    objTabs.UpdateTab(objTab);
                    ModuleController objModules = new ModuleController();
                    ModuleInfo objModule;
                    foreach (KeyValuePair<int, ModuleInfo> modulePair in objModules.GetTabModules(objTab.TabID))
                    {
                        objModule = modulePair.Value;
                        objModules.DeleteTabModule(objModule.TabID, objModule.ModuleID, false);
                    }
                }
            }
            node = xmlPortal.SelectSingleNode("//portal/tabs");
            if (node != null)
            {
                string version = xmlPortal.DocumentElement.GetAttribute("version");
                if (version != "5.0")
                {
                    XmlDocument xmlAdmin = new XmlDocument();
                    try
                    {
                        string path = Path.Combine(TemplatePath, "admin.template");
                        if(!File.Exists(path))
                        {
                            //if the template is a merged copy of a localized templte the
                            //admin.template may be one director up
                            path = Path.Combine(TemplatePath, "..\admin.template");
                        }

                        xmlAdmin.Load(path);

						XmlNode adminNode = xmlAdmin.SelectSingleNode("//portal/tabs");
						foreach (XmlNode adminTabNode in adminNode.ChildNodes)
						{
							node.AppendChild(xmlPortal.ImportNode(adminTabNode, true));
						}
                    }
					catch (Exception ex)
					{
						Logger.Error(ex);
					}
                }
                ParseTabs(node, PortalId, false, mergeTabs, IsNewPortal);
            }
        }
开发者ID:rrsc,项目名称:Dnn.Platform,代码行数:101,代码来源:PortalController.cs

示例7: SoftDeleteTabInternal

        private bool SoftDeleteTabInternal(TabInfo tabToDelete, PortalSettings portalSettings)
        {
            bool deleted = true;
            if (!IsSpecialTab(tabToDelete.TabID, portalSettings))
            {
                if (SoftDeleteChildTabs(tabToDelete.TabID, portalSettings))
                {
                    tabToDelete.IsDeleted = true;
                    UpdateTab(tabToDelete);

                    var moduleCtrl = new ModuleController();
                    foreach (ModuleInfo m in moduleCtrl.GetTabModules(tabToDelete.TabID).Values)
                    {
                        moduleCtrl.DeleteTabModule(m.TabID, m.ModuleID, true);
                    }

                    var eventLogController = new EventLogController();
                    eventLogController.AddLog(tabToDelete, portalSettings, portalSettings.UserId, "",
                                              EventLogController.EventLogType.TAB_SENT_TO_RECYCLE_BIN);
                }
                else
                {
                    deleted = false;
                }
            }
            else
            {
                deleted = false;
            }
            return deleted;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:31,代码来源:TabController.cs

示例8: HardDeleteTabInternal

        private void HardDeleteTabInternal(int tabId)
        {
            //Delete all tabModule Instances
            var moduleController = new ModuleController();
            foreach (ModuleInfo m in moduleController.GetTabModules(tabId).Values)
            {
                moduleController.DeleteTabModule(m.TabID, m.ModuleID, false);
            }

            //Delete Tab
            Provider.DeleteTab(tabId);

            //Log deletion
            var eventLog = new EventLogController();
            eventLog.AddLog("TabID",
                            tabId.ToString(),
                            PortalController.GetCurrentPortalSettings(),
                            UserController.GetCurrentUserInfo().UserID,
                            EventLogController.EventLogType.TAB_DELETED);
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:20,代码来源:TabController.cs

示例9: Delete

        private void Delete(ModuleAction Command)
        {
            var moduleController = new ModuleController();
            var module = moduleController.GetModule(int.Parse(Command.CommandArgument), ModuleContext.TabId, true);

            //Check if this is the owner instance of a shared module.
            var user = UserController.GetCurrentUserInfo();
            var eventLogController = new EventLogController();
            if (!module.IsShared)
            {
                foreach(ModuleInfo instance in moduleController.GetModuleTabs(module.ModuleID))
                {
                    if(instance.IsShared)
                    {
                        //HARD Delete Shared Instance
                        moduleController.DeleteTabModule(instance.TabID, instance.ModuleID, false);
                        eventLogController.AddLog(instance, PortalSettings, user.UserID, "", EventLogController.EventLogType.MODULE_DELETED);
                    }
                }
            }

            moduleController.DeleteTabModule(ModuleContext.TabId, int.Parse(Command.CommandArgument), true);
            eventLogController.AddLog(module, PortalSettings, user.UserID, "", EventLogController.EventLogType.MODULE_SENT_TO_RECYCLE_BIN);

            //Redirect to the same page to pick up changes
            Response.Redirect(Request.RawUrl, true);
        }
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:27,代码来源:ActionManager.cs

示例10: DeleteModule

 private void DeleteModule(ModuleInfo module)
 {
     var eventLogController = new EventLogController();
     var moduleController = new ModuleController();
     
     //hard-delete Tab Module Instance
     moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
     eventLogController.AddLog(module, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED);
 }
开发者ID:RichardHowells,项目名称:dnnextensions,代码行数:9,代码来源:RecycleBin.ascx.cs

示例11: RemoveModule

        private static int RemoveModule(string desktopModuleName, string tabName, int parentId, bool removeTab)
        {
            DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "RemoveModule:" + desktopModuleName);
            var tabController = new TabController();
            var moduleController = new ModuleController();
            TabInfo tab = tabController.GetTabByName(tabName, Null.NullInteger, parentId);
            int moduleDefId = 0;
            int count = 0;

            //Get the Modules on the Tab
            if (tab != null)
            {
                foreach (KeyValuePair<int, ModuleInfo> kvp in moduleController.GetTabModules(tab.TabID))
                {
                    var module = kvp.Value;
                    if (module.DesktopModule.FriendlyName == desktopModuleName)
                    {
                        //Delete the Module from the Modules list
                        moduleController.DeleteTabModule(module.TabID, module.ModuleID, false);
                        moduleDefId = module.ModuleDefID;
                    }
                    else
                    {
                        count += 1;
                    }
                }

                //If Tab has no modules optionally remove tab
                if (count == 0 && removeTab)
                {
                    tabController.DeleteTab(tab.TabID, tab.PortalID);
                }
            }

            return moduleDefId;
        }
开发者ID:ryanmalone,项目名称:BGDNNWEB,代码行数:36,代码来源:Upgrade.cs

示例12: DeleteModule

		/// <summary>
		/// Deletes a module
		/// </summary>
		/// <param name="intModuleId">ModuleId of the module to be deleted</param>
		/// <remarks>
		/// Adds a log entry for the action to the EvenLog
		/// </remarks>
		/// <history>
		/// 	[VMasanas]	18/08/2004	Created
		/// </history>
		private void DeleteModule(int intModuleId)
		{
			var objEventLog = new EventLogController();

			//delete module
			var objModules = new ModuleController();
			var objModule = objModules.GetModule(intModuleId, Null.NullInteger, false);
			if (objModule != null)
			{
				//hard-delete Tab Module INstance
				objModules.DeleteTabModule(objModule.TabID, objModule.ModuleID, false);
				objEventLog.AddLog(objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED);
			}
		}
开发者ID:marceltoben,项目名称:evandrix.github.com,代码行数:24,代码来源:RecycleBin.ascx.cs

示例13: cmdDelete_Click

        /// <summary>
        /// cmdDelete_Click runs when the Delete LinkButton is clicked.
        /// It deletes the current portal form the Database.  It can only run in Host
        /// (SuperUser) mode
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/18/2004	documented
        /// </history>
        protected void cmdDelete_Click( Object sender, EventArgs e )
        {
            try
            {
                ModuleController objModules = new ModuleController();

                objModules.DeleteTabModule( TabId, moduleId );

                Response.Redirect( Globals.NavigateURL(), true );
            }
            catch( Exception exc ) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException( this, exc );
            }
        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:23,代码来源:ModuleSettings.ascx.cs

示例14: RemoveProVersion

        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);
            }
        }
开发者ID:biganth,项目名称:Curt,代码行数:66,代码来源:MobileManagementController.cs

示例15: ParsePanes

        /// <summary>
        /// Processes all panes and modules in the template file
        /// </summary>
        /// <param name="nodePanes">Template file node for the panes is current tab</param>
        /// <param name="PortalId">PortalId of the new portal</param>
        /// <param name="TabId">Tab being processed</param>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	03/09/2004	Created
        /// 	[VMasanas]	15/10/2004	Modified for new skin structure
        ///		[cnurse]	15/10/2004	Modified to allow for merging template
        ///								with existing pages
        /// </history>
        public void ParsePanes( XmlNode nodePanes, int PortalId, int TabId, PortalTemplateModuleAction mergeTabs, Hashtable hModules )
        {
            XmlNode nodePane = null;
            XmlNode nodeModule = null;
            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
            ModuleDefinitionInfo objModuleDefinition = null;
            ModuleController objModules = new ModuleController();
            Dictionary<int, ModuleInfo> dicModules = objModules.GetTabModules( TabId );
            ModuleInfo objModule = null;
            int intModuleId = 0;
            string modTitle = null;
            bool moduleFound = false;

            PortalInfo objportal = null;
            objportal = GetPortal( PortalId );

            //If Mode is Replace remove all the modules already on this Tab
            if( mergeTabs == PortalTemplateModuleAction.Replace )
            {
                foreach( KeyValuePair<int, ModuleInfo> kvp in dicModules )
                {
                    objModule = kvp.Value;
                    objModules.DeleteTabModule( TabId, objModule.ModuleID );
                }
            }

            // iterate through the panes
            foreach( XmlNode nodePaneWithinLoop in nodePanes.ChildNodes )
            {
                nodePane = nodePaneWithinLoop;

                // iterate through the modules
                if( nodePaneWithinLoop.SelectSingleNode( "modules" ) != null )
                {
                    foreach( XmlNode nodeModuleWithinLoop in nodePaneWithinLoop.SelectSingleNode( "modules" ) )
                    {
                        nodeModule = nodeModuleWithinLoop;
                        // will be instance or module?
                        int templateModuleID = XmlUtils.GetNodeValueInt( nodeModule, "moduleID", 0 );
                        bool IsInstance = false;
                        if( templateModuleID > 0 )
                        {
                            if( hModules[templateModuleID] != null )
                            {
                                // this module has already been processed -> process as instance
                                IsInstance = true;
                            }
                        }

                        // Templates prior to v4.3.5 only have the <definition> node to define the Module Type
                        // This <definition> node was populated with the DesktopModuleInfo.ModuleName property
                        // Thus there is no mechanism to determine to which module definition the module belongs.
                        //
                        // Template from v4.3.5 on also have the <moduledefinition> element that is populated
                        // with the ModuleDefinitionInfo.FriendlyName.  Therefore the module Instance identifies
                        // which Module Definition it belongs to.

                        //Get the DesktopModule defined by the <definition> element
                        DesktopModuleInfo objDesktopModule = Globals.GetDesktopModuleByName( XmlUtils.GetNodeValue( nodeModule, "definition", "" ) );
                        if( objDesktopModule != null )
                        {
                            //Get the moduleDefinition from the <moduledefinition> element
                            string friendlyName = XmlUtils.GetNodeValue( nodeModule, "moduledefinition", "" );

                            if( string.IsNullOrEmpty( friendlyName ) )
                            {
                                //Module is pre 4.3.5 so get the first Module Definition (at least it won't throw an error then)
                                ArrayList arrModuleDefinitions = objModuleDefinitions.GetModuleDefinitions( objDesktopModule.DesktopModuleID );
                                objModuleDefinition = (ModuleDefinitionInfo)( arrModuleDefinitions[0] );
                            }
                            else
                            {
                                //Module is 4.3.5 or later so get the Module Defeinition by its friendly name
                                objModuleDefinition = objModuleDefinitions.GetModuleDefinitionByName( objDesktopModule.DesktopModuleID, friendlyName );
                            }

                            if( objModuleDefinition != null )
                            {
                                //If Mode is Merge Check if Module exists
                                moduleFound = false;
                                modTitle = XmlUtils.GetNodeValue( nodeModuleWithinLoop, "title", "" );
                                if( mergeTabs == PortalTemplateModuleAction.Merge )
                                {
                                    foreach( KeyValuePair<int, ModuleInfo> kvp in dicModules )
                                    {
                                        objModule = kvp.Value;
//.........这里部分代码省略.........
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:101,代码来源:PortalController.cs


注:本文中的DotNetNuke.Entities.Modules.ModuleController.DeleteTabModule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。