Extension:Lexicon

What can this extension do?
This extension is based on Extension:Terminology and was further developed by WiiKno Inc. This extension allows wiki authors to define a collection of Term and their definitions using a template. Whenever that Term is found in a topic, it will be highlighted, linked to term definition and mousing over it will reveal the definition in a tool tip. Extension uses Walter Zorn's "JavaScript, DHTML Tooltips" library so you can customize the appearance of the tooltips.

Usage
By default, extension uses a template with the name “Term”. In the “Term” template it is expecting a parameter “Term” and a parameter “Definition”. In the “Term” field it is expected to have the 'term name' and in the “Definition” parameter it is expected to have definition of the term. It's also possible to override these default template name and default parameter names.

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
Currently tested on: Example : mysql -u root -p {MediaWiki database name} < Lexicon.sql Enter mysql root password when prompted require_once("$IP/extensions/Lexicon/Lexicon.php");
 * Mediawiki version 1.15.4
 * Mysql version Ver 14.12 Distrib 5.0.77 (other databases are not supported at this time)
 * Before enabling the Extension in Localsetting file, apply the mysql script located on extensions/Lexicon directory, script requires mysql root privileged access.
 * Creates a table “Lexicon_cache”
 * Create three Triggers on tables “revisions” and “templatelinks”
 * Enable extension using following line in Localsettings.php

mkdir -p extensions/tooltip
 * (Optional) If you wish to use the Javascript-based tooltips, you need to download Walter Zorn's "JavaScript, DHTML Tooltips" library (found at: here or there). Create the directory: extensions/tooltip.

And uncompress the archive "wz_tooltip.zip" into that directory. You should have the latest version of the library (version 5.13 at the time of this writing.) (At the end, you should have 3 files: extensions/tooltip/tip_centerwindow.js, extensions/tooltip/tip_followsscroll.js, and extensions/tooltip/wz_tooltip.js )

Configuration parameters
Optionally use following variables in LocalSettings.php file to override the Default names.

$wgTemplateName="{template name}"; $wgTermField="{parameter name used in template to indicate the term}"; $wgDefinitionField="{parameter name used in template to indicate definition of term}";

Startup Instructions (IMPORTANT)
On the first time running the extension, extension will build a cache of all the terms and their definitions. There after cache will be updated one term at time. If the number of terms found on the first run of extension is very large (thousands), it may take 30 seconds or more to build the cache. In this case, there will be error on MediaWiki view of Topic, as maximum allowed time to process a request is limited to 30 seconds in typical MediaWiki installtion. Therefore, maximum allowed time to process a request must be increased to build the entire cache for the first time.

Two variables limiting execution time in MediaWiki Need put time in second to a value sufficant to update full term cache
 * php.ini file “max_execution_time =”
 * httpd.conf file “php_value max_execution_time”

Once cache is build for the first time, these values can be revert back to default values.

Rebuild Cache
To rebuild the entire cache, after the initial setup, run following sql query on Mediawiki database. UPDATE `Lexicon_cache` SET `term` = 'reload' WHERE `id` =0;