/// <summary> /// Change the root name. This is kept private to prevent it from being externally called and impacting app performance. This /// functionality is exposed by changing the name of the root menu name /// </summary> private SiteMapNode GetRootNodeInternal() { DataTable dt = GetDataSource(); DataView dv = dt.DefaultView; dv.RowFilter = string.Format("IsRoot = 1 AND MenuId = {0}", ActiveTopLevelMenuId.ToString()); if (dv.Count > 0) { return(new SiteMapNode(this, dv[0]["MenuItemId"].ToString())); } return(null); }
/// <summary> /// When overridden in a derived class, retrieves a <see cref="T:System.Web.SiteMapNode"></see> object that represents the page at the specified URL. /// </summary> /// <param name="rawUrl">A URL that identifies the page for which to retrieve a <see cref="T:System.Web.SiteMapNode"></see>.</param> /// <returns> /// A <see cref="T:System.Web.SiteMapNode"></see> that represents the page identified by rawURL; otherwise, null, if no corresponding <see cref="T:System.Web.SiteMapNode"></see> is found or if security trimming is enabled and the <see cref="T:System.Web.SiteMapNode"></see> cannot be returned for the current user. /// </returns> public override SiteMapNode FindSiteMapNode(string rawUrl) { string appPath = CMSContext.Current.AppPath; if (!appPath.EndsWith("/", StringComparison.Ordinal)) { appPath += "/"; } SiteMapNode node = null; lock (_lock) { string url = rawUrl; if (rawUrl.IndexOf(appPath, 0) == 0) { url = url.Substring(appPath.Length - 1); if (url.IndexOf('?') > 0) { url = url.Substring(0, url.IndexOf('?')); } DataTable src = GetDataSource(); DataView dv = src.DefaultView; dv.RowFilter = "IsRoot = 1"; if (dv.Count > 0) { // CommandType: Link dv.RowFilter = String.Format("MenuId = {0} AND Outline LIKE Outline + '%' AND CommandType = 1 AND CommandText LIKE '~{1}'", ActiveTopLevelMenuId.ToString(), url); if (dv.Count > 0) { node = CreateSiteMapNode(dv[0]); } // CommandType: Navigation // TODO : FindSiteMapNode for navigation command type } } } if (node != null) { return(node); } return(RootNode); }
private string GetSitemapCacheKey() { return(CmsCache.CreateCacheKey("sitemap", CMSContext.Current.SiteId.ToString(), ActiveTopLevelMenuId.ToString(), CMSContext.Current.LanguageId.ToString())); }