public TabInfo AddCoursePage(string tabName, string tabTitle) { PortalSettings portalSettings = new PortalSettings(); int portalId = portalSettings.PortalId; TabController tabController = new TabController(); TabInfo getTab = tabController.GetTabByName(tabName, portalId); if (getTab != null) throw new Exception("Cannot create Page. Page with this PageName already exists"); TabInfo newTab = new TabInfo(); newTab.PortalID = portalId; newTab.TabName = tabName; newTab.Title = tabTitle; newTab.SkinSrc = "[G]Skins/20047-UnlimitedColorPack-033/CoursePage.ascx"; newTab.ContainerSrc = portalSettings.DefaultPortalContainer; CommonTabSettings(newTab); AddViewPermissions(newTab); int tabId = tabController.AddTab(newTab, true); DotNetNuke.Common.Utilities.DataCache.ClearModuleCache(tabId); AddTabURL(newTab); //Makes the URL of Page /4 or /C4 // add modules to new page AddModuleToPage(newTab, ModuleType.DisplayCourse); AddModuleToPage(newTab, ModuleType.Rating); AddModuleToPage(newTab, ModuleType.Comments); return newTab; }
private void BindModules() { DotNetNuke.Entities.Modules.ModuleController mc = new ModuleController(); ArrayList existMods = mc.GetModulesByDefinition(this.PortalId, "GIBS - FlexMLS"); foreach (DotNetNuke.Entities.Modules.ModuleInfo mi in existMods) { if (!mi.IsDeleted) { DotNetNuke.Entities.Tabs.TabController tabController = new DotNetNuke.Entities.Tabs.TabController(); DotNetNuke.Entities.Tabs.TabInfo tabInfo = tabController.GetTab(mi.TabID, this.PortalId); string strPath = tabInfo.TabName.ToString(); ListItem objListItem = new ListItem(); objListItem.Value = mi.TabID.ToString(); // TabID & ModuleID + "-" + mi.ModuleID.ToString() objListItem.Text = strPath + " -> " + mi.ModuleTitle.ToString(); ddlViewListing.Items.Add(objListItem); } } ddlViewListing.Items.Insert(0, new ListItem(Localization.GetString("SelectModule", this.LocalResourceFile), "-1")); }
/// <summary> /// Upgrades the module. /// </summary> /// <param name="Version">The version.</param> /// <returns>System.String.</returns> public string UpgradeModule(string Version) { TabController tabs = new TabController(); foreach (PortalInfo p in new PortalController().GetPortals()) { TabInfo tabInfo = tabs.GetTabByName("Vanity Urls", p.PortalID); if (tabInfo == null) { tabInfo = new TabInfo(); tabInfo.TabID = -1; tabInfo.ParentId = tabs.GetTabByName("Admin", p.PortalID).TabID; tabInfo.PortalID = p.PortalID; tabInfo.TabName = "Vanity Urls"; try { int tabId = tabs.AddTab(tabInfo); AddModuleToPage(p.PortalID, tabId); return "Vanity Urls page added"; } catch (Exception ex) { DotNetNuke.Services.Exceptions.Exceptions.LogException(ex); } } } return ""; }
internal override string FriendlyUrl(TabInfo tab, string path, string pageName, PortalSettings portalSettings) { if (portalSettings == null) { throw new ArgumentNullException("portalSettings"); } return FriendlyUrlInternal(tab, path, pageName, String.Empty, portalSettings); }
private static void AddUniqueUrlToIndex(string furlKey, ref string qsKey, string qsValue, int portalID, Hashtable queryStringIndex, FriendlyUrlOptions options, bool addSuffixIfDuplicateFound, out string suffix) { DotNetNuke.Entities.Tabs.TabController tc = new DotNetNuke.Entities.Tabs.TabController(); bool duplicate = false; suffix = "";//can hold a de-duplicating suffix int suffixCounter = 1; bool furlKeyUsed = false; do { duplicate = false;//always start in the assumption that this is not a duplicate DotNetNuke.Entities.Tabs.TabInfo matchingTab = tc.GetTabByName(qsKey, portalID); if (matchingTab != null) { duplicate = true; } else if (portalID >= 0) { matchingTab = tc.GetTabByName(qsKey, -1);//host tabs if (matchingTab != null) { duplicate = true; } } if (duplicate == false) { //try and add to index if (queryStringIndex.ContainsKey(qsKey) == false) { queryStringIndex.Add(qsKey, qsValue); } else { duplicate = true; } } if (duplicate == true) { if (furlKeyUsed == false) { furlKeyUsed = true; suffix = options.PunctuationReplacement + furlKey; qsKey += suffix; } else { suffix += suffixCounter.ToString(); qsKey += suffix; } } }while (duplicate == true && addSuffixIfDuplicateFound == true); }
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/Aphelia/twoColumn-rightAside.ascx"; newPage.ContainerSrc = "[G]Containers/Aphelia/Title.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); } }
/// <summary> /// Determines if the tab is excluded from FriendlyUrl Processing /// </summary> /// <param name="tab"></param> /// <param name="settings"></param> /// <param name="rewriting">If true, we are checking for rewriting purposes, if false, we are checking for friendly Url Generating.</param> /// <returns></returns> private static bool IsExcludedFromFriendlyUrls(TabInfo tab, FriendlyUrlSettings settings, bool rewriting) { //note this is a duplicate of another method in RewriteController.cs bool exclude = false; string tabPath = (tab.TabPath.Replace("//", "/") + ";").ToLower(); if (settings.UseBaseFriendlyUrls != null) { exclude = settings.UseBaseFriendlyUrls.ToLower().Contains(tabPath); } return exclude; }
private static void AddChildTabsToList(TabInfo currentTab, ref TabCollection allPortalTabs, ref IDictionary<int, TabInfo> tabsWithModule, ref IDictionary<int, TabInfo> tabsInOrder) { if ((tabsWithModule.ContainsKey(currentTab.TabID) && !tabsInOrder.ContainsKey(currentTab.TabID))) { //add current tab tabsInOrder.Add(currentTab.TabID, currentTab); //add children of current tab foreach (TabInfo tab in allPortalTabs.WithParentId(currentTab.TabID)) { AddChildTabsToList(tab, ref allPortalTabs, ref tabsWithModule, ref tabsInOrder); } } }
public static void AddBreadCrumbs(List <BreadCrumb> breadCrumbs) { int idx = 0; foreach (var item in breadCrumbs) { var tab = new DotNetNuke.Entities.Tabs.TabInfo(); tab.TabID = -8888 + idx; tab.TabName = item.Name; tab.Url = item.Url; PortalSettings.Current.ActiveTab.BreadCrumbs.Add(tab); idx++; } }
/// <summary> /// Get the tab path for the supplied Tab /// </summary> /// <param name="tab"></param> /// <param name="options"></param> /// <param name="parentTraceId"></param> /// <returns></returns> internal static string GetFriendlyUrlTabPath(TabInfo tab, FriendlyUrlOptions options, Guid parentTraceId) { string baseTabPath = tab.TabPath.Replace("//", "/").TrimStart('/'); if (options.CanGenerateNonStandardPath) { //build up a non-space version of the tab path baseTabPath = BuildTabPathWithReplacement(tab, options, parentTraceId); baseTabPath = baseTabPath.Replace("//", "/"); //automatic diacritic conversion if (options.ConvertDiacriticChars) { bool diacriticsChanged; baseTabPath = ReplaceDiacritics(baseTabPath, out diacriticsChanged); } } return baseTabPath; }
private static void AddAllTabsModules(TabInfo tab) { var objmodules = new ModuleController(); var portalSettings = new PortalSettings(tab.TabID, tab.PortalID); foreach (ModuleInfo allTabsModule in objmodules.GetAllTabsModules(tab.PortalID, true)) { //[DNN-6276]We need to check that the Module is not implicitly deleted. ie If all instances are on Pages //that are all "deleted" then even if the Module itself is not deleted, we would not expect the //Module to be added var canAdd = (from ModuleInfo allTabsInstance in objmodules.GetModuleTabs(allTabsModule.ModuleID) select new TabController().GetTab(allTabsInstance.TabID, tab.PortalID, false)).Any( t => !t.IsDeleted) && (!portalSettings.ContentLocalizationEnabled || allTabsModule.CultureCode == portalSettings.CultureCode); if (canAdd) { objmodules.CopyModule(allTabsModule, tab, Null.NullString, true); } } }
public static void AddBreadCrumb(string name, string url) { int idx = -8888; if (PortalSettings.Current.ActiveTab.BreadCrumbs.Count > 0) { TabInfo last = (TabInfo)DotNetNuke.Entities.Portals.PortalSettings.Current.ActiveTab.BreadCrumbs[PortalSettings.Current.ActiveTab.BreadCrumbs.Count - 1]; if (last.TabID < -100) { idx = last.TabID + 1; } } var tab = new DotNetNuke.Entities.Tabs.TabInfo(); tab.TabID = idx; tab.TabName = name; tab.Url = url; PortalSettings.Current.ActiveTab.BreadCrumbs.Add(tab); }
private static string AppendToTabPath(string path, TabInfo tab, FriendlyUrlOptions options, out bool modified) { string tabName = tab.TabName; var result = new StringBuilder(tabName.Length); //922 : change to harmonise cleaning of tab + other url name items tabName = FriendlyUrlController.CleanNameForUrl(tabName, options, out modified); if (!modified && string.IsNullOrEmpty(options.PunctuationReplacement) == false && tab.TabName.Contains(" ") && tabName.Contains(" ") == false) { modified = true; //spaces replaced - the modified parameter is for all other replacements but space replacements } result.Append(tabName); result.Insert(0, "//"); result.Insert(0, path); //effectively adds result to the end of the path return result.ToString(); }
///----------------------------------------------------------------------------- ///<summary> /// AddModuleToPage adds a module to a Page ///</summary> ///<remarks> ///</remarks> ///<param name = "page">The Page to add the Module to</param> ///<param name = "moduleDefId">The Module Deinition Id for the module to be aded to this tab</param> ///<param name = "moduleTitle">The Module's title</param> ///<param name = "moduleIconFile">The Module's icon</param> ///<param name = "inheritPermissions">Inherit the Pages View Permisions</param> ///<history> /// [cnurse] 11/16/2004 created ///</history> ///----------------------------------------------------------------------------- public static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions) { var moduleController = new ModuleController(); ModuleInfo moduleInfo; int moduleId = Null.NullInteger; if ((page != null)) { bool isDuplicate = false; foreach (var kvp in moduleController.GetTabModules(page.TabID)) { moduleInfo = kvp.Value; if (moduleInfo.ModuleDefID == moduleDefId) { isDuplicate = true; moduleId = moduleInfo.ModuleID; } } if (!isDuplicate) { moduleInfo = new ModuleInfo { ModuleID = Null.NullInteger, PortalID = page.PortalID, TabID = page.TabID, ModuleOrder = -1, ModuleTitle = moduleTitle, PaneName = Globals.glbDefaultPane, ModuleDefID = moduleDefId, CacheTime = 0, IconFile = moduleIconFile, AllTabs = false, Visibility = VisibilityState.None, InheritViewPermissions = inheritPermissions }; moduleId = moduleController.AddModule(moduleInfo); } } return moduleId; }
private TabInfo CreatePage(TabInfo tab, int portalId, int parentTabId, string tabName, bool includeInMenu) { int id = -1; var tc = new TabController(); var tPermissions = new TabPermissionCollection(); var newTab = new TabInfo(); if ((tab != null)) { foreach (TabPermissionInfo t in tab.TabPermissions) { var tNew = new TabPermissionInfo { AllowAccess = t.AllowAccess, DisplayName = t.DisplayName, ModuleDefID = t.ModuleDefID, PermissionCode = t.PermissionCode, PermissionID = t.PermissionID, PermissionKey = t.PermissionKey, PermissionName = t.PermissionName, RoleID = t.RoleID, RoleName = t.RoleName, TabID = -1, TabPermissionID = -1, UserID = t.UserID, Username = t.Username }; newTab.TabPermissions.Add(t); } } newTab.ParentId = parentTabId; newTab.PortalID = portalId; newTab.TabName = tabName; newTab.Title = tabName; newTab.IsVisible = includeInMenu; newTab.SkinSrc = "[G]Skins/DarkKnight/2-Column-Right-SocialProfile-Mega-Menu.ascx"; id = tc.AddTab(newTab); tab = tc.GetTab(id, portalId, true); return tab; }
public void UpdateTabOrder(TabInfo objTab) { Provider.UpdateTabOrder(objTab.TabID, objTab.TabOrder, objTab.ParentId, UserController.Instance.GetCurrentUserInfo().UserID); UpdateTabVersion(objTab.TabID); EventLogController.Instance.AddLog(objTab, PortalController.Instance.GetCurrentPortalSettings(), UserController.Instance.GetCurrentUserInfo().UserID, "", EventLogController.EventLogType.TAB_ORDER_UPDATED); ClearCache(objTab.PortalID); }
/// <summary> /// Creates a friendly article url, depending on the options /// </summary> /// <param name="provider"></param> /// <param name="articleUrlMatch"></param> /// <param name="articleUrlRegex"></param> /// <param name="friendlyUrlPath"></param> /// <param name="tab"></param> /// <param name="options"></param> /// <param name="urlOptions"></param> /// <param name="cultureCode"></param> /// <param name="endingPageName"></param> /// <param name="useDnnPagePath"></param> /// <param name="messages"></param> /// <param name="articleUrl"></param> /// <returns></returns> internal static bool MakeArticleUrl(UrlProvider provider, Match articleUrlMatch, Regex articleUrlRegex, string friendlyUrlPath, DotNetNuke.Entities.Tabs.TabInfo tab, FriendlyUrlOptions options, ModuleUrlOptions urlOptions, string cultureCode, ref string endingPageName, ref bool useDnnPagePath, ref List <string> messages, out string articleUrl) { bool result = false; articleUrl = null; //this is a url that looks like an article url. We want to modify it and create the new one. string rawId = articleUrlMatch.Groups["artid"].Value; int articleId = 0; if (int.TryParse(rawId, out articleId)) { Hashtable friendlyUrlIndex = null; //the friendly url index is the lookup we use //we have obtained the item Id out of the Url //get the friendlyUrlIndex (it comes from the database via the cache) friendlyUrlIndex = UrlController.GetFriendlyUrlIndex(tab.TabID, tab.PortalID, provider, options, urlOptions); if (friendlyUrlIndex != null) { string furlkey = null; int pageId = -1; //first check if we are seeking page or article if (articleUrlMatch.Groups["pageid"].Success) { //page item urls are index by p + page id. But we only use this if it is present //ie pages override articles when both are present string rawPageId = articleUrlMatch.Groups["pageid"].Value; if (int.TryParse(rawPageId, out pageId)) { furlkey = "p" + rawPageId; } } else { //item urls are indexed with a + articleId ("a5") - this is so we could mix and match entities if necessary furlkey = "a" + articleId.ToString(); //create the lookup key for the friendly url index } string path = (string)friendlyUrlIndex[furlkey]; //check if in the index if (path == null) { //don't normally expect to have a no-match with a friendly url path when an articleId was in the Url. //could be that the page id is bunk - in that case, just use the article Id if (furlkey.Contains("p")) { furlkey = "a" + articleId.ToString(); //create the lookup key for the friendly url index path = (string)friendlyUrlIndex[furlkey]; //check if in the index } if (path == null) { //could be a new item that has been created and isn't in the index //do a direct call and find out if it's there path = UrlController.CheckForMissingNewsArticleItem(articleId, "article", tab.TabID, tab.PortalID, provider, options, urlOptions, ref messages); } } if (path != null) //got a valid path { //url found in the index for this entry. So replace the matched part of the path with the friendly url if (articleUrlMatch.Groups["l"].Success) //if the path had a leading /, then make sure to add that onto the replacement { path = provider.EnsureLeadingChar("/", path); } /* finish it all off */ messages.Add("Item Friendly Url Replacing : " + friendlyUrlPath + " in Path : " + path); //this is the point where the Url is modified! //replace the path in the path - which leaves any other parts of a path intact. articleUrl = articleUrlRegex.Replace(friendlyUrlPath, path);//replace the part in the friendly Url path with it's replacement. //check if this tab is the one specified to not use a path //if (provider.NoDnnPagePathTabId == tab.TabID) // useDnnPagePath = false;//make this Url relative from the site root //set back to default.aspx so that Url Master removes it - just in case it wasn't standard endingPageName = DotNetNuke.Common.Globals.glbDefaultPage; result = true; } } } return(result); }
public string FriendlyUrl(TabInfo tab, string path, string pageName, PortalSettings settings) { return Globals.FriendlyUrl(tab, path, pageName, settings); }
/// ----------------------------------------------------------------------------- /// <summary> /// AddPage adds a Tab Page /// </summary> /// <param name="portalId">The Id of the Portal</param> /// <param name="parentId">The Id of the Parent Tab</param> /// <param name="tabName">The Name to give this new Tab</param> /// <param name="description">Description.</param> /// <param name="tabIconFile">The Icon for this new Tab</param> /// <param name="tabIconFileLarge">The large Icon for this new Tab</param> /// <param name="isVisible">A flag indicating whether the tab is visible</param> /// <param name="permissions">Page Permissions Collection for this page</param> /// <param name="isAdmin">Is and admin page</param> /// <history> /// [cnurse] 11/11/2004 created /// </history> /// ----------------------------------------------------------------------------- private static TabInfo AddPage(int portalId, int parentId, string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, TabPermissionCollection permissions, bool isAdmin) { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddPage:" + tabName); TabInfo tab = TabController.Instance.GetTabByName(tabName, portalId, parentId); if (tab == null || tab.ParentId != parentId) { tab = new TabInfo { TabID = Null.NullInteger, PortalID = portalId, TabName = tabName, Title = "", Description = description, KeyWords = "", IsVisible = isVisible, DisableLink = false, ParentId = parentId, IconFile = tabIconFile, IconFileLarge = tabIconFileLarge, IsDeleted = false }; tab.TabID = TabController.Instance.AddTab(tab, !isAdmin); if (((permissions != null))) { foreach (TabPermissionInfo tabPermission in permissions) { tab.TabPermissions.Add(tabPermission, true); } TabPermissionController.SaveTabPermissions(tab); } } return tab; }
/// ----------------------------------------------------------------------------- /// <summary> /// AddModuleToPage adds a module to a Page /// </summary> /// <remarks> /// This overload assumes ModulePermissions will be inherited /// </remarks> /// <param name="page">The Page to add the Module to</param> /// <param name="moduleDefId">The Module Deinition Id for the module to be aded to this tab</param> /// <param name="moduleTitle">The Module's title</param> /// <param name="moduleIconFile">The Module's icon</param> /// <history> /// [cnurse] 11/11/2004 created /// </history> /// ----------------------------------------------------------------------------- private static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTitle, string moduleIconFile) { //Call overload with InheritPermisions=True return AddModuleToPage(page, moduleDefId, moduleTitle, moduleIconFile, true); }
///----------------------------------------------------------------------------- ///<summary> /// AddModuleToPage adds a module to a Page ///</summary> ///<remarks> ///</remarks> ///<param name = "page">The Page to add the Module to</param> ///<param name = "moduleDefId">The Module Deinition Id for the module to be aded to this tab</param> ///<param name = "moduleTitle">The Module's title</param> ///<param name = "moduleIconFile">The Module's icon</param> ///<param name = "inheritPermissions">Inherit the Pages View Permisions</param> ///<history> /// [cnurse] 11/16/2004 created ///</history> ///----------------------------------------------------------------------------- public static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions) { return AddModuleToPage(page, moduleDefId, moduleTitle, moduleIconFile, inheritPermissions, true, Globals.glbDefaultPane); }
private static bool CheckFor301RedirectExclusion(int tabId, int portalId, bool checkBaseUrls, out TabInfo tab, FriendlyUrlSettings settings) { bool doRedirect = false; tab = TabController.Instance.GetTab(tabId, portalId, false); //don't redirect unless allowed, the tab is valid, and it's not an admin or super tab if (tab != null && tab.IsSuperTab == false && !tab.DoNotRedirect) { if (checkBaseUrls) { //no redirect for friendly url purposes if the tab is in the 'base friendly urls' section doRedirect = !RewriteController.IsExcludedFromFriendlyUrls(tab, settings, true); } else { doRedirect = true; } } return doRedirect; }
public static void RestoreTab(TabInfo tab, PortalSettings portalSettings, int userId) { Instance.RestoreTab(tab, portalSettings); }
public static TabInfo DeserializeTab(XmlNode tabNode, TabInfo tab, int portalId) { return(DeserializeTab(tabNode, tab, new Hashtable(), portalId, false, PortalTemplateModuleAction.Ignore, new Hashtable())); }
public void UpdateTab(TabInfo updatedTab, string cultureCode) { updatedTab.CultureCode = cultureCode; UpdateTab(updatedTab); }
public void CreateLocalizedCopy(TabInfo originalTab, Locale locale) { CreateLocalizedCopy(originalTab, locale, true); }
public override string ChangeFriendlyUrl(DotNetNuke.Entities.Tabs.TabInfo tab, string friendlyUrlPath, FriendlyUrlOptions options, string cultureCode, ref string endingPageName, out bool useDnnPagePath, ref List <string> messages) { useDnnPagePath = true; return(friendlyUrlPath); }
private void ClearTabCache(TabInfo tabInfo) { TabController.Instance.ClearCache(tabInfo.PortalID); //Clear the Tab's Cached modules DataCache.ClearModuleCache(tabInfo.TabID); }
internal static bool GetUrlFromExtensionUrlProviders(int portalId, TabInfo tab, FriendlyUrlSettings settings, string friendlyUrlPath, string cultureCode, ref string endingPageName, out string changedPath, out bool changeToSiteRoot, ref List<string> messages, Guid parentTraceId) { bool wasChanged = false; changedPath = friendlyUrlPath; changeToSiteRoot = false; ExtensionUrlProvider activeProvider = null; if (messages == null) { messages = new List<string>(); } try { List<ExtensionUrlProvider> providersToCall = GetProvidersToCall(tab.TabID, portalId, settings, parentTraceId); FriendlyUrlOptions options = UrlRewriterUtils.GetOptionsFromSettings(settings); foreach (ExtensionUrlProvider provider in providersToCall) { activeProvider = provider; //keep for exception purposes bool useDnnPagePath; //go through and call each provider to generate the friendly urls for the module string customPath = provider.ChangeFriendlyUrl(tab, friendlyUrlPath, options, cultureCode, ref endingPageName, out useDnnPagePath, ref messages); if (string.IsNullOrEmpty(endingPageName)) { endingPageName = Globals.glbDefaultPage; //set back to default.aspx if provider cleared it } //now check to see if a change was made or not. Don't trust the provider. if (!string.IsNullOrEmpty(customPath)) { //was customPath any different to friendlyUrlPath? if (String.CompareOrdinal(customPath, friendlyUrlPath) != 0) { wasChanged = true; changedPath = customPath.Trim(); changeToSiteRoot = !useDnnPagePath; //useDNNpagePath means no change to site root. const string format = "Path returned from {0} -> path:{1}, ending Page:{2}, use Page Path:{3}"; messages.Add(string.Format(format, provider.ProviderConfig.ProviderName, customPath, endingPageName, useDnnPagePath)); break; //first module provider to change the Url is the only one used } } } } catch (Exception ex) { LogModuleProviderExceptionInRequest(ex, "500 Internal Server Error", activeProvider, null, messages); //reset all values to defaults wasChanged = false; changedPath = friendlyUrlPath; changeToSiteRoot = false; } return wasChanged; }
/// <summary> /// Renders the tab node. /// </summary> /// <param name="parentNode">The parent node.</param> /// <param name="tabInfo">The tab info.</param> /// <param name="moduleController">The module controller.</param> /// <param name="editorHostSettings">The editor host settings.</param> private void RenderTabNode( TreeNode parentNode, TabInfo tabInfo, ModuleController moduleController, List<EditorHostSetting> editorHostSettings) { var tabKey = string.Format("DNNCKT#{0}#", tabInfo.TabID); var tabSettingsExists = SettingsUtil.CheckExistsPortalOrPageSettings(editorHostSettings, tabKey); // Tabs var tabNode = new TreeNode { Text = tabInfo.TabName, Value = string.Format("t{0}", tabInfo.TabID), ImageUrl = tabSettingsExists ? "../images/PageHasSetting.png" : "../images/PageNoSetting.png" }; if (tabInfo.HasChildren) { foreach (var childTab in TabController.GetTabsByParent(tabInfo.TabID, tabInfo.PortalID)) { this.RenderTabNode(tabNode, childTab, moduleController, editorHostSettings); } } var modules = moduleController.GetTabModules(tabInfo.TabID).Values; foreach (var moduleNode in from moduleInfo in modules let moduleKey = string.Format("DNNCKMI#{0}#INS#", moduleInfo.ModuleID) let moduleSettingsExists = SettingsUtil.CheckExistsModuleSettings(moduleKey, moduleInfo.ModuleID) select new TreeNode { Text = moduleInfo.ModuleTitle, ImageUrl = moduleSettingsExists ? "../images/ModuleHasSetting.png" : "../images/ModuleNoSetting.png", Value = string.Format("m{0}", moduleInfo.ModuleID) }) { tabNode.ChildNodes.Add(moduleNode); } parentNode.ChildNodes.Add(tabNode); }
public static TabInfo DeserializeTab(string tabName, XmlNode nodeTab, TabInfo objTab, Hashtable hTabs, int portalId, bool isAdminTemplate, PortalTemplateModuleAction mergeTabs, Hashtable hModules) { return(DeserializeTab(nodeTab, objTab, hTabs, portalId, isAdminTemplate, mergeTabs, hModules)); }
public static TabInfo DeserializeTab(XmlNode tabNode, TabInfo tab, int portalId) { return DeserializeTab(tabNode, tab, new Hashtable(), portalId, false, PortalTemplateModuleAction.Ignore, new Hashtable()); }
public static int AddModuleToPage(TabInfo page, int moduleDefId, string moduleTitle, string moduleIconFile, bool inheritPermissions, bool displayTitle, string paneName) { DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogStart", Localization.Localization.GlobalResourceFile) + "AddModuleToPage:" + moduleDefId); ModuleInfo moduleInfo; int moduleId = Null.NullInteger; if ((page != null)) { bool isDuplicate = false; foreach (var kvp in ModuleController.Instance.GetTabModules(page.TabID)) { moduleInfo = kvp.Value; if (moduleInfo.ModuleDefID == moduleDefId) { isDuplicate = true; moduleId = moduleInfo.ModuleID; } } if (!isDuplicate) { moduleInfo = new ModuleInfo { ModuleID = Null.NullInteger, PortalID = page.PortalID, TabID = page.TabID, ModuleOrder = -1, ModuleTitle = moduleTitle, PaneName = paneName, ModuleDefID = moduleDefId, CacheTime = 0, IconFile = moduleIconFile, AllTabs = false, Visibility = VisibilityState.None, InheritViewPermissions = inheritPermissions, DisplayTitle = displayTitle }; try { moduleId = ModuleController.Instance.AddModule(moduleInfo); } catch (Exception exc) { Logger.Error(exc); DnnInstallLogger.InstallLogError(exc); } } } DnnInstallLogger.InstallLogInfo(Localization.Localization.GetString("LogEnd", Localization.Localization.GlobalResourceFile) + "AddModuleToPage:" + moduleDefId); return moduleId; }
public static TabInfo DeserializeTab(string tabName, XmlNode nodeTab, TabInfo objTab, Hashtable hTabs, int portalId, bool isAdminTemplate, PortalTemplateModuleAction mergeTabs, Hashtable hModules) { return DeserializeTab(nodeTab, objTab, hTabs, portalId, isAdminTemplate, mergeTabs, hModules); }
/// ----------------------------------------------------------------------------- /// <summary> /// AddPage adds a Tab Page /// </summary> /// <remarks> /// Adds a Tab to a parentTab /// </remarks> /// <param name="parentTab">The Parent Tab</param> /// <param name="tabName">The Name to give this new Tab</param> /// <param name="description">Description.</param> /// <param name="tabIconFile">The Icon for this new Tab</param> /// <param name="tabIconFileLarge">The Large Icon for this new Tab</param> /// <param name="isVisible">A flag indicating whether the tab is visible</param> /// <param name="permissions">Page Permissions Collection for this page</param> /// <param name="isAdmin">Is an admin page</param> /// <history> /// [cnurse] 11/11/2004 created /// </history> /// ----------------------------------------------------------------------------- private static TabInfo AddPage(TabInfo parentTab, string tabName, string description, string tabIconFile, string tabIconFileLarge, bool isVisible, TabPermissionCollection permissions, bool isAdmin) { int parentId = Null.NullInteger; int portalId = Null.NullInteger; if ((parentTab != null)) { parentId = parentTab.TabID; portalId = parentTab.PortalID; } return AddPage(portalId, parentId, tabName, description, tabIconFile, tabIconFileLarge, isVisible, permissions, isAdmin); }
public void MoveTab(TabInfo tab, TabMoveType type) { //Get the List of tabs with the same parent IOrderedEnumerable<TabInfo> siblingTabs = GetSiblingTabs(tab).OrderBy(t => t.TabOrder); int tabIndex = GetIndexOfTab(tab, siblingTabs); switch (type) { case TabMoveType.Top: MoveTabBefore(tab, siblingTabs.First().TabID); break; case TabMoveType.Bottom: MoveTabAfter(tab, siblingTabs.Last().TabID); break; case TabMoveType.Up: MoveTabBefore(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; case TabMoveType.Down: MoveTabAfter(tab, siblingTabs.ElementAt(tabIndex + 1).TabID); break; case TabMoveType.Promote: MoveTabAfter(tab, tab.ParentId); break; case TabMoveType.Demote: MoveTabToParent(tab, siblingTabs.ElementAt(tabIndex - 1).TabID); break; } ClearCache(tab.PortalID); }
public string FriendlyUrl(TabInfo tab, string path, string pageName) { return Globals.FriendlyUrl(tab, path, pageName); }
public string FriendlyUrl(TabInfo tab, string path, string pageName, string portalAlias) { return Globals.FriendlyUrl(tab, path, pageName, portalAlias); }