CPSDocument How-to

Revision: $Id$

Contents

1   For a CPSDocument documentType

portal_schemas:

  1. Create your fields.
  2. Title is required and description highly recommended.
  3. Title is an unique title or a short title displayed in folders
  4. Description can be used like a resume displayed in folders

portal_layouts:

  1. Create your widgets and your layout.

create layout_documentType_xxx:

  1. layout_documentType_edit and layout_documentType_view. Actually, you have to create them in CPSDocument/skins/cps_document/

portal_types:

  1. Create CPS Flexible Type Information and give schema, layout and layout style.
  2. Prefix for your documentType.
  3. Inform Workspace and Section portal type.

.cps_workflow_configuration

  1. Add the workflow_content_wf where it's necessary.

2   The case of the flexible parts

Document types can have flexible parts. Each flexible part requires the document type to have a dedicated layout and a dedicated associated schema.

The schema just has to be an empty schema, nothing special. The layout just has to be any layout, nothing special. The fields in the schema will be dynamically created through the informations contained in the widgets code. The widgets are defined in the CPSSchemas product. Each widget has a field_types attribute defining which fields are needed, and thus those are the fields which will be created by the flexible content mechanism.

If the field types defined in the field_types attribute are not those you want, you will have to create a new widget with a different field_types attribute. The CPS flexible mechanism is not 100% flexible.

An example of this situation occurs if one wants to use an AttachedFile Widget with a Disk File field. In this situation one would need to create a new widget, let's say an AttachedDiskFile Widget which would inherit from AttachedFile Widget, but with the field_types attribute redefined to use the Disk File field instead of CPS File Field field.