| 1 |
<?php |
|---|
| 2 |
/** |
|---|
| 3 |
* notes for the developers, kind of a todo list with suggestions, etc. |
|---|
| 4 |
* |
|---|
| 5 |
* $Id$ |
|---|
| 6 |
* |
|---|
| 7 |
* @access public |
|---|
| 8 |
* @package patForms |
|---|
| 9 |
* @author Sebastian Mordziol <argh@php-tools.net> |
|---|
| 10 |
* @author Stephan Schmidt <schst@php-tools.net> |
|---|
| 11 |
*/ |
|---|
| 12 |
?> |
|---|
| 13 |
|
|---|
| 14 |
BUGS: |
|---|
| 15 |
========================= |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
Planned features (schst): |
|---|
| 19 |
========================= |
|---|
| 20 |
|
|---|
| 21 |
* Event based form-processing: |
|---|
| 22 |
------------------------------ |
|---|
| 23 |
Event handling can be used to automate form handling and |
|---|
| 24 |
could be used best with the autovalidate option. |
|---|
| 25 |
It allows you to register callback methods or objects. |
|---|
| 26 |
|
|---|
| 27 |
This feature already is implemented but in alpha state. |
|---|
| 28 |
|
|---|
| 29 |
$form->registerEventHandler( 'onError', 'handleFormErrors' ); [OK] |
|---|
| 30 |
$form->registerEventHandler( 'onSuccess', array( $handlerObject, 'handleSuccess' ) ); [OK] |
|---|
| 31 |
$form->setEventHandlerObject( $handlerObject ); // supplies methods for all events [OK] |
|---|
| 32 |
|
|---|
| 33 |
boolean setEventHandlerObject( object &handlerObj [, array methodNames] ) |
|---|
| 34 |
boolean registerEventHandler( string event, mixed handler ) |
|---|
| 35 |
|
|---|
| 36 |
Events that are triggered: |
|---|
| 37 |
- onSubmit( &$form ) [OK] |
|---|
| 38 |
- onError( &$form ) [OK] |
|---|
| 39 |
- onValidated( &$form ) before finalize() [Needs attention] |
|---|
| 40 |
- onSuccess( &$form ) after finalize() [Needs attention] |
|---|
| 41 |
- onInit( &$form ) [Needs attention] |
|---|
| 42 |
- onRender( &$form ) [Needs attention] |
|---|
| 43 |
|
|---|
| 44 |
Event handling has to be implemented for: |
|---|
| 45 |
- Element |
|---|
| 46 |
- Rule |
|---|
| 47 |
|
|---|
| 48 |
* Storage containers: |
|---|
| 49 |
--------------------- |
|---|
| 50 |
Storage Containers will allow automatic-storage of validated |
|---|
| 51 |
data in a database, CSV-File, XML-File or any other place (like the moon). |
|---|
| 52 |
Planned containers: |
|---|
| 53 |
- DB (using PEAR::DB) |
|---|
| 54 |
- XML |
|---|
| 55 |
- CSV |
|---|
| 56 |
|
|---|
| 57 |
* Creators: |
|---|
| 58 |
----------- |
|---|
| 59 |
Creators build a form from any datasource or config file. Possible containers are: |
|---|
| 60 |
- DB (using DB::tableInfo) |
|---|
| 61 |
- MySQL (using SHOW COLUMNS) |
|---|
| 62 |
- DB_DataObject |
|---|
| 63 |
|
|---|
| 64 |
* Client side integration: |
|---|
| 65 |
-------------------------- |
|---|
| 66 |
Basic functionality should be available on the client side: |
|---|
| 67 |
|
|---|
| 68 |
Class for each element type, derived from a base class |
|---|
| 69 |
|
|---|
| 70 |
patForms: |
|---|
| 71 |
- patForms::validate() |
|---|
| 72 |
- patForms::getElementByName() (does not return a HTML object but an |
|---|
| 73 |
instance of a javascript form element) |
|---|
| 74 |
|
|---|
| 75 |
patForms_Element: |
|---|
| 76 |
- patForms_Element::getValue() |
|---|
| 77 |
- patForms_Element::validate() |
|---|
| 78 |
- patForms_Element::addRule() |
|---|
| 79 |
|
|---|
| 80 |
patForms_Rule: |
|---|
| 81 |
- patForms_Rule::applyRule() |
|---|
| 82 |
|
|---|
| 83 |
patForms_Filter: |
|---|
| 84 |
- patForms_Filter::in() |
|---|
| 85 |
|
|---|
| 86 |
Class defintions should reside in seperate files and included |
|---|
| 87 |
via javascript include if possible. If not possible (not in document-root, |
|---|
| 88 |
or script-language does not support the feature), the can be included by |
|---|
| 89 |
using file_get_contents(). |
|---|
| 90 |
|
|---|
| 91 |
Problem: |
|---|
| 92 |
-------- |
|---|
| 93 |
In the current implementation, script is only dependent of the format, |
|---|
| 94 |
not the mode. |
|---|
| 95 |
Can this be ignored? |
|---|
| 96 |
|
|---|
| 97 |
* Filters: |
|---|
| 98 |
---------- |
|---|
| 99 |
see docs/filters.txt for documentation |
|---|
| 100 |
|
|---|
| 101 |
- Filters should also be applied to patForms object |
|---|
| 102 |
(push each value through the filter) |
|---|
| 103 |
|
|---|
| 104 |
- Possible add-on: |
|---|
| 105 |
Allow filter to be a callback (or a set of callbacks): |
|---|
| 106 |
|
|---|
| 107 |
patForms_Element::applyFilter( mixed outCallback [, mixed inCallback] ) |
|---|
| 108 |
|
|---|
| 109 |
Problem: Type has to be specified as third parameter |
|---|
| 110 |
|
|---|
| 111 |
ARGH: |
|---|
| 112 |
================================= |
|---|
| 113 |
- add access private/public flag for attributes to make them settable |
|---|
| 114 |
only by private/public. |
|---|
| 115 |
- setting number-based attributes like maxlength/minlength as |
|---|
| 116 |
integers causes them not to be inserted via the insertSpecials |
|---|
| 117 |
modifier (e.g. [ELEMENT_MAXLENGTH]). |
|---|