From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png

Release status: experimental

Implementation User interface, ContentHandler
Description Allows book content structuring
Author(s) Molly White (GorillaWarfaretalk)
Latest version 0.1.0 (2013-07-02)
MediaWiki 1.20+
PHP 5.3+
Database changes No
License GPLv2 or later
Hooks used


Translate the BookManagerv2 extension if it is available at translatewiki.net

Check usage and version matrix; code metrics
Bugs: list open list all report

The BookManagerv2 extension allows book content to be structured using a simple form. It then autogenerates navigation bars, which are added to the various subpages. More information on the project's development is available at meta:Book management.

Installation[edit | edit source]

  • Download and extract the file(s) in a directory called BookManagerv2 in your extensions/ folder. If you're a developer and this extension is in a Git repository, then instead you should clone the repository.
  • Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/BookManagerv2/BookManagerv2.php";
  • Done! Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

This extension can make use of memcached for improved performance. If you would like to enable this, follow the instructions at Memcached#Setup.

Configuration[edit | edit source]

This extension makes use of two namespaces (or groups of namespaces):

  • Main: These are the namespaces in which the sections of the book are stored, and where the navigation bars should appear. This defaults to the namespaces in $wgContentNamespaces, but can be overridden using the $wgBookManagerv2NavigationNamespaces variable described below.
  • Book: These are the namespaces in which the JSON blocks describing the book are stored. This defaults to a localized version of "Book", but can be overridden. To override, add the following code to LocalSettings.php, directly below the code that loads the extension:
$wgExtraNamespaces[NS_BOOK] = 'YourCustomName';
$wgExtraNamespaces[NS_BOOK_TALK] = 'YourCustomName_talk'; 
Configuration settings in BookManagerv2.php
parameter default comment
$wgBookManagerv2ExampleNavigation false If set to "true", this will add an example navigation bar to each page in the navigation namespace (see below) that does not already have one defined.
$wgBookManagerv2NavigationNamespaces $wgContentNamespaces This can be changed to an array of namespaces where the navigation bars should be added.
$wgBookManagerv2Metadata true If set to false, the metadata icon and dropdown are hidden from the navigation bar.
$wgBookManagerv2ChapterList true If set to false, the chapter list icon and dropdown are hidden from the navigation bar.
$wgBookManagerv2PrevNext true If set to false, the previous and next links and icons are hidden from the navigation bar.
$wgBookManagerv2JsonFrontend false If set to false, when a page in the book namespace is viewed, the raw JSON will be visible. If set to true, a nicer-looking view frontend will override it.
$wgBookManagerv2JsonEditor false If set to false, an edit box containing the raw JSON will be provided when a user tries to edit in the book namespace. If set to true, a custom JSON editor overrides this.

Usage[edit | edit source]

This extension stores metadata and structural information about a book in a JSON block. The fields in this block are defined by a JSON schema, such as the default on at meta:Schema:BookManagerv2. The JSON block for each book is stored in the NS_BOOK namespace, where a custom editor allows it to be easily edited. This block then allows navigation bars to be automatically added to each section of the book.

Notes[edit | edit source]

"Publication date" field, which has "date_format": "YMD" in the schema

To add a date to a JSON schema, use "string" as the type. Add a "date_format" property to the additionalProperties object. This can consist of "y", "ym", or "ymd" to indicate that the date is a year, year and a month, or year, month, and day. These can be upper- or lowercase, and can come in any order. This will add the appropriate fields to the form (see image for example).

See also[edit | edit source]