Extension:UniversalSuggester

The extension Universal Suggester adds an extra icon to the edit form bar which simplifies the insertion of markup for page (and sections) links, categories, templates, images and media files. The user starts typing in the UniversalSuggester input field, the database is queried in the background and a list of matches is returned. The main difference to other link/category/... suggesters is the possibility to easily switch between different suggesters. Therefore only this extension is necessary to query multiple types of MediaWiki documents.

Requirements
This extension requires at least MediaWiki 1.13.0 and currently only works with the standard MediaWiki editor (the one with the blue button row, without any complex functionality).

Usage
To activate the suggester either click on the suggester icon (magnifying glass) in the edit toolbar or press Escape (Ctrl + Command also possible on a Mac). By default the link suggester is activated. This is also highlighted by the white background of the input field.

Switching between suggesters
To switch between suggesters, input a colon followed by
 * a (semantic attributes - if the extension Semantic MediaWiki is installed)
 * c (categories)
 * i (images)
 * f (files)
 * l (links)
 * r (transclusions)
 * t (templates)
 * u (users)

The input field will change its background color to mark the currently activated suggester.

Getting results
By typing a few letters a list of suggestions shows up. ''Note: It doesn't matter if the typed text appears at the beginning of a document name or in the middle of it. There's also no case sensitivity.'' The user can select a result by either clicking on it or move to the selection with the arrow keys and hit the Enter key. He might also just complete his current input with one of the suggestions by moving to it with the arrow keys and hit the Tab key. This way the selection is not directly inserted into the article field. This is useful if the user wants to use extra options as described in the following section.

Using extra options on completed terms
The suggesters,   and   offer the possibility to use the  -Char at the end of a completed entry to get specific results from that entry.

An example on that: By using the -Suggester the page name SecretOfLife was found and the term is placed in the UniversalSuggester input field. If the user adds the -Char (having now SecretOfLife#) a new type of suggestions is displayed: the sections of that page which are also selectable and insertable.

The -Suggester provides a list of super- and sub-categories and the  -Suggester a list of all possible params for this template.

For the - and  -Suggester it is also possible to use the  -Char in an empty input field, so that the current page is used as the basis for results. E.g. showing the page sections or the page categories.

Setup
Go to the method  in    and modify the variables   (suggesters in use) and   (namespaces to check for queries) to fit your needs.

Download instructions
Please download the extension from SVN or unzip the zip place the files into the extensions folder:. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

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

Credits
This extension uses the fabulous jquery library (v1.4.2). Additionally a slightly modified version of the jQuery plugin Autocomplete 1.0.2 by Dylan Verheul, Dan G. Switzer, Anjesh Tuladhar, Jörn Zaefferer is used.

Also many thanks to the Twoonix Software GmbH for financial support and critical feedback which helped me a lot to finally make the code public.