Extension:TemplateFormEditor

= Introduction =

This Template is an extended version of "Extension:CustomEdit".

But it needs the Extension:CreateArticle for showing a form at article creation time (since version 0.2.1 this template is compatible to that extension) - this editor is shown only when articles containing templates are edited, or when the "preload" Parameter of the "CreateArticle"-Form points to a Page containing an applicable template.

If you want to create a new article using the form editor provided by this extension, you need to use the extension "Create Article" (since Version 0.2.1 of this extension). The only other way using this form editor at page crateion time is to execute the following steps:


 * open the default editor for creating a new article
 * write the template into the article - without parameters
 * E.g.:
 * click the button "preview".

now the form-editor provided by this extension is shown. This holds only if the "Template:name" has parameters and contains a &lt;typedefinition&gt; tag (see below)

=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 form 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


 * If each template used in an article is in a different section, you can edit each template using the form editor by editing the corresponding section.

Detailed Type Definition
If an application of a template should be edited using the editor provided by this template, the types of the template's parameters have to be defined on the template's definition page.

The allowed types are described on a subpage of this page.

= Installation =

Extract the zip-file into the extension directory. Add the following line to the file LocalSettings.php:

The zip file contains a folder "TemplateFormEditor" which contain four php-files:
 * TemplateEdit.php - the entry point of the Extension.
 * TemplateFormEdit.i18n.php - the internationalization of the template.
 * TypeDefinition.php - the definition of the types of Parameters and the way they are represented on the template definition page.
 * clsTemplateForm.php - the main class of the template: the Editor.

= Compatibility = This Extension was tested with MediaWiki Version 1.13.2 and 1.13.3. Please send me an E-Mail if you tested the extension with other versions so that i can report if it works with version 1.11 or 1.14.

Compatibility to Mediawiki extensions

 * Extension:EditWarning
 * Since version 0.1.3 this extension can be used together with Extension:EditWarning provided that in the File "LocalSettings.php" the Extension "EditWarning" is mentioned first!
 * If this extention is mentioned before Extension:EditWarning the warning will not be shown in the Form-Editor provided by this Extension.
 * This might hold for other AlternateEdit extensions, too.


 * Extension:CreateArticle
 * If the 'preload' parameter is used and points to a page containing a template-usage this Template Form Editor is used for creating a new page. (Since version 0.2.1)


 * Extension:DPL and
 * Extension:RegexParserFunctions
 * In combination with these two extensions this extension can offer dynamically generated lists of allowed values for the parameter types 'oneof' and 'someof' (send me a mail if you want an example)

= Known Bugs =


 * offers the form editor only for the first applicable template of a page (or edited section) - up to now it should only be used for pages (or sections) which only contain one template.


 * Does not read values from unnamed parameters and writes "...|1=...|2=..." instead of using unnamed parameters.


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


 * Using Preload-Parameter of Extension:CreateArticle this editor does not parse the preload. therefore e.g. Extension:RegexParserFunctions can not be used in a preload.


 * This template does not read the parameter values correctly if the value itself is a template with parameters (e.g. containing a Pipe)

= Wanted features =


 * a "Combobox"-type could be usefull: an extended kind of the type "oneof" where you can additionally enter a text which is not a member of the enumeration of available values. (if possible without using javascript or other client-sided scripting).
 * a Parameter type "number": a textfield, where you can only enter the following chartacters

= Versions =

The Version history describes the changes between the published versions.