/// <exclude /> public override SiteMapNode GetParentNode(SiteMapNode node) { Verify.ArgumentNotNull(node, "node"); var pageSiteMapNode = (CmsPageSiteMapNode)node; IPage parentPage = null; using (new DataScope(pageSiteMapNode.Culture)) { Guid parentPageId = PageManager.GetParentId(pageSiteMapNode.Page.Id); if (parentPageId != Guid.Empty) { parentPage = PageManager.GetPageById(parentPageId); } } SiteMapNode parentNode; if (parentPage != null) { parentNode = new CmsPageSiteMapNode(this, parentPage); } else { parentNode = ParentProvider?.GetParentNode(node); } return(parentNode != null && parentNode.IsAccessibleToUser(HttpContext.Current) ? parentNode : null); }
/// <exclude /> protected override SiteMapNode GetRootNodeCore() { var context = SiteMapContext.Current; var rootPage = context?.RootPage; if (rootPage == null) { Guid homePageId = SitemapNavigator.CurrentHomePageId; if (homePageId == Guid.Empty) { homePageId = PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault(); } if (homePageId != Guid.Empty) { rootPage = PageManager.GetPageById(homePageId); } } if (rootPage == null) { return(null); } var node = new CmsPageSiteMapNode(this, rootPage); return(node.IsAccessibleToUser(HttpContext.Current) ? node : null); }
/// <inheritdoc /> protected override SiteMapNode GetRootNodeCore() { var siteMapContext = SiteMapContext.Current; var rootPage = siteMapContext?.RootPage; if (rootPage == null) { var homePageId = SitemapNavigator.CurrentHomePageId; if (homePageId == Guid.Empty) { var context = HttpContext.Current; if (context == null) { homePageId = PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault(); } else { using (var data = new DataConnection()) { var pageNode = data.SitemapNavigator.GetPageNodeByHostname(context.Request.Url.Host); homePageId = pageNode?.Id ?? Guid.Empty; } } } if (homePageId != Guid.Empty) { rootPage = PageManager.GetPageById(homePageId); } } if (rootPage == null) { return(null); } var node = new CmsPageSiteMapNode(this, rootPage); return(SecurityTrimNode(node)); }
private IHostnameBinding FindMatchingBinding(CmsPageSiteMapNode sitemapNode, List <IHostnameBinding> bindings) { Guid homePageId = Guid.Parse(sitemapNode.Key); string cultureName = sitemapNode.Culture.Name; var bestMatch = bindings.SingleOrDefault(h => h.HomePageId == homePageId && h.Culture == cultureName); if (bestMatch != null) { return(bestMatch); } string defaultCulture = DataLocalizationFacade.DefaultLocalizationCulture.Name; var secondBestMatch = bindings.SingleOrDefault(h => h.HomePageId == homePageId && h.Culture == defaultCulture); if (secondBestMatch != null) { return(secondBestMatch); } return(bindings.OrderBy(b => b.Hostname).FirstOrDefault(h => h.HomePageId == homePageId)); }
private IHostnameBinding FindMatchingBinding(CmsPageSiteMapNode sitemapNode, List<IHostnameBinding> bindings) { Guid homePageId = Guid.Parse(sitemapNode.Key); string cultureName = sitemapNode.Culture.Name; var bestMatch = bindings.SingleOrDefault(h => h.HomePageId == homePageId && h.Culture == cultureName); if (bestMatch != null) { return bestMatch; } string defaultCulture = DataLocalizationFacade.DefaultLocalizationCulture.Name; var secondBestMatch = bindings.SingleOrDefault(h => h.HomePageId == homePageId && h.Culture == defaultCulture); if (secondBestMatch != null) { return secondBestMatch; } return bindings.OrderBy(b => b.Hostname).FirstOrDefault(h => h.HomePageId == homePageId); }
/// <exclude /> public bool Equals(CmsPageSiteMapNode obj) { return(Key == obj.Key && Culture.Equals(obj.Culture)); }
/// <exclude /> protected override SiteMapNode GetRootNodeCore() { var context = SiteMapContext.Current; var rootPage = context?.RootPage; if (rootPage == null) { Guid homePageId = SitemapNavigator.CurrentHomePageId; if (homePageId == Guid.Empty) { homePageId = PageManager.GetChildrenIDs(Guid.Empty).FirstOrDefault(); } if (homePageId != Guid.Empty) { rootPage = PageManager.GetPageById(homePageId); } } if (rootPage == null) { return null; } var node = new CmsPageSiteMapNode(this, rootPage); return node.IsAccessibleToUser(HttpContext.Current) ? node : null; }
/// <exclude /> public override SiteMapNode GetParentNode(SiteMapNode node) { Verify.ArgumentNotNull(node, "node"); var pageSiteMapNode = (CmsPageSiteMapNode)node; IPage parentPage = null; using (new DataScope(pageSiteMapNode.Culture)) { Guid parentPageId = PageManager.GetParentId(pageSiteMapNode.Page.Id); if (parentPageId != Guid.Empty) { parentPage = PageManager.GetPageById(parentPageId); } } SiteMapNode parentNode; if (parentPage != null) { parentNode = new CmsPageSiteMapNode(this, parentPage); } else { parentNode = ParentProvider?.GetParentNode(node); } return parentNode != null && parentNode.IsAccessibleToUser(HttpContext.Current) ? parentNode : null; }
/// <exclude /> public bool Equals(CmsPageSiteMapNode obj) { return Key == obj.Key && Culture.Equals(obj.Culture); }