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?
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.
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
Related
Hi i created my first GRAV-Template with modular-pages.
Now i want to setup my Grav-Admin page fields to let the editor choose one of my module files themes/my-theme/modular/xyz-module.html.twig via a select-field.
In other words, i need a select-field like the Pages Field but within my template-modular-files.
In the GRAV documentation you will find following sentences:
Modular subpages are in folders with names that begin with an underscore (_).
To select a modular template, i do this steps:
Add Page (i.e. Sample)
Set the parent page to a modular page
Continue
Change the folder name to _sample
Save the page
Now you can choose your modular Page Template
Remember to add the new modular page to modular.md
I have many pages in the content section of Umbraco but some of the pages I would like to organize for departmental reference not necessarily for hierarchical site reference. For example, my pages might be A, B, C, D ... Z on the website but on the backend we have various teams that need their content grouped together. i.e. Team 1 folder has A-G in it. Team 2 folder has H-Q. Team 3 has R-Z in it. How can this be achieved so instead of seeing all the content on the root of the content page I only see these 3 team folders?
You have to be carefull in achieving this. When you create new nodes under your Home root node, eg new pages or folders, they are referenced with an url.
So If you have a page called A, this will be accessed using the url http://www.example.com/a. When you create folders to organize pages and you place page A under HQ, then your page will now be accessed by http://www.example.com/hq/a.
After that you can use url rewriting rules to avaid these folders indications in your url but that will be messed up if you have many pages.
I will suggest if you don't want to see these folder indications in your url, to just add all the nodes under your Home node and using Permission to allow/disallow departments to the nodes.
If you don't care about the folder indications in your url, let me know then I will edit this answer with the solution to achieve this.
EDIT
How to add folder structure in your content nodes.
Step 1
Create a new Document Type called Content Folder.
Go to Settings > Document Types > click on the 3 dots > Create.
Give it the name Content Folder.
As icon select the folder icon
Add a new property Redirect with alias umbracoRedirect with type Content Picker
Save changes
The builtin property umbracoRedirect is used to redirect one node to
another using its id. So for each folder set this property to the first child page.
Step 2
Allow your child node types in this folder.
Go to the structure tab of your Content Folder property
Check the child types that you want to allow under this folder
Save changes
Step 3
Allow this folder under your root Home node.
Go to the structure tab of your Home root property
Check the ContentFoldertype to allow as a child
Save changes
Step 4
Add you folder structure and add pages.
Go to your content
Add a new folder under your root node of type Content Folder
Give it the name HQ
Add a new page called A that's allowed under your folder
In your HQ set the Redirect property to your first A page
Do this for all your folders and pages
Save changes and publish
And thats it!
Another way of doing this is with a custom URL Provider and Content Finder. This is where you create a new provider for working out the URL of the pages on your site, overriding the default folder structure.
You can add your own logic out strip out folders from the URLS, so /folder/a/content could become /folder/content. Obviously you'd need to be careful that the other folders don't contain items with the same names, or you may get the wrong content returned.
The advantage of a URL Provider is that whenever you call the Umbraco methods to get the URL of a content item, you'll ALWAYS get the custom URL.
The content finder is a way for the site to match the modified URLs back to the original content. You'll need both for it to work.
Here is a link to an in depth article about using these two in conjunction in an Umbraco site.
I had created a custom page(test) in concrete5 through UI.
Dashboard->Sitemp->Addpage
I created a form in this page.After form submit I want to store those details in DB.I just want to where this page is saved in app folder structure.So that I can connet Db and save records.
The page is not saved anywhere in the folder structure. It is saved in the database.
If you are using any of the forms add'ons however they will save the data in the db and you'll have access to it from the dashboard report section.
If you really want to be able to control it yourself then you will need to create a single page through code, add the form to it and write the code to process the page.
The single page would be in the single_pages folder and its controller in the controllers folder
Replace "my_profile" with your php file name following the instructions below:
Sign in to the concrete5 dashboard, and go to Themes & Page Types > Single Pages. Find the "Add a Single Page" form at the bottom of the list, and enter "my_profile" at the bottom (or whatever the name of your single page.) Do not include ".php" in the field.
Per the instructions on Concrete5:
http://www.concrete5.org/documentation/developers/pages/single-pages
Within Plone 4.2, how can I constrain the addable content types for all members?
All my members (400 at the momemt and growing), should have a default set of content types to be addable within there "Home" folder (/Members/mymember). That is, if mymember goes to his Home folder, there should only be a few content types like "Document", "Image" and "File" as default addadle types. All other content types like Events, Collection etc. should only be under the "More" menu item of the "Add" menu.
I thought I could just set "Use parent folder setting" for each myplone.org/Members/mymember/folder_constraintypes_form ("Restrictions" item of "Add" menu). And then from the parent myplone.org/Members/folder_constraintypes_form I would set up the default content types as I like. That is all members' Home folders could inherit from the setting in Members. However, as a plone site administrator I cannot set the standard "Allowed" and "Secondary" ("More..." menu) for the /Members/ folder. I do allow have the possibility to select either
Allow the standard types to be added
Specify types manually
That is, there is no "Specify types manually" for /Members/. So I cannot set any defaults for the parent Members folder, from which all members' Home folders could inherit in return...
Of course, I could iterate through all Members with a script and set the folder_constraintypes for each Home folder. That would set things for all old members. However, that would have to be done again for each new member.
I find it very puzzling for users to let them have 8 and more content types to be addable within there Home folder, while they only need to use 2 or 3 actually. How can I change this?
You can create a content type for your members folder. And in the manage_afteradd method set all you want.
You we'll be able to configure Plone to use your content type as member folder, this will fix your problem for new users.
For all previously created members folders, as you said, you write a script that iterate over all members folders.
The members-folder has the member_search_form-template set as default-view. This template doesn't show the link to the folder_constraintypes-template, but you can access the template by appending its name at the end of the member-folder's url.
'http://localhost:8080/yourSiteName/Members/folder_constraintypes'
Note: Don't exclude folders, otherwise the userfolders cannot be created automatically :)
We know that /author/user can show personal information at all users.
Well in my case, each user has a personal folder whitin contents.
My goal is to show the info in /author/user, when an user visit the personal folder of each user. This info must be show first, with the option "select a content item as default view".
I've created a link to /author/user and option "select a content item as default view".
The problem is that the user are redirected to /author/user and cannot navigate in the personal folder.
Is there a trick that solve this problem?
Instead of realizing this with a content item as default view you could just register a new view for folders, being a customized copy of author.pt.
you've two problems: change the default view for user folder (only for those) and creating a new view.
Use the code from author.cpt to make a new skin cpt (or just a .pt removing the feedback form if you don't need it), and just change:
author python:(len(request.traverse_subpath) > 0 and url_unquote_plus(request.traverse_subpath[0])) or request.get('author', None);
to something that grab the user from username or /Members/<> path. Then copy the Folder type in portal_types to a new id (New User Folder or similar), assign this as a default folder in portal_membership for the user and in portal_types -> New User Folder and assign it as default view.
Then you've to migrate all users home folder to this new folder type.
An alternative is to have an index_html script that loads the alternative view, maybe just calling author.cpt with the author parameter in the request:
context.author(author=<<this folder author>>)
where <> is obtained as before. You can add this index_html following this hint on doing things after the user log in:
http://collective-docs.readthedocs.org/en/latest/sessions/login.html#post-login-actions