[FEATURE] Integrate Form project into Core
authorXavier Perseguers <typo3@perseguers.ch>
Fri, 22 Jul 2011 13:17:08 +0000 (15:17 +0200)
committerXavier Perseguers <xavier@typo3.org>
Mon, 1 Aug 2011 15:48:19 +0000 (17:48 +0200)
Form project should now become a system extension.

Change-Id: Ide145a64ebe9db26a87437c7befd88a1c5081012
Resolves: #28388
Reviewed-on: http://review.typo3.org/3472
Tested-by: Philipp Gampe
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
395 files changed:
typo3/sysext/form/ChangeLog [new file with mode: 0644]
typo3/sysext/form/Classes/Controller/Form.php [new file with mode: 0644]
typo3/sysext/form/Classes/Controller/Wizard.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Factory/JsonToTyposcript.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Factory/Typoscript.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Factory/TyposcriptToJson.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Additional.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Error.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Label.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Legend.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Additional/Mandatory.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Accept.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Acceptcharset.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Accesskey.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Action.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Alt.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Attributes.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Checked.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Class.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Cols.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Dir.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Disabled.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Enctype.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Id.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Label.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Lang.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Maxlength.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Method.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Multiple.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Name.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Readonly.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Rows.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Selected.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Size.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Src.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Style.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Tabindex.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Title.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Type.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Attributes/Value.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Content.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Button.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Captcha.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Content.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Hidden.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Imagebutton.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Optgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Option.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Password.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Reset.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Submit.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Element/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/Form.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Button.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Captcha.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Element.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Form.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Header.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Hidden.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Name.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Password.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Reset.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Submit.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Model/JSON/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Repository/Content.php [new file with mode: 0644]
typo3/sysext/form/Classes/Exception/class.tx_form_exception_general.php [new file with mode: 0644]
typo3/sysext/form/Classes/Exception/class.tx_form_exception_loader.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Elementcounter/Elementcounter.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Alphabetic.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Alphanumeric.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Currency.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Digit.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Filter.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Integer.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Interface.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Lowercase.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Regexp.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Removexss.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Stripnewlines.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Titlecase.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Trim.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Filter/Uppercase.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Layout/Layout.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Loader/Loader.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Localization/Localization.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Postprocessor/Mail.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Postprocessor/Postprocessor.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Request/Request.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Alphabetic.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Alphanumeric.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Between.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Captcha.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Date.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Digit.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Email.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Equals.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Fileallowedtypes.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Filemaximumsize.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Fileminimumsize.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Float.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Greaterthan.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Inarray.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Integer.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Interface.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Ip.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Length.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Lessthan.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Regexp.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Required.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Uri.php [new file with mode: 0644]
typo3/sysext/form/Classes/System/Validate/Validate.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Additional/Additional.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Additional/Label.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Additional/Legend.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Confirmation.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Optgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Option.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Confirmation/Element/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Additional/Additional.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Additional/Error.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Additional/Label.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Additional/Legend.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Additional/Mandatory.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Button.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Captcha.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Content.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Hidden.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Imagebutton.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Optgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Option.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Password.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Reset.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Submit.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Element/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Form/Form.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Additional/Additional.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Additional/Label.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Additional/Legend.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Abstract.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Hidden.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Optgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Option.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Element/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Html/Html.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Mail.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Checkbox.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Checkboxgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Container.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Element.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Fieldset.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Fileupload.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Hidden.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Optgroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Option.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Radio.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Radiogroup.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Select.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Textarea.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Element/Textline.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Mail/Plain/Plain.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Wizard/Load.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Wizard/Save.php [new file with mode: 0644]
typo3/sysext/form/Classes/View/Wizard/Wizard.php [new file with mode: 0644]
typo3/sysext/form/Configuration/TypoScript/setup.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Manual/en/manual.sxw [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/button.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/checkbox.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/checkboxgroup.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/fieldset.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/hidden.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/imagebutton.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/optgroup.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/option.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/password.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/radio.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/radiogroup.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/reset.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/select.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/submit.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/textarea.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Attributes/textline.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/alphabetic.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/alphanumeric.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/currency.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/digit.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/integer.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/lowercase.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/regexp.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/stripnewlines.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/titlecase.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/trim.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Filter/uppercase.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Request/checkbox.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Request/option.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Request/radio.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/alphabetic.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/alphanumeric.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/between.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/combined.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/date.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/digit.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/email.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/equals.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/float.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/greaterthan.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/inarray.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/integer.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/ip.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/length.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/lessthan.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/regexp.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/required.txt [new file with mode: 0644]
typo3/sysext/form/Documentation/Tests/Validation/uri.txt [new file with mode: 0644]
typo3/sysext/form/Resources/Private/Language/locallang_controller.xml [new file with mode: 0644]
typo3/sysext/form/Resources/Private/Language/locallang_wizard.xml [new file with mode: 0755]
typo3/sysext/form/Resources/Private/Templates/Wizard.html [new file with mode: 0644]
typo3/sysext/form/Resources/Public/CSS/Form.css [new file with mode: 0644]
typo3/sysext/form/Resources/Public/CSS/Wizard/Wizard.css [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/broom.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/captcha.jpg [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/cursor-move.png [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/drive-upload.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/edit-heading.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/mail.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/remove.gif [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/submit-trigger.gif [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/tooltip.png [new file with mode: 0644]
typo3/sysext/form/Resources/Public/Images/ui-button-default.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-button.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-check-box.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-check-boxes.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-combo-box.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-group-box.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-labels.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-radio-button.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-radio-buttons.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-scroll-pane-text.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-text-field-hidden.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-text-field-password.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/ui-text-field.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/Images/user-silhouette.png [new file with mode: 0755]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Button.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Captcha.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Checkbox.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Fieldset.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Fileupload.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Form.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Hidden.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Password.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Radio.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Reset.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Select.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Submit.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Textarea.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Basic/Textline.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/ButtonGroup.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Container.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Content/Header.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Dummy.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Elements.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Predefined/CheckboxGroup.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Predefined/Email.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Predefined/Name.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Elements/Predefined/RadioGroup.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Helpers/Element.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Helpers/History.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Initialize.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.form.spinnerfield.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.form.textfieldsubmit.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.grid.CheckColumn.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.grid.ItemDeleter.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.grid.SingleSelectCheckColumn.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.isemptyobject.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.merge.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Ux/Ext.ux.spinner.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Basic.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/ButtonGroup.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Content.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Elements/Predefined.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/Attributes.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/PostProcessor.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/PostProcessors/Dummy.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/PostProcessors/Mail.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/PostProcessors/PostProcessor.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Form/Prefix.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options.js [new file with mode: 0755]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Dummy.js [new file with mode: 0755]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Attributes.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Alphabetic.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Alphanumeric.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Currency.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Digit.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Dummy.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Filter.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Integer.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/LowerCase.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/RegExp.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/RemoveXSS.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/StripNewLines.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/TitleCase.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/Trim.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Filters/UpperCase.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Label.js [new file with mode: 0755]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Legend.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Options.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Alphabetic.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Alphanumeric.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Between.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Captcha.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Date.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Digit.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Dummy.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Email.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Equals.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/FileAllowedTypes.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/FileMaximumSize.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/FileMinimumSize.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Float.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/GreaterThan.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/InArray.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Integer.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Ip.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Length.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/LessThan.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/RegExp.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Required.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Rule.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Validation/Uri.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Forms/Various.js [new file with mode: 0644]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Left/Options/Panel.js [new file with mode: 0755]
typo3/sysext/form/Resources/Public/JavaScript/Wizard/Viewport/Right.js [new file with mode: 0644]
typo3/sysext/form/ext_autoload.php [new file with mode: 0644]
typo3/sysext/form/ext_emconf.php [new file with mode: 0644]
typo3/sysext/form/ext_icon.gif [new file with mode: 0644]
typo3/sysext/form/ext_localconf.php [new file with mode: 0644]
typo3/sysext/form/ext_tables.php [new file with mode: 0644]

diff --git a/typo3/sysext/form/ChangeLog b/typo3/sysext/form/ChangeLog
new file mode 100644 (file)
index 0000000..aa64238
--- /dev/null
@@ -0,0 +1,180 @@
+2009-10-27  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added inclusion of static TS in ext_tables.php
+       * Major refactoring: renaming folder and file names
+
+2009-02-04  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added 'captcha' to captcha
+       * Added 'simple_captcha' to captcha
+       * Added 'wt_calculating_captcha' to captcha
+       * Added 'securimage' to captcha
+       * Added 'jm_recaptcha' to captcha
+
+2009-02-03  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Starting adding captcha object and validation
+       * Added sr_freecap to captcha
+
+2009-01-31  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+       * Added possibility to have more than 1 checkbox with the same name. Now it's an array in tx_form_model_element_checkbox
+       * Changed setValue to checkFilterAndSetIncomingDataFromRequest in tx_form_model_element_option
+       * Changed the caching method in tx_form_controller_typoscript. Form will be a COA_INT from now on.
+
+2009-01-29  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-28  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-27  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-23  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-22  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-21  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Documentation
+
+2009-01-20  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added class.tx_form_filter_removexss
+       * Added removexss filter to all form elements by default
+       * Added class.tx_form_filter_regexp
+       * Deleted class.tx_form_datahandler.php which was deprecated
+
+2009-01-16  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Adding filtered submitted data to form elements
+
+2009-01-15  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Starting inserting and filtering incoming data
+       * Finished filtering incoming data
+
+2009-01-14  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Writing the isValid methods for several validation rules
+
+2009-01-13  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Writing the isValid methods for several validation rules
+
+2009-01-09  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Cleanup in validation rules
+       * Added PHPdoc to validation rules
+
+2009-01-08  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Messages from validation rules
+
+2009-01-07  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Adding validation classes and methods
+       * Integrate validation into model
+
+2009-01-04  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Adding validation classes and methods
+       * Writing methods for making the messages
+
+2008-12-30  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Starting validation
+
+2008-12-29  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added class="csc-form-xx" to element wraps
+       * Added javadoc to model_element
+       * Cleanup and adding javadoc documentation
+
+2008-12-28  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Mainly changes in views
+       
+2008-12-27  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Changing the views
+
+2008-12-24  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Big changes in views and models
+       
+2008-12-22  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * deleting old files in model
+       * Deleting model/elements folder
+       * Update of the model, big changes
+       * deleting form folder
+       * Changes to model
+
+2008-12-17  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added filters alphabetic, alphanumeric, currency, digit, integer, lowercase, stripnewlines, titlecase, trim, uppercase
+       * Changing the models for configuration without Typoscript
+       
+2008-12-16  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Added class.tx_form_requesthandler
+       * Added class.tx_form_loader
+       * Start with filters
+
+2008-12-15  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Moved class.tx_form_attributes to model/attributes/
+       * Made layouthandler and localizationhandler singleton
+
+2008-12-14  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Finished select, optgroup and option
+       * Moved the attribute functionality to separate object
+       * Added locallang values to buttons when empty
+
+2008-12-13  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Adding select, optgroup and option
+
+2008-12-10  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Adding static layout class for changing layout of all elements
+       * Finishing layout handling
+       * Added localization handling
+
+2008-12-09  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * changed various methods _setAttribute... in class.tx_form_model_elements_abstract.php
+
+2008-12-08  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * changed various methods _setAttribute... in class.tx_form_model_elements_abstract.php
+
+2008-12-04  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * changed various methods _setAttribute... in class.tx_form_model_elements_abstract.php
+
+2008-12-03  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Some cleaning up, checking the javadoc comments and moving methods to abstract classes in view objects
+       * Adapting views, adding error and mandatory parts, cleaning up
+
+2008-12-02  Patrick Broens  <patrick@patrickbroens.nl> 
+       
+       * Making the element views
+       * Updated views, code cleaning
+       
+2008-12-01  Patrick Broens  <patrick@patrickbroens.nl>
+
+       * Start of FORM project. Basic groundwork of MVC
+       * Including error handling
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Controller/Form.php b/typo3/sysext/form/Classes/Controller/Form.php
new file mode 100644 (file)
index 0000000..9585274
--- /dev/null
@@ -0,0 +1,298 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Main controller for Forms.  All requests come through this class
+ * and are routed to the model and view layers for processing.
+ *
+ * @category Controller
+ * @package TYPO3
+ * @subpackage form
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @license http://www.gnu.org/copyleft/gpl.html
+ * @version $Id$
+ */
+class tx_form_controller {
+
+       /**
+        * The TypoScript array
+        *
+        * @var array
+        */
+       protected $typoscript = array();
+
+       /**
+        * @var tx_form_domain_factory_typoscript
+        */
+       protected $typoscriptFactory;
+
+       /**
+        * @var tx_form_system_localization
+        */
+       protected $localizationHandler;
+
+       /**
+        * @var tx_form_system_request
+        */
+       protected $requestHandler;
+
+       /**
+        * @var tx_form_system_validate
+        */
+       protected $validate;
+
+       /**
+        * Initialisation
+        *
+        * @param array $typoscript TS configuration for this cObject
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function initialize($typoscript) {
+               t3lib_div::makeInstance(
+                       'tx_form_system_localization',
+                       'LLL:EXT:form/Resources/Private/Language/locallang_controller.xml'
+               );
+
+               $this->typoscriptFactory = t3lib_div::makeInstance('tx_form_domain_factory_typoscript');
+               $this->localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+               $this->requestHandler = $this->typoscriptFactory->setRequestHandler($typoscript);
+               $this->validate = $this->typoscriptFactory->setRules($typoscript);
+
+               $this->typoscript = $typoscript;
+       }
+
+       /**
+        * Renders the application defined cObject FORM
+        * which overrides the TYPO3 default cObject FORM
+        *
+        * First we make a COA_INT out of it, because it does not need to be cached
+        * Then we send a FORM_INT to the COA_INT
+        * When this is read, it will call the FORM class again.
+        *
+        * It simply calls execute because this function name is not really descriptive
+        * but is needed by the core of TYPO3
+        *
+        * @param string $typoscriptObjectName Name of the object
+        * @param array $typoscript TS configuration for this cObject
+        * @param string $typoscriptKey A string label used for the internal debugging tracking.
+        * @param tslib_cObj $contentObject reference
+        * @return string HTML output
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function cObjGetSingleExt(
+               $typoscriptObjectName,
+               $typoscript,
+               $typoscriptKey,
+               tslib_cObj $contentObject
+       ) {
+               $content = '';
+
+               if ($typoscriptObjectName === 'FORM') {
+                       if ($contentObject->data['CType'] === 'mailform') {
+                               $bodytext = $contentObject->data['bodytext'];
+                               /** @var $typoScriptParser t3lib_tsparser */
+                               $typoScriptParser = t3lib_div::makeInstance('t3lib_tsparser');
+                               $typoScriptParser->parse($bodytext);
+                               $typoscript = t3lib_div::array_merge_recursive_overrule(
+                                       (array) $typoScriptParser->setup,
+                                       (array) $typoscript
+                               );
+                       }
+                       $newTyposcript['10'] = 'FORM_INT';
+                       $newTyposcript['10.'] = $typoscript;
+                       $content = $contentObject->COBJ_ARRAY($newTyposcript, 'INT');
+               } elseif ($typoscriptObjectName == 'FORM_INT') {
+                       $this->initialize($typoscript);
+                       $content = $this->execute();
+               }
+
+               return $content;
+       }
+
+       /**
+        * Build the models and views and renders the output from the views
+        *
+        * @return string HTML Output
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function execute() {
+               $content = '';
+
+                       // Form
+               if ($this->showForm()) {
+                       $content = $this->renderForm();
+               } else {
+                               // Confirmation screen
+                       if ($this->showConfirmation()) {
+                               $content = $this->renderConfirmation();
+
+                               // We need the post processing
+                       } else {
+                               $content = $this->doPostProcessing();
+                       }
+               }
+
+               return $content;
+       }
+
+       /**
+        * Check if the form needs to be displayed
+        *
+        * This is TRUE when nothing has been submitted,
+        * when data has been submitted but the validation rules do not fit
+        * or when the user returns from the confirmation screen.
+        *
+        * @return boolean TRUE when form needs to be shown
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function showForm() {
+               $show = FALSE;
+
+               $submittedByPrefix = $this->requestHandler->getByMethod();
+
+               if (
+                               // Nothing has been submitted
+                       $submittedByPrefix === NULL ||
+
+                               // Submitted but not valid
+                       (
+                               !empty($submittedByPrefix) &&
+                               !$this->validate->isValid()
+                       ) ||
+
+                               // Submitted, valid, but not confirmed
+                       (
+                               !empty($submittedByPrefix) &&
+                               $this->validate->isValid() &&
+                               $this->requestHandler->getPost('confirmation') === $this->localizationHandler->getLocalLanguageLabel('tx_form_view_confirmation.donotconfirm')
+                       )
+               ) {
+                       $show = TRUE;
+               }
+
+               return $show;
+       }
+
+       /**
+        * Render the form
+        *
+        * @return string The form HTML
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function renderForm() {
+               $this->requestHandler->destroySession();
+
+               $form = $this->typoscriptFactory->buildModelFromTyposcript($this->typoscript);
+
+               /** @var $view tx_form_view_form */
+               $view = t3lib_div::makeInstance('tx_form_view_form', $form);
+
+               return $view->get();
+       }
+
+       /**
+        * Check if the confirmation message needs to be displayed
+        *
+        * This is TRUE when data has been submitted,
+        * the validation rules are valid,
+        * the confirmation screen has been configured in TypoScript
+        * and the confirmation screen has not been submitted
+        *
+        * @return boolean TRUE when confirmation screen needs to be shown
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function showConfirmation() {
+               $show = FALSE;
+
+               if (
+                       isset($this->typoscript['confirmation']) &&
+                       $this->typoscript['confirmation'] == 1 &&
+                       $this->requestHandler->getPost('confirmation') === NULL
+               ) {
+                       $show = TRUE;
+               }
+
+               return $show;
+       }
+
+       /**
+        * Render the confirmation screen
+        *
+        * Stores the submitted data in a session
+        *
+        * @return string The confirmation screen HTML
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function renderConfirmation() {
+               $form = $this->typoscriptFactory->buildModelFromTyposcript($this->typoscript);
+
+               $this->requestHandler->storeSession();
+
+               $confirmationTyposcript = array();
+               if (isset($this->typoscript['confirmation.'])) {
+                       $confirmationTyposcript = $this->typoscript['confirmation.'];
+               }
+
+               /** @var $view tx_form_view_confirmation */
+               $view = t3lib_div::makeInstance(
+                       'tx_form_view_confirmation',
+                       $form,
+                       $confirmationTyposcript
+               );
+
+               return $view->get();
+       }
+
+       /**
+        * Do the post processing
+        *
+        * Destroys the session because it is not needed anymore
+        *
+        * @return string The post processing HTML
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function doPostProcessing() {
+               $form = $this->typoscriptFactory->buildModelFromTyposcript($this->typoscript);
+
+               $postProcessorTypoScript = array();
+               if (isset($this->typoscript['postProcessor.'])) {
+                       $postProcessorTypoScript = $this->typoscript['postProcessor.'];
+               }
+
+               /** @var $postProcessor tx_form_system_postprocessor */
+               $postProcessor = t3lib_div::makeInstance(
+                       'tx_form_system_postprocessor',
+                       $form,
+                       $postProcessorTypoScript
+               );
+               $content = $postProcessor->process();
+               $this->requestHandler->destroySession();
+
+               return $content;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Controller/Wizard.php b/typo3/sysext/form/Classes/Controller/Wizard.php
new file mode 100644 (file)
index 0000000..4f28d56
--- /dev/null
@@ -0,0 +1,129 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+define('TYPO3_MOD_PATH', 'sysext/form/Classes/Controller/');
+$BACK_PATH = '../../../../';
+require($BACK_PATH . 'init.php');
+require($BACK_PATH . 'template.php');
+
+/**
+ * The form wizard controller
+ *
+ * @category Controller
+ * @package TYPO3
+ * @subpackage form
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @license http://www.gnu.org/copyleft/gpl.html
+ * @version $Id$
+ */
+class tx_form_controller_wizard {
+       /**
+        * Constructs this controller
+        *
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Dispatch on action
+        *
+        * Calls the requested action
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function dispatch() {
+               switch(t3lib_div::_GP('action')) {
+                       case 'save':
+                               $this->saveAction();
+                               break;
+                       case 'load':
+                               $this->loadAction();
+                               break;
+                       default:
+                               $this->indexAction();
+               }
+       }
+
+       /**
+        * The index action
+        *
+        * The action which should be taken when the wizard is loaded
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function indexAction() {
+               /** @var $repository tx_form_domain_repository_content */
+               $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
+
+               /** @var $view tx_form_view_wizard_wizard */
+               $view = t3lib_div::makeInstance('tx_form_view_wizard_wizard');
+               $view->setRepository($repository);
+               $view->render();
+       }
+
+       /**
+        * The save action
+        *
+        * The action which should be taken when the form in the wizard is saved
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function saveAction() {
+               /** @var $repository tx_form_domain_repository_content */
+               $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
+
+               /** @var $view tx_form_view_wizard_save */
+               $view = t3lib_div::makeInstance('tx_form_view_wizard_save');
+               $view->setRepository($repository);
+               $view->render();
+       }
+
+       /**
+        * The load action
+        *
+        * The action which should be taken when the form in the wizard is loaded
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function loadAction() {
+               /** @var $repository tx_form_domain_repository_content */
+               $repository = t3lib_div::makeInstance('tx_form_domain_repository_content');
+
+               /** @var $view tx_form_view_wizard_load */
+               $view = t3lib_div::makeInstance('tx_form_view_wizard_load');
+               $view->setRepository($repository);
+               $view->render();
+       }
+}
+
+/** @var $wizard tx_form_controller_wizard */
+$wizard = t3lib_div::makeInstance('tx_form_controller_wizard');
+$wizard->dispatch();
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Factory/JsonToTyposcript.php b/typo3/sysext/form/Classes/Domain/Factory/JsonToTyposcript.php
new file mode 100644 (file)
index 0000000..575b95e
--- /dev/null
@@ -0,0 +1,609 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2011 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Json to Typoscript converter
+ *
+ * Takes the incoming Json and converts it to Typoscipt
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_factory_jsontotyposcript {
+       /**
+        * Internal counter for the elements
+        *
+        * @var integer
+        */
+       private $elementId = 0;
+
+       /**
+        * Storage for the validation rules
+        * In TypoScript they are set in the form, in the wizard on the elements
+        *
+        * @var array
+        */
+       private $validationRules = array();
+
+       /**
+        * Internal counter for the validation rules
+        *
+        * @var integer
+        */
+       private $validationRulesCounter = 1;
+
+       /**
+        * Constructor
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Convert JSON to TypoScript
+        *
+        * First a TypoScript array is constructed,
+        * which will be converted to a formatted string
+        *
+        * @param string $json Json containing all configuration for the form
+        * @return string The typoscript for the form
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function convert($json) {
+               $elements = json_decode((string) $json, TRUE);
+               $typoscriptArray = array();
+               $typoscript = NULL;
+
+               $this->convertToTyposcriptArray($elements, $typoscriptArray);
+
+               if (
+                       $typoscriptArray['10.'] &&
+                       is_array($typoscriptArray['10.']) &&
+                       !empty($typoscriptArray['10.'])
+               ) {
+                       $typoscript = $this->typoscriptArrayToString($typoscriptArray['10.']);
+               }
+
+               return $typoscript;
+       }
+
+       /**
+        * Converts the JSON array for each element to a TypoScript array
+        * and adds this Typoscript array to the parent
+        *
+        * @param array $elements The JSON array
+        * @param array $parent The parent element
+        * @param boolean $childrenWithParentName Indicates if the children use the parent name
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function convertToTyposcriptArray($elements, &$parent, $childrenWithParentName = FALSE) {
+               if (is_array($elements)) {
+                       $elementCounter = 10;
+                       foreach($elements as $element) {
+                               if ($element['xtype']) {
+                                       $this->elementId++;
+                                       switch($element['xtype']) {
+                                               case 'typo3-form-wizard-elements-basic-button':
+                                               case 'typo3-form-wizard-elements-basic-captcha':
+                                               case 'typo3-form-wizard-elements-basic-checkbox':
+                                               case 'typo3-form-wizard-elements-basic-fileupload':
+                                               case 'typo3-form-wizard-elements-basic-hidden':
+                                               case 'typo3-form-wizard-elements-basic-password':
+                                               case 'typo3-form-wizard-elements-basic-radio':
+                                               case 'typo3-form-wizard-elements-basic-reset':
+                                               case 'typo3-form-wizard-elements-basic-select':
+                                               case 'typo3-form-wizard-elements-basic-submit':
+                                               case 'typo3-form-wizard-elements-basic-textarea':
+                                               case 'typo3-form-wizard-elements-basic-textline':
+                                               case 'typo3-form-wizard-elements-predefined-email':
+                                               case 'typo3-form-wizard-elements-content-header':
+                                                       $this->getDefaultElementSetup($element, $parent, $elementCounter, $childrenWithParentName);
+                                                       break;
+                                               case 'typo3-form-wizard-elements-basic-fieldset':
+                                               case 'typo3-form-wizard-elements-predefined-name':
+                                                       $this->getDefaultElementSetup($element, $parent, $elementCounter);
+                                                       $this->getContainer($element, $parent, $elementCounter);
+                                                       break;
+                                               case 'typo3-form-wizard-elements-predefined-checkboxgroup':
+                                               case 'typo3-form-wizard-elements-predefined-radiogroup':
+                                                       $this->getDefaultElementSetup($element, $parent, $elementCounter);
+                                                       $this->getContainer($element, $parent, $elementCounter, TRUE);
+                                                       break;
+                                               case 'typo3-form-wizard-elements-basic-form':
+                                                       $this->getDefaultElementSetup($element, $parent, $elementCounter);
+                                                       $this->getContainer($element, $parent, $elementCounter);
+                                                       $this->getForm($element, $parent, $elementCounter);
+                                                       break;
+                                               default:
+                                       }
+                               }
+                               $elementCounter = $elementCounter + 10;
+                       }
+               }
+       }
+
+       /**
+        * Called for elements are a container for other elements like FORM and FIELDSET
+        *
+        * @param array $element The JSON array for this element
+        * @param array $parent The parent element
+        * @param boolean $childrenWithParentName Indicates if the children use the parent name
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function getContainer($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+               if ($element['elementContainer'] && $element['elementContainer']['items']) {
+                       $this->convertToTyposcriptArray(
+                               $element['elementContainer']['items'],
+                               $parent[$elementCounter . '.'],
+                               $childrenWithParentName
+                       );
+               }
+       }
+
+       /**
+        * Only called for the type FORM
+        *
+        * Adds the validation rules to the form. In the wizard they are added to
+        * each element. In this script the validation rules are stored in a
+        * separate array to add them to the form at a later point.
+        *
+        * @param array $element The JSON array for this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function getForm($element, &$parent, $elementCounter) {
+                       // TODO: Put at the top of the form
+               if (!empty($this->validationRules)) {
+                       $parent[$elementCounter . '.']['rules'] = $this->validationRules;
+               }
+       }
+
+       /**
+        * Called for each element
+        *
+        * Adds the content object type to the parent array and starts adding the
+        * configuration for the element
+        *
+        * @param array $element The JSON array for this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @param boolean $childrenWithParentName Indicates if the children use the parent name
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function getDefaultElementSetup($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+               $parent[$elementCounter] = $this->getContentObjectType($element);
+               $parent[$elementCounter . '.'] = array();
+               if ($element['configuration']) {
+                       $this->setConfiguration($element, $parent, $elementCounter, $childrenWithParentName);
+               }
+       }
+
+       /**
+        * Returns the content object type which is related to the ExtJS xtype
+        *
+        * @param array $element The JSON array for this element
+        * @return string The Content Object Type
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function getContentObjectType($element) {
+               $shortXType = str_replace('typo3-form-wizard-elements-', '', $element['xtype']);
+               list($category, $type) = explode('-', $shortXType);
+
+               switch ($category) {
+                       case 'basic':
+                               $contentObjectType = strtoupper($type);
+                               break;
+                       case 'predefined':
+                               switch ($type) {
+                                       case 'checkboxgroup':
+                                       case 'radiogroup':
+                                               $contentObjectType = strtoupper($type);
+                                               break;
+                                       case 'email':
+                                               $contentObjectType = 'TEXTLINE';
+                                               break;
+                                       case 'name':
+                                               $contentObjectType = 'FIELDSET';
+                               }
+                               break;
+                       case 'content':
+                               $contentObjectType = 'TEXT';
+                               break;
+                       default:
+               }
+
+               return $contentObjectType;
+       }
+
+       /**
+        * Iterates over the various configuration settings and calls the
+        * appropriate function for each setting
+        *
+        * @param array $element The JSON array for this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @param boolean $childrenWithParentName Indicates if the children use the parent name
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setConfiguration($element, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+               foreach ($element['configuration'] as $key => $value) {
+                       switch ($key) {
+                               case 'attributes':
+                                       $this->setAttributes($value, $parent, $elementCounter, $childrenWithParentName);
+                                       break;
+                               case 'confirmation':
+                                       $this->setConfirmation($value, $parent, $elementCounter);
+                                       break;
+                               case 'filters':
+                                       $this->setFilters($value, $parent, $elementCounter);
+                                       break;
+                               case 'label':
+                                       $this->setLabel($value, $parent, $elementCounter);
+                                       break;
+                               case 'layout':
+                                       $this->setLayout($element, $value, $parent, $elementCounter);
+                                       break;
+                               case 'legend':
+                                       $this->setLegend($value, $parent, $elementCounter);
+                                       break;
+                               case 'options':
+                                       $this->setOptions($element, $value, $parent, $elementCounter);
+                                       break;
+                               case 'postProcessor':
+                                       $this->setPostProcessor($value, $parent, $elementCounter);
+                                       break;
+                               case 'prefix':
+                                       $this->setPrefix($value, $parent, $elementCounter);
+                                       break;
+                               case 'validation':
+                                       $this->setValidationRules($element, $value);
+                                       break;
+                               case 'various':
+                                       $this->setVarious($element, $value, $parent, $elementCounter);
+                                       break;
+                               default:
+                       }
+               }
+       }
+
+       /**
+        * Set the attributes for the element
+        *
+        * @param array $attributes The JSON array for the attributes of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @param boolean $childrenWithParentName Indicates if the children use the parent name
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setAttributes($attributes, &$parent, $elementCounter, $childrenWithParentName = FALSE) {
+               foreach ($attributes as $key => $value) {
+                       if ($key === 'name' && $value === '' && !$childrenWithParentName) {
+                               $value = $this->elementId;
+                       }
+                       if ($value != '' && $key != 'type') {
+                               $parent[$elementCounter . '.'][$key] = $value;
+                       }
+               }
+       }
+
+       /**
+        * Set the confirmation for the element FORM
+        *
+        * The confirmation indicates a confirmation screen has to be displayed
+        *
+        * @param boolean $confirmation TRUE when confirmation screen
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setConfirmation($confirmation, &$parent, $elementCounter) {
+               $parent[$elementCounter . '.']['confirmation'] = $confirmation;
+       }
+
+       /**
+        * Set the filters for the element
+        *
+        * @param array $filters The JSON array for the filters of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setFilters($filters, &$parent, $elementCounter) {
+               if (is_array($filters) && !empty($filters)) {
+                       $parent[$elementCounter . '.']['filters'] = array();
+                       $filterCounter = 1;
+                       foreach ($filters as $name => $filterConfiguration) {
+                               $parent[$elementCounter . '.']['filters'][$filterCounter] = $name;
+                               $parent[$elementCounter . '.']['filters'][$filterCounter . '.'] = $filterConfiguration;
+                               $filterCounter++;
+                       }
+               }
+       }
+
+       /**
+        * Set the label for the element
+        *
+        * @param array $label The JSON array for the label of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setLabel($label, &$parent, $elementCounter) {
+               if ($label['value'] != '') {
+                       $parent[$elementCounter . '.']['label.']['value'] = $label['value'];
+               }
+       }
+
+       /**
+        * Changes the layout of some elements when this has been set in the wizard
+        *
+        * The wizard only uses 'back' or 'front' to set the layout. The TypoScript
+        * of the form uses a XML notation for the position of the label to the
+        * field.
+        *
+        * @param array $element The JSON array for this element
+        * @param string $value The layout setting, back or front
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setLayout($element, $value, &$parent, $elementCounter) {
+               switch($element['xtype']) {
+                       case 'typo3-form-wizard-elements-basic-button':
+                       case 'typo3-form-wizard-elements-basic-captcha':
+                       case 'typo3-form-wizard-elements-basic-fileupload':
+                       case 'typo3-form-wizard-elements-basic-password':
+                       case 'typo3-form-wizard-elements-basic-reset':
+                       case 'typo3-form-wizard-elements-basic-submit':
+                       case 'typo3-form-wizard-elements-basic-textline':
+                               if ($value === 'back') {
+                                       $parent[$elementCounter . '.']['layout'] = '<input />' . chr(10) . '<label />';
+                               }
+                               break;
+                       case 'typo3-form-wizard-elements-basic-checkbox':
+                       case 'typo3-form-wizard-elements-basic-radio':
+                               if ($value === 'front') {
+                                       $parent[$elementCounter . '.']['layout'] = '<label />' . chr(10) . '<input />';
+                               }
+                               break;
+                       case 'typo3-form-wizard-elements-basic-select':
+                               if ($value === 'back') {
+                                       $parent[$elementCounter . '.']['layout'] = '<select>' . chr(10) .
+                                               '<elements />' . chr(10) . '</select>' . chr(10) . '<label />';
+                               }
+                               break;
+                       case 'typo3-form-wizard-elements-basic-textarea':
+                               if ($value === 'back') {
+                                       $parent[$elementCounter . '.']['layout'] = '<textarea />' . chr(10) . '<label />';
+                               }
+                               break;
+                       default:
+               }
+       }
+
+       /**
+        * Set the legend for the element
+        *
+        * @param array $legend The JSON array for the legend of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setLegend($legend, &$parent, $elementCounter) {
+               if ($legend['value'] != '') {
+                       $parent[$elementCounter . '.']['legend.']['value'] = $legend['value'];
+               }
+       }
+
+       /**
+        * Set the options for a SELECT
+        *
+        * Although other elements like CHECKBOXGROUP and RADIOGROUP are using the
+        * option setting as well, they act like containers and are handled
+        * differently
+        *
+        * @param array $element The JSON array for this element
+        * @param array $options The JSON array for the options of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setOptions($element, $options, &$parent, $elementCounter) {
+               if (is_array($options) && $element['xtype'] === 'typo3-form-wizard-elements-basic-select') {
+                       $optionCounter = 10;
+                       foreach ($options as $option) {
+                               $parent[$elementCounter . '.'][$optionCounter] = 'OPTION';
+                               $parent[$elementCounter . '.'][$optionCounter . '.']['data'] = $option['data'];
+                               if (isset($option['attributes'])) {
+                                       $parent[$elementCounter . '.'][$optionCounter . '.'] += $option['attributes'];
+                               }
+                               $optionCounter = $optionCounter + 10;
+                       }
+               }
+       }
+
+       /**
+        * Set the post processors for the element
+        *
+        * @param array $postProcessors The JSON array for the post processors of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setPostProcessor($postProcessors, &$parent, $elementCounter) {
+               if (is_array($postProcessors) && !empty($postProcessors)) {
+                       $parent[$elementCounter . '.']['postProcessor'] = array();
+                       $postProcessorCounter = 1;
+                       foreach ($postProcessors as $name => $postProcessorConfiguration) {
+                               $parent[$elementCounter . '.']['postProcessor'][$postProcessorCounter] = $name;
+                               $parent[$elementCounter . '.']['postProcessor'][$postProcessorCounter . '.'] = $postProcessorConfiguration;
+                               $postProcessorCounter++;
+                       }
+               }
+       }
+
+       /**
+        * Set the prefix for the element FORM
+        *
+        * The prefix will be used in the names of all elements in the form
+        *
+        * @param string $prefix The prefix for all element names
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setPrefix($prefix, &$parent, $elementCounter) {
+               $parent[$elementCounter . '.']['prefix'] = $prefix;
+       }
+
+       /**
+        * Stores the validation rules, set to the elements, in a temporary array
+        *
+        * In the wizard the validation rules are added to the element,
+        * in TypoScript they are added to the form.
+        *
+        * @param array $element The JSON array for this element
+        * @param array $validationRules The temporary storage array for the rules
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setValidationRules($element, $validationRules) {
+               if (is_array($validationRules)) {
+                       foreach ($validationRules as $name => $ruleConfiguration) {
+                               if (
+                                       isset($element['configuration']['attributes']['name']) &&
+                                       $element['configuration']['attributes']['name'] != ''
+                               ) {
+                                       $ruleConfiguration['element'] = $element['configuration']['attributes']['name'];
+                               } elseif (
+                                       isset($element['configuration']['various']['name']) &&
+                                       $element['configuration']['various']['name'] != ''
+                               ) {
+                                       $ruleConfiguration['element'] = $element['configuration']['various']['name'];
+                               } else {
+                                       $ruleConfiguration['element'] = $this->elementId;
+                               }
+
+                               $this->validationRules[$this->validationRulesCounter] = $name;
+                               $this->validationRules[$this->validationRulesCounter . '.'] = $ruleConfiguration;
+                               $this->validationRulesCounter++;
+                       }
+               }
+       }
+
+       /**
+        * Set the various configuration of an element
+        *
+        * @param array $element The JSON array for this element
+        * @param array $options The JSON array for the various options of this element
+        * @param array $parent The parent element
+        * @param integer $elementCounter The element counter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setVarious($element, $various, &$parent, $elementCounter) {
+               foreach ($various as $key => $value) {
+                       switch ($key) {
+                               case 'headingSize':
+                                       $parent[$elementCounter . '.']['wrap'] = str_replace(
+                                               '%headingSize%',
+                                               $value,
+                                               '<%headingSize%>|</%headingSize%>'
+                                       );
+                                       break;
+                               case 'heading':
+                                       $parent[$elementCounter . '.']['value'] = $value;
+                                       break;
+                               case 'name':
+                                       $parent[$elementCounter . '.']['name'] = $value;
+                                       break;
+                               default:
+                       }
+               }
+       }
+
+       /**
+        * Converts a TypoScript array to a formatted string
+        *
+        * Takes care of indentation, curly brackets and parentheses
+        *
+        * @param array $typoscriptArray The TypoScript array
+        * @param string $addKey Key which has underlying configuration
+        * @param integer $tabCount The amount of tabs for indentation
+        * @return string The formatted TypoScript string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function typoscriptArrayToString($typoscriptArray, $addKey = '', $tabCount = -1) {
+               $typoscript = '';
+
+               if ($addKey != '') {
+                       $typoscript .= str_repeat(chr(9), $tabCount) . str_replace('.', '', $addKey) . ' {' . chr(10);
+               }
+               $tabCount++;
+               foreach($typoscriptArray as $key => $value) {
+                       if (!is_array($value)) {
+                               if (strstr($value, chr(10))) {
+                                       $typoscript .= str_repeat(chr(9), $tabCount) . $key . ' (' . chr(10);
+                                       $value = str_replace(chr(10), chr(10) . str_repeat(chr(9), $tabCount + 1), $value);
+                                       $typoscript .= str_repeat(chr(9), $tabCount + 1) . $value . chr(10);
+                                       $typoscript .= str_repeat(chr(9), $tabCount) . ')' . chr(10);
+                               } else {
+                                       $typoscript .= str_repeat(chr(9), $tabCount) . $key . ' = ' . $value . chr(10);
+                               }
+                       }
+                       else {
+                               $typoscript .= $this->typoscriptArrayToString($value, $key, $tabCount);
+                       }
+               }
+
+               if ($addKey != '') {
+                       $tabCount--;
+                       $typoscript .= str_repeat(chr(9), $tabCount) . '}' . chr(10);
+               }
+
+               return $typoscript;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Factory/Typoscript.php b/typo3/sysext/form/Classes/Domain/Factory/Typoscript.php
new file mode 100644 (file)
index 0000000..d0793cf
--- /dev/null
@@ -0,0 +1,348 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Typoscript factory for form
+ *
+ * Takes the incoming Typoscipt and adds all the necessary form objects
+ * according to the configuration.
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_factory_typoscript implements t3lib_Singleton {
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor, fills the attributes
+        * and adds all form element objects
+        *
+        * @param array $arguments Typoscript configuration
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Build model from Typoscript
+        *
+        * @param array $typoscript Typoscript containing all configuration
+        * @return object The form object containing the child elements
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function buildModelFromTyposcript(array $typoscript) {
+               $this->setLayoutHandler($typoscript);
+
+               $form = $this->createElement('form', $typoscript);
+
+               return $form;
+       }
+
+       /**
+        * Rendering of a "numerical array" of Form objects from TypoScript
+        * Creates new object for each element found
+        *
+        * @param array $arguments Configuration array
+        * @throws Exception
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getChildElementsByIntegerKey(&$parentElement, $typoscript) {
+               if (is_array($typoscript)) {
+                       $keys = t3lib_TStemplate::sortedKeyList($typoscript);
+                       foreach ($keys as $key) {
+                               $class = $typoscript[$key];
+                               if (intval($key) && !strstr($key, '.')) {
+                                       if(isset($typoscript[$key . '.'])) {
+                                               $elementArguments = $typoscript[$key . '.'];
+                                       } else {
+                                               $elementArguments = array();
+                                       }
+                                       $this->setElementType($parentElement, $class, $elementArguments);
+                               }
+                       }
+               } else {
+                       throw new Exception ('Container element with id=' . $this->elementId . ' has no configuration which means no children');
+               }
+       }
+
+       /**
+        * Create and add element by type.
+        * This can be a derived Typoscript object by "<",
+        * a form element, or a regular Typoscript object.
+        *
+        * @param object $parentElement The parent for the new element
+        * @param string $class Classname for the element
+        * @param array $arguments Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setElementType(&$parentElement, $class, array $arguments) {
+               if (substr($class, 0, 1) == '<') {
+                       $key = trim(substr($class, 1));
+                       $typoscriptParser = t3lib_div::makeInstance('t3lib_TSparser');
+                       $oldArguments = $arguments;
+                       list($class, $arguments) = $typoscriptParser->getVal($key, $GLOBALS['TSFE']->tmpl->setup);
+                       if (is_array($oldArguments) && count($oldArguments)) {
+                               $arguments = $this->joinTSarrays($arguments, $oldArguments);
+                       }
+                       $GLOBALS['TT']->incStackPointer();
+                       $contentObject['cObj'] = $class;
+                       $contentObject['cObj.'] = $arguments;
+                       $this->addElement($parentElement, 'content', $contentObject);
+                       $GLOBALS['TT']->decStackPointer();
+               } elseif(in_array($class, $GLOBALS['OBJECTS_form'])) {
+                       try {
+                               $this->addElement($parentElement, $class, $arguments);
+                       } catch (Exception $exception) {
+                               throw $exception;
+                       }
+               } else {
+                       $contentObject['cObj'] = $class;
+                       $contentObject['cObj.'] = $arguments;
+                       $this->addElement($parentElement, 'content', $contentObject);
+               }
+       }
+
+       /**
+        * Add child object to this element
+        *
+        * @param string $class Type of element
+        * @param array $arguments Configuration array
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addElement(&$parentElement, $class, array $arguments = array()) {
+               $element = $this->createElement($class, $arguments);
+               $parentElement->addElement($element);
+       }
+
+       /**
+        * Create element by loading class
+        * and instantiating the object
+        *
+        * @param string $class Type of element
+        * @param array $arguments Configuration array
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function createElement($class, array $arguments = array()) {
+               $class = strtolower((string) $class);
+
+               if($class === 'form') {
+                       $className = 'tx_form_domain_model_' . $class;
+               } else {
+                       $className = 'tx_form_domain_model_element_' . $class;
+               }
+
+               $object = t3lib_div::makeInstance($className);
+
+               $this->setAttributes($object, $arguments);
+               $this->setAdditionals($object, $arguments);
+               $this->setFilters($object, $arguments['filters.']);
+
+               $object->setLayout($arguments['layout']);
+               $object->setValue($arguments['value']);
+               $object->setName($arguments['name']);
+
+               if($class === 'content') {
+                       $object->setData($arguments['cObj'], $arguments['cObj.']);
+               } else {
+                       $object->setData($arguments['data']);
+               }
+
+               $object->setMessagesFromValidation();
+               $object->setErrorsFromValidation();
+               $object->checkFilterAndSetIncomingDataFromRequest();
+
+               $this->getChildElementsByIntegerKey($object, $arguments);
+
+               return $object;
+       }
+
+       /**
+        * Set the attributes
+        *
+        * @param array $configuration Configuration
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAttributes(&$element, $arguments) {
+               if($element->hasAllowedAttributes()) {
+                       $attributes = $element->getAllowedAttributes();
+                       $mandatoryAttributes = $element->getMandatoryAttributes();
+                       foreach($attributes as $attribute => $value) {
+                               if(
+                                       isset($arguments[$attribute]) ||
+                                       isset($arguments[$attribute . '.']) ||
+                                       in_array($attribute, $mandatoryAttributes) ||
+                                       !empty($value)
+                               ) {
+                                       if(!empty($arguments[$attribute])) {
+                                               $value = $arguments[$attribute];
+                                       } elseif(!empty($arguments[$attribute . '.'])) {
+                                               $value = $arguments[$attribute . '.'];
+                                       }
+
+                                       try {
+                                               $element->setAttribute($attribute, $value);
+                                       } catch (Exception $exception) {
+                                               throw new Exception ('Cannot call user function for attribute ' . ucfirst($attribute));
+                                       }
+                               }
+                       }
+               } else {
+                       throw new Exception ('The element with id=' . $elementId . ' has no default attributes set');
+               }
+       }
+
+       /**
+        * Set the additionals from Element Typoscript configuration
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAdditionals(&$element, $arguments) {
+               if(!empty($arguments)) {
+                       if($element->hasAllowedAdditionals()) {
+                               $additionals = $element->getAllowedAdditionals();
+                               foreach($additionals as $additional) {
+                                       if(isset($arguments[$additional . '.']) || isset($arguments[$additional])) {
+                                               if(isset($arguments[$additional]) && isset($arguments[$additional . '.'])) {
+                                                       $value = $arguments[$additional . '.'];
+                                                       $type = $arguments[$additional];
+                                               } elseif(isset($arguments[$additional . '.'])) {
+                                                       $value = $arguments[$additional . '.'];
+                                                       $type = 'TEXT';
+                                               } else {
+                                                       $value['value'] = $arguments[$additional];
+                                                       $type = 'TEXT';
+                                               }
+
+                                               try {
+                                                       $element->setAdditional($additional, $type, $value);
+                                               } catch (Exception $exception) {
+                                                       throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
+                                               }
+                                       }
+                                       if(isset($arguments['layout.'][$additional]) && $element->additionalIsSet($additional)) {
+                                               $layout = $arguments['layout.'][$additional];
+                                               $element->setAdditionalLayout($additional, $layout);
+                                       }
+                               }
+                       } else {
+                               throw new Exception ('The element with id=' . $elementId . ' has no additionals set');
+                       }
+               }
+       }
+
+       /**
+        * Add the filters according to the settings in the Typoscript array
+        *
+        * @param array $arguments TypoScript
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setFilters(&$element, $arguments) {
+               if (is_array($arguments)) {
+                       $keys = t3lib_TStemplate::sortedKeyList($arguments);
+                       foreach ($keys as $key) {
+                               $class = $arguments[$key];
+                               if (intval($key) && !strstr($key, '.')) {
+                                       $filterArguments = $arguments[$key . '.'];
+                                       $filter = $element->makeFilter($class, $filterArguments);
+                                       $element->addFilter($filter);
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Set the layout handler
+        *
+        * @param array $typoscript TypoScript
+        * @return tx_form_system_layout The layout handler
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setLayoutHandler($typoscript) {
+               $layoutHandler = t3lib_div::makeInstance('tx_form_system_layout'); // singleton
+               $layoutHandler->setLayout($typoscript['layout.']);
+
+               return $layoutHandler;
+       }
+
+       /**
+        * Set the request handler
+        *
+        * @param array $typoscript TypoScript
+        * @return tx_form_system_request The request handler
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setRequestHandler($typoscript) {
+               $prefix = isset($typoscript['prefix']) ? $typoscript['prefix'] : '';
+               $method = isset($typoscript['method']) ? $typoscript['method'] : '';
+
+               /** @var $requestHandler tx_form_system_request */
+               $requestHandler = t3lib_div::makeInstance('tx_form_system_request'); // singleton
+               $requestHandler->setPrefix($prefix);
+               $requestHandler->setMethod($method);
+               $requestHandler->storeFiles();
+
+               return $requestHandler;
+       }
+
+       /**
+        * Set the validation rules
+        *
+        * Makes the validation object and adds rules to it
+        *
+        * @param array $typoscript TypoScript
+        * @return tx_form_system_validate The validation object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setRules($typoscript) {
+               $rulesTyposcript = isset($typoscript['rules.']) ? $typoscript['rules.'] : NULL;
+               $rulesClass = t3lib_div::makeInstance('tx_form_system_validate', $rulesTyposcript); // singleton
+
+               if (is_array($rulesTyposcript)) {
+                       $keys = t3lib_TStemplate::sortedKeyList($rulesTyposcript);
+                       foreach ($keys as $key) {
+                               $class = $rulesTyposcript[$key];
+                               if (intval($key) && !strstr($key, '.')) {
+                                       $elementArguments = $rulesTyposcript[$key . '.'];
+                                       $rule = $rulesClass->createRule($class, $elementArguments);
+                                       $rule->setFieldName($elementArguments['element']);
+                                       $breakOnError = isset($elementArguments['breakOnError']) ? $elementArguments['breakOnError'] : FALSE;
+                                       $rulesClass->addRule($rule, $elementArguments['element'], $breakOnError);
+                               }
+                       }
+               }
+
+               return $rulesClass;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Factory/TyposcriptToJson.php b/typo3/sysext/form/Classes/Domain/Factory/TyposcriptToJson.php
new file mode 100644 (file)
index 0000000..50429f6
--- /dev/null
@@ -0,0 +1,190 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2011 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Typoscript to JSON converter
+ *
+ * Takes the incoming Typoscript and converts it to Json
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_factory_typoscripttojson {
+       /**
+        * Constructor
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Convert TypoScript string to JSON
+        *
+        * @param string $typoscript TypoScript string containing all configuration for the form
+        * @return string The JSON for the form
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function convert($typoscript) {
+               $this->setValidationRules($typoscript);
+               $jsonObject = $this->createElement('form', $typoscript);
+
+               return $jsonObject;
+       }
+
+       /**
+        * Create element by loading class
+        * and instantiating the object
+        *
+        * @param string $class Type of element
+        * @param array $arguments Configuration array
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function createElement($class, array $arguments = array()) {
+               $class = strtolower((string) $class);
+               $className = 'tx_form_domain_model_json_' . $class;
+
+               $this->addValidationRules($arguments);
+
+               $object = t3lib_div::makeInstance($className);
+               $object->setParameters($arguments);
+
+               if ($object->childElementsAllowed()) {
+                       $this->getChildElementsByIntegerKey($object, $arguments);
+               }
+
+               return $object;
+       }
+
+       /**
+        * Rendering of a "numerical array" of Form objects from TypoScript
+        * Creates new object for each element found
+        *
+        * @param array $arguments Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function getChildElementsByIntegerKey(&$parentElement, $typoscript) {
+               if (is_array($typoscript)) {
+                       $keys = t3lib_TStemplate::sortedKeyList($typoscript);
+                       foreach ($keys as $key) {
+                               $class = $typoscript[$key];
+                               if (intval($key) && !strstr($key, '.')) {
+                                       if(isset($typoscript[$key . '.'])) {
+                                               $elementArguments = $typoscript[$key . '.'];
+                                       } else {
+                                               $elementArguments = array();
+                                       }
+                                       $this->setElementType($parentElement, $class, $elementArguments);
+                               }
+                       }
+               }
+       }
+
+       /**
+        * Set the element type of the object
+        *
+        * Checks if the typoscript object is part of the FORM or has a predefined
+        * class for name or header object
+        *
+        * @param object $parentElement The parent object
+        * @param string $class A predefined class
+        * @param array $arguments Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setElementType(&$parentElement, $class, array $arguments) {
+               if(in_array($class, $GLOBALS['OBJECTS_form'])) {
+                       if (strstr($arguments['class'], 'predefined-name')) {
+                               $class = 'NAME';
+                       }
+                       $this->addElement($parentElement, $class, $arguments);
+               } elseif (strstr($arguments['class'], 'content-header')) {
+                       $class = 'HEADER';
+                       $this->addElement($parentElement, $class, $arguments);
+               }
+       }
+
+       /**
+        * Add child object to this element
+        *
+        * @param object The parent object
+        * @param string $class Type of element
+        * @param array $arguments Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addElement(&$parentElement, $class, array $arguments) {
+               $element = $this->createElement($class, $arguments);
+               $parentElement->addElement($element);
+       }
+
+       /**
+        * Set the validation rules
+        *
+        * @param array $typoscript Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function setValidationRules($typoscript) {
+               if (isset($typoscript['rules.']) && is_array($typoscript['rules.'])) {
+                       $this->validationRules = $typoscript['rules.'];
+               }
+       }
+
+       /**
+        * Add validation rules to an element if available
+        *
+        * In TypoScript the validation rules belong to the form and are connected
+        * to the elements by name. However, in the wizard, they are added to the
+        * element for usability
+        *
+        * @param array $arguments The element arguments
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       private function addValidationRules(&$arguments) {
+               $validationRulesAvailable = FALSE;
+
+               if (!empty($this->validationRules) && isset($arguments['name'])) {
+                       foreach ($this->validationRules as $key => $ruleName) {
+                               if (intval($key) && !strstr($key, '.')) {
+                                       $ruleConfiguration = array();
+                                       if(isset($this->validationRules[$key . '.'])) {
+                                               $ruleConfiguration = $this->validationRules[$key . '.'];
+                                               if (isset($ruleConfiguration['element']) && $ruleConfiguration['element'] === $arguments['name']) {
+                                                       $arguments['validation'][$ruleName] = $ruleConfiguration;
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Abstract.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Abstract.php
new file mode 100644 (file)
index 0000000..7b465d9
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Abstract for additional
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+abstract class tx_form_domain_model_additional_abstract {
+
+       /**
+        * Additional value
+        *
+        * @var string
+        */
+       protected $value;
+
+       /**
+        * Additional type
+        *
+        * @var string
+        */
+       protected $type;
+
+       /**
+        * Additional layout
+        *
+        * @var string
+        */
+       protected $layout;
+
+       /**
+        * The content object
+        *
+        * @var tslib_cObj
+        */
+       protected $localCobj;
+
+       /**
+        * Constructor
+        *
+        * @param string $type Type of the object
+        * @param mixed $value Value of the object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($type, $value) {
+               $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
+               $this->value = $value;
+               $this->type = $type;
+       }
+
+       /**
+        * Get the layout string
+        *
+        * @return string XML string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getLayout() {
+               return $this->layout;
+       }
+
+       /**
+        * Set the layout
+        *
+        * @param string $layout XML string
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setLayout($layout) {
+               $this->layout = (string) $layout;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Additional.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Additional.php
new file mode 100644 (file)
index 0000000..71aaf1d
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Additional elements for FORM object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_additional_additional {
+
+       /**
+        * Array with the additional objects of the element
+        *
+        * @var array
+        */
+       private $additional = array();
+
+       /**
+        * Constructor
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Add an additional object to the additional array
+        *
+        * @param string $class Name of the additional
+        * @param mixed $value Typoscript configuration to construct value
+        * @param string $type Typoscript content object
+        * @return tx_form_domain_model_additional
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addAdditional($class, $type, $value) {
+               $class = strtolower((string) $class);
+               $className = 'tx_form_domain_model_additional_' . $class;
+
+               $this->additional[$class] = t3lib_div::makeInstance($className, $type, $value);
+
+               return $this;
+       }
+
+       /**
+        * Get the additional array of the object
+        *
+        * @return array Additionals of the object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAdditional() {
+               return $this->additional;
+       }
+
+       /**
+        * Get a specific additional object by using the key
+        *
+        * @param string $key Key of the additional
+        * @return string The additional object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAdditionalObjectByKey($key) {
+               return $this->additional[$key];
+       }
+
+       /**
+        * Check if an additional is set.
+        * Returns TRUE if set, FALSE if not set.
+        *
+        * @param string $key Name of the additional
+        * @return boolean
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function additionalIsSet($key) {
+               if (isset($this->additional[$key])) {
+                       return TRUE;
+               } else {
+                       return FALSE;
+               }
+       }
+
+       /**
+        * Set the layout for an additional
+        *
+        * @param string $key Key for the additional
+        * @param string $layout XML string
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setLayout($key, $layout) {
+               $this->additional[$key]->setLayout($layout);
+       }
+
+       /**
+        * Get a specific additional value by using the key
+        *
+        * @param string $key Key of the additional
+        * @return string The value of the additional
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue($key) {
+               return $this->additional[$key]->getValue();
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Error.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Error.php
new file mode 100644 (file)
index 0000000..c290e4d
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Additional 'error'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_additional_error extends tx_form_domain_model_additional_abstract implements tx_form_domain_model_additional_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $type Type of the object
+        * @param mixed $value Value of the object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($type, $value) {
+               parent::__construct($type, $value);
+       }
+
+       /**
+        * Return the value of the object
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $errors = array();
+
+               foreach($this->value as $error) {
+                       $errors[] = $this->localCobj->cObjGetSingle($this->type, $error);
+               }
+
+               $value = implode(' - ', $errors);
+
+               return $value;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Interface.php
new file mode 100644 (file)
index 0000000..af0c4e9
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Interface for additional
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+interface tx_form_domain_model_additional_interface {
+
+       /**
+        * Return the value of the object
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue();
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Label.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Label.php
new file mode 100644 (file)
index 0000000..141ebe4
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Additional 'label'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_additional_label extends tx_form_domain_model_additional_abstract implements tx_form_domain_model_additional_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($type, $value) {
+               parent::__construct($type, $value);
+       }
+
+       /**
+        * Return the value of the object
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = $this->localCobj->cObjGetSingle($this->type, $this->value);
+
+               return $value;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Legend.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Legend.php
new file mode 100644 (file)
index 0000000..18a6259
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Additional 'legend'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_additional_legend extends tx_form_domain_model_additional_abstract implements tx_form_domain_model_additional_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $type Type of the object
+        * @param mixed $value Value of the object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($type, $value) {
+               parent::__construct($type, $value);
+       }
+
+       /**
+        * Return the value of the object
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $additional = $this->localCobj->cObjGetSingle($this->type, $this->value);
+
+               return $additional;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Additional/Mandatory.php b/typo3/sysext/form/Classes/Domain/Model/Additional/Mandatory.php
new file mode 100644 (file)
index 0000000..e64029e
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Additional 'mandatory'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_additional_mandatory extends tx_form_domain_model_additional_abstract implements tx_form_domain_model_additional_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $type Type of the object
+        * @param mixed $value Value of the object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($type, $value) {
+               parent::__construct($type, $value);
+       }
+
+       /**
+        * Return the value of the object
+        *
+        * @return array
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $messages = array();
+
+               foreach($this->value as $message) {
+                       $messages[] = $this->localCobj->cObjGetSingle($this->type, $message);
+               }
+
+               $value = implode(' - ', $messages);
+
+               return $value;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Abstract.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Abstract.php
new file mode 100644 (file)
index 0000000..c1a65a5
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Abstract for attribute objects
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+abstract class tx_form_domain_model_attributes_abstract {
+
+       /**
+        * The value of the attribute
+        *
+        * @var array
+        */
+       protected $value;
+
+       /**
+        * Internal Id of the element
+        *
+        * @var integer
+        */
+       protected $elementId;
+
+       /**
+        * The content object
+        *
+        * @var tslib_cObj
+        */
+       protected $localCobj;
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
+               $this->value = $value;
+               $this->elementId = (integer) $elementId;
+       }
+
+       /**
+        * Set the value
+        *
+        * @param $value string The value to set
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setValue($value) {
+               $this->value = (string) $value;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Accept.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Accept.php
new file mode 100644 (file)
index 0000000..ce2ee23
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'accept'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_accept extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'accept'.
+        * Used with the elements 'form', 'input'
+        * Case Insensitive
+        *
+        * This attribute specifies a comma-separated list of content types
+        * that a server processing this form will handle correctly.
+        * User agents may use this information to filter out non-conforming files
+        * when prompting a user to select files to be sent to the server (cf. the INPUT element when type="file").
+        * RFC2045: For a complete list, see http://www.iana.org/assignments/media-types/
+        *
+        * TODO: Perhaps we once can add a list of all content-types to TYPO3
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Acceptcharset.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Acceptcharset.php
new file mode 100644 (file)
index 0000000..50f1226
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'acceptcharset'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_acceptcharset extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'accept-charset'.
+        * Used with the element 'form'
+        * Case Insensitive
+        *
+        * This attribute specifies the list of character encodings for input data
+        * that is accepted by the server processing this form.
+        * The value is a space- and/or comma-delimited list of charset values.
+        * The client must interpret this list as an exclusive-or list, i.e.,
+        * the server is able to accept any single character encoding per entity received.
+        *
+        * The default value for this attribute is the reserved string "UNKNOWN".
+        * User agents may interpret this value as the character encoding that was
+        * used to transmit the document containing this FORM element.
+        *
+        * RFC2045: For a complete list, see http://www.iana.org/assignments/character-sets/
+        *
+        * TODO: Perhaps we once can add a list of all character-sets to TYPO3
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Accesskey.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Accesskey.php
new file mode 100644 (file)
index 0000000..c2826cf
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'accesskey'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_accesskey extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'accesskey'.
+        * Used with the element 'button, input, label, legend, textarea'
+        * Not subject to case changes
+        *
+        * This attribute assigns an access key to an element.
+        * An access key is a single character from the document character set.
+        * Note. Authors should consider the input method of the expected reader
+        * when specifying an accesskey.
+        *
+        * Pressing an access key assigned to an element gives focus to the element.
+        * The action that occurs when an element receives focus depends on the element.
+        * For example, when a user activates a link defined by the A element,
+        * the user agent generally follows the link. When a user activates a radio
+        * button, the user agent changes the value of the radio button.
+        * When the user activates a text field, it allows input, etc.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Action.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Action.php
new file mode 100644 (file)
index 0000000..d3c50fb
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'action'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_action extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'action'
+        * Used with the element 'form'
+        * Lower case
+        *
+        * This attribute specifies a form processing agent.
+        * User agent behavior for a value other than an HTTP URI is undefined.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = $this->value;
+
+               if(empty($value)) {
+                       $value = $GLOBALS['TSFE']->id;
+               }
+
+               $attribute = $this->localCobj->getTypoLink_URL($value);
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Alt.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Alt.php
new file mode 100644 (file)
index 0000000..0124ed2
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'alt'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_alt extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'alt'
+        * Used with the element 'input'
+        * Case sensitive
+        *
+        * For user agents that cannot display images, forms, or applets,
+        * this attribute specifies alternate text. The language of the alternate
+        * text is specified by the lang attribute.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Attributes.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Attributes.php
new file mode 100644 (file)
index 0000000..3d98089
--- /dev/null
@@ -0,0 +1,173 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute class for the form elements
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_attributes {
+
+       /**
+        * The attributes of the element
+        *
+        * @var array
+        */
+       private $attributes = array();
+
+       /**
+        * Internal Id of the element
+        *
+        * @var integer
+        */
+       protected $elementId;
+
+       /**
+        * The content object
+        *
+        * @var tslib_cObj
+        */
+       protected $localCobj;
+
+       /**
+        * Constructor
+        *
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($elementId) {
+               $this->elementId = (integer) $elementId;
+               $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
+               $this->localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+               $this->requestHandler = t3lib_div::makeInstance('tx_form_system_request');
+       }
+
+       /**
+        * Add an attribute object to the attribute array
+        *
+        * @param string $class Name of the attribute
+        * @param mixed $value Typoscript configuration to construct value
+        * @return tx_form_domain_model_attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addAttribute($class, $value) {
+               $class = strtolower((string) $class);
+               $className = 'tx_form_domain_model_attributes_' . $class;
+
+               $this->attributes[$class] = t3lib_div::makeInstance($className, $value, $this->elementId);
+
+               return $this;
+       }
+
+       /**
+        * Remove an attribute object from the attribute array
+        *
+        * @param string $class Name of the attribute
+        * @return tx_form_domain_model_attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function removeAttribute($class) {
+               unset($this->attributes[$class]);
+
+               return $this;
+       }
+
+       /**
+        * Get the attributes of the object
+        *
+        * @return array Attributes objects
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAttributes() {
+               return $this->attributes;
+       }
+
+       /**
+        * Get a specific attribute object by using the key
+        *
+        * @param string $key Key of the attribute
+        * @return string The attribute object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAttributeObjectByKey($key) {
+               return $this->attributes[$key];
+       }
+
+       /**
+        * Add an attribute object to the attribute array
+        *
+        * @param string $key The name of the attribute
+        * @param object $attributeObject The attribute object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAttribute($key, $attributeObject) {
+               $this->attributes[$key] = (object) $attributeObject;
+       }
+
+       /**
+        * Returns TRUE if attribute is set
+        *
+        * @param string $key The name of the attribute
+        * @return boolean
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function hasAttribute($key) {
+               if(isset($this->attributes[$key])) {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * Set the value of a specific attribute object
+        *
+        * @param $key string Name of the object
+        * @param $value string The value
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setValue($key, $value) {
+               $this->attributes[$key]->setValue($value);
+       }
+
+       /**
+        * Get a specific attribute value by using the key
+        *
+        * @param string $key Key of the attribute
+        * @return string The content of the attribute
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue($key) {
+               if($this->attributes[$key]) {
+                       return $this->attributes[$key]->getValue();
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Checked.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Checked.php
new file mode 100644 (file)
index 0000000..80f7b29
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'checked'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_checked extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'checked'
+        * Used with the element 'input' only if type attribute has the value
+        * 'radio, checkbox'
+        * Case insensitive
+        *
+        * When the type attribute has the value "radio" or "checkbox",
+        * this boolean attribute specifies that the button is on.
+        * User agents must ignore this attribute for other control types.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               if((integer) $this->value === 1
+                       || (boolean) $this->value === TRUE
+                       || strtolower((string) $this->value === 'checked'))
+               {
+                       $attribute = 'checked';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Class.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Class.php
new file mode 100644 (file)
index 0000000..23976e5
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'class'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_class extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'class'.
+        * Used with all elements
+        * Case Sensitive
+        *
+        * This attribute assigns a class name or set of class names to an element.
+        * Any number of elements may be assigned the same class name or names.
+        * Multiple class names must be separated by white space characters.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Cols.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Cols.php
new file mode 100644 (file)
index 0000000..9422f5b
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'cols'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_cols extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'cols'.
+        * Used with the element 'textarea'
+        * Not subject to case changes, because it's an integer
+        *
+        * This attribute specifies the visible width in average character widths.
+        * Users should be able to enter longer lines than this,
+        * so user agents should provide some means to scroll through the contents
+        * of the control when the contents extend beyond the visible area.
+        * User agents may wrap visible text lines to keep long lines visible
+        * without the need for scrolling.
+        *
+        * @return integer Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = (integer) $this->value;
+               if($value <= 0) {
+                       $attribute = 40;
+               } else {
+                       $attribute = $value;
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Dir.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Dir.php
new file mode 100644 (file)
index 0000000..b0d4182
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'dir'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_dir extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'dir'.
+        * Used with all elements
+        * Case Insensitive
+        *
+        * This attribute specifies the base direction of directionally neutral text
+        * (i.e., text that doesn't have inherent directionality as defined in
+        * [UNICODE]) in an element's content and attribute values.
+        * It also specifies the directionality of tables. Possible values:
+        *
+        * LTR: Left-to-right text or table.
+        * RTL: Right-to-left text or table.
+        *
+        * In addition to specifying the language of a document with the lang
+        * attribute, authors may need to specify the base directionality
+        * (left-to-right or right-to-left) of portions of a document's text,
+        * of table structure, etc. This is done with the dir attribute.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = strtolower((string) $this->value);
+               if($value == 'ltr' || $value == 'rtl') {
+                       $attribute = $value;
+               }
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Disabled.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Disabled.php
new file mode 100644 (file)
index 0000000..421164e
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'disabled'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_disabled extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'disabled'.
+        * Used with the elements button, input, optgroup, option, select & textarea
+        * Case Insensitive
+        *
+        * When set for a form control, this boolean attribute disables the control
+        * for user input.
+        *
+        * When set, the disabled attribute has the following effects on an element:
+        * Disabled controls do not receive focus.
+        * Disabled controls are skipped in tabbing navigation.
+        * Disabled controls cannot be successful.
+        *
+        * This attribute is inherited but local declarations override the inherited value.
+        *
+        * How disabled elements are rendered depends on the user agent.
+        * For example, some user agents "gray out" disabled menu items,
+        * button labels, etc.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               if((integer) $this->value === 1
+                       || (boolean) $this->value === TRUE
+                       || strtolower((string) $this->value) === 'disabled')
+               {
+                       $attribute = 'disabled';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Enctype.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Enctype.php
new file mode 100644 (file)
index 0000000..fe93a86
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'enctype'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_enctype extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'enctype'.
+        * Used with the element 'form'
+        * Case Insensitive
+        *
+        * This attribute specifies the content type used to submit the form to the
+        * server (when the value of method is "post"). The default value for this
+        * attribute is "application/x-www-form-urlencoded".
+        * The value "multipart/form-data" should be used in combination with the
+        * INPUT element, type="file".
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = strtolower((string) $this->value);
+               if($value == 'multipart/form-data' || $value == 'application/x-www-form-urlencoded') {
+                       $attribute = $value;
+               } elseif (!empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'])) {
+                       $attribute = $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'];
+               }
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Id.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Id.php
new file mode 100644 (file)
index 0000000..601e1cc
--- /dev/null
@@ -0,0 +1,86 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'id'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_id extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'id'.
+        * Used with all elements
+        * Case Sensitive
+        *
+        * This attribute assigns an id to an element.
+        * This id must be unique in a document.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = (string) $this->value;
+
+               if($this->elementClassName === 'tx_form_domain_model_form') {
+                       if(empty($value)) {
+                               $value = 'form-' . $GLOBALS['TSFE']->id;
+                       }
+               } elseif(empty($value)) {
+                       $value = $this->elementId;
+                       if(is_integer($value)) {
+                               $value = 'field-' . $value;
+                       }
+               }
+
+                       // Change spaces into hyphens
+               $attribute = preg_replace('/\s/' , '-', $value);
+
+                       // Change first non-letter to field-
+               if(preg_match('/^([^a-zA-Z]{1})/', $attribute)) {
+                       $attribute = 'field-' . $attribute;
+               }
+                       // Remove non-word characters
+               $attribute = preg_replace('/([^a-zA-Z0-9_:\-\.]*)/', '', $attribute);
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Interface.php
new file mode 100644 (file)
index 0000000..ed5fa4e
--- /dev/null
@@ -0,0 +1,44 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Interface for attributes
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+interface tx_form_domain_model_attributes_interface {
+
+       /**
+        * Return attribute value, probably run through filter
+        *
+        * @return mixed
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue();
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Label.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Label.php
new file mode 100644 (file)
index 0000000..dff0448
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'label'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_label extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Defines the label usage of the linked document.
+        * Used with optgroup and option
+        * Case Sensitive
+        *
+        * This attribute allows authors to specify a shorter label for an option
+        * than the content of the OPTION element. When specified, user agents
+        * should use the value of this attribute
+        * rather than the content of the OPTION element as the option label.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Lang.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Lang.php
new file mode 100644 (file)
index 0000000..79f630c
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'lang'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_lang extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'lang'.
+        * Used with all elements
+        * Case Insensitive
+        *
+        * This attribute specifies the base language of an element's attribute
+        * values and text content. The default value of this attribute is unknown.
+        *
+        * Briefly, language codes consist of a primary code
+        * and a possibly empty series of subcodes:
+        *
+        * language-code = primary-code ( "-" subcode )
+        *
+        * Here are some sample language codes:
+        * "en": English
+        * "en-US": the U.S. version of English.
+        * "en-cockney": the Cockney version of English.
+        * "i-navajo": the Navajo language spoken by some Native Americans.
+        * "x-klingon": The primary tag "x" indicates an experimental language tag
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Maxlength.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Maxlength.php
new file mode 100644 (file)
index 0000000..0cad52a
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'maxlength'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_maxlength extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'maxlength'.
+        * Used with element 'input'
+        * Not subject to case changes, because it's an integer
+        *
+        * When the type attribute has the value "text" or "password",
+        * this attribute specifies the maximum number of characters
+        * the user may enter. This number may exceed the specified size,
+        * in which case the user agent should offer a scrolling mechanism.
+        * The default value for this attribute is an unlimited number.
+        *
+        * @return integer Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = (integer) $this->value;
+
+               if($value <= 0) {
+                       $attribute = 40;
+               } else {
+                       $attribute = $value;
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Method.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Method.php
new file mode 100644 (file)
index 0000000..227438b
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'method'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_method extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'method'.
+        * Used with element 'form'
+        * Case Insensitive
+        *
+        * This attribute specifies which HTTP method will be used
+        * to submit the form data set.
+        * Possible (case-insensitive) values are "get" (the default) and "post".
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = strtolower((string) $this->value);
+
+               if($value == 'post' || $value == 'get') {
+                       $attribute = $value;
+               } else {
+                       $attribute = 'post';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Multiple.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Multiple.php
new file mode 100644 (file)
index 0000000..189a30e
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'multiple'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_multiple extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'multiple'.
+        * Used with element 'select'
+        * Case Insensitive
+        *
+        * If set, this boolean attribute allows multiple selections.
+        * If not set, the SELECT element only permits single selections.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               if((integer) $this->value === 1
+                       || (boolean) $this->value === TRUE
+                       || strtolower((string) $this->value) === 'multiple')
+               {
+                       $attribute = 'multiple';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Name.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Name.php
new file mode 100644 (file)
index 0000000..9b329f5
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'name'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_name extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Addition to the name value
+        *
+        * @var string
+        */
+       protected $addition;
+
+       /**
+        * TRUE if value is expected without prefix
+        *
+        * @var boolean
+        */
+       private $returnValueWithoutPrefix = FALSE;
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Return the name attribute without the prefix
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValueWithoutPrefix() {
+               $value = (string) $this->value;
+
+                       // Change spaces into hyphens
+               $value = preg_replace('/\s/' , '-', $value);
+
+                       // Remove non-word characters
+               $value = preg_replace('/[^a-zA-Z0-9_\-]+/', '', $value);
+
+               if(empty($value)) {
+                       $value = $this->elementId;
+               }
+
+               return $value;
+       }
+
+       /**
+        * Sets the attribute 'name'.
+        * Used with all elements
+        * Case Insensitive
+        *
+        * This attribute names the element so that it may be referred to
+        * from style sheets or scripts.
+        *
+        * Note: This attribute has been included for backwards compatibility.
+        * Applications should use the id attribute to identify elements.
+        * This does not apply for form objects, only the form tag
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = $this->getValueWithoutPrefix();
+
+               if($this->returnValueWithoutPrefix === FALSE) {
+                       $requestHandler = t3lib_div::makeInstance('tx_form_system_request');
+                       $attribute = $requestHandler->getPrefix() . '[' . $value . ']' . $this->addition;
+               } else {
+                       $attribute = $value;
+               }
+
+               return $attribute;
+       }
+
+       /**
+        * Sets an additional string which will be added to the name
+        * This is necessarry in some cases like a multiple select box
+        *
+        * @param string $addition The additional string
+        * @return tx_form_domain_model_attributes_name
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAddition($addition) {
+               $this->addition = (string) $addition;
+
+               return $this;
+       }
+
+       /**
+        * TRUE if element is not allowed to use a prefix
+        * This is the case with the <form> tag
+        *
+        * @param boolean $parameter
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setReturnValueWithoutPrefix($parameter) {
+               $this->returnValueWithoutPrefix = (boolean) $parameter;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Readonly.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Readonly.php
new file mode 100644 (file)
index 0000000..86478f1
--- /dev/null
@@ -0,0 +1,79 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'readonly'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_readonly extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'readonly'.
+        * Used with the elements input and textarea
+        * Case Insensitive
+        *
+        * When set for a form control, this boolean attribute prohibits changes
+        * to the control.
+        *
+        * The readonly attribute specifies whether the control may be modified by the user.
+        *
+        * When set, the readonly attribute has the following effects on an element:
+        * Read-only elements receive focus but cannot be modified by the user.
+        * Read-only elements are included in tabbing navigation.
+        * Read-only elements may be successful.
+        *
+        * How read-only elements are rendered depends on the user agent.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               if((integer) $this->value === 1
+                       || (boolean) $this->value === TRUE
+                       || strtolower((string) $this->value) === 'readonly')
+               {
+                       $attribute = 'readonly';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Rows.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Rows.php
new file mode 100644 (file)
index 0000000..2135eea
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'rows'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_rows extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'rows'.
+        * Used with the element 'textarea'
+        * Not subject to case changes, because it's an integer
+        *
+        * This attribute specifies the number of visible text lines.
+        * Users should be able to enter more lines than this,
+        * so user agents should provide some means to scroll
+        * through the contents of the control when the contents extend
+        * beyond the visible area.
+        *
+        * @return integer Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = (integer) $this->value;
+
+               if($value <= 0) {
+                       $attribute = 80;
+               } else {
+                       $attribute = $value;
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Selected.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Selected.php
new file mode 100644 (file)
index 0000000..61951bb
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'selected'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_selected extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'selected'
+        * Used with the element 'option'
+        * Case insensitive
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               if((integer) $this->value === 1
+                       || (boolean) $this->value === TRUE
+                       || strtolower((string) $this->value) === 'selected')
+               {
+                       $attribute = 'selected';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Size.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Size.php
new file mode 100644 (file)
index 0000000..f655b09
--- /dev/null
@@ -0,0 +1,73 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'size'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_size extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'size'.
+        * Used with the element 'input'
+        * Not subject to case changes, because it's an integer
+        *
+        * This attribute tells the user agent the initial width of the control.
+        * The width is given in pixels except when type attribute
+        * has the value "text" or "password".
+        * In that case, its value refers to the (integer) number of characters.
+        *
+        * @return integer Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $value = (integer) $this->value;
+
+               if($value <= 0) {
+                       $attribute = 40;
+               } else {
+                       $attribute = $value;
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Src.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Src.php
new file mode 100644 (file)
index 0000000..2d8838b
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'src'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_src extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'src'.
+        * Used with the element 'input'
+        * URI type definition
+        *
+        * When the type attribute has the value "image", this attribute
+        * specifies the location of the image to be used to decorate the
+        * graphical submit button.
+        *
+        * @return string Attribute value
+        * @see tslib_cObj::getImgResource()
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = $this->localCobj->IMG_RESOURCE($this->value);
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Style.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Style.php
new file mode 100644 (file)
index 0000000..7b86673
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'style'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_style extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'style'.
+        * Used with all elements
+        * Not subject to case changes
+        *
+        * This attribute specifies style information for the current element.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Tabindex.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Tabindex.php
new file mode 100644 (file)
index 0000000..0c5dbb7
--- /dev/null
@@ -0,0 +1,96 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'tabindex'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_tabindex extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'tabindex'.
+        * Used with the elements button, input, select and textarea
+        * Not subject to case changes
+        *
+        * This attribute specifies the position of the current element in the
+        * tabbing order for the current document. This value must be a number
+        * between 0 and 32767. User agents should ignore leading zeros.
+        *
+        * The tabbing order defines the order in which elements will receive focus
+        * when navigated by the user via the keyboard. The tabbing order may
+        * include elements nested within other elements.
+        *
+        * Elements that may receive focus should be navigated by user agents
+        * according to the following rules:
+        * 1. Those elements that support the tabindex attribute and assign a
+        *    positive value to it are navigated first. Navigation proceeds from the
+        *    element with the lowest tabindex value to the element with the highest
+        *    value. Values need not be sequential nor must they begin with any
+        *    particular value. Elements that have identical tabindex values should
+        *    be navigated in the order they appear in the character stream.
+        * 2. Those elements that do not support the tabindex attribute or support
+        *    it and assign it a value of "0" are navigated next. These elements are
+        *    navigated in the order they appear in the character stream.
+        * 3. Elements that are disabled do not participate in the tabbing order.
+        *
+        * The actual key sequence that causes tabbing navigation or element
+        * activation depends on the configuration of the user agent
+        * (e.g., the "tab" key is used for navigation and the "enter" key is used
+        * to activate a selected element)
+        *
+        * User agents may also define key sequences to navigate the tabbing order
+        * in reverse. When the end (or beginning) of the tabbing order is reached,
+        * user agents may circle back to the beginning (or end).
+        *
+        * @return integer Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (integer) $this->value;
+
+               if($attribute < 0 || $attribute > 32767) {
+                       $attribute = 0;
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Title.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Title.php
new file mode 100644 (file)
index 0000000..c6a8625
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'title'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_title extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'title'.
+        * Used with all elements
+        * Case Sensitive
+        *
+        * This attribute offers advisory information about the element for which it is set.
+        * Unlike the TITLE element, which provides information about an entire
+        * document and may only appear once, the title attribute may annotate any
+        * number of elements. Please consult an element's definition to verify that
+        * it supports this attribute.
+        *
+        * Values of the title attribute may be rendered by user agents in a variety
+        * of ways. For instance, visual browsers frequently display the title as a
+        * "tool tip" (a short message that appears when the pointing device pauses
+        * over an object). Audio user agents may speak the title information in a
+        * similar context.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Type.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Type.php
new file mode 100644 (file)
index 0000000..38d6f89
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'type'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_type extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       private $allowedValues = array(
+               'text',
+               'password',
+               'checkbox',
+               'radio',
+               'submit',
+               'reset',
+               'file',
+               'hidden',
+               'image',
+               'button'
+       );
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'type'.
+        * Used with all input elements
+        * Case Insensitive
+        *
+        * Defines the type of form input control to create.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = strtolower((string) $this->value);
+
+               if(empty($attribute) || !in_array($attribute, $this->allowedValues)) {
+                       $attribute = 'text';
+               }
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Attributes/Value.php b/typo3/sysext/form/Classes/Domain/Model/Attributes/Value.php
new file mode 100644 (file)
index 0000000..6d5a058
--- /dev/null
@@ -0,0 +1,72 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Attribute 'value'
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_attributes_value extends tx_form_domain_model_attributes_abstract implements tx_form_domain_model_attributes_interface {
+
+       /**
+        * Constructor
+        *
+        * @param string $value Attribute value
+        * @param integer $elementId The ID of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct($value, $elementId) {
+               parent::__construct($value, $elementId);
+       }
+
+       /**
+        * Sets the attribute 'value'.
+        * Used with the elements input, option, button
+        * The element or attribute definition itself gives case information.
+        *
+        * button: This attribute assigns the initial value to the button.
+        *
+        * input: This attribute specifies the initial value of the control. It is
+        * optional except when the type attribute has the value
+        * "radio" or "checkbox".
+        *
+        * option: This attribute specifies the initial value of the control.
+        * If this attribute is not set, the initial value is set to the contents
+        * of the OPTION element.
+        *
+        * @return string Attribute value
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               $attribute = (string) $this->value;
+
+               return $attribute;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Content.php b/typo3/sysext/form/Classes/Domain/Model/Content.php
new file mode 100644 (file)
index 0000000..c406c02
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2010 Patrick Broens <patrick@patrickbroens.nl>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Content domain model
+ *
+ * @category Model
+ * @package TYPO3
+ * @subpackage form
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @license http://www.gnu.org/copyleft/gpl.html
+ * @version $Id$
+ */
+class tx_form_domain_model_content {
+
+       /**
+        * The uid
+        *
+        * @var integer
+        */
+       private $uid = 0;
+
+       /**
+        * The page id
+        *
+        * @var integer
+        */
+       private $pageId = 0;
+
+       /**
+        * The configuration Typoscript
+        *
+        * @var array
+        */
+       private $typoscript = array();
+
+       /**
+        * Constructor
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+       }
+
+       /**
+        * Sets the uid
+        *
+        * @param integer $uid The uid
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setUid($uid) {
+               $this->uid = (integer) $uid;
+       }
+
+       /**
+        * Returns the uid
+        *
+        * @return integer The uid
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getUid() {
+               return $this->uid;
+       }
+
+       /**
+        * Sets the page id
+        *
+        * @param integer $pageId The page id
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setPageId($pageId) {
+               $this->pageId = (integer) $pageId;
+       }
+
+       /**
+        * Returns the page id
+        *
+        * @return integer The page id
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getPageId() {
+               return $this->pageId;
+       }
+
+       /**
+        * Sets the Typoscript configuration
+        *
+        * @param array $typoscript The Typoscript configuration
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setTyposcript(array $typoscript) {
+               $this->typoscript = (array) $typoscript;
+       }
+
+       /**
+        * Returns the Typoscript configuration
+        *
+        * @return array The Typoscript configuration
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getTyposcript() {
+               return $this->typoscript;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Abstract.php b/typo3/sysext/form/Classes/Domain/Model/Element/Abstract.php
new file mode 100644 (file)
index 0000000..036da29
--- /dev/null
@@ -0,0 +1,528 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Abstract for the form elements
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+abstract class tx_form_domain_model_element_abstract {
+
+       /**
+        * Internal Id of the element
+        *
+        * @var integer
+        */
+       protected $elementId;
+
+       /**
+        * The name of the element
+        *
+        * @var string
+        */
+       protected $name;
+
+       /**
+        * True if it accepts the parent name instead of its own
+        * This is necessary for groups
+        *
+        * @var boolean
+        */
+       protected $acceptsParentName = FALSE;
+
+       /**
+        * Attribute object
+        *
+        * @var tx_form_domain_model_attributes
+        */
+       protected $attributes;
+
+       /**
+        * Additional object
+        *
+        * @var tx_form_domain_model_additional
+        */
+       protected $additional;
+
+       /**
+        * Layout override for the element
+        *
+        * @var string
+        */
+       protected $layout;
+
+       /**
+        * Value of the element
+        *
+        * @var mixed
+        */
+       protected $value;
+
+       /**
+        * Content of the element when no singleton tag
+        * <option>, <textarea>
+        *
+        * @var mixed
+        */
+       protected $data;
+
+       /**
+        * Allowed additionals for elements
+        *
+        * @var array
+        */
+       protected $allowedAdditional = array(
+               'label',
+               'legend'
+       );
+
+       /**
+        * Mandatory attributes for elements
+        *
+        * @var array
+        */
+       protected $mandatoryAttributes = array();
+
+       /**
+        * The content object
+        *
+        * @var tslib_cObj
+        */
+       protected $localCobj;
+
+       /**
+        * Constructor
+        *
+        * @param integer $elementId Internal Id of the element
+        * @param array $arguments Configuration array
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               $this->localCobj = t3lib_div::makeInstance('tslib_cObj');
+               $this->requestHandler = t3lib_div::makeInstance('tx_form_system_request');
+               $this->validateClass = t3lib_div::makeInstance('tx_form_system_validate');
+               $this->elementCounter = t3lib_div::makeInstance('tx_form_system_elementcounter');
+               $this->setElementId();
+               $this->createAttributes();
+               $this->createAdditional();
+               $this->createFilter();
+       }
+
+       /**
+        * Set the internal ID of the element
+        *
+        * @param integer $elementId Internal Id of the element
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setElementId() {
+               $this->elementId = $this->elementCounter->getElementId();
+       }
+
+       /**
+        * Get the internal ID for the id attribute
+        * of the outer tag of an element like <li>
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getElementId() {
+               return $this->elementId;
+       }
+
+       /**
+        * Set the name for the element
+        *
+        * @param string $name The name
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setName($name = '') {
+               if ($name != '') {
+                       $this->name = (string) $name;
+               } else {
+                       $this->name = 'id-' . $this->getElementId();
+               }
+       }
+
+       /**
+        * Get the name of the element
+        *
+        * @return string
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getName() {
+               return $this->name;
+       }
+
+       /**
+        * Check to see if this element accepts the parent name instead of its own
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function acceptsParentName() {
+               return $this->acceptsParentName;
+       }
+
+       /**
+        * Set a specific attribute by name and value
+        *
+        * @param string $attribute Name of the attribute
+        * @param mixed $value Value of the attribute
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAttribute($attribute, $value) {
+               if(array_key_exists($attribute, $this->allowedAttributes)) {
+                       $this->attributes->addAttribute($attribute, $value);
+               }
+
+               return $this;
+       }
+
+       /**
+        * Get the allowed attributes for an element
+        *
+        * @return array The allowed attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAllowedAttributes() {
+               return $this->allowedAttributes;
+       }
+
+       /**
+        * Get the mandatory attributes for an element
+        *
+        * @return array The mandatory attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getMandatoryAttributes() {
+               return $this->mandatoryAttributes;
+       }
+
+       /**
+        * Check if element has attributes which are allowed
+        *
+        * @return boolean TRUE if there is a list of allowed attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function hasAllowedAttributes() {
+               if(isset($this->allowedAttributes)) {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * Check if element has additionals which are allowed
+        *
+        * @return boolean TRUE if there is a list of allowed additionals
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function hasAllowedAdditionals() {
+               if(isset($this->allowedAdditional)) {
+                       return TRUE;
+               }
+               return FALSE;
+       }
+
+       /**
+        * Get the allowed additionals for an element
+        *
+        * @return array The allowed additionals
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAllowedAdditionals() {
+               return $this->allowedAdditional;
+       }
+
+       /**
+        * Get the array with all attribute objects for the element
+        *
+        * @return array
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAttributes() {
+               return $this->attributes->getAttributes();
+       }
+
+       /**
+        * Returns TRUE if attribute is set
+        *
+        * @param string $key The name of the attribute
+        * @return boolean
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function hasAttribute($key) {
+               return $this->attributes->hasAttribute($key);
+       }
+
+       /**
+        * Get the value of a specific attribute by key
+        *
+        * @param string $key Name of the attribute
+        * @return mixed
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAttributeValue($key) {
+               return $this->attributes->getValue($key);
+       }
+
+       /**
+        * Get the array with all additional objects for the element
+        *
+        * @return array
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAdditional() {
+               return $this->additional->getAdditional();
+       }
+
+       /**
+        * Get a specific additional object by using the key
+        *
+        * @param string $key Key of the additional
+        * @return string The additional object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAdditionalObjectByKey($key) {
+               return $this->additional->getAdditionalObjectByKey($key);
+       }
+
+       /**
+        * Get the value of a specific additional by key
+        *
+        * @param string $key Name of the additional
+        * @return mixed
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAdditionalValue($key) {
+               return $this->additional->getValue($key);
+       }
+
+       /**
+        * Load the attributes object
+        *
+        * @return tx_form_domain_model_attributes
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function createAttributes() {
+               $className = 'tx_form_domain_model_attributes_attributes';
+
+               $this->attributes = t3lib_div::makeInstance($className, $this->elementId);
+       }
+
+       /**
+        * Set the layout override for the element
+        *
+        * @param string $layout The layout
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setLayout($layout = '') {
+               $this->layout = (string) $layout;
+       }
+
+       /**
+        * Get the layout for an element
+        *
+        * @return string XML for layout
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getLayout() {
+               return $this->layout;
+       }
+
+       /**
+        * Set the value for the element
+        *
+        * @param string $value The value
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setValue($value = '') {
+               $this->value = (string) $value;
+       }
+
+       /**
+        * Get the value for the element
+        *
+        * @return mixed
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getValue() {
+               return $this->value;
+       }
+
+       /**
+        * Set the content for the element
+        *
+        * @param string $data The content
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setData($data = '') {
+               $this->data = (string) $data;
+       }
+
+       /**
+        * Set the additionals from validation rules
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setMessagesFromValidation() {
+               if($this->validateClass->hasMessage($this->getName())) {
+                       $messages = $this->validateClass->getMessagesByName($this->getName());
+
+                       try {
+                               $this->setAdditional('mandatory', 'COA', $messages);
+                       } catch (Exception $exception) {
+                               throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
+                       }
+               }
+       }
+
+       /**
+        * Set the additional error from validation rules
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setErrorsFromValidation() {
+               if($this->validateClass->hasErrors($this->getName())) {
+                       $errors = $this->validateClass->getErrorsByName($this->getName());
+
+                       try {
+                               $this->setAdditional('error', 'COA', $errors);
+                       } catch (Exception $exception) {
+                               throw new Exception ('Cannot call user function for additional ' . ucfirst($additional));
+                       }
+               }
+       }
+
+       /**
+        * Set a specific additional by name and value
+        *
+        * @param string $additional Name of the additional
+        * @param mixed $value Value of the additional
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAdditional($additional, $type, $value) {
+               $this->additional->addAdditional($additional, $type, $value);
+
+               return $this;
+       }
+
+       /**
+        * Check if additional exists
+        *
+        * @param string $key Name of the additional
+        * @return boolean
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function additionalIsSet($key) {
+               return $this->additional->additionalIsSet($key);
+       }
+
+       /**
+        * Load the additional object
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function createAdditional() {
+               $className = 'tx_form_domain_model_additional_additional';
+
+               $this->additional = t3lib_div::makeInstance($className);
+       }
+
+       /**
+        * Set the layout for an additional element
+        *
+        * @param string $key Name of the additional
+        * @param string $layout XML for layout
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAdditionalLayout($key, $layout) {
+               $this->additional->setLayout($key, $layout);
+       }
+
+       /**
+        * Load the filter object
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function createFilter() {
+               $this->filter = t3lib_div::makeInstance('tx_form_system_filter');
+       }
+
+       /**
+        * Make a filter object for an element
+        * This is a shortcut to the function in _filter
+        *
+        * @param string $class Name of the filter
+        * @param array $arguments Arguments for the filter
+        * @return object Filter object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function makeFilter($class, $arguments = array()) {
+               $filter = $this->filter->makeFilter($class, $arguments);
+
+               return $filter;
+       }
+
+       /**
+        * Add a filter to the filter list
+        * This is a shortcut to the function in _filter
+        *
+        * @param object $filter Filter object
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addFilter($filter) {
+               $this->filter->addFilter($filter);
+       }
+
+       /**
+        * Dummy function to check the request handler on input
+        * and set submitted data right for elements
+        *
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function checkFilterAndSetIncomingDataFromRequest() {
+               return $this;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Button.php b/typo3/sysext/form/Classes/Domain/Model/Element/Button.php
new file mode 100644 (file)
index 0000000..00176bb
--- /dev/null
@@ -0,0 +1,104 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Button model object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_button extends tx_form_domain_model_element_abstract {
+
+       /**
+        * Allowed attributes for this object
+        *
+        * @var array
+        */
+       protected $allowedAttributes = array(
+               'accesskey' => '',
+               'alt' => '',
+               'class' => '',
+               'dir' => '',
+               'disabled' => '',
+               'id' => '',
+               'lang' => '',
+               'name' => '',
+               'style' => '',
+               'tabindex' => '',
+               'title' => '',
+               'type' => 'button',
+               'value' => '',
+       );
+
+       /**
+        * Mandatory attributes for this object
+        *
+        * @var array
+        */
+       protected $mandatoryAttributes = array(
+               'name',
+               'id'
+       );
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor and fills the attributes
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+
+       /**
+        * Set the value of the button
+        * Checks if value is set from Typoscript,
+        * otherwise use localized value.
+        * Also changes the value attribute
+        *
+        * @param string $value Value to display on button
+        * @return void
+        * @see typo3/sysext/form/model/element/tx_form_domain_model_element#setValue()
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setValue($value = '') {
+               $localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+
+               $oldValue = $this->getAttributeValue('value');
+               if(empty($oldValue)) {
+                       if(!empty($value)) {
+                               $newValue = (string) $value;
+                       } else {
+                               $newValue = $localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_button.value');
+                       }
+                       $this->value = (string) $newValue;
+                       $this->setAttribute('value', $newValue);
+               }
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Captcha.php b/typo3/sysext/form/Classes/Domain/Model/Element/Captcha.php
new file mode 100644 (file)
index 0000000..d695be9
--- /dev/null
@@ -0,0 +1,336 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Captcha model object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_captcha extends tx_form_domain_model_element_abstract {
+
+       /**
+        * Allowed attributes for this object
+        *
+        * @var array
+        */
+       protected $allowedAttributes = array(
+               'accesskey' => '',
+               'alt' => '',
+               'class' => '',
+               'dir' => '',
+               'disabled' => '',
+               'id' => '',
+               'lang' => '',
+               'maxlength' => '',
+               'name' => '',
+               'readonly' => '',
+               'size' => '',
+               'style' => '',
+               'tabindex' => '',
+               'title' => '',
+               'type' => 'text',
+               'value' => '',
+       );
+
+       /**
+        * Mandatory attributes for this object
+        *
+        * @var array
+        */
+       protected $mandatoryAttributes = array(
+               'name',
+               'id'
+       );
+
+       /**
+        * HTML string for captcha image
+        *
+        * @var string
+        */
+       protected $image = '';
+
+       /**
+        * HTML string for text to reload the image
+        *
+        * @var string
+        */
+       protected $reload = '';
+
+       /**
+        * HTML string for accessibility feature
+        *
+        * @var string
+        */
+       protected $accessibility = '';
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor and fills the attributes
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+               $this->setCaptcha();
+       }
+
+       /**
+        * Returns the HTML string for the captcha image
+        *
+        * @return string HTML for the image
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getImage() {
+               return $this->image;
+       }
+
+       /**
+        * Returns the HTML string for the text to reload the captcha image
+        *
+        * @return string HTML for the reload text
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getReload() {
+               return $this->reload;
+       }
+
+       /**
+        * Returns the HTML string for an accessible audio fragment
+        *
+        * @return string HTML for the accessibility feature
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getAccessibility() {
+               return $this->accessibility;
+       }
+
+       /**
+        * Read the captcha object
+        * Check which captcha extension is loaded
+        * and make captcha according to this extension
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setCaptcha() {
+               switch (TRUE) {
+                       case t3lib_extMgm::isLoaded('sr_freecap'):
+                               $this->useExtensionSrfreecap();
+                               break;
+                       case t3lib_extMgm::isLoaded('captcha'):
+                               $this->useExtensionCaptcha();
+                               break;
+                       case t3lib_extMgm::isLoaded('simple_captcha'):
+                               $this->useExtensionSimpleCaptcha();
+                               break;
+                       case t3lib_extMgm::isLoaded('wt_calculating_captcha'):
+                               $this->useExtensionWtCalculatingCaptcha();
+                               break;
+                       /*case t3lib_extMgm::isLoaded('securimage'):
+                               $this->useExtensionSecurimage();
+                               break;*/
+                       case t3lib_extMgm::isLoaded('jm_recaptcha'):
+                               $this->useExtensionJmRecaptcha();
+                               break;
+               }
+       }
+
+       /**
+        * Use the extension sr_freecap for captcha validation
+        * Set the label, image, reload text and accessibility feature
+        * Uses the default input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionSrfreecap() {
+               require_once(t3lib_extMgm::extPath('sr_freecap') . 'pi2/class.tx_srfreecap_pi2.php');
+               $captchaObject = t3lib_div::makeInstance('tx_srfreecap_pi2');
+
+               $captchaValues = $captchaObject->makeCaptcha();
+               $this->setLabelIfEmpty($captchaValues['###SR_FREECAP_NOTICE###']);
+               $this->setImage($captchaValues['###SR_FREECAP_IMAGE###']);
+               $this->setReload($captchaValues['###SR_FREECAP_CANT_READ###']);
+               $this->setAccessibility($captchaValues['###SR_FREECAP_ACCESSIBLE###']);
+       }
+
+       /**
+        * Use the extension captcha for captcha validation
+        * Set the image and label
+        * Uses the default input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionCaptcha() {
+               $localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+
+               $this->setImage('<img src="' . t3lib_extMgm::siteRelPath('captcha') . 'captcha/captcha.php" alt="" />');
+               $this->setLabelIfEmpty($localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_captcha.captcha'));
+       }
+
+       /**
+        * Use the extension simple_captcha for captcha validation
+        * Set the label and images
+        * Makes multiple images with checkboxes,
+        * uses different layout and no default input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionSimpleCaptcha() {
+               require_once(t3lib_extMgm::extPath('simple_captcha') . 'class.tx_simplecaptcha.php');
+               $localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+
+               $this->setLayout('<label /><captchaimage />');
+
+               $captchaObject = t3lib_div::makeInstance('tx_simplecaptcha');
+
+               $this->setImage($captchaObject->getCaptcha());
+               $this->setLabelIfEmpty($localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_captcha.simple_captcha'));
+       }
+
+       /**
+        * Use the extension wt_calculation_captcha for captcha validation
+        * Set the image and label
+        * Uses the default input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionWtCalculatingCaptcha() {
+               require_once(t3lib_extMgm::extPath('wt_calculating_captcha') . 'class.tx_wtcalculatingcaptcha.php');
+               $localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+
+               $captchaObject = t3lib_div::makeInstance('tx_wtcalculatingcaptcha');
+
+               $this->setImage($captchaObject->generateCaptcha());
+               $this->setLabelIfEmpty($localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_captcha.wt_calculating_captcha'));
+       }
+
+       /**
+        * Use the extension securimage for captcha validation
+        * Set the label, image, reload text and accessibility feature
+        * Uses the default input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionSecurimage() {
+               require_once(t3lib_extMgm::extPath('securimage') . 'pi1/class.tx_securimage_pi1.php');
+               $captchaObject = t3lib_div::makeInstance('tx_securimage_pi1');
+
+               $captchaValues = $captchaObject->getCaptcha();
+               $this->setLabelIfEmpty($captchaValues['###CAPCTHA_DESC###']);
+               $this->setImage($captchaValues['###CAPCTHA###']);
+               $this->setReload($captchaValues['###CAPCTHA_RELOAD###']);
+               $this->setAccessibility($captchaValues['###CAPCTHA_AUDIO###']);
+       }
+
+       /**
+        * Use the extension jm_recaptcha for captcha validation
+        * Set the label and image
+        * Uses its own input field
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function useExtensionJmRecaptcha() {
+               require_once(t3lib_extMgm::extPath('jm_recaptcha') . 'class.tx_jmrecaptcha.php');
+               $localizationHandler = t3lib_div::makeInstance('tx_form_system_localization');
+               $captchaObject = t3lib_div::makeInstance('tx_jmrecaptcha');
+
+               $this->setLayout('<label /><captchaimage />');
+
+               $this->setImage($captchaObject->getReCaptcha());
+               $this->setLabelIfEmpty($localizationHandler->getLocalLanguageLabel('tx_form_domain_model_element_captcha.jm_recaptcha'));
+       }
+
+       /**
+        * Use local language label if it ain't set by user
+        * Label will be used from captcha extension if available,
+        * otherwise from FORM local language file
+        *
+        * @param string $text The override label
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setLabelIfEmpty($text) {
+               if(!$this->additionalIsSet('label')) {
+                       $label['value'] = (string) $text;
+                       $this->setAdditional('label', 'TEXT', $label);
+               }
+       }
+
+       /**
+        * Set the captcha image
+        *
+        * @param string $image HTML string of the image
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setImage($image) {
+               $this->image = (string) $image;
+       }
+
+       /**
+        * Set the text for reloading the image
+        *
+        * @param string $reload Reload text
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setReload($reload) {
+               $this->reload = (string) $reload;
+       }
+
+       /**
+        * Set the HTML for the accessibility feature
+        *
+        * @param string $accessibility HTML string for the feature
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function setAccessibility($accessibility) {
+               $this->accessibility = (string) $accessibility;
+       }
+
+       /**
+        * Get the local language label(s) for the message
+        *
+        * @return string The local language message label
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       protected function getLocalLanguageLabel($type) {
+               $label = get_class($this) . '.' . $type;
+               $message = $this->localizationHandler->getLocalLanguageLabel($label);
+               return $message;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Checkbox.php b/typo3/sysext/form/Classes/Domain/Model/Element/Checkbox.php
new file mode 100644 (file)
index 0000000..b586ad7
--- /dev/null
@@ -0,0 +1,140 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Checkbox model object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_checkbox extends tx_form_domain_model_element_abstract {
+
+       /**
+        * Allowed attributes for this object
+        *
+        * @var array
+        */
+       protected $allowedAttributes = array(
+               'accesskey' => '',
+               'alt' => '',
+               'checked' => '',
+               'class' => '',
+               'dir' => '',
+               'disabled' => '',
+               'id' => '',
+               'lang' => '',
+               'name' => '',
+               'style' => '',
+               'tabindex' => '',
+               'title' => '',
+               'type' => 'checkbox',
+               'value' => '',
+       );
+
+       /**
+        * Mandatory attributes for this object
+        *
+        * @var array
+        */
+       protected $mandatoryAttributes = array(
+               'name',
+               'id'
+       );
+
+       /**
+        * True if it accepts the parent name instead of its own
+        * This is necessary for groups
+        *
+        * @var boolean
+        */
+       protected $acceptsParentName = TRUE;
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor and fills the attributes
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+
+       /**
+        * Set the value of the checkbox
+        *
+        * If there is submitted data for this field
+        * it will change the checked attribute
+        *
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        * @see typo3/sysext/form/model/element/tx_form_domain_model_element#checkFilterAndSetIncomingDataFromRequest()
+        */
+       public function checkFilterAndSetIncomingDataFromRequest() {
+               if ($this->value === '') {
+                       $this->value = (string) $this->getElementId();
+                       $this->setAttribute('value', $this->value);
+               }
+
+               if($this->requestHandler->has($this->getName())) {
+                       $submittedValue = $this->requestHandler->getByMethod($this->getName());
+                       if(is_array($submittedValue) && in_array($this->value, $submittedValue)) {
+                               $this->setAttribute('checked', 'checked');
+                       } elseif($submittedValue === $this->value) {
+                               $this->setAttribute('checked', 'checked');
+                       } elseif(is_array($submittedValue) && in_array('on', $submittedValue)) {
+                               $this->setAttribute('checked', 'checked');
+                       }
+               } elseif($this->requestHandler->hasRequest()) {
+                       $this->attributes->removeAttribute('checked');
+               }
+               return $this;
+       }
+
+       /**
+        * Set a specific attribute by name and value
+        *
+        * @param string $attribute Name of the attribute
+        * @param mixed $value Value of the attribute
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function setAttribute($attribute, $value) {
+               if(array_key_exists($attribute, $this->allowedAttributes)) {
+                       $this->attributes->addAttribute($attribute, $value);
+               }
+
+               if($attribute === 'name') {
+                       $nameAttribute = $this->attributes->getAttributeObjectByKey('name');
+                       $nameAttribute->setAddition('[]');
+                       $this->attributes->setAttribute('name', $nameAttribute);
+               }
+
+               return $this;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Checkboxgroup.php b/typo3/sysext/form/Classes/Domain/Model/Element/Checkboxgroup.php
new file mode 100644 (file)
index 0000000..0ecf8db
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Checkbox group model object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_checkboxgroup extends tx_form_domain_model_element_fieldset {
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor, fills the attributes
+        * and adds all child objects
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+
+       /**
+        * Add child object to this element
+        *
+        * @param object $element The child object
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addElement($element) {
+               if ($element->acceptsParentName()) {
+                       $element->setName($this->getName());
+                       $element->attributes->setValue('name', $this->getName());
+                       $element->checkFilterAndSetIncomingDataFromRequest();
+               }
+               $this->elements[] = $element;
+               return $this;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Container.php b/typo3/sysext/form/Classes/Domain/Model/Element/Container.php
new file mode 100644 (file)
index 0000000..c8f5283
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Class for the form container elements
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_container extends tx_form_domain_model_element_abstract {
+
+       /**
+        * Child elements of this object
+        *
+        * @var array
+        */
+       protected $elements = array();
+
+       /**
+        * Constructor
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+
+       /**
+        * Add child object to this element
+        *
+        * @param object $element The child object
+        * @return object
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function addElement($element) {
+               $this->elements[] = $element;
+               return $this;
+       }
+
+       /**
+        * Get the child elements
+        *
+        * @return array Child objects
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function getElements() {
+               return $this->elements;
+       }
+}
+?>
\ No newline at end of file
diff --git a/typo3/sysext/form/Classes/Domain/Model/Element/Content.php b/typo3/sysext/form/Classes/Domain/Model/Element/Content.php
new file mode 100644 (file)
index 0000000..2a7bb04
--- /dev/null
@@ -0,0 +1,87 @@
+<?php
+declare(encoding = 'utf-8');
+
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2008 Patrick Broens (patrick@patrickbroens.nl)
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+/**
+ * Content model object
+ *
+ * @author Patrick Broens <patrick@patrickbroens.nl>
+ * @package TYPO3
+ * @subpackage form
+ */
+class tx_form_domain_model_element_content extends tx_form_domain_model_element_abstract {
+
+       /**
+        * Allowed attributes for this object
+        *
+        * @var array
+        */
+       protected $allowedAttributes = array();
+
+       /**
+        * Mandatory attributes for this object
+        * @var array
+        */
+       protected $mandatoryAttributes = array();
+
+       /**
+        * Constructor
+        * Sets the configuration, calls parent constructor and fills the attributes
+        *
+        * @return void
+        * @author Patrick Broens <patrick@patrickbroens.nl>
+        */
+       public function __construct() {
+               parent::__construct();
+       }
+
+       /**
+        * Set the content for the element
+&nb