Extension:BookManager

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear app error.png
Book Manager

Release status: unstable

Gnome-applications-office.svg
Implementation Parser extension, User interface
Description Tools for books
Author(s) Raylton P. Sousa and Helder.wiki
Latest version 0.1.x
MediaWiki 1.18+
License GPL v3 or Any OSI approved license
Download
Hooks used
BeforePageDisplay

MagicWordwgVariableIDs
BaseTemplateToolbox
ParserAfterTidy
ParserFirstCallInit
ParserGetVariableValueSwitch

Translate the BookManager extension if possible

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

This extension adds automatic navigation through the pages of a book from its list of pages. In future implementations it should be possible to generate this list automatically (by the prefix), and organize from a special page.

Installation[edit | edit source]

  1. Download a snapshot and extract it to your extensions directory. Choose the version that matches your version of MediaWiki.
  2. Add
    require_once( "$IP/extensions/BookManager/BookManager.php" );
    to the bottom of LocalSettings.php.
  3. Installation can now be verified through Special:Version of your wiki.

Download from svn[edit | edit source]

You can also use the following command in your extensions folder:

# svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/BookManager/ 

Configuration[edit | edit source]

MediaWiki messages[edit | edit source]

Parameter Default Explanation
$wgBookManagerPrefixNamespace[1] NS_PROJECT This variable defines the namespace name which will be used to store the list of chapters of each book (if MediaWiki:coll-community_book_prefix is left blank). Its value is combined with the text of MediaWiki:coll-collections to define the common prefix used for all lists.

Example: If $wgBookManagerPrefixNamespace = NS_PROJECT and MediaWiki:coll-collections has the text "Book", then the list of chapters of a book called "Foo" should be saved on page "Project:Book/Foo".

$wgBookManagerNavBar true Indicates whether the navigation bar should be added to the chapters of a book or not
$wgBookManagerNamespaces array( NS_MAIN )[2] An array of namespaces where the navigation bar can be displayed
$wgBookManagerVariables true Indicates whether the extension should provide additional #variables for the users

MediaWiki messages[edit | edit source]

Message Default Explanation
MediaWiki:coll-collections[1] empty These messages[3] are used in conjunction with $wgBookManagerPrefixNamespace to determine the common prefix used for all chapter lists. The prefix can be either:
  • Completely defined by the value of MediaWiki:coll-community_book_prefix; or
  • The concatenation of $wgBookManagerPrefixNamespace and MediaWiki:coll-collections, followed by a bar "/"
MediaWiki:coll-community_book_prefix[1] empty

Usage[edit | edit source]

The first step is to create the list of chapters which belongs to a book.

List of chapters[edit | edit source]

The syntax and the page used to keep the list are the same used by Extension:Collection (see also Collection Help on Wikibooks):

:[[Book name/chapter name|chapter name]]
:[[Book name/another chapter name|another chapter name]]
:...

Once the list is created, the extension will provide you some features for your book:

Automatic navigation[edit | edit source]

It will be possible to navigate through the pages of the book with a navigation bar like the following, which can be customized using CSS or editing the the MediaWiki messages where they are defined:

BookManger navigation bar

Variables[edit | edit source]

The extension also provides some variables, which can be used along the book chapters:

Variable Description
{{PREVPAGENAME}} get the name of previous chapter page from chapter's list
{{PREVPAGENAMEE}} get the encoded name of previous page from chapter's list
{{NEXTPAGENAME}} get the name of next page from chapter's list
{{NEXTPAGENAMEE}} get the encoded name of next page from chapter's list
{{ROOTPAGENAME}} get the name of root page
{{ROOTPAGENAMEE}} get the encoded name of root page
{{CHAPTERNAME}} get the name of current chapter
{{CHAPTERNAMEE}} get encoded name of current chapter
{{RANDOMCHAPTER}}[4] get the name of a random chapter from chapter's list
{{RANDOMCHAPTERE}}[4] get encoded name of a random chapter from chapter's list (it is a random value unlike {{RANDOMCHAPTER}})

Automatic print version[edit | edit source]

The page Special:PrintVersion of your wiki can be used to get a print version of a book, with all its pages into one only page. If you have a book called "Introduction to Sociology", you can go to

Special:PrintVersion/Introduction to Sociology

which accepts the url parameter printable=yes to show the page in a form that is suitable for printing. The book name can also be provided by the url parameter book, as in

http://www.mediawiki.org/wiki/Special:PrintVersion?book=Introduction to Sociology

Future improvements[edit | edit source]

Notes[edit | edit source]

  1. 1.0 1.1 1.2 This component will be obsolete when it was implemented the navigation through categories
  2. This should defaults to $wgContentNamespaces instead of array( NS_MAIN )(Bug 30994)
  3. In future versions, these messages should be renamed to avoid conflicts with Extension:Collection, and should default to the same value used by that extension (Bug 30995)
  4. 4.0 4.1 the magic word will be replaced by a special page(Bug 31003)

See also[edit | edit source]