[dokuwiki] Improvements in form handling for plugins

Dokuwiki's forms are output directly from inc/html.php, this doesn't
allow plugins to easily intercept and modify them. A few of the forms
have been graced with an inflexible "FORM_INJECTION" event.

I've completely rewritten how most forms are output that makes them
structured and easily modifiable by plugins. A Doku_Form class manages
the form as a list of elements. An element can be a string (output
directly), or an array that describes an HTML element (somewhat like
what you get from expat) or one of the common form elements: 'button',
'textfield', 'checkboxfield', and a special 'wikitext' element for edit
forms. Hidden fields are also managed specially by the class. 

When created, the html_form() function (inc/html.php) takes the class
and triggers a 'HTML_{$name}FORM_OUTPUT' event. Current forms are: LOGIN
REGISTER RESENDPWD UPDATEPROFILE EDIT DRAFT CONFLICT.

One of the benefits is that the way forms are displayed is unified in a
single place. Forms output from Doku_Form will have a consistent look.
And some convenient shortcuts can be added. For instance, if you create
a button with an "accesskey" attribute, a title with the name and
"ALT+[key]" is automatically created.

Drawbacks are the increased memory required to build the Doku_Form
class.

Obviously, the few plugins that use the old events would need to be
rewritten.
-- tom
telliamed@xxxxxxxxxxx

-- 
http://www.fastmail.fm - The professional email service

Other related posts: