Extension:SelectCategoryTagCloud

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
SelectCategoryTagCloud

Release status: stable

Implementation Page action
Description Adds a category selection tag cloud to the edit and upload pages and enables a Google Suggest-like/typeahead completion of categories entered by the user.
Author(s) Andreas Rindler
Version 1.3 (2008-04-01)
MediaWiki 1.10.0, 1.11.0
Download download
Parameters $wgSelectCategoryNamespaces $wgSelectCategoryRoot

The SelectCategoryTagCloud extension provides five functions:

  • It shows a tag cloud of all categories (unless limited by minimum count or by a custom root category)
  • It strips all categories linked within a page upon editing and inserts them in a category input box.
  • It adds categories selected from the tag cloud to the input box and removes them if already there.
  • It suggests existing categories that match the user input in the input box from the database via AJAX
  • It saves the categories from the input box to the text body of the page on saving.

For an overview of the extension also see the author's blog post on Open Spaces.

To see the extension in action, see MIKE2.0.

Contents

[edit] RELATED EXTENSIONS

Please see the below pages for further documentation:

[edit] Installation

Copy the SelectCategoryTagCloud directory into the extensions folder of your MediaWiki installation. Then add the following line to your LocalSettings.php file (near the end):

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

[edit] Configuration

[edit] SelectCategoryTagCloud.body.php

The tag cloud paramters are configured at the top of SelectCategoryTagCloudFunctions.php. (These are going to be moved to LocalSettings.php in a future release.)

[edit] SelectCategoryTagCloudSuggest.php

Configure the database details for the AJAX server page at the top of SelectCategoryTagCloudSuggest.php. Because this is a basically a standalone webpage that is not included in any MediaWiki php pages, it doesn't have access to the configuration details in LocalSettings.php (which would include the database details).

This functionality has been replaced with the Mediawiki built-in AJAX framework.
--Lindele 17:27, 1 April 2008 (UTC)

[edit] Parameters

[edit] $wgSelectCategoryNamespaces

This is in the SelectCategoryTagCloud.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
 );

[edit] $wgSelectCategoryRoot

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.

[edit] Example
$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
  );

[edit] $wgSelectCategoryEnableSubpages

Defines if the extension should be active when editing subpages.

[edit] Example
$wgSelectCategoryEnableSubpages = false;

[edit] To Do

  • Move SelectCategoryTagCloudSuggest.php configuration for database access into Mediawiki framework to simplify configuration --Completed, Lindele 17:27, 1 April 2008 (UTC)
  • Move configuration of tag cloud parameters from SelectCategoryTagCloudFunctions.php into LocalSettings.php
  • Test i18n features

[edit] Versions

[edit] Version 1.2

  • Modified SelectCategoryTagCloudSuggest.php to remove extra } at end of file
  • Modified SELECT statement to ignore case of search terms
  • Changed trim() function (4x) to rtrim() in SelectCategoryTagCloudFunctions.php to allow for leading spaces to create sections on the page

[edit] Version 1.3

  • Removed SelectCategoryTagCloudSuggest.php file and moved functionality to Mediawiki AJAX framework
  • Improved typeahead display
  • Fixed bug "not recognising categories with a . (dot) in the name"
  • Clicking outside the suggest div removes the div that is displaying the suggestions and frees up the view on the tag cloud
  • Categories are not lost on "Preview" anymore, but stay in the input box


Document issues on http://www.mediawiki.org/wiki/Extension_talk:SelectCategoryTagCloud. Alternatively, you can reach me at - Andreas Rindler: <mediawiki at jenandi dot com>

[edit] Bugs on related extensions

See Extension SelectCategory bugs

[edit] Feature Requests

  • the extension automatically detects which categories are already associated with this article and inputs them into the Category field.

[edit] See Also

Extension:CategorySuggest

Personal tools