Hi devs,
I just committed a prototype of the class editor that will be used by
the Application Within Minutes. If you want to try it out, you can
either checkout the feature-applicationWithinMinutes platform branch
(see
https://github.com/xwiki/xwiki-platform/tree/feature-applicationWithinMinut…
) and build the latest XAR by yourself or you can download the
snapshot I put at
http://ubuntuone.com/5dPv28OKz1p3ysY2ypjzrZ . It
requires XWiki Enterprise 3.2+ . Follow this steps after you import
the XAR:
* choose an existing class or any document if you want to create a new class
* add an object of type XWiki.DocumentSheetBinding and set the sheet
property to ApplicationWithinMinutes.ClassEditSheet
* edit the class/document in "Inline form" edit mode (simply click on
the Edit button)
Notes:
* I only tested the editor on Firefox for now but it should work on
other browsers too
* The "hint" and "required" meta properties are not saved yet. I
included them on the prototype just to show you the direction I'm
going in.
A few words about the design:
The class editor is an edit sheet for XWiki documents holding class
definitions. The editor supports only property types described by
FormFieldClass, which are grouped by FormFieldCategoryClass. For
instance ApplicationWithinMinutes.TextArea has an object of type
FormFieldClass which specifies the field icon, category and the list
of meta (configuration) properties that should be displayed. Moreover,
ApplicationWithinMinutes.TextArea holds a class definition with a
single TextArea field that serves as a template for all TextArea
fields added through the class editor. The class editor can store the
default field values in the class template and can generate a basic
class sheet (binding included).
Open questions and limitations:
(1) The editor relies heavily on JavaScript. If we're going to replace
the current class editor with the one used by the Application Within
Minutes then we need to decide if it needs to work without JavaScript.
(2) The editor doesn't save intermediary changes (like the current
editor does when you add a new field or when you delete a field). All
changes are saved when you hit Save.
(3) I don't think the Preview button is really needed because the edit
form already offers a preview of how the sheet will look like
(4) The problem with the Save & Continue button is this: the action
servlet filter forwards the request based on the action_* request
parameter. In order to prevent this (because I want to handle the
submit by myself) I renamed the submit buttons to xaction_* but
actionbuttons.js looks explicitly for action_saveandcontinue submit
button, and since it doesn't find it, it doesn't include it in the
POST request parameters, so I don't know the request is a Save &
Continue request.
(5) Because I process the submit myself (i.e. the form action is '') I
need to find a good way to handle errors so that the user doesn't
loose unsaved changes due to an invalid value (e.g. invalid field
name).
(6) Although the UI allows it, you can't really swap the names of two
fields (e.g. rename 'title' to 'description' and 'description' to
'title').
I'm waiting your feedback.
Thanks,
Marius