pediapress / Collection

mirror of https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Collection.git
10 stars 2 forks source link

==================================== Collection Extension for MediaWiki

About the Collection Extension

The Collection extension for MediaWiki_ allows users to collect articles and generate downloadable version in different formats (PDF, OpenDocument Text etc.) for article collections and single articles.

The extension has been developed for and tested with MediaWiki version 1.14 and later. Some features may not be available with older MediaWikis that don't have the MediaWiki API enabled.

The extension is being developed under the GNU General Public License by PediaPress GmbH in close collaboration with Wikimedia Foundation and the Commonwealth of Learning_.

Copyright (C) 2008-2012, PediaPress GmbH, Siebrand Mazeland, Marcin Cieślak and other contributors

Prerequisites

If you use a render server the MediaWiki API_ must be enabled (i.e. just don't override the default value of true for $wgEnableApi in your LocalSettings.php).

Install PHP with cURL support

Currently Collection extension needs PHP with cURL support, see http://php.net/curl

Installation and Configuration of the Collection Extension

If you intend to use the public render server, you're now ready to go.

Install and Setup a Render Server

Rendering and ZIP file generation is done by a server, which can run separately from the MediaWiki installation and can be shared by different MediaWikis.

If you have a low-traffic MediaWiki you can use the public render server running at http://tools.pediapress.com/mw-serve/. In this case, just keep the configuration variable $wgCollectionMWServeURL (see below) at its default value.

Your MediaWiki must be accessible from the render server, i.e. if your MediaWiki is behind a firewall you cannot use the public render server.

If you can't use the public render server, you'll have to :ref:install mwlib <mwlib-install> and :ref:run your own render server <mwlib-renderserver>. See http://mwlib.readthedocs.org/ for more information.

Finally you'll have to set $wgCollectionMWServeURL in your LocalSetting.php:

$wgCollectionMWServeURL (string)

Set this to the URL of a render server (see above).

The default is http://tools.pediapress.com/mw-serve/, the public render server hosted by PediaPress.

Password protected wikis

Password protected wikis require some more information. You'll have to set the $wgCollectionMWServeCredentials variable.

$wgCollectionMWServeCredentials (string)

Set this to a string of the form "USERNAME:PASSWORD" (or "USERNAME:PASSWORD:DOMAIN" if you're using LDAP), if the MediaWiki requires to be logged in to view articles. The render server will then login with these credentials using MediaWiki API before doing other requests.

SECURITY NOTICE: If the MediaWiki and the render server communicate over an insecure channel (for example on an unencrypted channel over the internet), please DO NOT USE THIS SETTING, as the credentials will be exposed to eavesdropping!

Advanced Settings

The following variables can be set in LocalSetting.php. Most people do not have to change them:

$wgCollectionMWServeCert (string) Filename of a SSL certificate in PEM format for the mw-serve render server. This needs to be used for self-signed certificates, otherwise cURL will throw an error. The default is null, i.e. no certificate.

$wgCollectionFormats An array mapping names of mwlib_ writers to the name of the produced format. The default value is::

   array(
   'rl' => 'PDF',
   )

i.e. only PDF enabled. If you want to add OpenDocument Text in addition to PDF you can set $wgCollectionFormats to something like this::

   $wgCollectionFormats = array(
   'rl' => 'PDF',
   'odf' => 'ODT',
   );

On the public render server tools.pediapress.com, currently the following writers are available:

$wgCollectionContentTypeToFilename (array) An array matching content types to filenames for downloaded documents. The default is::

  $wgCollectionContentTypeToFilename = array(
      'application/pdf' => 'collection.pdf',
      'application/vnd.oasis.opendocument.text' => 'collection.odt',
  );

$wgCollectionPortletFormats (array) An array containing formats (keys in $wgCollectionFormats) that shall be displayed as "Download as XYZ" links in the "Print/export" portlet. The default value is::

   array( 'rl' );

i.e. there's one link "Download as PDF".

$wgCollectionHierarchyDelimiter (string or null) If not null, treat wiki pages whose title contains the configured delimiter as subpages.

For example, to treat article [[Foo/Bar]] as subpage of article [[Foo]] set this variable to "/". This makes sense e.g. on wikibooks.org, but it's questionable on wikipedia.org (cf. [[AC/DC]]).

The (only) effect is that the display title for subpages in collections is set to the title of the (deepest) subpage. For example, the title of article [[Foo/Bar]] will be displayed/rendered as "Bar".

The defaul value is null, which means that no hierarchy is assumed.

$wgCollectionArticleNamespaces (array) List of namespace numbers for pages which can be added to a collection. Category pages (NS_CATEGORY) are always an exception (all articles in a category are added, not the category page itself). Default is::

array(
  NS_MAIN,
  NS_TALK,
  NS_USER,
  NS_USER_TALK,
  NS_PROJECT,
  NS_PROJECT_TALK,
  NS_MEDIAWIKI,
  NS_MEDIAWIKI_TALK,
  100,
  101,
  102,
  103,
  104,
  105,
  106,
  107,
  108,
  109,
  110,
  111,
);

$wgCommunityCollectionNamespace (integer) Namespace for "community collections", i.e. the namespace where non-personal article collection pages are saved.

 Note: This configuration setting is only used if the system message
 Coll-community_book_prefix has not been set (see below).

Default is NS_PROJECT.

$wgCollectionMaxArticles (integer) Maximum number of articles allowed in a collection.

Default is 500.

$wgCollectionLicenseName (string or null) License name for articles in this MediaWiki. If set to null the localized version of the word "License" is used.

Default is null.

$wgCollectionLicenseURL (string or null) HTTP URL of an article containing the full license text in wikitext format for articles in this MediaWiki. E.g.

::

   $wgCollectionLicenseURL = 'http://en.wikipedia.org/w/index.php?title=Wikipedia:Text_of_the_GNU_Free_Documentation_License&action=raw';

for the GFDL. If set to null, the standard MediaWiki variables $wgRightsPage, $wgRightsUrl and $wgRightsText are used for license information.

If your MediaWiki contains articles with different licenses, make sure that each article contains the name of the license and set $wgCollectionLicenseURL to an article that contains all needed licenses.

$wgCollectionPODPartners (array or false) Array of parameters needed to define print on demand providers:

::

    $wgCollectionPODPartners = array(
            'pediapress' => array(
                    'name' => 'PediaPress',
                    'url' => 'http://pediapress.com/',
                    'posturl' => 'http://pediapress.com/api/collections/',
                    'infopagetitle' => 'coll-order_info_article',
            ),
    );

(This is the default.)

name, url and posturl are mandatory parameters to display information on the list of available providers.

If infopagetitle is present, it will be interpreted as the MediaWiki message that contains the name of the short information on particular provider. For example, it can be coll-order_info_mypress and if the message contains Help:Books/MyPress order information, a contents of this page will be used. The message itself can be localized for different languages.

Setting $wgCollectionPODPartners to false disables ordering interface altogether.

$wgEnableWriteAPI

If you want to let users save their collections as wiki pages, make sure $wgEnableWriteAPI is set to true, i.e. put this line in your LocalSettings.php::

$wgEnableWriteAPI = true;

(This is the default.)

There are two MediaWiki rights that are checked, before users are allowed to save collections: To be able to save collection pages under the User namespace, users must have the right 'collectionsaveasuserpage'; to be able to save collection pages under the community namespace (see $wgCommunityCollectionNamespace), users must have the right 'collectionsaveascommunitypage'. For example, if all logged-in users shall be allowed to save collection pages under the User namespace, but only autoconfirmed users, shall be allowed to save collection pages under the community namespace, add this to your LocalSettings.php::

$wgGroupPermissions['user']['collectionsaveasuserpage'] = true;
$wgGroupPermissions['autoconfirmed']['collectionsaveascommunitypage'] = true;

You may also want to configure some of the following:

Customization via System Messages

There are several system messages, which can be adjusted for a MediaWiki installation. They can be changed by editing the wiki page [[MediaWiki:SYSTEMMESSAGENAME]], where SYSTEMMESSAGENAME is the name of the system message.

.. _mwlib: http://mwlib.readthedocs.org/ .. MediaWiki: http://www.mediawiki.org/ .. PediaPress GmbH: http://pediapress.com/ .. Wikimedia Foundation: http://wikimediafoundation.org/ .. Commonwealth of Learning: http://www.col.org/ .. MediaWiki API: http://www.mediawiki.org/wiki/API .. Meta-Wiki: http://meta.wikimedia.org/wiki/Book_tool/Help/Books