示例#1
0
        private void ClearTabCache(TabInfo tabInfo)
        {
            TabController.Instance.ClearCache(tabInfo.PortalID);

            // Clear the Tab's Cached modules
            DataCache.ClearModuleCache(tabInfo.TabID);
        }
示例#2
0
        protected void CmdAddPageClick(object sender, EventArgs e)
        {
            var tabCtrl = new TabController();

            int     selectedTabID = Int32.Parse(PageLst.SelectedValue);
            TabInfo selectedTab   = tabCtrl.GetTab(selectedTabID, PortalSettings.ActiveTab.PortalID, false);
            var     tabLocation   = (TabRelativeLocation)Enum.Parse(typeof(TabRelativeLocation), LocationLst.SelectedValue);
            TabInfo newTab        = RibbonBarManager.InitTabInfoObject(selectedTab, tabLocation);

            string templateFile = string.Empty;

            if ((!string.IsNullOrEmpty(TemplateLst.SelectedValue)))
            {
                templateFile = Path.Combine(PortalSettings.HomeDirectoryMapPath, "Templates\\" + TemplateLst.SelectedValue);
            }

            newTab.TabName   = Name.Text;
            newTab.IsVisible = IncludeInMenu.Checked;

            string errMsg = string.Empty;

            try
            {
                RibbonBarManager.SaveTabInfoObject(newTab, selectedTab, tabLocation, templateFile);
            }
            catch (DotNetNukeException ex)
            {
                Exceptions.LogException(ex);
                errMsg = (ex.ErrorCode != DotNetNukeErrorCode.NotSet) ? GetString("Err." + ex.ErrorCode) : ex.Message;
            }
            catch (Exception ex)
            {
                Exceptions.LogException(ex);
                errMsg = ex.Message;
            }

            //Clear the Tab's Cached modules
            DataCache.ClearModuleCache(PortalSettings.ActiveTab.TabID);

            //Update Cached Tabs as TabPath may be needed before cache is cleared
            TabInfo tempTab;

            if (new TabController().GetTabsByPortal(PortalSettings.ActiveTab.PortalID).TryGetValue(newTab.TabID, out tempTab))
            {
                tempTab.TabPath = newTab.TabPath;
            }

            if ((string.IsNullOrEmpty(errMsg)))
            {
                Response.Redirect(Globals.NavigateURL(newTab.TabID));
            }
            else
            {
                errMsg = string.Format("<p>{0}</p><p>{1}</p>", GetString("Err.Header"), errMsg);
                Web.UI.Utilities.RegisterAlertOnPageLoad(this, new MessageWindowParameters(errMsg)
                {
                    Title = GetString("Err.Title")
                });
            }
        }
示例#3
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);
                }
            }
        }
示例#4
0
        public ConsoleResultModel Run()
        {
            List <ModuleInfoModel> lst = new List <ModuleInfoModel>();


            var results = ModuleController.Instance.GetAllTabsModulesByModuleID((int)ModuleId);

            if (results != null)
            {
                var module = (ModuleInfo)results[0];
                if (PageId.HasValue)
                {
                    // we can do a soft Delete
                    ModuleController.Instance.DeleteTabModule((int)PageId, (int)ModuleId, true);
                    return(new ConsoleResultModel(string.Format("Module {0} sent to Recycle Bin", ModuleId)));
                }
                else
                {
                    ModuleController.Instance.DeleteModule((int)ModuleId);
                    DataCache.ClearModuleCache(module.TabID);
                    return(new ConsoleResultModel(string.Format("Module {0} permanently deleted", ModuleId)));
                }
            }
            else
            {
                return(new ConsoleResultModel(string.Format("No module found with ID '{0}'", ModuleId)));
            }
        }
            internal static void MigrateToVanjaro(PortalSettings PortalSettings)
            {
                TabInfo Tab = TabController.Instance.GetTab(PortalSettings.ActiveTab.TabID, PortalSettings.Current.PortalId);

                if (Tab != null && Tab.TabID > 0)
                {
                    try
                    {
                        Tab.SkinSrc      = "[g]skins/vanjaro/base.ascx";
                        Tab.ContainerSrc = "[g]containers/vanjaro/base.ascx";

                        using (VanjaroRepo db = new VanjaroRepo())
                        {
                            db.Execute(PortalScript.UpdateTabContainerSrc(PortalSettings.Current.PortalId, Tab.TabID));
                        }

                        //Clear Cache for all TabModules
                        foreach (ModuleInfo tabModule in ModuleController.Instance.GetTabModules(Tab.TabID).Values)
                        {
                            DataCache.RemoveCache(string.Format(DataCache.SingleTabModuleCacheKey, tabModule.TabModuleID));
                        }
                        DataCache.ClearModuleCache(Tab.TabID);

                        TabController.Instance.UpdateTab(Tab);
                    }
                    catch (Exception)
                    {
                    }
                }
            }
示例#6
0
        public void UpdateTabModuleOrder(int TabId)
        {
            IDataReader dr = DataProvider.Instance().GetTabPanes(TabId);

            while (dr.Read())
            {
                int         ModuleCounter = 0;
                IDataReader dr2           = DataProvider.Instance().GetTabModuleOrder(TabId, Convert.ToString(dr["PaneName"]));
                while (dr2.Read())
                {
                    ModuleCounter++;
                    DataProvider.Instance().UpdateModuleOrder(TabId, Convert.ToInt32(dr2["ModuleID"]), (ModuleCounter * 2) - 1, Convert.ToString(dr["PaneName"]));
                }
                dr2.Close();
            }
            dr.Close();

            // clear module cache
            DataCache.ClearModuleCache(TabId);
        }
示例#7
0
        protected void CmdUpdateClick(object sender, EventArgs e)
        {
            if (TabPermissionController.CanManagePage())
            {
                TabInfo selectedTab = null;
                if (!string.IsNullOrEmpty(this.PageLst.SelectedValue))
                {
                    int selectedTabID = int.Parse(this.PageLst.SelectedValue);
                    selectedTab = TabController.Instance.GetTab(selectedTabID, PortalSettings.ActiveTab.PortalID, false);
                }

                TabRelativeLocation tabLocation = TabRelativeLocation.NOTSET;
                if (!string.IsNullOrEmpty(this.LocationLst.SelectedValue))
                {
                    tabLocation = (TabRelativeLocation)Enum.Parse(typeof(TabRelativeLocation), this.LocationLst.SelectedValue);
                }

                TabInfo tab = this.CurrentTab;

                tab.TabName     = this.Name.Text;
                tab.IsVisible   = this.IncludeInMenu.Checked;
                tab.DisableLink = this.IsDisabled.Checked;
                tab.IsSecure    = this.IsSecure.Checked;
                tab.SkinSrc     = this.SkinLst.SelectedValue;

                string errMsg = string.Empty;
                try
                {
                    RibbonBarManager.SaveTabInfoObject(tab, selectedTab, tabLocation, null);
                }
                catch (DotNetNukeException ex)
                {
                    Exceptions.LogException(ex);
                    errMsg = (ex.ErrorCode != DotNetNukeErrorCode.NotSet) ? this.GetString("Err." + ex.ErrorCode) : ex.Message;
                }
                catch (Exception ex)
                {
                    Exceptions.LogException(ex);
                    errMsg = ex.Message;
                }

                // Clear the Tab's Cached modules
                DataCache.ClearModuleCache(PortalSettings.ActiveTab.TabID);

                // Update Cached Tabs as TabPath may be needed before cache is cleared
                TabInfo tempTab;
                if (TabController.Instance.GetTabsByPortal(PortalSettings.ActiveTab.PortalID).TryGetValue(tab.TabID, out tempTab))
                {
                    tempTab.TabPath = tab.TabPath;
                }

                if (string.IsNullOrEmpty(errMsg))
                {
                    this.Response.Redirect(this._navigationManager.NavigateURL(tab.TabID));
                }
                else
                {
                    errMsg = string.Format("<p>{0}</p><p>{1}</p>", this.GetString("Err.Header"), errMsg);
                    Web.UI.Utilities.RegisterAlertOnPageLoad(this, new MessageWindowParameters(errMsg)
                    {
                        Title = this.GetString("Err.Title")
                    });
                }
            }
        }
示例#8
0
 private static void ClearCache(int TabId)
 {
     DataCache.ClearModuleCache(TabId);
 }