Logo

How-to Boxes

Last modified: 04/11/2006 09:04 AM
Author: Julien Anguenot
Revision: howto-boxes.txt 30087 2005-11-29 19:07:20Z dkuhlman

Warning: This is a draft!

1   Introduction and Structure

The main template of the CPS web page is divided into 7 slots:

------------------
|                |   1. top
|       1        |
|                |   2. center top
|----------------|
|   |        |   |   3. center or folder skin
|   |   2    |   |
|   |--------|   |   4. center bottom
|   |        |   |
| 6 |   3    | 7 |   5. bottom
|   |        |   |
|   |        |   |   6. left
|   |--------|   |
|   |        |   |   7. right
|   |   4    |   |
|----------------|
|                |
|       5        |
------------------

A box is displayed in its slot and ranked by its order attribute.

The main template page is a blank page only defining slots. It uses an HTML table for slot 6/2/3/4/7.

Boxes are place-full objects; they are located in a box container (.cps_boxes) located in a folder (section or workspace).

Boxes are searched from the root of the cps to your current location.

Some attributes of a box can be overridden; this allow you to override a box that is defined in a parent folder.

Overrides defined in the box container in the personal folder (/workspaces/members/user_login/.cps_boxes) are always interpreted except for the minimize/closed in the personal area attributes of the loaded boxes.

If you need to do global override, for example changing a slot for a box in a specific sub folder, you need to do it with the ZMI. See .cps_boxes/override tab.

2   How to Skin a Folder

The view action on a folder (section|workspace) is folder_view:

  • folder_view will check if there are boxes defined with the slot: center (named Skin folder in the UI), on success folder_view will display only those boxes,
  • If there is no box with the slot center, folder_view will display default boxes from an hidden slot named folder_view. These hidden boxes should be edited through the ZMI.

Boxes that belong to the center slot can not be acquire in sub folder. This way you can have different skin in sub folder.

3   Create a Simple foo Box

If your project is named bar and you want to create a foo box, do the following:

  1. Create a metal macro named basebox_foo in a skin named boxes_bar.pt.

  2. In getBoxTypes.py:

    {'category': 'basebox',
     'title': 'portal_type_BaseBox_title',
     'desc': 'portal_type_BaseBox_description',
     'types': [
           ... # add the 3 following lines:
             {'provider': 'bar',
              'id': 'foo',
              'desc': 'description_bar_basebox_foo'},
           ...
    
  3. Add to /i18n/custom.pot:

    msgid "description_bar_basebox_foo"
    msgstr "some description for foo"
    

    then run Products/CPSI18n/bin/update_pos and kbabel.

If the box is more than a sample macro, create a new portal_type. See TextBox or other *Box.py files.

This site is powered by CPS, which includes CPSSkins. CPS and its design are Copyright © 2002-2006 Nuxeo SAS.
CPSSkins is Copyright © 2003-2006 Jean-Marc Orliaguet.
powered_by_nuxeo.png