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") }); } }
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") }); } } }