[CPS-devel] Flexible documents, dependant fields and compound widgets

Yves Bastide ybastide at wanadoo.fr
Mon Jun 5 22:15:57 CEST 2006


(CPS3-current)

Hi,

The flexible part of a document is somewhat hackish. Say you want to 
document type (MyDocument) containing .pdf files, you'll define

* Two schemes: my_document and my_sub_document. my_sub_document contains 
2 file fields (file_pdf with its suffixes properties filled, and 
file_html), a sub-objects (file_html_subfiles), and 2 string fields 
(file_text, caption).

* Two layouts: my_document and my_sub_document, with my_sub_document 
containing a string (caption), an attached file (fields: file, 
file_text, file_html) and a compound widget referring to caption and file.

* A Flexible Type Information MyDocument with a flexible layout, say 
my_sub_document:my_sub_document.


The schema my_sub_document thus contains
* the original file
* the fields needed to get the preview and printable contents


But this doesn't work: create a MyDocument, add to it an PDF file, 
there's no preview nor printable version. This is because the File field 
can't find its dependent fields. The first PDf file fields are file_0_f0 
(original), file_0_f1 (text), file_0_f2 (html) and file_0_f3 (html 
subfiles), while file_0_f0's computeDependantFields() method looks for 
file_0_f0_f1 and so on.


I filled a ticket with a patch: <http://svn.nuxeo.org/trac/pub/ticket/1666>

The patch is not mine, except for possible bugs :-)

yves


P. S. 1 -- CPSOOo's field looks like it's got the same bug

P. S. 2 -- This isn't enough to put a previewable file in a `CPS 
Document` object



More information about the cps-devel mailing list

This list archive provided by Nuxeo, the leaders of open source ECM. Check out the Nuxeo 5 open source, standards-based ECM project.