晔分类和图书馆项目(V9) [英] Ektron taxonomy and library items (in v9)

查看:78
本文介绍了晔分类和图书馆项目(V9)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们最近从晔8.6升级到9.0(晔CMS400.NET,版本:9.00 SP2(内部版本9.0.0.249))。

We recently upgraded from Ektron 8.6 to 9.0 (Ektron CMS400.NET, Version: 9.00 SP2(Build 9.0.0.249)).

我有一些code(下图),我们用它来显示链接到一个分类项目。在8.6,这将显示,如果他们被添加到分类库项目。截至9.0,它不再显示库项目。它仍然适用于DMS项目和正常的页面(在所有晔一流的内容)。

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. As of 9.0, it no longer displays library items. It still works for DMS items and normal pages (all first class content 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'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;
}

(我喜欢简单的说就是用户使用,而不是库中的DMS,但我们有一个安全的要求,我不知道的一种方式,我可以在DMS项目实施安全一样,我们可以使用库项目由在下降的库文件夹中的文件webconfig)

(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.)

这是一个错误,任何人都经历?
还是有我的code(的确在升级到9.0的API的变化)?

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)?

感谢。

推荐答案

我结束了电子邮件在悉尼晔支持(我在澳大利亚),他们说:

I ended up emailing Ektron support in Sydney (I'm in Australia), and they said:

我希望ContentManager只返回内容,而不是库
  项目 - 必须有一个漏洞,它现在已经关闭。分类是
  路要走。

I would expect ContentManager to only return content, not library items – must have been a loophole which is now closed. Taxonomy is the way to go.

所以我用一些他们提供的code,并与以下,这似乎工作上来......

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 "";
}

这code为获取所有子分类项目,以及返回库项目。
一个问题是,它取某些项目重复,但这些是便于清理。

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.

我也被晔告诉...

TaxonomyManager.GetItem({}路径)是一种更有效的方式来获得
  分类

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

这就是为什么我已经包括了GetTaxonomyPathById()方法(通过这个博客帖子的启发:<一href=\"http://www.nimbleuser.com/blog/posts/2009/iterating-through-ektron-content-in-multiple-taxonomies-via-directly-interfacing-with-search-indexing-services/\" rel=\"nofollow\">http://www.nimbleuser.com/blog/posts/2009/iterating-through-ektron-content-in-multiple-taxonomies-via-directly-interfacing-with-search-indexing-services/ )

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/ )

这篇关于晔分类和图书馆项目(V9)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆