如何防止内容类型出现在集合中?

发布于 2024-10-19 17:45:54 字数 199 浏览 8 评论 0原文

如何防止特定内容类型出现在 Plone 3 站点范围内的集合(智能文件夹)中?我在 Portal_types 以及类型和搜索控制面板中查找了相关选项(关闭搜索的内容类型似乎对集合没有影响)。

具体情况:我最近在 Plone 3.3.5 安装上安装了 plone.app.discussion,现在评论出现在所有集合中。我们想将它们从集合中删除。

谢谢。

How do I prevent a specific content type from appearing in collections (smart folders) site wide in Plone 3? I've looked for relevant options in portal_types and the types and search control panel (turning off the content type for searching doesn't seem to have an effect on collections).

Specific situation: I recently installed plone.app.discussion on a Plone 3.3.5 installation and now comments appear in all the collections. We want to remove them from the collections.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

稀香 2024-10-26 17:45:54

门户类型标准基于 plone.app.vocabularies.ReallyUserFriendlyTypes,它是 http://svn.plone.org/svn/plone/plone.app.vocabularies/trunk/plone/app/vocabularies/types.py

如果您通过添加讨论评论来修补 BAD_TYPES,您会将它们从集合中排除,但也会在使用此词汇工厂的任何地方隐藏它们。据我所知,它们也用于内容规则和搜索控制面板。

您可以通过将以下行添加到自定义包的 __init__.py 文件中来修补 BAD_TYPES:

def initialize(context):
"""Initializer called when used as a Zope 2 product."""
    from plone.app.vocabularies import types
    types.BAD_TYPES = types.BAD_TYPES + ('Discussion Item',)

Portal Types criterion is based on plone.app.vocabularies.ReallyUserFriendlyTypes, a vocabulary factory defined in http://svn.plone.org/svn/plone/plone.app.vocabularies/trunk/plone/app/vocabularies/types.py.

If you patch BAD_TYPES by adding discussion comments you'll exclude them from Collections, but you'll also hide them from anywhere this vocabulary factory is used. As far as I know they are also used in contentrules and search control panel.

You can patch BAD_TYPES by adding these lines into __init__.py file of a custom package:

def initialize(context):
"""Initializer called when used as a Zope 2 product."""
    from plone.app.vocabularies import types
    types.BAD_TYPES = types.BAD_TYPES + ('Discussion Item',)
小伙你站住 2024-10-26 17:45:54

如果您没有太多集合,最简单的解决方案可能是添加条件以排除评论。您可以轻松获取所有收藏的列表:

http://your-site/search?portal_type% 3Alist=Topic

如果您有很多集合,您可能需要编写一些自定义代码来执行此操作。它不一定是产品或任何严肃的东西,只需运行一些代码即可向现有集合添加“排除评论”条件。我首先查看 http://svn.plone.org/svn/collective/Products.ATContentTypes/branches/1.3/Products/ATContentTypes/tests/test_criteria.py

If you don't have too many collections, the simplest solution might be to add criteria to exclude comments. You can easily get a list of all your collections:

http://your-site/search?portal_type%3Alist=Topic

If you have a lot of collections, you might need to write some custom code to do this. It doesn't have to be a product or anything serious, just some code you can run to add an 'exclude comments' criteria to existing collections. I would start by looking around line 507 of http://svn.plone.org/svn/collective/Products.ATContentTypes/branches/1.3/Products/ATContentTypes/tests/test_criteria.py

§对你不离不弃 2024-10-26 17:45:54

您可以向集合添加条件,说明要显示的内容类型。您无法(无需修补/黑客)选择要排除的内容。

即集合可以具有白名单类型而不是黑名单类型。

You can add criteria to your collections stating which content types you want to display. You can not (without patching/hacking) choose which to exclude.

I.e collections have can have type whitelilsts not blacklists.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文