Working With MediaWiki
enough that they cannot be placed in the #arraymap function. For this purpose, you can instead use the similar #arraymaptemplate function. To use this function, create a template that takes in a single field and applies the mapping you would like to that field. Then apply #arraymaptemplate onto the main template field just as you would with #arraymap, using the following format:
{{#arraymaptemplate: value | template | delimiter | new delimiter }}
...where ’template’ is the name of the mapping template in question.
\n delimiter
For both #arraymap and #arraymaptemplate, the string “\n” in the value of either
delimiter
or
new delimiter
will get converted into a newline. If you want an actual line break to appear between values, you should have two newlines (i.e, "\n\n") as the delimiter, since MediaWiki requires two newlines in order to display a line break.
The “edit with form” tab
If a user is not allowed to edit a page that is form-editable, the tab will show up for them as "view form" instead; clicking on the tab will show the disabled form.
Getting "edit with form" to appear
There are three ways to get the ’edit with form’ tab to appear for specific pages:
Based on category
The first, and recommended, way, is to use categories. To enable a page to have a tab in this way, you must do the following two steps:
First define that page as belonging to a specific category — categories are the standard Semantic MediaWiki approach to defining a page’s type. The best way to match pages with a category is to place a ’Category’ tag inside the main template that defines this page type; that way, every page that uses this template will become part of this category.
Once you have done that, you should place the semantic property ’Has default form’ in the page for that category; the tag should look like
[[Has default form:: form-name ]]
. You can do this automatically if you create the category using the ’CreateCategory’ page.
Based on namespace
The second possible way is to match the pages’ namespace to a form. You can do that by placing a ’Has default form’ property in the page defining that namespace. If, for instance, your wiki is called ’MyWiki’, and the namespace you want to associate with a form is ’User’, the page in which you need to add the property will probably be called ’MyWiki:User’ (you will probably need to create this page). If the namespace you want a default form for is the main one (i.e., the one with no name), you will need to create and add this property to the page called ’MyWiki:Main’, or whatever the main namespace is called in the language of this wiki.
Once you’ve added this property, every page within that namespace will have that form associated with it, unless it already belongs to a category that has an associated form (categories take precedence over namespaces).
Within the page
With the special property "Page has default form", any page can set its own form. This is especially useful when the category and namespace options aren’t possible, such as when pages belong to multiple categories that have different default forms; or for editing category pages themselves. To apply it, place this property either directly within the page, or in a template that the page calls, using syntax like this:
[[Page has default form:: form-name ]]
Configuring the editing tabs
For pages that have an “edit with form” tab, you may want the regular “edit” tab to be renamed or even removed altogether. There are flags you can set in "LocalSettings.php" to change the appearance of the editing tabs:
$sfgRenameEditTabs - if set to true , renames the “edit with form” tab to “edit”, and the “edit” tab to “edit source” (in whatever language the wiki is being viewed in)
$sfgRenameMainEditTab - if set to true , renames only the “edit” tab to “edit source” (in whatever language the wiki is being viewed in)
$wgGroupPermissions[...]['viewedittab'] - can be set, for different types of viewers, to toggle whether each type will see the regular edit tab. One common modification is to set it to false normally (i.e. for viewer type ’*’), and to true for ’sysop’ viewers:
$wgGroupPermissions['*']['viewedittab'] = false;
$wgGroupPermissions['sysop']['viewedittab'] = true;
If these settings are added to LocalSettings.php, they should be placed in the file after the inclusion of Semantic Forms. Note that some of the early MediaWiki skins,
Weitere Kostenlose Bücher