Beispiel #1
0
        protected virtual IEnumerable <IPage> GetIncludesFromModel(IPage page, Localization localization)
        {
            List <IPage> result = new List <IPage>();

            string[]             pageTemplateTcmUriParts = page.PageTemplate.Id.Split('-');
            IEnumerable <string> includePageUrls         = SiteConfiguration.GetIncludePageUrls(pageTemplateTcmUriParts[1], localization);

            foreach (string includePageUrl in includePageUrls)
            {
                IPage includePage = GetPage(SiteConfiguration.LocalizeUrl(includePageUrl, localization), localization);
                if (includePage == null)
                {
                    Log.Error("Include Page '{0}' not found.", includePageUrl);
                    continue;
                }
                FullyLoadDynamicComponentPresentations(includePage, localization);
                result.Add(includePage);
            }
            return(result);
        }
Beispiel #2
0
 /// <summary>
 /// Gets the Navigation Model (Sitemap) for a given Localization.
 /// </summary>
 /// <param name="localization">The Localization.</param>
 /// <returns>The Navigation Model (Sitemap root Item).</returns>
 public virtual SitemapItem GetNavigationModel(Localization localization)
 {
     using (new Tracer(localization))
     {
         string url = SiteConfiguration.LocalizeUrl("navigation.json", localization);
         // TODO TSI-110: This is a temporary measure to cache the Navigation Model per request to not retrieve and serialize 3 times per request. Comprehensive caching strategy pending
         string      cacheKey = "navigation-" + url;
         SitemapItem result;
         if (HttpContext.Current.Items[cacheKey] == null)
         {
             Log.Debug("Deserializing Navigation Model from raw content URL '{0}'", url);
             string navigationJsonString = GetPageContent(url, localization);
             result = new JavaScriptSerializer().Deserialize <SitemapItem>(navigationJsonString);
             HttpContext.Current.Items[cacheKey] = result;
         }
         else
         {
             Log.Debug("Obtained Navigation Model from cache.");
             result = (SitemapItem)HttpContext.Current.Items[cacheKey];
         }
         return(result);
     }
 }