Collapsible field-sets

 Plone 2.1 comes with Javascript that scan a document for certain markers (usually CSS classes or id attributes) and applies some behaviour where they are found. For example, the "globe" icon that appears in front of any external link in your portal is applied by such a script.
 
RichDocument uses the collapsible field-set machinery written for the new 'History' collapsible field-set to collapse the images and attachments manager widgets in the edit form. The mark-up is very simple::

  <dl id="image-controls" class="collapsible inline collapsedOnLoad">
    <dt class="collapsibleHeader">Title</dt>
    <dd class="collapsibleContent">
     
        ....
        
    </dd>
  </dl>
 
The existence of the "collapsible" class turns collapsing on. "inline" means that the field-set will not be a block level element. collapsedOnLoad, if present, will leave the field set collapsed when the page is loaded, otherwise it will be expanded until the user collapses it.

For the full example, see 'widget_imagesmanager' or 'widget_attachmentsmanager'.