用于显示文件夹中内容的自定义视图
我们正在使用 Plone 4.1,并且希望对文件夹中的内容有自定义视图。
“选择要用作此文件夹中的默认视图的内容项”显示对我们不起作用,因为我们有私有子文件夹,仅当登录用户具有正确的权限时才应列出这些子文件夹。
例如,我们有一个名为“IT”的主文件夹。在这个“IT”文件夹中,我们有名为“Admin”、“Users”、“FAQ”等的子文件夹。“Admin”文件夹未发布,即是私有的,只有在以下情况下才应在文件夹显示视图中列出:登录用户是管理员组的一部分。 “Users”和“FAQ”文件夹已发布 - 所以这里没有问题。
如果我们使用“选择要用作此文件夹中的默认视图的内容项”,则仅当登录用户属于管理员组时,内容页面才具有列出“Admin”子文件夹的智能。
我们不想使用默认视图,即摘要视图、标准视图、表格视图,尽管这些视图仅当登录用户属于管理员组时才能列出“Admin”子文件夹。
有没有办法拥有我们自己的自定义视图,当登录的使用是管理组的一部分时,该视图将显示“Admin”子文件夹?
We are using Plone 4.1, and would like to have a custom view of the contents in a folder.
The "Select a content item to be used as a default view in this folder" display won't work for us because we have Private subfolders which should only be listed when the logged-in user has the right permissions.
For example, we have a main folder called "IT". Inside this "IT" folder, we have subfolders called "Admin", "Users", "FAQ", etc. The "Admin" folder is not published, i.e. is private, and it should listed in the Folder display view only if the logged-in user is part of the admin group. The "Users" and "FAQ" folders are published -- so no problem here.
If we use "Select a content item to be used as a default view in this folder", the content page does not have the intelligence to list the "Admin" subfolder only when the logged-in user is part of the admin group.
We do not want to use the default views, i.e., Summary View, Standard View, Tabular View, although these views are able to list the "Admin" subfolder only when the logged-in user is part of the admin group.
Is there a way to have our own custom view which will display "Admin" subfolder when the logged-use is part of the admin group?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您可以通过几种不同的方式来做到这一点。建议在主题产品(或其他带有皮肤文件夹的产品)中执行此操作,但我也会为您提供在 ZMI 中执行此操作的说明。
(1) 为默认视图之一自定义模板。在 Products/CMFPlone/skins/plone_content 中找到原始模板(将原始模板复制到产品的 Skins/templates 文件夹中),或者在 ZMI 的 Portal_skins > 中找到原始模板。 plone_content(单击自定义按钮)。然后根据您的喜好调整模板。
~ 或 ~
(2) 创建一个新模板,该模板也将在“显示”下拉列表中可用。我将首先使用默认模板之一,以便您有一个好的起点。将模板放入您产品的skins/templates文件夹中,或者ZMI> Portal_skins >自定义文件夹,但这次给它一个自定义名称。然后在portal_types>中文件夹,将模板 ID(不带 .pt 的名称)添加到“可用视图方法”列表中。该信息可以从portal_setup > 导出到产品中。导出选项卡,导出类型工具。
Yes, you can do this a couple different ways. It is recommended to do this in a theme product (or other product with a skins folder), but I will also give you instructions for doing this in the ZMI.
(1) Customize the template for one of the default views. Find the original template in Products/CMFPlone/skins/plone_content (copy the original template into your product's skins/templates folder), or in the ZMI at portal_skins > plone_content (click the customize button). Then adjust the template to your liking.
~ or ~
(2) Create a new template that will also be available in the Display dropdown. I would start by using one of the default templates so you have a good place to start from. Put the template in your product's skins/templates folder, or ZMI > portal_skins > custom folder, but this time give it a custom name. Then in portal_types > Folder, add the template id (the name without .pt) to the list of 'Available view methods'. This information can be exported to a product from portal_setup > export tab, an export the Types Tool.
这是我创建的一个产品,用于向文件夹和集合添加新视图,以表格布局(与默认表格视图不同)显示事件对象。这是一个非常小的产品,应该可以帮助您开始创建自己的自定义模板。
https://bitbucket.org/paulrentschler/tabulareventsview
Here is a product I created to add a new view to folders and collections that displays event objects in a tabular layout (something different than the default Tabular View). It's a very minimal product and should get you started on creating your own custom template.
https://bitbucket.org/paulrentschler/tabulareventsview