public void GivenThereIsAPageCalled(string pageName, Table permissions) { var reset = false; var tabController = new TabController(); var tab = tabController.GetTabByName(pageName, PortalId); if (tab == null) { tab = new TabInfo { TabName = pageName, PortalID = 0 }; tab.TabID = tabController.AddTab(tab); foreach (var row in permissions.Rows) { var roleId = -1; var roleController = new RoleController(); if (row[0] == "All Users") { roleId = -1; } else { var role = roleController.GetRoleByName(PortalId, row[0]); if (role == null) { if (roleController.GetRoleByName(Null.NullInteger, row[0]) == null) { role = new RoleInfo { RoleName = row[0], RoleGroupID = Null.NullInteger }; roleId = roleController.AddRole(role); } } } var permissionController = new PermissionController(); var permission = permissionController.GetPermissionByCodeAndKey("SYSTEM_TAB", row[1]); var tabPermission = new TabPermissionInfo { PermissionID = 3, TabID = tab.TabID, AllowAccess = true, RoleID = roleId }; tab.TabPermissions.Add(tabPermission); } tabController.UpdateTab(tab); reset = true; } Page = tab; if (reset) { Config.Touch(); } }
public void MustHaveTestPageAdded() { //Create a tabInfo obj, then use TabController AddTab Method? TabInfo newPage = new TabInfo(); newPage.TabName = "Test Page"; newPage.PortalID = 0; newPage.SkinSrc = "[G]Skins/DarkKnight/Home-Mega-Menu.ascx"; newPage.ContainerSrc = "[G]Containers/DarkKnight/SubTitle_Grey.ascx"; TabController tabController = new TabController(); var tab = tabController.GetTabByName("Test Page", 0); if (tab == null) { try { tabController.AddTab(newPage); } catch (Exception exc) { Assert.IsTrue(false, "Add Tab result: " + exc.Message); } //tabController.AddTab(newPage); newPage = tabController.GetTabByName("Test Page", 0); TabPermissionInfo tabPermission = new TabPermissionInfo(); tabPermission.PermissionID = 3; tabPermission.TabID = newPage.TabID; tabPermission.AllowAccess = true; tabPermission.RoleID = 0; newPage.TabPermissions.Add(tabPermission); try { tabController.UpdateTab(newPage); } catch (Exception exc) { Assert.IsTrue(false, "Update Tab result: " + exc.Message); } newPage = tabController.GetTabByName("Test Page", 0); tabPermission.RoleID = 0; tabPermission.PermissionID = 4; tabPermission.TabID = newPage.TabID; tabPermission.AllowAccess = true; newPage.TabPermissions.Add(tabPermission); try { tabController.UpdateTab(newPage); } catch (Exception exc) { Assert.IsTrue(false, "Update Tab Permissions result: " + exc.Message); } Thread.Sleep(1500); } }
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); } }
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); } }
private void UpdateTabName(int tabId, string newName) { var tc = new TabController(); var tab = tc.GetTab(tabId, PortalId, false); tab.TabName = newName; tc.UpdateTab(tab); }
protected override void OnInit(EventArgs e) { base.OnInit(e); jQuery.RequestDnnPluginsRegistration(); cboCacheProvider.SelectedIndexChanged += cboCacheProvider_Change; cboCopyPage.SelectedIndexChanged += cboCopyPage_SelectedIndexChanged; cboFolders.SelectedIndexChanged += cboFolders_SelectedIndexChanged; cboParentTab.SelectedIndexChanged += cboParentTab_SelectedIndexChanged; cmdClearAllPageCache.Click += cmdClearAllPageCache_Click; cmdClearPageCache.Click += cmdClearPageCache_Click; cmdCopyPerm.Click += cmdCopyPerm_Click; cmdCopySkin.Click += cmdCopySkin_Click; cmdDelete.Click += cmdDelete_Click; cmdUpdate.Click += cmdUpdate_Click; editDefaultCultureButton.Command += editDefaultCultureButton_Command; localizePagesButton.Click += localizePagesButton_Click; moduleLocalization.ModuleLocalizationChanged += moduleLocalization_ModuleLocalizationChanged; tabLocalization.TabLocalizationChanged += tabLocalization_ModuleLocalizationChanged; publishPageButton.Click += publishPageButton_Click; rbInsertPosition.SelectedIndexChanged += rbInsertPosition_SelectedIndexChanged; rblCacheIncludeExclude.SelectedIndexChanged += rblCacheIncludeExclude_Change; readyForTranslationButton.Click += readyForTranslationButton_Click; cmdSubmitTranslation.Click += submitTranslation_Click; cmdCancelTranslation.Click += cancelTranslation_Click; translatedCheckbox.CheckedChanged += translatedCheckbox_CheckedChanged; viewDefaultCultureButton.Command += viewDefaultCultureButton_Command; // Verify that the current user has access to edit this module if (!TabPermissionController.HasTabPermission("ADD,EDIT,COPY,DELETE,MANAGE")) { Response.Redirect(Globals.AccessDeniedURL(), true); } if ((Request.QueryString["action"] != null)) { _strAction = Request.QueryString["action"].ToLower(); } if (Tab.ContentItemId == Null.NullInteger && Tab.TabID != Null.NullInteger) { var tabCtl = new TabController(); //This tab does not have a valid ContentItem tabCtl.CreateContentItem(Tab); tabCtl.UpdateTab(Tab); } moduleLocalization.TabId = TabId; moduleLocalization.ShowEditColumn = false; DisableHostAdminFunctions(); }
private void UpdateTab(TabInfo tab) { var tc = new TabController(); if (tab != null) { tc.UpdateTab(tab); } }
protected void CmdUpdateClick(object sender, EventArgs e) { //Often times grid stays but node is not selected (e.g. when node is deleted or update page is clicked) if (ctlPages.SelectedNode == null) return; var intTab = Convert.ToInt32(ctlPages.SelectedNode.Value); var tabcontroller = new TabController(); var tab = tabcontroller.GetTab(intTab, PortalId, true); this.Page.Validate(); if (!this.Page.IsValid) return; if (tab != null && TabPermissionController.CanManagePage(tab)) { tab.TabName = txtName.Text; tab.Title = txtTitle.Text; tab.Description = txtDescription.Text; tab.KeyWords = txtKeywords.Text; tab.IsVisible = chkVisible.Checked; tab.DisableLink = chkDisabled.Checked; tab.IsDeleted = false; tab.Url = ctlURL.Url; tabcontroller.UpdateTabSetting(tab.TabID, "LinkNewWindow", ctlURL.NewWindow.ToString()); tabcontroller.UpdateTabSetting(tab.TabID, "AllowIndex", chkAllowIndex.Checked.ToString()); tab.SkinSrc = drpSkin.SelectedValue; tab.ContainerSrc = drpContainer.SelectedValue; tab.TabPath = Globals.GenerateTabPath(tab.ParentId, tab.TabName); tab.TabPermissions.Clear(); if (tab.PortalID != Null.NullInteger) { tab.TabPermissions.AddRange(dgPermissions.Permissions); } //All validations have been done in the Page.Validate() //Check for invalid if (!IsValidTabName(tab.TabName)) { return; } //Validate Tab Path if (!IsValidTabPath(tab, tab.TabPath)) { return; } tab.RefreshInterval = txtRefresh.Text == "" ? Null.NullInteger : Convert.ToInt32(txtRefresh.Text); tab.SiteMapPriority = float.Parse(txtSitemapPriority.Text); tab.PageHeadText = txtMeta.Text; tab.IsSecure = chkSecure.Checked; tab.PermanentRedirect = chkPermanentRedirect.Checked; var iconFile = ctlIcon.Url; var iconFileLarge = ctlIconLarge.Url; tab.IconFile = iconFile; tab.IconFileLarge = iconFileLarge; tab.Terms.Clear(); tab.Terms.AddRange(termsSelector.Terms); tabcontroller.UpdateTab(tab); ShowSuccessMessage(string.Format(Localization.GetString("TabUpdated", LocalResourceFile), tab.TabName)); BindTree(); //keep the tab selected SelectedNode = intTab.ToString(CultureInfo.InvariantCulture); ctlPages.FindNodeByValue(SelectedNode).Selected = true; ctlPages.FindNodeByValue(SelectedNode).ExpandParentNodes(); } }
protected void CtlPagesNodeEdit(object sender, RadTreeNodeEditEventArgs e) { var objTabController = new TabController(); var objTab = objTabController.GetTab(int.Parse(e.Node.Value), PortalId, false); if (objTab != null && TabPermissionController.CanManagePage(objTab)) { //Check for invalid string invalidType; if (!TabController.IsValidTabName(e.Text, out invalidType)) { ShowErrorMessage(string.Format(Localization.GetString(invalidType, LocalResourceFile), e.Text)); e.Node.Text = objTab.TabName; e.Text = objTab.TabName; } else if (!IsValidTabPath(objTab, Globals.GenerateTabPath(objTab.ParentId, e.Text))) { e.Node.Text = objTab.TabName; e.Text = objTab.TabName; } else { objTab.TabName = e.Text; objTabController.UpdateTab(objTab); } BindTreeAndShowTab(objTab.TabID); } }
public void AdvancedUrlRewriter_ReplaceChars(Dictionary<string, string> testFields) { var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]); string testPageName = testFields.GetValue("TestPageName"); TabInfo tab = null; if (!String.IsNullOrEmpty(testPageName)) { var tabName = testFields["Page Name"]; var tc = new TabController(); tab = tc.GetTabByName(tabName, PortalId); tab.TabName = testPageName; tc.UpdateTab(tab); //Refetch tab from DB tab = tc.GetTab(tab.TabID, tab.PortalID, false); } settings.PortalId = PortalId; string autoAscii = testFields.GetValue("AutoAscii"); if (!String.IsNullOrEmpty(autoAscii)) { settings.AutoAsciiConvert = Convert.ToBoolean(autoAscii); } TestUtil.GetReplaceCharDictionary(testFields, settings.ReplaceCharacterDictionary); SetDefaultAlias(testFields); ExecuteTestForTab(tab, settings, testFields); }
protected override void OnInit(EventArgs e) { base.OnInit(e); jQuery.RequestDnnPluginsRegistration(); ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/Scripts/dnn.extensions.js", FileOrder.Js.DefaultPriority); ClientResourceManager.RegisterScript(Page, "~/Resources/Shared/scripts/dnn.jquery.extensions.js", FileOrder.Js.DefaultPriority + 1); ClientResourceManager.RegisterScript(Page, "~/DesktopModules/Admin/Tabs/ClientScripts/dnn.PageUrl.js", FileOrder.Js.DefaultPriority + 2); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); cboCacheProvider.SelectedIndexChanged += cboCacheProvider_Change; cboCopyPage.SelectionChanged += cboCopyPage_SelectedIndexChanged; cboFolders.SelectionChanged += cboFolders_SelectedIndexChanged; cboParentTab.SelectionChanged += cboParentTab_SelectedIndexChanged; cmdClearAllPageCache.Click += cmdClearAllPageCache_Click; cmdClearPageCache.Click += cmdClearPageCache_Click; cmdCopyPerm.Click += cmdCopyPerm_Click; cmdCopySkin.Click += cmdCopySkin_Click; cmdDelete.Click += cmdDelete_Click; cmdUpdate.Click += cmdUpdate_Click; rblCacheIncludeExclude.SelectedIndexChanged += rblCacheIncludeExclude_Change; readyForTranslationButton.Click += readyForTranslationButton_Click; cmdSubmitTranslation.Click += submitTranslation_Click; cmdCancelTranslation.Click += cancelTranslation_Click; // Verify that the current user has access to edit this module if (!TabPermissionController.HasTabPermission("ADD,EDIT,COPY,DELETE,MANAGE")) { Response.Redirect(Globals.AccessDeniedURL(), true); } if ((Request.QueryString["action"] != null)) { _strAction = Request.QueryString["action"].ToLower(); } if (Tab.ContentItemId == Null.NullInteger && Tab.TabID != Null.NullInteger) { var tabCtl = new TabController(); //This tab does not have a valid ContentItem tabCtl.CreateContentItem(Tab); tabCtl.UpdateTab(Tab); } DisableHostAdminFunctions(); if (PortalSettings.ActiveTab.IsSuperTab || PortalSecurity.IsInRole("Administrators") || PortalSettings.ActiveTab.ParentId == Null.NullInteger) { // Add Non Specified if user is Admin or if current tab is already on the top level cboParentTab.UndefinedItem = new ListItem(SharedConstants.Unspecified, string.Empty); } cboCopyPage.UndefinedItem = new ListItem(SharedConstants.Unspecified, string.Empty); PortalAliasCaption.Text = PortalAlias.HTTPAlias; PortalAliasCaption.ToolTip = PortalAlias.HTTPAlias; UrlContainer.Attributes.Add(HtmlTextWriterAttribute.Class.ToString(), "um-page-url-container"); }
private static void AddProfessionalPreviewPage(int parentId, string tabPath, string moduleFriendlyName, string tabName, string tabDescription, string smallIcon, string largeIcon) { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddProfessionalPreviewPage:" + parentId); var tabController = new TabController(); TabInfo hostTab; //Get web servers module ModuleDefinitionInfo moduleDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName(moduleFriendlyName); //Add Pages under Professional Features Tab int tabId = TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString); if (tabId == Null.NullInteger) { //Add host page hostTab = AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true); hostTab.ParentId = parentId; tabController.UpdateTab(hostTab); //Add module to page AddModuleToPage(hostTab, moduleDef.ModuleDefID, tabName, largeIcon, true); } }
private static void AddLinkedProfessionalPreviewPage(int parentId, string tabPath, string url, string tabName, string tabDescription, string smallIcon, string largeIcon) { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddLinkedProfessionalPreviewPage:" + parentId); var tabController = new TabController(); TabInfo newTab; if (TabController.GetTabByTabPath(Null.NullInteger, tabPath, Null.NullString) == Null.NullInteger) { newTab = AddHostPage(tabName, tabDescription, smallIcon, largeIcon, true); newTab.ParentId = parentId; newTab.Url = url; tabController.UpdateTab(newTab); } }
private static void UpgradeToVersion610() { AddModuleCategories(); //update languages module int moduleDefId = GetModuleDefinition("Languages", "Languages"); AddModuleControl(moduleDefId, "LocalizePages", "Localize Pages", "DesktopModules/Admin/Languages/LocalizePages.ascx", "~/images/icon_language_32px.gif", SecurityAccessLevel.Edit, 0, Null.NullString, true); //add store control moduleDefId = AddModuleDefinition("Extensions", "", "Extensions"); AddModuleControl(moduleDefId, "Store", "Store Details", "DesktopModules/Admin/Extensions/Store.ascx", "~/images/icon_extensions_32px.png", SecurityAccessLevel.Host, 0); EnableModalPopUps(); var tabController = new TabController(); var tab = tabController.GetTabByName("Portals", Null.NullInteger); tab.TabName = "Site Management"; tabController.UpdateTab(tab); var moduleController = new ModuleController(); foreach (var module in moduleController.GetTabModules(tab.TabID).Values) { if (module.ModuleTitle == "Portals") { module.ModuleTitle = "Site Management"; moduleController.UpdateModule(module); } } //Add List module to Admin page of every portal ModuleDefinitionInfo mDef = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Lists"); if (mDef != null) { AddAdminPages("Lists", "Manage common lists", "~/Icons/Sigma/Lists_16X16_Standard.png", "~/Icons/Sigma/Lists_32X32_Standard.png", true, mDef.ModuleDefID, "Lists", "~/Icons/Sigma/Lists_16X16_Standard.png", true); } //update DotNetNuke.Portals' friend name to 'Sites'. var portalPackage = PackageController.GetPackageByName("DotNetNuke.Portals"); if(portalPackage != null) { portalPackage.FriendlyName = "Sites"; PackageController.SavePackage(portalPackage); } //add mobile preview control AddModuleControl(Null.NullInteger, "MobilePreview", "Mobile Preview", "DesktopModules/Admin/MobilePreview/Preview.ascx", string.Empty, SecurityAccessLevel.Admin, Null.NullInteger); }
private static void UpgradeToVersion613() { //Rename admin pages page's title to 'Page Management'. var portalController = new PortalController(); foreach (PortalInfo portal in portalController.GetPortals()) { var tabController = new TabController(); var pagesTabId = TabController.GetTabByTabPath(portal.PortalID, "//Admin//Pages", Null.NullString); if (pagesTabId != Null.NullInteger) { var pagesTab = tabController.GetTab(pagesTabId, portal.PortalID, false); if (pagesTab != null && pagesTab.Title == "Pages") { pagesTab.Title = "Page Management"; tabController.UpdateTab(pagesTab); } } } }
private static void UpgradeToVersion602() { //Add avi,mpg,mpeg,mp3,wmv,mov,wav extensions var exts = new List<string> { ".avi", ".mpg", ".mpeg", ".mp3", ".wmv", ".mov", ".wav" }; HostController.Instance.Update("FileExtensions", Host.AllowedExtensionWhitelist.ToStorageString(exts)); //Fix the icons for SiteMap page var portalController = new PortalController(); foreach (PortalInfo portal in portalController.GetPortals()) { var tabController = new TabController(); var siteMap = tabController.GetTabByName("Search Engine SiteMap", portal.PortalID); if (siteMap != null) { siteMap.IconFile = "~/Icons/Sigma/Sitemap_16X16_Standard.png"; siteMap.IconFileLarge = "~/Icons/Sigma/Sitemap_32X32_Standard.png"; tabController.UpdateTab(siteMap); } } }
private static void UpgradeToVersion600() { var tabController = new TabController(); var hostPages = tabController.GetTabsByPortal(Null.NullInteger); //This ensures that all host pages have a tab path. //so they can be found later. (DNNPRO-17129) foreach (var hostPage in hostPages.Values) { hostPage.TabPath = Globals.GenerateTabPath(hostPage.ParentId, hostPage.TabName); tabController.UpdateTab(hostPage); } var settings = PortalController.GetCurrentPortalSettings(); var moduleController = new ModuleController(); if (settings != null) { var hostTab = tabController.GetTab(settings.SuperTabId, Null.NullInteger, false); hostTab.IsVisible = false; tabController.UpdateTab(hostTab); foreach (var module in moduleController.GetTabModules(settings.SuperTabId).Values) { moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true"); } } //remove timezone editor int moduleDefId = GetModuleDefinition("Languages", "Languages"); RemoveModuleControl(moduleDefId, "TimeZone"); //6.0 requires the old TimeZone property to be marked as Deleted - Delete for Host ProfilePropertyDefinition ppdHostTimeZone = ProfileController.GetPropertyDefinitionByName(Null.NullInteger, "TimeZone"); if (ppdHostTimeZone != null) { ProfileController.DeletePropertyDefinition(ppdHostTimeZone); } var portalController = new PortalController(); foreach (PortalInfo portal in portalController.GetPortals()) { //update timezoneinfo #pragma warning disable 612,618 TimeZoneInfo timeZoneInfo = Localization.Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(portal.TimeZoneOffset); #pragma warning restore 612,618 PortalController.UpdatePortalSetting(portal.PortalID, "TimeZone", timeZoneInfo.Id, false); //6.0 requires the old TimeZone property to be marked as Deleted - Delete for Portals ProfilePropertyDefinition ppdTimeZone = ProfileController.GetPropertyDefinitionByName(portal.PortalID, "TimeZone"); if (ppdTimeZone != null) { ProfileController.DeletePropertyDefinition(ppdTimeZone); } var adminTab = tabController.GetTab(portal.AdminTabId, portal.PortalID, false); adminTab.IsVisible = false; tabController.UpdateTab(adminTab); foreach (var module in moduleController.GetTabModules(portal.AdminTabId).Values) { moduleController.UpdateTabModuleSetting(module.TabModuleID, "hideadminborder", "true"); } } //Ensure that Display Beta Notice setting is present var displayBetaNotice = Host.DisplayBetaNotice; HostController.Instance.Update("DisplayBetaNotice", displayBetaNotice ? "Y": "N"); moduleDefId = GetModuleDefinition("Languages", "Languages"); AddModuleControl(moduleDefId, "EnableContent", "Enable Localized Content", "DesktopModules/Admin/Languages/EnableLocalizedContent.ascx", "", SecurityAccessLevel.Host, 0, null, false); AddProfessionalPreviewPages(); AddDefaultModuleIcons(); AddIconToAllowedFiles(); FavIconsToPortalSettings(); var tab = tabController.GetTabByName("Host", Null.NullInteger, Null.NullInteger); if (tab != null) { RemoveModule("Extensions", "Module Definitions", tab.TabID, true); RemoveModule("Marketplace", "Marketplace", tab.TabID, true); } }
/// <summary> /// Processess a template file for the new portal. This method will be called twice: for the portal template and for the admin template /// </summary> /// <param name="PortalId">PortalId of the new portal</param> /// <param name="TemplatePath">Path for the folder where templates are stored</param> /// <param name="TemplateFile">Template file to process</param> /// <param name="AdministratorId">UserId for the portal administrator. This is used to assign roles to this user</param> /// <param name="mergeTabs">Flag to determine whether Module content is merged.</param> /// <param name="IsNewPortal">Flag to determine is the template is applied to an existing portal or a new one.</param> /// <remarks> /// The roles and settings nodes will only be processed on the portal template file. /// </remarks> /// <history> /// [VMasanas] 27/08/2004 Created /// </history> public void ParseTemplate( int PortalId, string TemplatePath, string TemplateFile, int AdministratorId, PortalTemplateModuleAction mergeTabs, bool IsNewPortal ) { XmlDocument xmlDoc = new XmlDocument(); XmlNode node = null; int AdministratorRoleId = -1; int RegisteredRoleId = -1; int SubscriberRoleId = -1; RoleController objrole = new RoleController(); bool isAdminTemplate = false; isAdminTemplate = ( TemplateFile == "admin.template" ); // open the XML file try { xmlDoc.Load( TemplatePath + TemplateFile ); } catch // error { // } // settings, roles, folders and files can only be specified in portal templates, will be ignored on the admin template if( !isAdminTemplate ) { // parse roles if available node = xmlDoc.SelectSingleNode( "//portal/roles" ); if( node != null ) { ParseRoles( node, PortalId, AdministratorId, ref AdministratorRoleId, ref RegisteredRoleId, ref SubscriberRoleId ); } // create required roles if not already created if( AdministratorRoleId == -1 ) { AdministratorRoleId = CreateRole( PortalId, "Administrators", "Portal Administrators", 0F, 0, "M", 0F, 0, "N", false, false ); } if( RegisteredRoleId == -1 ) { RegisteredRoleId = CreateRole( PortalId, "Registered Users", "Registered Users", 0F, 0, "M", 0F, 0, "N", false, true ); } if( SubscriberRoleId == -1 ) { SubscriberRoleId = CreateRole( PortalId, "Subscribers", "A public role for portal subscriptions", 0F, 0, "M", 0F, 0, "N", true, true ); } objrole.AddUserRole( PortalId, AdministratorId, AdministratorRoleId, Null.NullDate, Null.NullDate ); objrole.AddUserRole( PortalId, AdministratorId, RegisteredRoleId, Null.NullDate, Null.NullDate ); objrole.AddUserRole( PortalId, AdministratorId, SubscriberRoleId, Null.NullDate, Null.NullDate ); // parse portal folders node = xmlDoc.SelectSingleNode( "//portal/folders" ); if( node != null ) { ParseFolders( node, PortalId ); } // force creation of root folder if not present on template FolderController objController = new FolderController(); if( objController.GetFolder( PortalId, "" ) == null ) { int folderid = objController.AddFolder( PortalId, "", (int)FolderController.StorageLocationTypes.InsecureFileSystem, true, false ); PermissionController objPermissionController = new PermissionController(); ArrayList arr = objPermissionController.GetPermissionByCodeAndKey( "SYSTEM_FOLDER", "" ); foreach( PermissionInfo objpermission in arr ) { FileSystemUtils.SetFolderPermission( PortalId, folderid, objpermission.PermissionID, AdministratorRoleId, "" ); if( objpermission.PermissionKey == "READ" ) { // add READ permissions to the All Users Role FileSystemUtils.SetFolderPermission( PortalId, folderid, objpermission.PermissionID, int.Parse( Globals.glbRoleAllUsers ), "" ); } } } // parse portal settings if available only for new portals node = xmlDoc.SelectSingleNode( "//portal/settings" ); if( node != null & IsNewPortal ) { ParsePortalSettings( node, PortalId ); } // update portal setup PortalInfo objportal = null; objportal = GetPortal( PortalId ); UpdatePortalSetup( PortalId, AdministratorId, AdministratorRoleId, RegisteredRoleId, objportal.SplashTabId, objportal.HomeTabId, objportal.LoginTabId, objportal.UserTabId, objportal.AdminTabId ); //Remove Exising Tabs if doing a "Replace" if( mergeTabs == PortalTemplateModuleAction.Replace ) { TabController objTabs = new TabController(); TabInfo objTab = null; foreach( KeyValuePair<int, TabInfo> tabPair in objTabs.GetTabsByPortal( PortalId ) ) { objTab = tabPair.Value; if( !objTab.IsAdminTab ) { //soft delete Tab objTab.TabName = objTab.TabName + "_old"; objTab.IsDeleted = true; objTabs.UpdateTab( objTab ); //Delete all Modules ModuleController objModules = new ModuleController(); ModuleInfo objModule = null; foreach( KeyValuePair<int, ModuleInfo> modulePair in objModules.GetTabModules( objTab.TabID ) ) { objModule = modulePair.Value; objModules.DeleteTabModule( objModule.TabID, objModule.ModuleID ); } } } } } // parse portal tabs node = xmlDoc.SelectSingleNode( "//portal/tabs" ); if( node != null ) { ParseTabs( node, PortalId, isAdminTemplate, mergeTabs, IsNewPortal ); } }
private void UpdateTabSkin(int tabId, string newSkin) { var tc = new TabController(); var tab = tc.GetTab(tabId, PortalId, false); tab.SkinSrc = newSkin; tc.UpdateTab(tab); }
private static void AddProfessionalPreviewPages() { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddProfessionalPreviewPages:"); var tabController = new TabController(); TabInfo newTab; //Add new Professional Preview module int moduleDefID = AddModuleDefinition("ProfessionalPreview", "", "ProfessionalPreview", false, true); AddModuleControl(moduleDefID, "", "", "DesktopModules/Admin/ProfessionalPreview/ProfessionalPreview.ascx", "~/images/icon_profeatures_16px.png", SecurityAccessLevel.Host, 0); //Add Advanced Features - hidden tab int advancedFeaturesTabID = TabController.GetTabByTabPath(Null.NullInteger, "//Host//ProfessionalFeatures", Null.NullString); if (advancedFeaturesTabID == Null.NullInteger) { newTab = AddHostPage("Professional Features", "", "~/images/icon_profeatures_16px.gif", "", true); newTab.DisableLink = true; tabController.UpdateTab(newTab); advancedFeaturesTabID = newTab.TabID; } //Add Pages under Advanced Features Tab AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//ManageWebServers", "ProfessionalPreview", "Manage Web Servers", "Manage web servers in a web farm.", "~/images/icon_webservers_16px.gif", "~/images/icon_webservers_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//HealthMonitoring", "ProfessionalPreview", "Health Monitoring", "Monitor health of your DotNetNuke web site.", "~/images/icon_health_16px.gif", "~/images/icon_health_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//ApplicationIntegrity", "ProfessionalPreview", "Application Integrity", "View files that are different than the core framework version.", "~/images/icon_appintegrity_16px.gif", "~/images/icon_appintegrity_32px.gif"); AddLinkedProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//KnowledgeBase", "http://customers.dotnetnuke.com/KB/root.aspx", "Knowledge Base", "Comprehensive Knowledge Base that provides guidance for DotNetNuke administrative tasks and answers to common technical questions.", "~/images/icon_kb_16px.gif", "~/images/icon_kb_32px.gif"); AddLinkedProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//SoftwareAndDocumentation", "http://www.dotnetnuke.com/Resources/Manuals/tabid/1667/Default.aspx", "Software and Documentation", "Download upgrades, subscribed products and additional documentation for professional edition customers.", "~/images/icon_software_16px.gif", "~/images/icon_software_32px.gif"); AddLinkedProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//TechnicalSupport", "http://customers.dotnetnuke.com", "Technical Support", "Visit the technical support home page to find the latest support news, knowledge base articles and more.", "~/images/icon_support_16px.gif", "~/images/icon_support_32px.gif"); AddLinkedProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//MySupportTickets", "http://customers.dotnetnuke.com/Main/frmTickets.aspx", "My Support Tickets", "The Support Ticket system will allow you to email support questions to our staff. A staff member will promptly reply to your request and progress will be tracked using the ticket. You can 'Start a new Ticket' and view your existing tickets here.", "~/images/icon_mytickets_16px.gif", "~/images/icon_mytickets_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//ActivateyourLicense", "ProfessionalPreview", "Activate Your License", "Activate your DotNetNuke Professional licenses. Activating your license will ensure that you continue to receive the benefits provided to our customers.", "~/images/icon_activatelicense_16px.gif", "~/images/icon_activatelicense_32px.gif"); AddLinkedProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//LicenseManagement", "http://www.dotnetnuke.com/tabid/1205/Default.aspx", "License Management", "Manage licenses for your subscribed products.", "~/images/icon_licensemgmt_16px.gif", "~/images/icon_licensemgmt_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//SearchCrawlerAdmin", "ProfessionalPreview", "SearchCrawler Admin", "Administration of Search Crawler attributes..", "~/images/SearchCrawler_16px.gif", "~/images/SearchCrawler_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//SecurityCenter", "ProfessionalPreview", "Security Center", "Displays Security Bulletins for this instance of DotNetNuke.", "~/images/icon_securityroles_16px.gif", "~/images/icon_securityroles_32px.gif"); AddProfessionalPreviewPage(advancedFeaturesTabID, "//Host//ProfessionalFeatures//UserSwitcher", "ProfessionalPreview", "User Switcher", "Switch to another user's identity.", "~/images/icon_usersSwitcher_16px.gif", "~/images/icon_usersSwitcher_32px.gif"); }
public void AdvancedUrlRewriter_ForwardExternalUrls(Dictionary<string, string> testFields) { var settings = UrlTestFactoryClass.GetSettings("UrlRewrite", testFields["TestName"]); settings.PortalId = PortalId; var tc = new TabController(); var tab = tc.GetTabByName(_testPage, PortalId); tab.Url = testFields["ExternalUrl"]; tc.UpdateTab(tab); ExecuteTest(settings, testFields, true); }
private bool MoveTab(TabInfo tab, TabInfo targetTab, Position position) { //Validate Tab Path if (!IsValidTabPath(tab, Globals.GenerateTabPath((targetTab == null) ? Null.NullInteger : targetTab.TabID, tab.TabName))) { return false; } var tabController = new TabController(); //get current siblings of moving tab var siblingTabs = GetSiblingTabs(tab); int siblingCount = siblingTabs.Count; //move all current siblings of moving tab one level up in order int tabIndex = GetIndexOfTab(tab, siblingTabs); UpdateTabOrder(siblingTabs, tabIndex + 1, siblingCount - 1, -2); //get siblings of new position siblingTabs = GetSiblingTabs(targetTab); siblingCount = siblingTabs.Count; //First make sure the list of siblings at the new position is sorted and spaced UpdateTabOrder(siblingTabs, tab.CultureCode, 2); //Find Index position of new positin in the Sibling List var targetIndex = GetIndexOfTab(targetTab, siblingTabs); switch (position) { case Position.Above: targetIndex = targetIndex - 1; break; case Position.Below: break; } //We need to update the taborder for items that were after that position UpdateTabOrder(siblingTabs, targetIndex + 1, siblingCount - 1, 2); //Get the descendents of old tab position now before the new parentid is updated var descendantTabs = tabController.GetTabsByPortal(tab.PortalID).DescendentsOf(tab.TabID); //Update the current Tab to reflect new parent id and new taborder tab.ParentId = targetTab.ParentId; tabController.UpdateTab(tab); //Update the moving tabs level and tabpath tab.Level = targetTab.Level; //Update TabOrder as the previous UpdateTab call pushes the tab to the bottom switch (position) { case Position.Above: tab.TabOrder = targetTab.TabOrder - 2; break; case Position.Below: tab.TabOrder = targetTab.TabOrder + 1; break; } UpdateTabOrder(tab, true); //Update the Descendents of the moving tab UpdateDescendantLevel(descendantTabs, tab.Level + 1); ShowSuccessMessage(string.Format(Localization.GetString("TabMoved", LocalResourceFile), tab.TabName)); return true; }
private void UpdateTabSetting(string tabName, string settingName, string settingValue) { var tc = new TabController(); var tab = tc.GetTabByName(tabName, PortalId); tab.TabSettings[settingName] = settingValue; tc.UpdateTab(tab); }
protected void CtlPagesNodeEdit(object sender, RadTreeNodeEditEventArgs e) { var objTabController = new TabController(); var objTab = objTabController.GetTab(int.Parse(e.Node.Value), PortalId, false); if (objTab != null && TabPermissionController.CanManagePage(objTab)) { //Check for invalid if (!IsValidTabName(e.Text) || !IsValidTabPath(objTab, Globals.GenerateTabPath(objTab.ParentId, e.Text))) { e.Node.Text = objTab.TabName; e.Text = objTab.TabName; } else { objTab.TabName = e.Text; objTabController.UpdateTab(objTab); } BindTreeAndShowTab(objTab.TabID); } }
/// <summary> /// SaveTabData saves the Tab to the Database /// </summary> /// <remarks> /// </remarks> /// <param name = "strAction">The action to perform "edit" or "add"</param> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// [jlucarino] 2/26/2009 Added CreatedByUserID and LastModifiedByUserID /// </history> private int SaveTabData(string strAction) { string strIcon = ctlIcon.Url; string strIconLarge = ctlIconLarge.Url; var objTabs = new TabController(); Tab.TabName = txtTabName.Text; Tab.Title = txtTitle.Text; Tab.Description = txtDescription.Text; Tab.KeyWords = txtKeyWords.Text; Tab.IsVisible = chkMenu.Checked; Tab.DisableLink = chkDisableLink.Checked; TabInfo parentTab = null; if (cboParentTab.SelectedItem != null) { var parentTabId = cboParentTab.SelectedItemValueAsInt; var controller = new TabController(); parentTab = controller.GetTab(parentTabId, -1, false); } if (parentTab != null) { Tab.PortalID = parentTab.PortalID; Tab.ParentId = parentTab.TabID; } else { Tab.ParentId = Null.NullInteger; } Tab.IconFile = strIcon; Tab.IconFileLarge = strIconLarge; Tab.IsDeleted = false; Tab.Url = ctlURL.Url; Tab.TabPermissions.Clear(); if (Tab.PortalID != Null.NullInteger) { Tab.TabPermissions.AddRange(dgPermissions.Permissions); } Tab.Terms.Clear(); Tab.Terms.AddRange(termsSelector.Terms); Tab.SkinSrc = pageSkinCombo.SelectedValue; Tab.ContainerSrc = pageContainerCombo.SelectedValue; Tab.TabPath = Globals.GenerateTabPath(Tab.ParentId, Tab.TabName); //Check for invalid string invalidType; if (!TabController.IsValidTabName(Tab.TabName, out invalidType)) { ShowWarningMessage(string.Format(Localization.GetString(invalidType, LocalResourceFile), Tab.TabName)); return Null.NullInteger; } //Validate Tab Path if (!IsValidTabPath(Tab, Tab.TabPath)) { return Null.NullInteger; } //Set Culture Code var positionTabId = Null.NullInteger; if (cboPositionTab.SelectedItem != null) { positionTabId = Int32.Parse(cboPositionTab.SelectedItem.Value); } if (strAction != "edit") { if (PortalSettings.ContentLocalizationEnabled) { switch (cultureTypeList.SelectedValue) { case "Localized": var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId); Tab.CultureCode = defaultLocale.Code; break; case "Culture": Tab.CultureCode = PortalSettings.CultureCode; break; default: Tab.CultureCode = Null.NullString; break; } var tabLocale = LocaleController.Instance.GetLocale(Tab.CultureCode) ?? LocaleController.Instance.GetDefaultLocale(PortalId); //Fix parent if (Tab.ParentId > Null.NullInteger) { parentTab = objTabs.GetTab(Tab.ParentId, PortalId, false); if (parentTab.CultureCode != Tab.CultureCode) { parentTab = objTabs.GetTabByCulture(Tab.ParentId, PortalId, tabLocale); } if (parentTab != null) { Tab.ParentId = parentTab.TabID; } } //Fix position TabId if (positionTabId > Null.NullInteger) { var positionTab = objTabs.GetTab(positionTabId, PortalId, false); if (positionTab.CultureCode != Tab.CultureCode) { positionTab = objTabs.GetTabByCulture(positionTabId, PortalId, tabLocale); } if (positionTab != null) { positionTabId = positionTab.TabID; } } } else { Tab.CultureCode = Null.NullString; } } //Validate Tab Path if (string.IsNullOrEmpty(strAction)) { var tabID = TabController.GetTabByTabPath(Tab.PortalID, Tab.TabPath, Tab.CultureCode); if (tabID != Null.NullInteger) { var existingTab = objTabs.GetTab(tabID, PortalId, false); if (existingTab != null && existingTab.IsDeleted) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabRecycled", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } return Null.NullInteger; } } Tab.StartDate = datepickerStartDate.SelectedDate != null ? datepickerStartDate.SelectedDate.Value : Null.NullDate; Tab.EndDate = datepickerEndDate.SelectedDate != null ? datepickerEndDate.SelectedDate.Value : Null.NullDate; if (Tab.StartDate > Null.NullDate && Tab.EndDate > Null.NullDate && Tab.StartDate.AddDays(1) >= Tab.EndDate) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidTabDates", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } if (!valRefreshInterval.IsValid) { return Null.NullInteger; } Tab.RefreshInterval = txtRefreshInterval.Text == "" ? Null.NullInteger : Convert.ToInt32(txtRefreshInterval.Text); if (!valPriorityRequired.IsValid || !valPriority.IsValid) { return Null.NullInteger; } Tab.SiteMapPriority = float.Parse(txtPriority.Text); Tab.PageHeadText = txtPageHeadText.Text; Tab.IsSecure = chkSecure.Checked; Tab.PermanentRedirect = chkPermanentRedirect.Checked; UpdateTabSettings(Tab); if (strAction == "edit") { // trap circular tab reference if (cboParentTab.SelectedItem != null && Tab.TabID != cboParentTab.SelectedItemValueAsInt && !IsCircularReference(cboParentTab.SelectedItemValueAsInt, Tab.PortalID)) { objTabs.UpdateTab(Tab); if (IsHostMenu && Tab.PortalID != Null.NullInteger) { //Host Tab moved to Portal so clear Host cache objTabs.ClearCache(Null.NullInteger); } if (!IsHostMenu && Tab.PortalID == Null.NullInteger) { //Portal Tab moved to Host so clear portal cache objTabs.ClearCache(PortalId); } } } else { if (positionTabId == Null.NullInteger) { Tab.TabID = objTabs.AddTab(Tab); } else { if (rbInsertPosition.SelectedValue == "After" && positionTabId > Null.NullInteger) { Tab.TabID = objTabs.AddTabAfter(Tab, positionTabId); } else if (rbInsertPosition.SelectedValue == "Before" && positionTabId > Null.NullInteger) { Tab.TabID = objTabs.AddTabBefore(Tab, positionTabId); } else { Tab.TabID = objTabs.AddTab(Tab); } } //Create Localized versions if (PortalSettings.ContentLocalizationEnabled && cultureTypeList.SelectedValue == "Localized") { objTabs.CreateLocalizedCopies(Tab); //Refresh tab _tab = objTabs.GetTab(Tab.TabID, Tab.PortalID, true); } var copyTabId = cboCopyPage.Visible && cboCopyPage.SelectedItem != null ? cboCopyPage.SelectedItemValueAsInt : Null.NullInteger; if (copyTabId != Null.NullInteger) { var objModules = new ModuleController(); ModuleInfo objModule; CheckBox chkModule; RadioButton optCopy; RadioButton optReference; TextBox txtCopyTitle; foreach (DataGridItem objDataGridItem in grdModules.Items) { chkModule = (CheckBox)objDataGridItem.FindControl("chkModule"); if (chkModule.Checked) { var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]); optCopy = (RadioButton)objDataGridItem.FindControl("optCopy"); optReference = (RadioButton)objDataGridItem.FindControl("optReference"); txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle"); objModule = objModules.GetModule(intModuleID, copyTabId, false); ModuleInfo newModule = null; if ((objModule != null)) { //Clone module as it exists in the cache and changes we make will update the cached object newModule = objModule.Clone(); newModule.TabID = Tab.TabID; newModule.DefaultLanguageGuid = Null.NullGuid; newModule.CultureCode = Tab.CultureCode; newModule.ModuleTitle = txtCopyTitle.Text; if (!optReference.Checked) { newModule.ModuleID = Null.NullInteger; objModules.InitialModulePermission(newModule, newModule.TabID, 0); } newModule.ModuleID = objModules.AddModule(newModule); if (optCopy.Checked) { if (!string.IsNullOrEmpty(newModule.DesktopModule.BusinessControllerClass)) { var objObject = Reflection.CreateObject(newModule.DesktopModule.BusinessControllerClass, newModule.DesktopModule.BusinessControllerClass); if (objObject is IPortable) { var content = Convert.ToString(((IPortable)objObject).ExportModule(intModuleID)); if (!string.IsNullOrEmpty(content)) { ((IPortable)objObject).ImportModule(newModule.ModuleID, content, newModule.DesktopModule.Version, UserInfo.UserID); } } } } } if (optReference.Checked) { //Make reference copies on secondary language foreach (var m in objModule.LocalizedModules.Values) { var newLocalizedModule = m.Clone(); var localizedTab = Tab.LocalizedTabs[m.CultureCode]; newLocalizedModule.TabID = localizedTab.TabID; newLocalizedModule.CultureCode = localizedTab.CultureCode; newLocalizedModule.ModuleTitle = txtCopyTitle.Text; newLocalizedModule.DefaultLanguageGuid = newModule.UniqueId; newLocalizedModule.ModuleID = objModules.AddModule(newLocalizedModule); } } } } } else { // create the page from a template if (cboTemplate.SelectedItem != null && cboTemplate.SelectedItem.Value != Null.NullInteger.ToString()) { var xmlDoc = new XmlDocument(); try { // open the XML file var folder = FolderManager.Instance.GetFolder(cboFolders.SelectedItemValueAsInt); if (folder != null) xmlDoc.Load(PortalSettings.HomeDirectoryMapPath + folder.FolderPath + cboTemplate.SelectedValue); } catch (Exception ex) { Exceptions.LogException(ex); Skin.AddModuleMessage(this, Localization.GetString("BadTemplate", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), Tab.PortalID, Tab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable()); //save tab permissions RibbonBarManager.DeserializeTabPermissions(xmlDoc.SelectNodes("//portal/tabs/tab/tabpermissions/permission"), Tab); var tabIndex = 0; var exceptions = string.Empty; foreach (XmlNode tabNode in xmlDoc.SelectSingleNode("//portal/tabs").ChildNodes) { //Create second tab onward tabs. Note first tab is already created above. if (tabIndex > 0) { try { TabController.DeserializeTab(tabNode, null, PortalId, PortalTemplateModuleAction.Replace); } catch (Exception ex) { Exceptions.LogException(ex); exceptions += string.Format("Template Tab # {0}. Error {1}<br/>", tabIndex + 1, ex.Message); } } else { if (string.IsNullOrEmpty(Tab.SkinSrc) && !String.IsNullOrEmpty(XmlUtils.GetNodeValue(tabNode, "skinsrc", ""))) { Tab.SkinSrc = XmlUtils.GetNodeValue(tabNode, "skinsrc", ""); } if (string.IsNullOrEmpty(Tab.ContainerSrc) && !String.IsNullOrEmpty(XmlUtils.GetNodeValue(tabNode, "containersrc", ""))) { Tab.ContainerSrc = XmlUtils.GetNodeValue(tabNode, "containersrc", ""); } objTabs.UpdateTab(Tab); } tabIndex++; } if (!string.IsNullOrEmpty(exceptions)) { Skin.AddModuleMessage(this, exceptions, ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } } } } // url tracking var objUrls = new UrlController(); objUrls.UpdateUrl(PortalId, ctlURL.Url, ctlURL.UrlType, 0, Null.NullDate, Null.NullDate, ctlURL.Log, ctlURL.Track, Null.NullInteger, ctlURL.NewWindow); //Clear the Tab's Cached modules DataCache.ClearModuleCache(TabId); //Update Cached Tabs as TabPath may be needed before cache is cleared TabInfo tempTab; if (new TabController().GetTabsByPortal(PortalId).TryGetValue(Tab.TabID, out tempTab)) { tempTab.TabPath = Tab.TabPath; } //Update Custom Url if (!Tab.IsSuperTab) { var tabUrl = Tab.TabUrls.SingleOrDefault(t => t.IsSystem && t.HttpStatus == "200" && t.SeqNum == 0); var url = urlTextBox.Text; if (!String.IsNullOrEmpty(url)) { if (!url.StartsWith("/")) { url = "/" + url; } string currentUrl = String.Empty; var friendlyUrlSettings = new FriendlyUrlSettings(PortalId); if (Tab.TabID > -1 && !Tab.IsSuperTab) { var baseUrl = Globals.AddHTTP(PortalAlias.HTTPAlias) + "/Default.aspx?TabId=" + Tab.TabID; var path = AdvancedFriendlyUrlProvider.ImprovedFriendlyUrl(Tab, baseUrl, Globals.glbDefaultPage, PortalAlias.HTTPAlias, false, //dnndev-27493 :we want any custom Urls that apply friendlyUrlSettings, Guid.Empty); currentUrl = path.Replace(Globals.AddHTTP(PortalAlias.HTTPAlias), ""); } if (url != currentUrl) { if (tabUrl == null) { tabUrl = new TabUrlInfo() { TabId = Tab.TabID, SeqNum = 0, PortalAliasId = -1, PortalAliasUsage = PortalAliasUsageType.Default, QueryString = String.Empty, Url = url, HttpStatus = "200", IsSystem = true }; } else { tabUrl.Url = url; } //Delete any redirects to the same url foreach (var redirecturl in TestableTabController.Instance.GetTabUrls(Tab.TabID, Tab.PortalID)) { if (redirecturl.Url == url && redirecturl.HttpStatus != "200") { TestableTabController.Instance.DeleteTabUrl(redirecturl, Tab.PortalID, false); } } //Save url TestableTabController.Instance.SaveTabUrl(tabUrl, PortalId, true); } } else { if (tabUrl != null) { TestableTabController.Instance.DeleteTabUrl(tabUrl, PortalId, true); } } } return Tab.TabID; }
public void ParseTemplate(int PortalId, string TemplatePath, string TemplateFile, int AdministratorId, PortalTemplateModuleAction mergeTabs, bool IsNewPortal, out LocaleCollection localeCollection) { XmlDocument xmlPortal = new XmlDocument(); IFolderInfo objFolder; XmlNode node; try { xmlPortal.Load(Path.Combine(TemplatePath, TemplateFile)); } catch(Exception ex) { Logger.Error(ex); } node = xmlPortal.SelectSingleNode("//portal/settings"); if (node != null && IsNewPortal) { ParsePortalSettings(node, PortalId); } node = xmlPortal.SelectSingleNode("//locales"); if (node != null && IsNewPortal) { localeCollection = ParseEnabledLocales(node, PortalId); } else { var portalInfo = new PortalController().GetPortal(PortalId); var defaultLocale = LocaleController.Instance.GetLocale(portalInfo.DefaultLanguage); if (defaultLocale == null) { defaultLocale = new Locale { Code = portalInfo.DefaultLanguage, Fallback = Localization.SystemLocale, Text = CultureInfo.CreateSpecificCulture(portalInfo.DefaultLanguage).NativeName }; Localization.SaveLanguage(defaultLocale, false); } localeCollection = new LocaleCollection { { defaultLocale.Code, defaultLocale } }; } node = xmlPortal.SelectSingleNode("//portal/rolegroups"); if (node != null) { ParseRoleGroups(node.CreateNavigator(), PortalId, AdministratorId); } 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); } }
protected void CtlPagesContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e) { SelectedNode = e.Node.Value; var tabController = new TabController(); var portalId = rblMode.SelectedValue == "H" ? Null.NullInteger : PortalId; var objTab = tabController.GetTab(int.Parse(e.Node.Value), portalId, false); switch (e.MenuItem.Value.ToLower()) { case "makehome": if (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName)) { var portalController = new PortalController(); PortalInfo portalInfo = portalController.GetPortal(PortalId); portalInfo.HomeTabId = objTab.TabID; PortalSettings.HomeTabId = objTab.TabID; portalController.UpdatePortalInfo(portalInfo); DataCache.ClearPortalCache(PortalId, false); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabMadeHome", LocalResourceFile), objTab.TabName)); } break; case "view": Response.Redirect(objTab.FullUrl); break; case "edit": if (TabPermissionController.CanManagePage(objTab)) { var editUrl = Globals.NavigateURL(objTab.TabID, "Tab", "action=edit", "returntabid=" + TabId); // Prevent PageSettings of the current page in a popup if SSL is enabled and enforced, which causes redirection/javascript broswer security issues. if (PortalSettings.EnablePopUps && !(objTab.TabID == TabId && (PortalSettings.SSLEnabled && PortalSettings.SSLEnforced))) { editUrl = UrlUtils.PopUpUrl(editUrl, this, PortalSettings, true, false); var script = string.Format("<script type=\"text/javascript\">{0}</script>", editUrl); ClientAPI.RegisterStartUpScript(Page, "EditInPopup", script); } else { Response.Redirect(editUrl, true); } } break; case "delete": if (TabPermissionController.CanDeletePage(objTab)) { tabController.SoftDeleteTab(objTab.TabID, PortalSettings); BindTree(); //keep the parent tab selected if (objTab.ParentId != Null.NullInteger) { SelectedNode = objTab.ParentId.ToString(CultureInfo.InvariantCulture); ctlPages.FindNodeByValue(SelectedNode).Selected = true; ctlPages.FindNodeByValue(SelectedNode).ExpandParentNodes(); BindTab(objTab.ParentId); } else { pnlDetails.Visible = false; } ShowSuccessMessage(string.Format(Localization.GetString("TabDeleted", LocalResourceFile), objTab.TabName)); } break; case "add": if ((objTab!= null && TabPermissionController.CanAddPage(objTab)) || (PortalSecurity.IsInRole(PortalSettings.AdministratorRoleName))) { pnlBulk.Visible = true; btnBulkCreate.CommandArgument = e.Node.Value; ctlPages.FindNodeByValue(e.Node.Value).Selected = true; txtBulk.Focus(); pnlDetails.Visible = false; //Response.Redirect(NavigateURL(objTab.TabID, "Tab", "action=add", "returntabid=" & TabId.ToString), True) } break; case "hide": if (TabPermissionController.CanManagePage(objTab)) { objTab.IsVisible = false; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabHidden", LocalResourceFile), objTab.TabName)); } break; case "show": if (TabPermissionController.CanManagePage(objTab)) { objTab.IsVisible = true; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabShown", LocalResourceFile), objTab.TabName)); } break; case "disable": if (TabPermissionController.CanManagePage(objTab)) { objTab.DisableLink = true; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabDisabled", LocalResourceFile), objTab.TabName)); } break; case "enable": if (TabPermissionController.CanManagePage(objTab)) { objTab.DisableLink = false; tabController.UpdateTab(objTab); BindTreeAndShowTab(objTab.TabID); ShowSuccessMessage(string.Format(Localization.GetString("TabEnabled", LocalResourceFile), objTab.TabName)); } break; } }
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); } }
private bool MoveTabToParent(TabInfo tab, TabInfo targetTab) { //Validate Tab Path if (!IsValidTabPath(tab, Globals.GenerateTabPath((targetTab == null) ? Null.NullInteger : targetTab.TabID, tab.TabName))) { return false; } var tabController = new TabController(); //get current siblings of moving tab var siblingTabs = GetSiblingTabs(tab); var siblingCount = siblingTabs.Count; //move all current siblings of moving tab one level up in order var tabIndex = GetIndexOfTab(tab, siblingTabs); UpdateTabOrder(siblingTabs, tabIndex + 1, siblingCount - 1, -2); tab.TabOrder = -1; tab.ParentId = (targetTab == null) ? Null.NullInteger : targetTab.TabID; tab.Level = (targetTab == null) ? 0 : targetTab.Level + 1; tabController.UpdateTab(tab); UpdateTabOrder(tab, true); ShowSuccessMessage(string.Format(Localization.GetString("TabMoved", LocalResourceFile), tab.TabName)); return true; }
/// <summary> /// SaveTabData saves the Tab to the Database /// </summary> /// <remarks> /// </remarks> /// <param name = "strAction">The action to perform "edit" or "add"</param> /// <history> /// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// [jlucarino] 2/26/2009 Added CreatedByUserID and LastModifiedByUserID /// </history> private int SaveTabData(string strAction) { string strIcon; string strIconLarge; strIcon = ctlIcon.Url; strIconLarge = ctlIconLarge.Url; var objTabs = new TabController(); Tab.TabName = txtTabName.Text; Tab.Title = txtTitle.Text; Tab.Description = txtDescription.Text; Tab.KeyWords = txtKeyWords.Text; Tab.IsVisible = chkMenu.Checked; Tab.DisableLink = chkDisableLink.Checked; TabInfo parentTab = null; if (cboParentTab.SelectedItem != null) { var parentTabID = Int32.Parse(cboParentTab.SelectedItem.Value); var controller = new TabController(); parentTab = controller.GetTab(parentTabID, -1, false); } if (parentTab != null) { Tab.PortalID = parentTab.PortalID; Tab.ParentId = parentTab.TabID; } else { Tab.ParentId = Null.NullInteger; } Tab.IconFile = strIcon; Tab.IconFileLarge = strIconLarge; Tab.IsDeleted = false; Tab.Url = ctlURL.Url; Tab.TabPermissions.Clear(); if (Tab.PortalID != Null.NullInteger) { Tab.TabPermissions.AddRange(dgPermissions.Permissions); } Tab.Terms.Clear(); Tab.Terms.AddRange(termsSelector.Terms); Tab.SkinSrc = pageSkinCombo.SelectedValue; Tab.ContainerSrc = pageContainerCombo.SelectedValue; Tab.TabPath = Globals.GenerateTabPath(Tab.ParentId, Tab.TabName); //Check for invalid if (!IsValidTabName(Tab.TabName)) { return Null.NullInteger; } //Validate Tab Path if (!IsValidTabPath(Tab, Tab.TabPath)) { return Null.NullInteger; } //Set Culture Code var positionTabID = Null.NullInteger; if (cboPositionTab.SelectedItem != null) { positionTabID = Int32.Parse(cboPositionTab.SelectedItem.Value); } if (strAction != "edit") { if (PortalSettings.ContentLocalizationEnabled) { switch (cultureTypeList.SelectedValue) { case "Localized": var defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalId); Tab.CultureCode = defaultLocale.Code; break; case "Culture": Tab.CultureCode = PortalSettings.CultureCode; break; default: Tab.CultureCode = Null.NullString; break; } var tabLocale = LocaleController.Instance.GetLocale(Tab.CultureCode) ?? LocaleController.Instance.GetDefaultLocale(PortalId); //Fix parent if (Tab.ParentId > Null.NullInteger) { parentTab = objTabs.GetTab(Tab.ParentId, PortalId, false); if (parentTab.CultureCode != Tab.CultureCode) { parentTab = objTabs.GetTabByCulture(Tab.ParentId, PortalId, tabLocale); } Tab.ParentId = parentTab.TabID; } //Fix position TabId if (positionTabID > Null.NullInteger) { var positionTab = objTabs.GetTab(positionTabID, PortalId, false); if (positionTab.CultureCode != Tab.CultureCode) { positionTab = objTabs.GetTabByCulture(positionTabID, PortalId, tabLocale); } positionTabID = positionTab.TabID; } } else { Tab.CultureCode = Null.NullString; } } //Validate Tab Path if (string.IsNullOrEmpty(strAction)) { var tabID = TabController.GetTabByTabPath(Tab.PortalID, Tab.TabPath, Tab.CultureCode); if (tabID != Null.NullInteger) { var existingTab = objTabs.GetTab(tabID, PortalId, false); if (existingTab != null && existingTab.IsDeleted) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabRecycled", LocalResourceFile), ModuleMessage.ModuleMessageType.YellowWarning); } else { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("TabExists", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); } return Null.NullInteger; } } Tab.StartDate = datepickerStartDate.SelectedDate != null ? datepickerStartDate.SelectedDate.Value : Null.NullDate; Tab.EndDate = datepickerEndDate.SelectedDate != null ? datepickerEndDate.SelectedDate.Value : Null.NullDate; if (Tab.StartDate > Null.NullDate && Tab.EndDate > Null.NullDate && Tab.StartDate.AddDays(1) >= Tab.EndDate) { UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("InvalidTabDates", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } if (txtRefreshInterval.Text.Length > 0 && Regex.IsMatch(txtRefreshInterval.Text, "^\\d+$")) { Tab.RefreshInterval = Convert.ToInt32(txtRefreshInterval.Text); } Tab.SiteMapPriority = float.Parse(txtPriority.Text); Tab.PageHeadText = txtPageHeadText.Text; Tab.IsSecure = chkSecure.Checked; Tab.PermanentRedirect = chkPermanentRedirect.Checked; if (strAction == "edit") { // trap circular tab reference if (cboParentTab.SelectedItem != null && Tab.TabID != Int32.Parse(cboParentTab.SelectedItem.Value) && !IsCircularReference(Int32.Parse(cboParentTab.SelectedItem.Value), Tab.PortalID)) { objTabs.UpdateTab(Tab); if (IsHostMenu && Tab.PortalID != Null.NullInteger) { //Host Tab moved to Portal so clear Host cache objTabs.ClearCache(Null.NullInteger); } if (!IsHostMenu && Tab.PortalID == Null.NullInteger) { //Portal Tab moved to Host so clear portal cache objTabs.ClearCache(PortalId); } UpdateTabSettings(Tab.TabID); } // add or copy } else { if (positionTabID == Null.NullInteger) { Tab.TabID = objTabs.AddTab(Tab); } else { if (rbInsertPosition.SelectedValue == "After" && positionTabID > Null.NullInteger) { Tab.TabID = objTabs.AddTabAfter(Tab, positionTabID); } else if (rbInsertPosition.SelectedValue == "Before" && positionTabID > Null.NullInteger) { Tab.TabID = objTabs.AddTabBefore(Tab, positionTabID); } else { Tab.TabID = objTabs.AddTab(Tab); } } UpdateTabSettings(Tab.TabID); //Create Localized versions if (PortalSettings.ContentLocalizationEnabled && cultureTypeList.SelectedValue == "Localized") { objTabs.CreateLocalizedCopies(Tab); //Refresh tab _tab = objTabs.GetTab(Tab.TabID, Tab.PortalID, true); } var copyTabId = Int32.Parse(cboCopyPage.SelectedItem.Value); if (copyTabId != -1) { var objModules = new ModuleController(); ModuleInfo objModule; CheckBox chkModule; RadioButton optCopy; RadioButton optReference; TextBox txtCopyTitle; foreach (DataGridItem objDataGridItem in grdModules.Items) { chkModule = (CheckBox)objDataGridItem.FindControl("chkModule"); if (chkModule.Checked) { var intModuleID = Convert.ToInt32(grdModules.DataKeys[objDataGridItem.ItemIndex]); optCopy = (RadioButton)objDataGridItem.FindControl("optCopy"); optReference = (RadioButton)objDataGridItem.FindControl("optReference"); txtCopyTitle = (TextBox)objDataGridItem.FindControl("txtCopyTitle"); objModule = objModules.GetModule(intModuleID, copyTabId, false); ModuleInfo newModule = null; if ((objModule != null)) { //Clone module as it exists in the cache and changes we make will update the cached object newModule = objModule.Clone(); if (!optReference.Checked) { newModule.ModuleID = Null.NullInteger; } newModule.TabID = Tab.TabID; newModule.DefaultLanguageGuid = Null.NullGuid; newModule.CultureCode = Tab.CultureCode; newModule.ModuleTitle = txtCopyTitle.Text; newModule.ModuleID = objModules.AddModule(newModule); if (optCopy.Checked) { if (!string.IsNullOrEmpty(newModule.DesktopModule.BusinessControllerClass)) { var objObject = Reflection.CreateObject(newModule.DesktopModule.BusinessControllerClass, newModule.DesktopModule.BusinessControllerClass); if (objObject is IPortable) { var content = Convert.ToString(((IPortable)objObject).ExportModule(intModuleID)); if (!string.IsNullOrEmpty(content)) { ((IPortable)objObject).ImportModule(newModule.ModuleID, content, newModule.DesktopModule.Version, UserInfo.UserID); } } } } } if (optReference.Checked) { //Make reference copies on secondary language foreach (var m in objModule.LocalizedModules.Values) { var newLocalizedModule = m.Clone(); var localizedTab = Tab.LocalizedTabs[m.CultureCode]; newLocalizedModule.TabID = localizedTab.TabID; newLocalizedModule.CultureCode = localizedTab.CultureCode; newLocalizedModule.ModuleTitle = txtCopyTitle.Text; newLocalizedModule.DefaultLanguageGuid = newModule.UniqueId; newLocalizedModule.ModuleID = objModules.AddModule(newLocalizedModule); } } } } } else { // create the page from a template if (cboTemplate.SelectedItem != null && cboTemplate.SelectedItem.Value != Null.NullInteger.ToString()) { var xmlDoc = new XmlDocument(); try { // open the XML file xmlDoc.Load(PortalSettings.HomeDirectoryMapPath + cboFolders.SelectedValue + cboTemplate.SelectedValue); } catch (Exception ex) { Exceptions.LogException(ex); UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("BadTemplate", LocalResourceFile), ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } TabController.DeserializePanes(xmlDoc.SelectSingleNode("//portal/tabs/tab/panes"), Tab.PortalID, Tab.TabID, PortalTemplateModuleAction.Ignore, new Hashtable()); //save tab permissions RibbonBarManager.DeserializeTabPermissions(xmlDoc.SelectNodes("//portal/tabs/tab/tabpermissions/permission"), Tab); var tabIndex = 0; var exceptions = string.Empty; foreach (XmlNode tabNode in xmlDoc.SelectSingleNode("//portal/tabs").ChildNodes) { //Create second tab onward tabs. Note first tab is already created above. if(tabIndex > 0) { try { TabController.DeserializeTab(tabNode, null, PortalId, PortalTemplateModuleAction.Replace); } catch (Exception ex) { Exceptions.LogException(ex); exceptions += string.Format("Template Tab # {0}. Error {1}<br/>", tabIndex + 1, ex.Message); } } tabIndex++; } if (!string.IsNullOrEmpty(exceptions)) { UI.Skins.Skin.AddModuleMessage(this, exceptions, ModuleMessage.ModuleMessageType.RedError); return Null.NullInteger; } } } } // url tracking var objUrls = new UrlController(); objUrls.UpdateUrl(PortalId, ctlURL.Url, ctlURL.UrlType, 0, Null.NullDate, Null.NullDate, ctlURL.Log, ctlURL.Track, Null.NullInteger, ctlURL.NewWindow); //Clear the Tab's Cached modules DataCache.ClearModuleCache(TabId); //Update Cached Tabs as TabPath may be needed before cache is cleared TabInfo tempTab; if (new TabController().GetTabsByPortal(PortalId).TryGetValue(Tab.TabID, out tempTab)) { tempTab.TabPath = Tab.TabPath; } //Update Translation Status objTabs.UpdateTranslationStatus(Tab, translatedCheckbox.Checked); return Tab.TabID; }