Attention

This document was written for an unsupported version of Plone, Plone 2.0.x, and was last updated 898 days ago.

For more information, see the version support policy.

To learn how to upgrade to the current version of Plone, read the upgrade manual.

Display Topic Results In Navtree

by Marc Mittag last modified Dec 06, 2009 09:27 PM
Modify the navigation tree so that when you click a document inside a topic, the navigation tree displays the document as a child of the topic.

This tutorial shows you how to make topics in the navigation work like ordinary folders, which means:

You have a topic with several items (which are in different folders across the site). The topic naturally appears in your navigation tree. But if you are currently viewing e.g. a document inside a topic, you normally don't see any relation to the topic in your navigation.

With this HowTo you can make it apear as a sub-entry of your topic in the navigation (just as if the topic were a folder and your Document were located in it). This allows you to structure your site with topics while still having a good usability in your navigation.

In addition it re-enables the display of topic-results in the navtree for a currently viewed topic, even if showFolderishSiblingsOnly is activated (which was possible in Plone 1.0 but is not in Plone 2.0)

Please note: For this to work, it's necessary to modify a file in Products/CMFPlone on the filesystem. This is not recommended practice, but in this case it would be very difficult to avoid it. Use at your own risk, and keep backups. Also note that if you upgrade Plone, your changes will be overwritten.

  1. Add an integer-property with name topicBatchSize to your navtree_properties (located in your portal_properties)
  2. Add this script to your custom-folder and give it the id navigation_tree_builder_transline.
  3. Insert the following lines in your StatelessTree.py, at the end of the function def __call__(self) before the return res statement - delete the line-breaks except after the first line (the comment). This file is located in Products/CMFPlone:
            #next lines included by transline for special navigation_tree_builder_transline
            res = context.navigation_tree_builder_transline(res,self.tree_root,
            self.checkPublished,self.childFinder,self.includeTop,
            self.showFolderishSiblingsOnly,self.showFolderishChildrenOnly,
            self.showNonFolderishObject,self.forceParentsInBatch,
            self.skipIndex_html,self.bottomLevel,getattr(self,'idsNotToList',[]),
            self.batchSize,self.navBatchStart,navtree_properties)
    

Attention: Afterwards you will need the navigation_tree_builder_transline in your custom-folder or elsewhere in your path, otherwhise you'll get an error!

  1. Restart Zope
  2. Activate the checkbox showTopicResults in your navtree_properties (located in your portal_properties in ZMI)
  3. That's it!

(Thanks to transline - Übersetzungsdienst für technische Übersetzung for coding this at working-time!!! - Meanwhile http://www.transline.de/ is based on Plone and this howto is working practice on this site as well as on Steinbeis Transferzentrum für Wissensmanagement & Kommunikation!)


Contribute

Something wrong or out of date? Anybody can edit or create a new article in the knowledge base. Simply create an account on this site, log in, and click the Edit button to contribute.