如何防止内容类型出现在集合中?
如何防止特定内容类型出现在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
门户类型标准基于 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:
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:
如果您没有太多集合,最简单的解决方案可能是添加条件以排除评论。您可以轻松获取所有收藏的列表:
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
您可以向集合添加条件,说明要显示的内容类型。您无法(无需修补/黑客)选择要排除的内容。
即集合可以具有白名单类型而不是黑名单类型。
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.