Le 5 juin 2006, à 22:15, Yves Bastide a écrit :

(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.

Right. Let me point out that this is the case if you want to have a flexible part with one flexible widget already created. Otherwise (void schema, templates with '?' for fields only), the consistentency would be better.

The first field used to be labeled simply 'file'. This changed somewhere between 3.3.5 and 3.3.8. Before that, the transition between flexible and flexible predefined fields/widgets was smoothier. I forgot the reason of the change, just remember that the explanation was convincing when I asked for it.

Thanks for the patch.



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

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

_______________________________________________
cps-devel mailing list
http://lists.nuxeo.com/mailman/listinfo/cps-devel

Reply via email to