Here's the checkin message for code I just checked in.
There's probably a few places in CPS that will break because of this. Please test and report.

Thanks,
Florent

-------

Big refactoring of the way forms are submitted and validated. Now the
process uses the session to store intermediate results when needed. The
process looks like:

1. The initial cpsdocument_edit_form is called, and displays the form by
   using doc.render.

2. The user fills the form and posts, which goes to cpsdocument_edit.

3. The cpsdocument_edit script does the validation, by calling
   doc.validate, which either:

   a. returns OK so everything is stored in the object from the
      datamodel that the validation process constructed,

   b. fails validation, in which case the datastructure is saved in the
      session for future redisplay.

In both cases a redirect occurs. If there was a validation error, the
   redirect goes back to the cpsdocument_edit_form page, which gets the
   data to display from the session (including the errors).

A similar process happens for creation, except that as there's no
document yet, ti.renderObject and ti.validateObject are called instead
of doc.render and doc.validate. The final creation is done by
cpsdocument_create_do.


The whole callback system for creation is now obsolete, as well as the
methods ti.renderEditObjectDetail, ti.renderCreateObjectDetailed, etc.

This allows file/image widgets to not lose data even when validation
errors occur (will be in the next CPSSchemas checkin).

This will also allow easy implementation of multi-page creation forms or
edition forms.


The File, Image, Photo and AttachedFile widgets have been refactored to
reuse code correctly, and to take advantage of session storage between
requests in the case of validation errors.

--
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]


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

Reply via email to