예제 #1
0
        private static SitemapItem BuildNavigationModel(string navTaxonomyUri, Localization localization)
        {
            using (new Tracer(navTaxonomyUri, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                Keyword         taxonomyRoot    = taxonomyFactory.GetTaxonomyKeywords(navTaxonomyUri, new DepthFilter(DepthFilter.UnlimitedDepth, DepthFilter.FilterDown));

                NavigationFilter navFilter = new NavigationFilter();
                return(CreateTaxonomyNode(taxonomyRoot, -1, navFilter, localization));
            }
        }
예제 #2
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)));
            }
        }
예제 #3
0
        private static TaxonomyNode ExpandAncestorsForKeyword(string keywordUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(keywordUri, taxonomyUri, filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                TaxonomyFilter  taxonomyFilter  = new DepthFilter(DepthFilter.UnlimitedDepth, DepthFilter.FilterUp);
                Keyword         taxonomyRoot    = taxonomyFactory.GetTaxonomyKeywords(taxonomyUri, taxonomyFilter, keywordUri);
                if (taxonomyRoot == null)
                {
                    Log.Warn("Keyword '{0}' in Taxonomy '{1}' not found.", keywordUri, taxonomyUri);
                    return(null);
                }

                return(CreateTaxonomyNode(taxonomyRoot, -1, filter, localization));
            }
        }
예제 #4
0
        private static IEnumerable <SitemapItem> ExpandDescendants(string keywordUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(keywordUri, taxonomyUri, filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                TaxonomyFilter  taxonomyFilter  = new DepthFilter(filter.DescendantLevels, DepthFilter.FilterDown);
                Keyword         contextKeyword  = taxonomyFactory.GetTaxonomyKeywords(taxonomyUri, taxonomyFilter, keywordUri);
                if (contextKeyword == null)
                {
                    Log.Warn("Keyword '{0}' in Taxonomy '{1}' not found.", keywordUri, taxonomyUri);
                    return(new SitemapItem[0]);
                }

                TaxonomyNode contextTaxonomyNode = CreateTaxonomyNode(contextKeyword, filter.DescendantLevels, filter, localization);
                return(contextTaxonomyNode.Items);
            }
        }
        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));
            }
        }
        private static IEnumerable<SitemapItem> ExpandDescendants(string keywordUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(keywordUri, taxonomyUri, filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                TaxonomyFilter taxonomyFilter = new DepthFilter(filter.DescendantLevels, DepthFilter.FilterDown);
                Keyword contextKeyword = taxonomyFactory.GetTaxonomyKeywords(taxonomyUri, taxonomyFilter, keywordUri);
                if (contextKeyword == null)
                {
                    Log.Warn("Keyword '{0}' in Taxonomy '{1}' not found.", keywordUri, taxonomyUri);
                    return new SitemapItem[0];
                }

                TaxonomyNode contextTaxonomyNode = CreateTaxonomyNode(contextKeyword, filter.DescendantLevels, filter, localization);
                return contextTaxonomyNode.Items;
            }
        }
        private static TaxonomyNode ExpandAncestorsForKeyword(string keywordUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(keywordUri, taxonomyUri, filter, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                TaxonomyFilter taxonomyFilter = new DepthFilter(DepthFilter.UnlimitedDepth, DepthFilter.FilterUp);
                Keyword taxonomyRoot = taxonomyFactory.GetTaxonomyKeywords(taxonomyUri, taxonomyFilter, keywordUri);
                if (taxonomyRoot == null)
                {
                    Log.Warn("Keyword '{0}' in Taxonomy '{1}' not found.", keywordUri, taxonomyUri);
                    return null;
                }

                return CreateTaxonomyNode(taxonomyRoot, -1, filter, localization);
            }
        }
        private static SitemapItem BuildNavigationModel(string navTaxonomyUri, Localization localization)
        {
            using (new Tracer(navTaxonomyUri, localization))
            {
                TaxonomyFactory taxonomyFactory = new TaxonomyFactory();
                Keyword taxonomyRoot = taxonomyFactory.GetTaxonomyKeywords(navTaxonomyUri, new DepthFilter(DepthFilter.UnlimitedDepth, DepthFilter.FilterDown));

                NavigationFilter navFilter = new NavigationFilter();
                return CreateTaxonomyNode(taxonomyRoot, -1, navFilter, localization);
            }
        }