Extension:TemplateFormEditor

= Introduction =

This Template is not published yet. It will be an extended version of "Extension:CustomEdit". But it does not show a form at article creation time - only when articles containing templates are edited.

=Functional Specification=

In the following description we asume that there is a Template called "name".

Extended Syntax

 * in the template definition page "Template:name" you can define the types of parameters enclosed in tags
 * inside these typedefinition tags each line starting with an asterisk "*" is one definiton.
 * Syntax:
 * * NAME : TYPE (PARAMS) "LABEL" // COMMENT
 * where
 * NAME is the name of one of the templates parameter (e.g. "date" if a parameter "" is used or "1" for the parameter )
 * Type is one of the following defined types: "text", "oneof", "someof" "-"
 * where
 * * text   the form will offer a multiline textbox. Details see below.
 * * oneof  the form offers a dropdown list where one of the given elements can be choosen, so below.
 * * someof  the form offers several checkboxes where any number of elements can be choosen.
 * * -  the form offers a single line textfield like the Extension:CustomEdit does
 * Params &nbps; the expected paramenters for the type - depent on the selected type.
 * Label  the form shows this text on the lefthandside of the input field.
 * Comment &nbps; the form shows this text on the righthandside of the input field.

Page Action
This extension offers an alternative Editor for applications of templates with parameters.


 * Templates can be used as usual e.g.


 * If you edit an article the following is done.
 * Default Editor is shown if no template is used in the article.
 * if the page uses a Template e.g. the template definition page (e.g. " Template:name ") is inspected
 * if the definition page contains a Tag a formular for editing the parameters of that template is shown instead of the default editor.
 * if none of the used templates defines its parameters types the Default Editor is shown.
 * if the article to be edited contains more than one template containing a Tag only the first template can be edited by such a form.
 * The form-editor has a button which allows switching to the default editor, preserving the latest changes in the input fields

Default
if an undefined type name (like "-" or "default") is entered for this parameter a simple single-line input field is shown (like in the form of the Extension:CustomEdit.

Parameters that are not mentioned inside the &lt;typedefinition&gt;-tag automatically have the default type. Only if you want to define an alternate Label or a comment you need to define a parameter with default type.

No Parameters are expected and any parameters are simply ignored.

E.g.: * ParameterName : - "Simple Parameter" // a single inputline is shown with this label and comment.

Text
For Parameters of this type a multi-line text area is shown in the Form.

Parameters
Exactly two parameters are expected.
 * width
 * heigth

E.g.: * Parametername: text (20,4) "A textarea" // 20 columns wide and 4 lines high

oneof
For parameters of this type a dropdownlist is shown

Parameters
A coma separated list of all allowed values is expected. E.g.: * Parametername : oneof (a Value, another value, (third value) ,"fourth") "Dropdownlist:" // you can choose exactly one of these four elements

someof
Up to now this type has a bug, it does not write the selected values back into the article

Parameters
A coma separated list of all allowed values is expected. E.g.: * Parametername : oneof (a Value, another value, (third value) ,"fourth") "Dropdownlist:" // you can choose any number of these four elements.

= Installation =

Extract the zip-file (not published yet) into the extension directory. Add the following line to the file LocalSettings.php:

The zip file will contain a folder "TemplateFormEditor" which will contain tree php-files.

= Known Bugs =


 * no translation: some texts are always in German.


 * type "someof" does not work correctly.


 * does not correctly handle editing sections - edits always the whole article.


 * offers the form editor only for the first applicable template of a page - up to now it should only be used for pages which only containe one template.


 * Possibly heavy performance problems: not yet tested with da bigger database. Works fine when the whole wiki does not contain more than 100 pages.