Extension:MsCatSelect

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

Release status:Extension status stable

Mscatselect 1.jpg
ImplementationTemplate:Extension#type User interface
DescriptionTemplate:Extension#description Allows to add a page to an existing or newly creatable category via a drop-down list
Author(s)Template:Extension#username Martin Schwindl, Martin Keyler and Felipe Schenone
Latest versionTemplate:Extension#version 6.1 (2015-01-04)
MediaWikiTemplate:Extension#mediawiki 1.21+
PHPTemplate:Extension#php 5.3+
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ParametersTemplate:Extension#parameters

$wgMSCS_MainCategories, $wgMSCS_UseNiceDropdown, $wgMSCS_WarnNoCategories, $wgMSCS_WarnNoCategoriesException

Hooks usedTemplate:Extension#hook
EditPage::showEditForm:initialManual:Hooks/EditPage::showEditForm:initial
EditPage::attemptSaveManual:Hooks/EditPage::attemptSave

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

Check usage and version matrix.

IssuesPhabricator

Open tasks · Report a bug

The MsCatSelect extension adds a visual interface to the edit page that allows you to:

  • Add a category to a page by selecting the category in a drop-down on the edit page.
  • Remove categories from a page
  • Define a custom list of categories
  • Set a specific sortkey for each category
  • Create a new subcategory in a selected category

Furthermore:

  • If you select a category in the drop-down list another drop-down will be created with all subcategories
  • The selected categories are received through the MediaWiki API
  • User-friendly select boxes with Chosen

Installation[edit]

  • Download and place the file(s) in a directory called MsCatSelect in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    require_once "$IP/extensions/MsCatSelect/MsCatSelect.php";
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

$wgMSCS_MainCategories[edit]

Is an array filled with categories which should be loaded in the first drop-down. If this array is nonexistent all main categories (categories which are not subcategories) of the wiki are loaded automatically. Null by default.

$wgMSCS_MainCategories = array( 'Category1', 'Category2' ); // Don't include the 'Category:' namespace

$wgMSCS_WarnNoCategories[edit]

By default, if you try to save a page that has no categories assigned, MsCatSelect will ask for confirmation. If you wish to avoid this, set:

$wgMSCS_WarnNoCategories = false;

$wgMSCS_WarnNoCategoriesException[edit]

When $wgMSCS_WarnNoCategories is set to true, you may still want to avoid warnings in certain pages or namespaces. Add those pages and namespaces to the $wgMSCS_WarnNoCategoriesException array to do so. For example:

$wgMSCS_WarnNoCategoriesException = array( NS_TALK, NS_FILE_TALK, 'Main Page', 'Category:Whatever' );

By default the array is empty. You can find all the namespace constants here.

API high limits[edit]

MsCatSelect uses the MediaWiki API, which returns a maximum of 500 subcategories for regular users. If some of your categories have more than 500 subcategories, set the following to overcome this limitation:

$wgGroupPermissions['*']['apihighlimits'] = true;

Usage[edit]

Once the extension is installed and configured, edit a page and scroll to the bottom to see the visual interface for adding or removing categories. Select the categories you want from the dropdown menus and save the changes to add the page to those categories.

See also[edit]