Bücher online kostenlos Kostenlos Online Lesen
Working With MediaWiki

Working With MediaWiki

Titel: Working With MediaWiki Kostenlos Bücher Online Lesen
Autoren: Yaron Koren
Vom Netzwerk:
almost all the elements of this definition, but one thing that won’t be covered later is the

element. That is there so that, when the user hits the “Show preview” button, the Semantic Forms code can display both the form and the previewed page on the screen at the same time. It’s an optional element.
    You can see what this form page looks like when a user goes there in Figure 17.3. Only the top part of the page’s contents, within the tag, is displayed.
    Figure 17.3 A form definition page’s display
    When they reach the input on the form definition page, the user has to enter a page name. Let’s say that they enter the text “Planting flower garden” and press “Create or edit”. Figure 17.4 shows what the resulting form page, defined by the “Project” form definition, would look like in action (after the user also presses the “Add another” button once).
    Figure 17.4 A Semantic Forms-based form
    It’s very important to note that this form can be used to both create new pages and edit existing ones; the form will look the same in both cases, other than having its values pre-populated for existing pages.
    Now, let’s go through the form-definition syntax.
Form markup language
    Forms are defined using a set of tags that specify templates and fields within those templates. Wikitext, and some HTML, can be freely embedded anywhere outside of the tags. Semantic Forms tags are always surrounded by three curly braces, have pipes to separate their “parameters”, and usually contain at least one extra parameter, to define the name. The text “
{{{field|Start date}}}
” from the previously-shown form definition is an SF tag, for instance. They differ from template calls because they have three curly brackets instead of two. And they differ from parameters within template definitions, which have three curly brackets, because those can only be used in the “Template:” namespace, whereas SF tags can only be used within the “Form:” namespace.
    Below is a listing of the allowed tags in form definitions, and the allowed parameters for each. It may be helpful to refer back to the sample form definition here , to see how these tags can fit in context.
’info’ tag
    The ’info’ tag holds special information about the form. This tag is optional, but should be placed at the top of the form if it is present. Allowed parameters of this tag are:
create title= title
- Sets the title for the ’FormEdit’ page, if the form is being used to create a new page.
edit title= title
- Sets the title for the ’FormEdit’ page, if the form is being used to edit an existing page.
query title= title
- Sets the title for the ’RunQuery’ page.
page name= formula
- Sets a formula for automatic setting of the name of the page being added; see "The one-step process".
query form at top
- Places the form at the top, instead of the bottom, for the ’RunQuery’ page.
onlyinclude free text
- Indicates that the free text in the page generated by the form should be placed within an "" tag, so that pages created by the form can be transcluded in other pages without affecting those other pages’ semantic properties.
partial form
- Indicates that this form is a partial form; partial forms are not recommended, though, and may become deprecated in the future.
’for template’ tag
    The ’for template’ tag specifies a template name, and declares that all of the following fields (until ’end template’ is reached) will be those of this template. The text immediately following the ’for template’ declaration is the name of the template. Allowed parameters of this tag are:
label= label text
- Specifies a label to be placed in a square around the entire set of this template’s fields in the form. This is especially useful if the template can have multiple instances.
multiple
- Specifies that the user can change the number of instances of this template in the form, allowing multiple (or zero) occurrences; see "Multiple-instance templates", here .
add button text=
- For multiple-instance templates, sets the text in the "Add another" button.
strict
- Specifies that only fields in the form that correspond to fields used by the template should get turned into form elements.
embed in field= template name [ field name ]
- Specifies that the call(s) to this template within the generated pages will get embedded within a field of another template (i.e., "{{main template|some