Taxonomy and elements of the Ektron library (in version 9)

Recently we upgraded from Ektron 8.6 to 9.0 (Ektron CMS400.NET, version: 9.00 SP2 (Build 9.0.0.249)).

I have a code (below) that we use to display links to elements in a taxonomy. In section 8.6, this will display library items if they were added to the taxonomy. Starting with 9.0, it no longer displays library items. It still works for DMS elements and regular pages (all first class materials in Ektron).

private List<ContentData> getTaxonomyItems(long TaxonomyId) { listContentManager = new ContentManager(); criteria = new ContentTaxonomyCriteria(ContentProperty.Id, EkEnumeration.OrderByDirection.Ascending); criteria.PagingInfo = new Ektron.Cms.PagingInfo(400); // there a lot of items and I don't want to page them. criteria.AddFilter(TaxonomyId, true); // this gets sub taxonomies too :) List<ContentData> contentList = listContentManager.GetList(criteria); return contentList; } 

(I would just like to tell users to use DMS instead of the library, but we have a security requirement, and I don’t know how I can ensure the security of DMS elements, as we can, by using library elements deleting the webconfig file in the library folder.)

Is this a mistake someone else has experienced? Or a problem with my code (has the API changed in version prior to 9.0)?

Thanks.

+1
source share
1 answer

I ended up ectron support email in Sydney (I am in Australia) and they said:

I would expect the ContentManager to return only content, not a library of items - there must be a loophole that is now closed. Taxonomy is the way to go.

So, I used the piece of code that they provided, and came up with the following, which seems to work ...

 private List<TaxonomyItemData> getTaxonomyItems(long TaxonomyId) { List<TaxonomyItemData> list = new List<TaxonomyItemData>(); TaxonomyManager taxManager = new TaxonomyManager(Ektron.Cms.Framework.ApiAccessMode.Admin); TaxonomyCriteria taxonomyCriteria = new Ektron.Cms.Organization.TaxonomyCriteria(); taxonomyCriteria.AddFilter(Ektron.Cms.Organization.TaxonomyProperty.Path, Ektron.Cms.Common.CriteriaFilterOperator.StartsWith, GetTaxonomyPathById(TaxonomyId)); List<TaxonomyData> TaxonomyDataList = taxManager.GetList(taxonomyCriteria); foreach (TaxonomyData taxd in TaxonomyDataList) { TaxonomyData taxTree = taxManager.GetTree(taxd.Path, 1, // depth. doesn't seem to work. have to manually tranverse lower taxonomies. true, // include items null, Ektron.Cms.Common.EkEnumeration.TaxonomyType.Content, Ektron.Cms.Common.EkEnumeration.TaxonomyItemsSortOrder.taxonomy_item_display_order); foreach (TaxonomyItemData taxItem in taxTree.TaxonomyItems) { list.Add(taxItem); } } return list; } private static String GetTaxonomyPathById(long taxonomyId) { TaxonomyManager tMgr = new TaxonomyManager(); TaxonomyData tData = tMgr.GetItem(taxonomyId); if (tData != null) { return tData.Path; } return ""; } 

This code retrieves elements for all taxonomies of children, and also returns library elements. One problem is that it extracts duplicates for some elements, but they are easy to clean.

Ektron also told me that ...

TaxonomyManager.GetItem ("{path}") is a more efficient way to get Categories

That's why I included the GetTaxonomyPathById () method (inspired by this blog post: http://www.nimbleuser.com/blog/posts/2009/iterating-through-ektron-content-in-multiple-taxonomies-via-directly-interfacing -with-search-indexing-services / )

+2
source

Source: https://habr.com/ru/post/1433702/


All Articles