Beispiel #1
0
        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);
                }
            }
        }
Beispiel #2
0
        private void DeleteSubTab(string tabName, int parentId)
        {
            TabController tabController = new TabController();
            TabInfo       tab           = tabController.GetTabByName(tabName, PortalId, parentId);

            tabController.DeleteTab(tab.TabID, PortalId);
        }
Beispiel #3
0
        public void MustNotHaveTestPages()
        {
            var tabController = new TabController();
            var tabId         = Null.NullInteger;

            tabId = TabController.GetTabByTabPath(PortalId, "//TestA", Null.NullString);
            if (tabId != Null.NullInteger)
            {
                tabController.DeleteTab(tabId, PortalId);
            }

            tabId = TabController.GetTabByTabPath(PortalId, "//TestB", Null.NullString);
            if (tabId != Null.NullInteger)
            {
                tabController.DeleteTab(tabId, PortalId);
            }
        }
Beispiel #4
0
        private void DeleteTab(string tabName, bool isSuperTab = true)
        {
            TabController tabController = new TabController();
            TabInfo       tab           = tabController.GetTabByName(tabName, PortalId);

            if (tab != null)
            {
                tabController.DeleteTab(tab.TabID, PortalId, true);
            }
        }
Beispiel #5
0
        private void MustNotHavePage(string pageName)
        {
            var     controller = new TabController();
            TabInfo page       = controller.GetTabByName(pageName, 0);

            if (page != null)
            {
                controller.DeleteTab(page.TabID, page.PortalID);
            }
        }
        private void DeleteTab(string tabName)
        {
            var tc  = new TabController();
            var tab = tc.GetTabByName(tabName, PortalId);

            if (tab != null)
            {
                tc.DeleteTab(tab.TabID, PortalId);
            }
        }
Beispiel #7
0
 protected void cmdDeleteTranslatedPage(object sender, EventArgs eventArgs)
 {
     if ((sender) is LinkButton)
     {
         var cmdDeleteTranslation = (LinkButton)sender;
         var args  = cmdDeleteTranslation.CommandArgument.Split('|');
         int tabId = int.Parse(args[0]);
         TabController.DeleteTab(tabId, PortalSettings.PortalId);
         Response.Redirect(Request.RawUrl, false);
     }
 }
Beispiel #8
0
        public void PageDesignersMustNotExist()
        {
            var tabController = new TabController();
            var tab           = tabController.GetTabByName("Designers", 0);

            if (tab != null)
            {
                tabController.DeleteTab(tab.TabID, 0);
                Config.Touch();
            }
        }
Beispiel #9
0
        public ConsoleResultModel Run()
        {
            TabController    tc   = new TabController();
            List <PageModel> lst  = new List <PageModel>();
            List <TabInfo>   tabs = new List <TabInfo>();

            if (PageId.HasValue)
            {
                var tab = tc.GetTab((int)PageId, PortalId);
                if (tab != null)
                {
                    tabs.Add(tab);
                }
            }
            else
            {
                // must be parent ID
                tabs = TabController.GetTabsByParent((int)ParentId, PortalId);
            }

            // hard-delete deleted tabs only
            StringBuilder sbResults = new StringBuilder();

            if (tabs.Count > 0)
            {
                foreach (TabInfo tab in tabs)
                {
                    if (tab.IsDeleted)
                    {
                        try
                        {
                            tc.DeleteTab(tab.TabID, PortalId);
                            sbResults.AppendFormat("Successfully purged '{0}' ({1}).\n", tab.TabName, tab.TabID);
                        }
                        catch (Exception ex)
                        {
                            DotNetNuke.Services.Exceptions.Exceptions.LogException(ex);
                            sbResults.AppendFormat("An unexpected error occurred while purging page '{0}' ({1}).\n", tab.TabName, tab.TabID);
                        }
                    }
                    else
                    {
                        sbResults.AppendFormat("Cannot purge page '{0}' ({1}) because it has not been deleted. Try delete-page first.\n", tab.TabName, tab.TabID);
                    }
                }
            }
            else
            {
                sbResults.Append("No pages were found to purge.");
            }

            return(new ConsoleResultModel(sbResults.ToString()));
        }
        /// <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);
                }
            }
        }
        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);
        }
        /// <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);
        }
Beispiel #13
0
    private void procede()
    {
        PortalSettings          ps       = new PortalSettings();
        int                     portalId = ps.PortalId;
        TabController           tc       = new TabController();
        DesktopModuleController DMC      = new DesktopModuleController();
        //string check = "";
        Dictionary <String, String> settings = null;
        TabController TC = new TabController();

        System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(Server.MapPath("DesktopModules/AIS/Installer/Modules.xml"));
        while (reader.Read())
        {
            if (reader.Name == "tab" && reader.HasAttributes)
            {
                TabInfo ti = TC.GetTabByName(reader.GetAttribute("name"), portalId);
                if (ti == null)
                {
                    if (reader.GetAttribute("parent") != null && reader.GetAttribute("parent") != "")
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), reader.GetAttribute("parent"));
                    }
                    else
                    {
                        createPage(reader.GetAttribute("name"), getListPermissionsTab(reader.GetAttribute("name")), bool.Parse(reader.GetAttribute("visible")), bool.Parse(reader.GetAttribute("superTab")), "");
                    }
                    if
                    (reader.GetAttribute("dependency") != null && reader.GetAttribute("dependency") != "")
                    {
                        TC.DeleteTab(TC.GetTabByName(reader.GetAttribute("dependency"), portalId).TabID, portalId);
                        procede();
                        reader.Close();
                    }
                }
            }
            if (reader.Name == "module" && reader.HasAttributes)
            {
                if (DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName")) != null)
                {
                    DesktopModuleInfo dmi = DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"));
                    if (reader.AttributeCount > 2)
                    {
                        settings = new Dictionary <string, string>();
                        for (int i = 2; i < reader.AttributeCount; i = i + 2)
                        {
                            settings.Add(reader.GetAttribute(i), reader.GetAttribute(i + 1));
                        }
                    }
                    Label   lbl  = new Label();
                    Literal line = new Literal();
                    line.Text = "<br />";
                    TabInfo ti = new TabInfo();
                    ti.TabName = reader.GetAttribute("tab");
                    switch (checkPage(ti, DesktopModuleController.GetDesktopModuleByFriendlyName(reader.GetAttribute("friendlyName"))))
                    {
                    case "OK":
                        break;

                    case "Page":

                        break;

                    case "Bin":
                        break;

                    default:
                        AddModuleToTab(tc.GetTabByName(ti.TabName, portalId), dmi, settings: settings);
                        break;
                    }
                }
            }
        }
        pnl_install.Visible = false;
        pnl_install_missing_files.Visible = false;
        pnl_manuel.Visible = true;
        pnl_fin.Visible    = true;
    }