Extension:CategorySuggest

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

Release status: stable

CategorySuggest v1.1.png
Implementation Page action
Description Adds input box to edit and upload page which allows users to assign categories to the article. When a user starts typing the name of a category, the extension queries the database to find categories that match the user input
Author(s) Maintainer: Adam Franco,
Author: Andreas Rindler (Adamfrancotalk)
Latest version 1.3 (2013-03-26)
MediaWiki 1.18-1.20x
License GPLv2+
Download
Hooks used
EditPage::showEditForm:initial

EditPage::attemptSave
UploadForm:initial
UploadForm:BeforeProcessing
OutputPageParserOutput
LoadAllMessages

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

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

Adds input box to edit and upload page which allows users to assign categories to the article. When a user starts typing the name of a category, the extension queries the database to find categories that match the user input.

Extension appears to match by prefix only, so on the LabView wiki, typing "bugs" does not offer "LabView bugs".

This extension has been extracted from the code in Extension:SelectCategoryTagCloud.

Bugs/Errors[edit | edit source]

Please see the GitHub issue tracker to view or report bugs.

Conflicts with other extensions[edit | edit source]

These are not errors per se, as the extension works with the following extensions, and they work as they are intended as well, but you may have error messages when using the functions of the following extensions (after the extension has been used, to be exact):

The error messages may be ignored, as these extensions use similar functions as the Category Suggest extension, which causes the error report, but repeated testing has shown no anomalies when using these extensions, and they may be installed safely on the same installation without causing any known instability.

If you do not wish to see these error messages, add the following at the end of your LocalSettings.php file.

error_reporting( E_ALL & ~( E_STRICT | E_NOTICE ) );

Usage[edit | edit source]

Download instructions[edit | edit source]

Please clone or download the extension from GitHub and place the files into the extensions folder: $IP/extensions/CategorySuggest/. Note: $IP stands for the root directory of your mediawiki installation, the same directory that holds LocalSettings.php.

Installation[edit | edit source]

To install this extension, add the following to LocalSettings.php:

require_once("$IP/extensions/CategorySuggest/CategorySuggest.php");

Old To Do List[edit | edit source]

Please add feature requests or bugs to the GitHub issue tracker.

  • Configure the MediaWiki database credentials in CategorySuggestSuggest.php.

If necessary, customise the location of the CategorySuggestSuggest.php file on your webserver in CategorySuggest.js. (Obsolete, Lindele 17:49, 10 March 2008 (UTC))

  • Categories disappear after clicking on 'Preview' (Completed, Lindele 18:04, 10 March 2008 (UTC))
  • Modify SQL query to allow search for multiple terms (currently search ignores everything after a user entered a space character) (Completed, Lindele 17:49, 10 March 2008 (UTC))
  • Add event to resultsdiv so that hitting ESC clears the div (Completed. ESC not working, but a mouse click outside the results area will clear it (Kudos to Jared Milbank), Lindele 17:49, 10 March 2008 (UTC))
  • Change resultsdiv to display in block (one single column) (Completed, Lindele 17:49, 10 March 2008 (UTC))
  • Make resultsdiv navigateable. Google suggest and other sites allow users to navigate the results list with the arrow keys.
  • Highlight matching characters of user input with results list (user types MI and all results matching MI have the MI part of the word in bold or different color) (Completed (Kudos to Jared Milbank), Lindele 17:49, 10 March 2008 (UTC))
  • Move CategorySuggestSuggest.php page to a Mediawiki Query API based solution. Need to extend API to enable that feature. (Completed (Kudos to Jared Milbank), Lindele 17:49, 10 March 2008 (UTC))
  • Optimise for large category sets. If this extension would be run against Wikipedia, it would be choked by the large number of categories.
  • Adds a space after a </nowiki> tag for each time the page is edited (Completed, Lindele 17:49, 10 March 2008 (UTC))
  • Adds a line break before each <nowiki> tag for each time the page is edited,
  • It is tricky to use with <includeonly> and <noinclude>tags, (perhaps there should be a user preference to turn it off, so they can prevent pages being parsed)
  • Categories with characters other than spaces, letters and numbers are not found on the page (e.g. ".", "-") (Completed, Lindele 17:49, 10 March 2008 (UTC))
  • Category lookup is case-sensitive (Completed, Lindele 17:49, 10 March 2008 (UTC))
  • Hard to use with | to reorder categories,
  • Sometimes does not show categories that have just been added (caching issue),
  • does not look up categories including some special characters when you type them (e.g. &),
  • Inserts some special characters in markup format (e.g. & becomes &amp ;),
  • Form should be created by javascript extension so it is not presented to users without javascript (Completed (Kudos Jared Milbank), Lindele 17:49, 10 March 2008 (UTC))
  • Soeren notes that the suggestions are currently sent with no charset specified (Changed to use AJAX API, retest of this bug required, Lindele 17:49, 10 March 2008 (UTC))
  • this extension seems to disable the special:allmessages function: the page comes up blank. I'm not sure if this is a local issue of mine.. [Friso]
  • Adding a space after a semicolon to separate categories is often done by users but it results in no categories suggested as it assumes you are looking for a category that starts with space.
  • When using category suggest with the new mediawiki editor (in 1.18) if 'Enable navigable table of contents' is enabled category suggest duplicates any category tags in a page every time it is saved.

See also[edit | edit source]