Ejemplo n.º 1
0
        /// <summary>
        /// Gets the SitemapNodes, looking up the page they point to automatically to get the accurate Document last modified.
        /// </summary>
        /// <param name="Path">The parent Nodealiaspath</param>
        /// <param name="ClassName">The Class Name to query</param>
        /// <param name="SiteName">The SiteName</param>
        /// <param name="Options">The Options</param>
        /// <returns>The SitemapNodes</returns>
        private IEnumerable <SitemapNode> GetSiteMapUrlSetForClassWithUrlColumn(string Path, string ClassName, string SiteName, SiteMapOptions Options)
        {
            var DocumentQuery = _Helper.GetDocumentQuery(Path, Options, ClassName);
            List <SitemapNode> SiteMapItems = new List <SitemapNode>();

            foreach (string RelativeUrl in _Helper.GetRelativeUrls(Path, ClassName, SiteName, Options))
            {
                // Get the page, Dynamic Routing already has it's own internal Caching and adds to the output cache
                var Page = (TreeNode)_DynamicRouteHelper.GetPage(RelativeUrl, Options.CultureCode, SiteName, new string[] { "DocumentModifiedWhen", "NodeID", "DocumentCulture" }, true);
                if (Page != null)
                {
                    SiteMapItems.Add(ConvertToSiteMapUrl(Page.RelativeURL, SiteName, Page.DocumentModifiedWhen));
                }
                else
                {
                    SiteMapItems.Add(ConvertToSiteMapUrl(RelativeUrl, SiteName, null));
                }
            }
            return(SiteMapItems);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the SitemapNodes, looking up the page they point to automatically to get the accurate Document last modified.
        /// </summary>
        /// <param name="Path">The parent Nodealiaspath</param>
        /// <param name="ClassName">The Class Name to query</param>
        /// <param name="SiteName">The SiteName</param>
        /// <param name="Options">The Options</param>
        /// <returns>The SitemapNodes</returns>
        private IEnumerable <SitemapNode> GetSiteMapUrlSetForClassWithUrlColumn(string Path, string ClassName, string SiteName, SiteMapOptions Options)
        {
            var DocumentQuery = _Helper.GetDocumentQuery(Path, Options, ClassName);
            List <SitemapNode> SiteMapItems = new List <SitemapNode>();

            foreach (var Page in DocumentQuery.TypedResult)
            {
                string Culture     = !string.IsNullOrWhiteSpace(Options.CultureCode) ? Options.CultureCode : LocalizationContext.CurrentCulture.CultureCode;
                var    RelativeUrl = Page.GetStringValue(Options.UrlColumnName, _pageUrlRetriever.Retrieve(Page.NodeAliasPath, Culture, SiteName).RelativePath);


                // Try to find page by NodeAliasPath
                var ActualPage = (TreeNode)_generalDocumentRepository.GetDocumentByPath(RelativeUrl, SiteName, Columns: new string[] { "DocumentModifiedWhen", "NodeID", "DocumentCulture" });
                if (ActualPage != null)
                {
                    SiteMapItems.Add(ConvertToSiteMapUrl(RelativeUrl, SiteName, Page.DocumentModifiedWhen));
                }
                else
                {
                    SiteMapItems.Add(ConvertToSiteMapUrl(RelativeUrl, SiteName, null));
                }
            }
            return(SiteMapItems);
        }