Mediawiki Extension PageSchema
Source: | DataSource |
---|---|
Language: | English |
Topic: | Mediawiki |
SubTopic: | Mediawiki Extension |
Last Edit By: | DochyJP |
LastEdit: | 2021-04-14 |
Document type: | Documentation |
Status: | Active |
Access: | free |
Description
Page Schemas is a MediaWiki extension that allows for defining all the schema information about a "class", or data type - for naming, display, data input, and browsing - within a single piece of XML contained within a category page. This XML then is used to generate all the necessary additional pages needed to put the schema into effect, such as template pages and, for instance, if Page Forms is installed, form pages. The XML can be created and edited via a helper form, preventing users from having to generate or modify it manually.
Page Schemas allows other extensions to define their own fields to add to the XML, using hooks. Currently, the following extensions hook into Page Schemas:
- Cargo
- Page Forms
- Semantic MediaWiki
- Semantic Drilldown
- Semantic Internal Objects
Installation
Download
You can download the Page Schemas code, in .zip format, here.
You can also download the code via Git from the MediaWiki source code repository. From a command line, you can call the following:
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/PageSchemas.git
Activation
After you've obtained a 'PageSchemas' directory, place this directory within the main MediaWiki 'extensions' directory. Then, in the file 'LocalSettings.php' in the main MediaWiki directory, add either one of the following lines:
wfLoadExtension( "PageSchemas" );
or
include_once( "$IP/extensions/PageSchemas/PageSchemas.php" );
Configuration
Page Schemas defines two pages that can show up as tabs on category pages: "Edit schema" (which appears as "Create schema" if no schema exists yet) and "Generate pages". "Edit schema" allows for creating or editing the XML via the helper form, while "Generate pages" provides a button that lets the administrator create the template(s), semantic properties, form etc. automatically from the XML definition. "Generate pages" also includes checkboxes for each of the pages to be generated, to let administrators choose not to override certain wiki pages that already exist.
Any user who is allowed to edit a certain category page will see the "Edit schema/Create schema" tab for that category, and will be allowed to use that page to modify the schema.
In order to generate pages, a user must have the 'generatepages' permission. By default, this permission is given only to members of the 'sysop' user group. You can add to or modify the set of allowed users, though, by modifying the $wgGroupPermissions array in LocalSettings.php. To enable all registered users to generate pages from the schema, for instance, you would add the following:
$wgGroupPermissions['user']['generatepages'] = true;
Tutorial video
You can see a screencast video for Page Schemas created by Yury Katkov, explaining how it's used and why it can be useful.
Sample XML structure
Here is some sample XML, to be contained within a page called "Category:Cities", used to define the schema for pages within that category. This section defines the name of the form, and information for a single field of that class, "Population".