コード例 #1
0
ファイル: DNN.cs プロジェクト: Jochumzen/DisplayPluggOld
        public void DeleteTab(TabInfo t)
        {
            PortalSettings portalSettings = new PortalSettings();
            int portalId = portalSettings.PortalId;

            if (t != null)
            {
                TabController tc = new TabController();
                if (t != null)
                {
                    if (t.Modules != null)
                    {
                        foreach (ModuleInfo mod in t.Modules)
                        {
                            ModuleController moduleC = new ModuleController();
                            moduleC.DeleteModule(mod.ModuleID);
                            moduleC.DeleteModuleSettings(mod.ModuleID);
                        }
                    }

                    tc.DeleteTab(t.TabID, portalId);
                    tc.DeleteTabSettings(t.TabID);
                    DataCache.ClearModuleCache(t.TabID);
                }
            }
        }
コード例 #2
0
	    private void DeleteTab(TabInfo tab, bool deleteDescendants)
		{
			var eventLogController = new EventLogController();
			var tabController = new TabController();
			var moduleController = new ModuleController();

			//get tab modules before deleting page
			var tabModules = moduleController.GetTabModules(tab.TabID);

			//hard delete the tab
			tabController.DeleteTab(tab.TabID, tab.PortalID, deleteDescendants);
			
			//delete modules that do not have other instances
			foreach (var kvp in tabModules)
			{
				//check if all modules instances have been deleted
				var delModule = moduleController.GetModule(kvp.Value.ModuleID, Null.NullInteger, false);
				if (delModule == null || delModule.TabID == Null.NullInteger)
				{
					moduleController.DeleteModule(kvp.Value.ModuleID);
				}
			}
			eventLogController.AddLog(tab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_DELETED);
		}
コード例 #3
0
		/// <summary>
		/// Deletes a tab
		/// </summary>
		/// <param name="objTab">The tab to be deleted</param>
		/// <remarks>
		/// Adds a log entry for the action to the EventLog
		/// </remarks>
		/// <history>
		/// 	[VMasanas]	18/08/2004	Created
		///                 19/09/2004  Remove skin deassignment. BLL takes care of this.
		///                 30/09/2004  Change logic so log is only added when tab is actually deleted
		///                 28/02/2005  Remove modules when deleting pages
		/// </history>
		private void DeleteTab(TabInfo objTab, bool deleteDescendants)
		{
			var objEventLog = new EventLogController();
			var objTabs = new TabController();
			var objModules = new ModuleController();

			//get tab modules before deleting page
			var dicTabModules = objModules.GetTabModules(objTab.TabID);

			//hard delete the tab
			objTabs.DeleteTab(objTab.TabID, objTab.PortalID, deleteDescendants);
			
			//delete modules that do not have other instances
			foreach (var kvp in dicTabModules)
			{
				//check if all modules instances have been deleted
				var objDelModule = objModules.GetModule(kvp.Value.ModuleID, Null.NullInteger, false);
				if (objDelModule == null || objDelModule.TabID == Null.NullInteger)
				{
					objModules.DeleteModule(kvp.Value.ModuleID);
				}
			}
			objEventLog.AddLog(objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_DELETED);
		}
コード例 #4
0
ファイル: Upgrade.cs プロジェクト: huayang912/cs-dotnetnuke
        /// <summary>
        /// RemoveCoreModule removes a Core Module from the system
        /// </summary>
        /// <remarks>
        /// </remarks>
        ///	<param name="DesktopModuleName">The Friendly Name of the Module to Remove</param>
        ///	<param name="ParentTabName">The Name of the parent Tab/Page for this module</param>
        ///	<param name="TabName">The Name to tab that contains the Module</param>
        ///	<param name="TabRemove">A flag to determine whether to remove the Tab if it has no
        ///	other modules</param>
        private static void RemoveCoreModule(string DesktopModuleName, string ParentTabName, string TabName, bool TabRemove)
        {
            TabController objTabs = new TabController();
            ModuleController objModules = new ModuleController();
            int intIndex;
            int intModuleDefId = 0;
            int intDesktopModuleId;

            //Find and remove the Module from the Tab
            switch (ParentTabName)
            {
                case "Host":
                    //TODO - when we have a need to remove a Host Module
                    break;
                case "Admin":
                    PortalController objPortals = new PortalController();

                    ArrayList arrPortals = objPortals.GetPortals();                  

                    //Iterate through the Portals to remove the Module from the Tab
                    for (int intPortal = 0; intPortal < arrPortals.Count; intPortal++)
                    {
                        PortalInfo objPortal = (PortalInfo)(arrPortals[intPortal]);

                        int ParentId = objPortal.AdminTabId;
                        TabInfo objTab = objTabs.GetTabByName(TabName, objPortal.PortalID, ParentId);
                        int intCount = 0;

                        //Get the Modules on the Tab
                        foreach (KeyValuePair<int, ModuleInfo> kvp in objModules.GetTabModules(objTab.TabID))
                        {
                            ModuleInfo objModule = kvp.Value;
                            if (objModule.FriendlyName == DesktopModuleName)
                            {
                                //Delete the Module from the Modules list
                                objModules.DeleteModule(objModule.ModuleID);
                                intModuleDefId = objModule.ModuleDefID;
                            }
                            else
                            {
                                intCount += 1;
                            }
                        }

                        //If Tab has no modules optionally remove tab
                        if (intCount == 0 & TabRemove)
                        {
                            objTabs.DeleteTab(objTab.TabID, objTab.PortalID);
                        }
                    }
                    break;
            }

            //Delete all the Module Controls for this Definition
            ModuleControlController objModuleControls = new ModuleControlController();
            ArrayList arrModuleControls = objModuleControls.GetModuleControls(intModuleDefId);
            for (intIndex = 0; intIndex <= arrModuleControls.Count - 1; intIndex++)
            {
                ModuleControlInfo objModuleControl = (ModuleControlInfo)arrModuleControls[intIndex];
                objModuleControls.DeleteModuleControl(objModuleControl.ModuleControlID);
            }

            //Get the Module Definition
            ModuleDefinitionController objModuleDefinitions = new ModuleDefinitionController();
            ModuleDefinitionInfo objModuleDefinition;
            objModuleDefinition = objModuleDefinitions.GetModuleDefinition(intModuleDefId);
            intDesktopModuleId = objModuleDefinition.DesktopModuleID;

            //Delete the Module Definition
            objModuleDefinitions.DeleteModuleDefinition(intModuleDefId);

            //Delete the Desktop Module Control
            DesktopModuleController objDesktopModules = new DesktopModuleController();
            objDesktopModules.DeleteDesktopModule(intDesktopModuleId);
        }
コード例 #5
0
        /// <summary>
        /// Deletes a tab
        /// </summary>
        /// <param name="intTabid">TabId of the tab to be deleted</param>
        /// <remarks>
        /// Adds a log entry for the action to the EventLog
        /// </remarks>
        /// <history>
        /// 	[VMasanas]	18/08/2004	Created
        ///                 19/09/2004  Remove skin deassignment. BLL takes care of this.
        ///                 30/09/2004  Change logic so log is only added when tab is actually deleted
        ///                 28/02/2005  Remove modules when deleting pages
        /// </history>
        private void DeleteTab( int intTabid )
        {
            EventLogController objEventLog = new EventLogController();

            // delete tab
            TabController objTabs = new TabController();
            ModuleController objModules = new ModuleController();

            TabInfo objTab = objTabs.GetTab( intTabid );
            if( objTab != null )
            {
                //save tab modules before deleting page
                ArrayList arrTabModules = objModules.GetPortalTabModules( objTab.PortalID, objTab.TabID );

                // hard delete the tab
                objTabs.DeleteTab( objTab.TabID, objTab.PortalID );

                // check if it's deleted
                TabInfo objTabDeleted = objTabs.GetTab( intTabid );
                if( objTabDeleted == null )
                {
                    //delete modules that do not have other instances
                    foreach( ModuleInfo objmodule in arrTabModules )
                    {
                        // check if all modules instances have been deleted
                        ModuleInfo objDelModule = objModules.GetModule( objmodule.ModuleID, Null.NullInteger );
                        if( objDelModule == null || objDelModule.TabID == Null.NullInteger )
                        {
                            objModules.DeleteModule( objmodule.ModuleID );
                        }
                    }
                    objEventLog.AddLog( objTab, PortalSettings, UserId, "", EventLogController.EventLogType.TAB_DELETED );
                }
                else
                {
                    // should be a parent tab
                    UI.Skins.Skin.AddModuleMessage( this, string.Format( Localization.GetString( "ParentTab.ErrorMessage", this.LocalResourceFile ), objTab.TabName ), ModuleMessageType.YellowWarning );
                }
            }
        }
コード例 #6
0
        /// <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 )
        {
            EventLogController objEventLog = new EventLogController();

            // delete module
            ModuleController objModules = new ModuleController();
            ModuleInfo objModule = objModules.GetModule( intModuleId, Null.NullInteger );
            if( objModule != null )
            {
                objModules.DeleteModule( objModule.ModuleID );
                objEventLog.AddLog( objModule, PortalSettings, UserId, "", EventLogController.EventLogType.MODULE_DELETED );
            }
        }
コード例 #7
0
 void DeleteMe()
 {
     var m = new ModuleController();
     m.DeleteTabModule(ModuleContext.TabId, ModuleContext.ModuleId, false);
     m.DeleteModule(ModuleContext.ModuleId);
     Response.Redirect(Globals.NavigateURL(ModuleContext.TabId), true);
 }