public static string UrlForTabPath(string tabPath, string csvParams) { TabController tabs = new TabController(); List <TabInfo> tabInfos = new List <TabInfo>((TabInfo[])tabs.GetAllTabs().ToArray(typeof(TabInfo))); foreach (TabInfo info in tabInfos) { if (info.TabPath == tabPath && !info.IsDeleted) { return(Globals.NavigateURL(info.TabID, "", csvParams.Split(','))); } } return(""); }
private NTree <ItemDto> SearchPagesInternal(int portalId, string searchText, int sortOrder, bool includeDisabled = false, bool includeAllTypes = false) { var tree = new NTree <ItemDto> { Data = new ItemDto { Key = RootKey } }; List <TabInfo> tabs; if (portalId == -1) { portalId = GetActivePortalId(); } else { if (!IsPortalIdValid(portalId)) { return(tree); } } Func <TabInfo, bool> searchFunc; if (String.IsNullOrEmpty(searchText)) { searchFunc = page => true; } else { searchFunc = page => page.LocalizedTabName.IndexOf(searchText, StringComparison.InvariantCultureIgnoreCase) > -1; } var tabController = new TabController(); var allTabs = tabController.GetAllTabs().ToArray().Select(tab => (TabInfo)tab).ToList(); if (portalId > -1) { var includeHiddenTabs = PortalSettings.UserInfo.IsSuperUser || PortalSettings.UserInfo.IsInRole("Administrators"); if (!includeHiddenTabs) { allTabs = allTabs.Where(t => t.IsVisible).ToList(); } tabs = allTabs.Where(tab => tab.PortalID == portalId && (includeDisabled || !tab.DisableLink) && (includeAllTypes || tab.TabType == TabType.Normal) && searchFunc(tab)) .OrderBy(tab => tab.TabOrder) .ToList(); } else { if (PortalSettings.UserInfo.IsSuperUser) { tabs = allTabs.Where(tab => tab.PortalID == -1 && !tab.DisableLink && searchFunc(tab)) .OrderBy(tab => tab.TabOrder) .ToList(); } else { return(tree); } } var pages = tabs.Select(tab => new ItemDto { Key = tab.TabID.ToString(CultureInfo.InvariantCulture), Value = tab.LocalizedTabName, HasChildren = false, Selectable = true }); tree.Children = ApplySort(pages, sortOrder).Select(dto => new NTree <ItemDto> { Data = dto }).ToList(); return(tree); }