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
Related
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
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
I wonder if there's a Drupal module that can do this kind of functionality: if i go to home page, it will take me to some subpath within the site. i.e. www.something.com will redirect to www.something.com/product/node/11.
I tried creating an alias and used Path redirect module but for some reason, i can't reach the expanded URL when going to home page. it will display the content of www.something.com/product/node/11 but still using www.something.com.
I'm thinking that this can only be implemented in Apache server, not inside Drupal?
Note that our purpose of doing this feature is whenever a new product is created, we want our home website to point to that (i.e. www.something.com -> www.something.com/product2/home, before www.something.com/product1/home). If this is configurable inside Drupal, the changes would be easier and can be done by a Drupal administrator.
You should be able to go to /admin/settings/site-information and set the Default Front Page at the bottom of the form. That doesn't do a redirect: the home page will BE whatever you set the default to.
Create a new view (Node type) named "frontpage_redirect"
As suggested in answer by Michael D, create and save a view configured to search for your specified criteria:
display: page display, path = frontpage-redirect
pager: 1 item
row style = Fields
fields: Node => Node ID
filters: node type = product
sort: post date desc
Save your new view
At admin/config/system/site-information, set your "Default front page" to the view display path above (frontpage-redirect in my example)
In the view edit screen select "Theme: Information" link in the Page display. Look for the most specific (rightmost) entry under "Field Node: Nid (ID: nid)" - should be something like views-view-field--frontpage-redirect--page-1--nid.tpl.php, but will depend on the view name and display name. Copy the default views template views-view.tpl.php into your theme folder using the filename from 3.
Edit the template and put this code in it:
if (isset($row->nid)) {
drupal_goto('node/' . $row->nid);
}
This way of setting up the redirect lets you drive it from Views, which gives flexibility. When your customer decides in six weeks that they want to feature only the latest red product on the frontpage, you'll be able to update the logic behind the redirect using the views UI. (And you can do it from your phone on the train home!)
You avoid the need to create a custom module (which is easy enough, but does add some complexity) or to move your site logic into .htaccess.
Using the Views module, create a new view that displays one full node, ordered by last created, filtered appropriately, then create a page display in the view. Then follow Graham's instruction to set the site homepage to the view URL.
Another way would be to write a very simple custom module that db-queries for the latest node created of the sort you want, grab the URL to the page, then redirect there using drupal_goto().
There are other ways to do what you want inside Drupal, but I can't think of any that are more direct and simple at the moment...
What you are asking seems wrong. Sorry if I misunderstand some detail, but it seems you should reconsider the problem on a higher level.
If I understand you right, you want to show the page for the latest product as the homepage?
If so, maybe you should turn that into show the latest project page on the homepage. That fits a lot better with the RESTfullness of the web. And with expectations of the users.
The pattern would then be:
GET /products/22 shows product 22
GET /products/23 shows product 23
GET /product/latest shows the last product (in this case, the page would be exactly similar to /products/23)
To achieve that, you can use views module.
On similar lines to Michael D's post, assuming you want to pull the most recently published product from a custom content type called "products," you could put something like this in your settings.php:
function yourtheme_preprocess_page(&$variables) {
$query = db_query("SELECT nid FROM {content_type_products} ORDER BY nid DESC LIMIT 1");
while ($row = db_fetch_object($query)) {
$redirect_nid = $row->nid;
}
if ($variables['is_front'] == 1) drupal_goto("/node/" . $redirect_nid);
}
modify the .htaccess file.
http://drupal.org/node/50322#comment-2456576
I have setup a view which outputs nodes, including the name of the person who created it.
If a non-admin person browses to the page where that view is displayed, they dont see the name field, I recall somewhere about this being an administrative permission ??
Is the name of the creator a CCK field? Make sure the permission to view this field is set for anonymous users (in the /admin/user/permissions page).