Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom view for displaying contents in folder

Tags:

plone

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?

like image 451
user1017702 Avatar asked Feb 22 '23 06:02

user1017702


2 Answers

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.

like image 192
cdw9 Avatar answered Mar 08 '23 14:03

cdw9


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

like image 41
PaulR Avatar answered Mar 08 '23 16:03

PaulR