Custom view to display content in a folder

We use Plone 4.1 and would like to have a custom view of the contents in the folder.
The "Select a content item to be used as the default view in this folder" display will not work for us, because we have private subfolders that should only be displayed if the user who is logged in access rights.

For example, we have the main folder "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 be displayed in the folder display view only if the registered user is a member of the administrator group. The Users and Frequently Asked Questions folders are published, so there’s no problem.

If we use “Select a content item that will be used as the default view in this folder”, there will be no information on the content page to list the “Administrator” subfolder only if the logged-in user is part of the administrator Group.

We do not want to use default views, i.e. “Summary view”, “Standard view”, “Table view”, although these views can display the “Administrator” subfolder only if the logged-in user is a member of the administrator group.

Is there a way to create my own custom view in which the "Admin" subfolder will be displayed when the registered use is part of the admin group?

+4
source share
2 answers

Yes, you can do this in several different ways. It is recommended to do this in the theme product (or in another product with a folder of skins), but I will also give you instructions for this in ZMI.

(1) Configure a template for one of the default views. Locate the source template in Products / CMFPlone / skins / plone_content (copy the source template to the skins / product template folder) or in ZMI on the skins portal> plone_content (click the settings button). Then customize the template to your liking.

~ or ~

(2) Create a new template that will also be available in the "Display" drop-down menu. I would start by using one of the default templates so that you have a good place to start. Place the template in the skins / product templates folder or ZMI> portal_skins> custom folder, but this time specify this name. Then, in portal_types> Folder, add the template identifier (name without .pt) to the "Available viewing methods" list. This information can be exported to the product from the portal_setup> export tab, export the Types tool.

+5
source

Here is a product that I created to add a new view to folders and collections that displays event objects in a table layout (something other than the default table view). This is a very minimal product and you should start creating your own template. https://bitbucket.org/paulrentschler/tabulareventsview

+1
source

Source: https://habr.com/ru/post/1384187/


All Articles