Ejemplo n.º 1
0
        private static IEnumerable <SitemapItem> ExpandTaxonomyRoots(NavigationFilter filter, Localization localization)
        {
            using (new Tracer(filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                string[]        taxonomyIds     = taxonomyFactory.GetTaxonomies(localization.GetCmUri());

                int                   depth          = filter.DescendantLevels > 0 ? (filter.DescendantLevels - 1) : filter.DescendantLevels;
                TaxonomyFilter        taxonomyFilter = new DepthFilter(depth, DepthFilter.FilterDown);
                IEnumerable <Keyword> taxonomyRoots  = taxonomyIds.Select(id => taxonomyFactory.GetTaxonomyKeywords(id, taxonomyFilter));

                return(taxonomyRoots.Select(kw => CreateTaxonomyNode(kw, depth, filter, localization)));
            }
        }
Ejemplo n.º 2
0
        private static string ResolveNavigationTaxonomyUri(Localization localization)
        {
            using (new Tracer(localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                string[]        taxonomyIds     = taxonomyFactory.GetTaxonomies(localization.GetCmUri());

                Keyword navTaxonomyRoot = taxonomyIds.Select(id => taxonomyFactory.GetTaxonomyKeyword(id)).FirstOrDefault(tax => tax.KeywordName.Contains(TaxonomyNavigationMarker));
                if (navTaxonomyRoot == null)
                {
                    Log.Warn("No Navigation Taxonomy Found in Localization [{0}]. Ensure a Taxonomy with '{1}' in its title is published.", localization, TaxonomyNavigationMarker);
                    return(string.Empty);
                }

                Log.Debug("Resolved Navigation Taxonomy: {0} ('{1}')", navTaxonomyRoot.TaxonomyUri, navTaxonomyRoot.KeywordName);

                return(navTaxonomyRoot.TaxonomyUri);
            }
        }
        private static string ResolveNavigationTaxonomyUri(Localization localization)
        {
            using (new Tracer(localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                string[] taxonomyIds = taxonomyFactory.GetTaxonomies(GetPublicationTcmUri(localization));

                Keyword navTaxonomyRoot = taxonomyIds.Select(id => taxonomyFactory.GetTaxonomyKeyword(id)).FirstOrDefault(tax => tax.KeywordName.Contains(TaxonomyNavigationMarker));
                if (navTaxonomyRoot == null)
                {
                    Log.Warn("No Navigation Taxonomy Found in Localization [{0}]. Ensure a Taxonomy with '{1}' in its title is published.", localization, TaxonomyNavigationMarker);
                    return string.Empty;
                }

                Log.Debug("Resolved Navigation Taxonomy: {0} ('{1}')", navTaxonomyRoot.TaxonomyUri, navTaxonomyRoot.KeywordName);

                return navTaxonomyRoot.TaxonomyUri;
            }
        }
        private static IEnumerable<SitemapItem> ExpandTaxonomyRoots(NavigationFilter filter, Localization localization)
        {
            using (new Tracer(filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                string[] taxonomyIds = taxonomyFactory.GetTaxonomies(GetPublicationTcmUri(localization));

                int depth= filter.DescendantLevels > 0 ? (filter.DescendantLevels - 1) : filter.DescendantLevels;
                TaxonomyFilter taxonomyFilter = new DepthFilter(depth, DepthFilter.FilterDown);
                IEnumerable<Keyword> taxonomyRoots = taxonomyIds.Select(id => taxonomyFactory.GetTaxonomyKeywords(id, taxonomyFilter));

                return taxonomyRoots.Select(kw => CreateTaxonomyNode(kw, depth, filter, localization));
            }
        }