Extension:Uniwiki Layouts

What can this extension do?
This extension allows the WikiSysop (or anyone with the "editlayouts" permission) to create pages in the "Layouts" namespace, which are subsequently offered as pre-built "templates" (but not in the MediaWiki sense!) to users creating new pages. This is intended to encourage (but not force) users to use a common structure throughout the wiki.

There are also some enhancements when running this extension alongside the Generic Edit Page extension. Before pre-filling the edit page, each section of the chosen Layout is parsed for optional "directives", which provide hints to the Generic Edit Page, slightly affecting its behavior. Currently, the following directives are available:


 * @optional: The section will not be added to the new page as default, but a relevant checkbox will be added to the "sections" menu in the top-right of the Generic Editor.
 * @required: The section will be added to the new page, along with a checkbox in the menu, but it will be disabled, dissuading (not preventing) the user from removing the section. The user is still able to remove the section via the "Classic Mode" of the Generic Edit Page.
 * @lock-header: The section will be added to the new page, but the ==Title== will not be editable in the usual way. As above, this is not enforced in "Classic Mode".
 * @lock-text: As above, but applied to the section body.

Installation
Create a subdirectory in your extensions directory: (we do this to make it easy to distribute all Uniwiki extensions as a bundle)

Download the extension and its dependencies using Subversion:

Add the following to LocalSettings.php:

Bug Fix
This extension causes a small problem when you are editing an old revision in v1.13 (it will show the current revisions content instead of the old revisions text, didn't test in other versions yet)

Open up /extensions/uniwiki/Layouts/Layouts.php Search for the following code in function maybeRedirectToLayout:

and change it into

this will give the fetchContent function the id of the old revision when needed. If oldid is empty, it will display the current revision!

Configuration parameters
todo