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:
properties. Not every page type can be defined in this way — some pages will contain more than one standard template, for instance — but in many cases it’s a good starting point. The set of fields at the bottom is used to create the template, the form, and the properties.
    Why bother creating the category? Because, in Semantic Forms, the category is where the connection between pages and their forms is defined, so that an “edit with form” tab shows up at the top of each page. This is done via the “Has default form” special property, which we’ll get to later.
    Another option is to use the special pagesSpecial:CreateProperty, Special:CreateCategory, Special:CreateTemplate and Special:CreateForm, all defined by Semantic Forms. These have the advantage of granularity — you can create, or regenerate, any specific pages — and they also have the advantage of additional fields that Special:CreateClass doesn’t offer.
    For example, in Figure 17.2 you can see part of the helper form at Special:CreateForm — it lets you set all the allowed parameters for each form field, with the group of parameters based on the selected input type. We’ll get to all of these specific parameters in the next section.
    Figure 17.2 Special:CreateForm page
    By the way, you may find it odd that the pages Special:CreateProperty and Special:CreateTemplate are contained in Semantic Forms, since they have nothing to do with forms (other than the fact that they provide a helper form to generate pages — which is not the same thing). And the same argument could actually be made for Special:Templates, which Semantic Forms also provides. For the case of CreateTemplate and Templates, they are part of Semantic Forms because Semantic Forms is based around templates in a way that almost nothing else is among core MediaWiki and its extensions. For Special:CreateProperty, though, it’s really just an accident of history that it’s part of Semantic Forms and not Semantic MediaWiki, which would be the obvious home for it. It could be that in the future Special:CreateProperty will move to SMW.

Form definitions
    Semantic Forms provides an entire syntax for defining forms, that makes use of special tags contained within triple curly brackets. Pages that define forms should always go in the "Form:" namespace (or, for non-English-language wikis, its equivalent in another language). Such pages are not called forms, but rather "form-definition pages", to distinguish them from the actual corresponding forms that users see.
    Before we define the syntax, here’s an example of the full contents of a form-definition page, for a “Project” form:

This is the
'
Project
'
form.
To add a site with this form, enter its name below;
if a page with that name already exists, you will be sent to a form to edit that page.
 
{{#forminput:form=Project|autocomplete on category=Projects}}


 
{{{for template|Project}}}
{| class="wikitable"
! Client
| {{{field|Client|autocomplete on category=Clients}}}
|-
! Start date
| {{{field|Start date}}}
|-
! End date
| {{{field|Start date}}}
|-
! Status
| {{{field|Status}}}
|}
{{{end template}}}
{{{for template|Task|multiple|label=Tasks}}}
{| class="wikitable"
! Task name
| {{{field|Task name}}}
|-
! Deadline
| {{{field|Deadline}}}
|-
! Status
| {{{field|Status}}}
|}
{{{end template}}}

    Already, without getting into any of the specifics of the syntax, you can notice a few things:
The form-definition page serves a dual purpose: within the tag it holds the form definition , while within the tag it holds a brief explanation of that form, and an input to get to the actual form. (These two tags, and , serve the same purpose that they do in templates — see here .)
Form definitions hold a mix of regular wikitext and special syntax, the latter of which is defined within three curly brackets.
A form can specify more than one template within a page — in this case, there are two.
Form fields, for the most part, can be simple, although they can also take in parameters. (Form field tags tend to be simple because Semantic Forms can already get a lot of information about the nature of each field from the template(s), and the semantic properties they use.)
    We’ll get to a full explanation later of

Weitere Kostenlose Bücher