Extension:SelectCategory

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

Release status: stable

SelectCategory 0.2.png
Implementation Page action
Description Allows the user to select from existing categories when editing a page.
Author(s) Leon Weber & Manuel Schneider & Christian Boltz
Latest version 0.8.2 (2013-02-28)
MediaWiki > 1.8.2
License GPL
Download
README
CHANGELOG
Parameters

$wgSelectCategoryNamespaces $wgSelectCategoryRoot

Hooks used
EditPage::showEditForm:initial

EditPage::attemptSave
UploadForm:BeforeProcessing
OutputPageParserOutput

Translate the SelectCategory extension if possible

Check usage and version matrix; code metrics
Bugs: list open list all report
Screenshot of v0.1

The SelectCategory extension provides three functions:

  • It shows a list of all categories (unless a custom root category is configured) in their hierarchical structure on the edit page.
  • It strips all categories linked within a page upon editing and selects them in the category list list.
  • It adds selected categories from the list to the text body of the page on saving.

Installation[edit | edit source]

Stable release (recommended for most uses)[edit | edit source]

To use the stable release, download the tarball linked in the box on the right, and uncompress it. Copy the SelectCategory directory into the extensions folder of your MediaWiki installation. Then add the following lines to your LocalSettings.php file (near the end):

require_once( 'extensions/SelectCategory/SelectCategory.php' );

Download from git[edit | edit source]

To use the current git version, which might be unstable and full of bugs, run the following git command:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SelectCategory.git

Parameters[edit | edit source]

$wgSelectCategoryNamespaces[edit | edit source]

This is in your SelectCategory.php file

Defines in which namespaces the Extension should be active.

All namespaces are already predefined in the array. Set a specific namespace to true to enable or to false to disable the extension.

Active per default are: Media, Main, Project, Image, Help, Category.

Example
$wgSelectCategoryNamespaces[NS_PROJECT] = false;
$wgSelectCategoryNamespaces[NS_CATEGORY] = false;
Or
$wgSelectCategoryNamespaces     = array(
        NS_MEDIA                => true,
        NS_MAIN                 => true,
        NS_TALK                 => false,
        NS_USER                 => false,
        NS_USER_TALK            => false,
        NS_PROJECT              => true,
        NS_PROJECT_TALK         => false,
        NS_IMAGE                => true,
        NS_IMAGE_TALK           => false,
        NS_MEDIAWIKI            => false,
        NS_MEDIAWIKI_TALK       => false,
        NS_TEMPLATE             => false,
        NS_TEMPLATE_TALK        => false,
        NS_HELP                 => true,
        NS_HELP_TALK            => false,
        NS_CATEGORY             => true,
        NS_CATEGORY_TALK        => false,
        100                     => true,  # customized namespace, e.g. ''Portal'', c.f. [[Manual:Using custom namespaces]]
        101                     => false  # customized namespace, e.g. ''Portal talk'', c.f. [[Manual:Using custom namespaces]]
);

$wgSelectCategoryRoot[edit | edit source]

Set a specific root category depending the namespace. Only categories within this root will be displayed when editing a page in a certain namespace.

Useful on big wiki sites to keep the database load down.

If not set (default) the extension searches for all root categories and displays them including all children.

Example[edit | edit source]

  $wgSelectCategoryRoot = array(
       NS_MEDIA                => false,
       NS_MAIN                 => "My Article Root Category",
       NS_TALK                 => false,
       NS_USER                 => false,
       NS_USER_TALK            => false,
       NS_PROJECT              => false,
       NS_PROJECT_TALK         => false,
       NS_IMAGE                => "My Image Root Category",
       NS_IMAGE_TALK           => false,
       NS_MEDIAWIKI            => false,
       NS_MEDIAWIKI_TALK       => false,
       NS_TEMPLATE             => false,
       NS_TEMPLATE_TALK        => false,
       NS_HELP                 => false,
       NS_HELP_TALK            => false,
       NS_CATEGORY             => false,
       NS_CATEGORY_TALK        => false
  );

$wgSelectCategoryEnableSubpages[edit | edit source]

Defines if the extension should be active when editing subpages.

Example[edit | edit source]

 $wgSelectCategoryEnableSubpages = false;

Style[edit | edit source]

To customize the design of the select box use the CSS id "SelectCategoryBox" and attach your own settings to [[MediaWiki:Monobook.css]] or your users [[User:USERNAME/Monobook.css]].

Bugs & Feature Requests[edit | edit source]

Please file bugs and feature requests on the bug tracker on bugzilla.wikimedia.org in the bugzilla product "MediaWiki extensions" and its component "SelectCategory" . You might just use this direct link that has these two settings pre-defined: