简体   繁体   English

Ektron分类法和图书馆项目(在v9中)

[英]Ektron taxonomy and library items (in v9)

We recently upgraded from Ektron 8.6 to 9.0 (Ektron CMS400.NET, Version: 9.00 SP2(Build 9.0.0.249)). 我们最近从Ektron 8.6升级到9.0(Ektron CMS400.NET,版本:9.00 SP2(内部版本9.0.0.249))。

I have some code (below) which we use to display links to items in a taxonomy. 我有一些代码(如下),用于显示分类法中项目的链接。 Under 8.6, this would show library items if they had been added to the taxonomy. 在8.6下,如果已将图书馆项目添加到分类法中,则将显示这些项目。 As of 9.0, it no longer displays library items. 从9.0开始,它不再显示库项目。 It still works for DMS items and normal pages (all first class content in Ektron). 它仍然适用于DMS项目和常规页面(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's 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 love to simply say to users to use the DMS instead of the library, but we have a security requirement and I'm not aware of a way I can enforce security on DMS items like we can with library items by dropping a webconfig file in the library folder.) (我只想简单地告诉用户使用DMS而不是库,但是我们有一个安全性要求,而且我不知道我可以像这样通过删除webconfig来对库项目执行DMS项安全性的方法库文件夹中的文件。)

Is this a bug that anyone else has experienced? 这是其他任何人都遇到过的错误吗? Or is there a problem with my code (did an API change in the upgrade to 9.0)? 还是我的代码有问题(升级到9.0后API是否进行了更改)?

Thanks. 谢谢。

I ended up emailing Ektron support in Sydney (I'm in Australia), and they said: 我最终通过电子邮件向悉尼的Ektron支持小组发送邮件(我在澳大利亚),他们说:

I would expect ContentManager to only return content, not library items – must have been a loophole which is now closed. 我希望ContentManager仅返回内容,而不返回库项目–必须是一个漏洞,该漏洞已关闭。 Taxonomy is the way to go. 分类学是必经之路。

So I used some of the code they provided and came up with the following, which appears 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 fetches items for all the child taxonomies as well as returning library items. 该代码获取所有子分类法的项目以及返回库项目。 The one problem is that it fetches duplicates for some items, but those are easy to clean out. 一个问题是,它获取某些项目的重复项,但这些项很容易清除。

I was also told by Ektron that... Ektron还告诉我...

TaxonomyManager.GetItem(“{path}”) is a more efficient way to get the categories TaxonomyManager.GetItem(“ {path}”)是获取类别的更有效方法

That's why I've 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/ ) 这就是为什么我包括GetTaxonomyPathById()方法(受此博客文章启发: http ://www.nimbleuser.com/blog/posts/2009/iterating-through-ektron-content-in-multiple-taxonomies-via- 与搜索索引服务直接接口/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM