Personal tools
You are here: Home Documentation Tutorials RichDocument: Creating content types the Plone 2.1 way Non-structural folders
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Non-structural folders

Sometimes you have a folderish item that is folderish as an implementation detail, but should not appear as a folder to the user. RichDocument is a prime example.

Martin Aspeli

This tutorial will teach you how to create content types the Plone 2.1 way, using the ATContentTypes library, by following the example of RichDocument, an extension of Plone's standard Page/Document type.
Page 7 of 17.

RichDocument has to be containerish so that it can contain files and attachments. Thus, it extends OrderedBaseFolder. However, to the user, a document is not a folder.

Folders in Plone 2.1 get a few particular UI features:

  • A contents tab (unlike in Plone 2.0, there is no contents tab on non-folders in Plone 2.1, because with the new actions menu, there is much less need to use this view)
  • An add item menu to add items to the folder instead of an add to folder menu to add sibling items in the parent folder.
  • If you are in a parent folder's contents tab and click a folder, you will see that folder's contents tab, too.

Plone checks whether an item is a folder using the is_folderish script. The expression object/is_folderish (and its catalog metadata equivalent, which for efficiency reasons is implemented using ExtensibleObjectIndexWrapper in CMFPlone/CatalogTool.py) will evaluate to True if object is a "structural folder" – that is, if it is a folder in the UI sense.

By default, all folders are structural, unless they implement the INonStructuralFolder marker interface defined in CMFPlone/interfaces/NonStructuralFolder.py. RichDocument does just this:

  __implements__ = ATDocument.__implements__ + (IRichDocument, INonStructuralFolder,)

And as if by magic, the folder acts like a folder no more.

Finally, because being able to choose a contained item as a default-view does not make sense for RichDocument, we use the method canSetDefaultView from ISelectableBrowserDefault (see the section on dynamic views) to explicitly disallow default views:

  def canSetDefaultPage(self):
        return False

 
by Martin Aspeli last modified September 5, 2005 - 10:59 All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by