Extension:Gadget-ImageAnnotator

From Biowikifarm Metawiki
Revision as of 21:11, 8 April 2011 by LiaVeja (Talk | contribs)

Jump to: navigation, search

ImageAnnotator is a JavaScript extension of the MediaWiki user interface, allowing users to place comments onto images shown on file description pages, similar to the "photo notes" on Flickr. This works on all image files for which the MediaWiki software displays a preview image on the file description page, i.e., PNG, JPG, GIF, and SVG files. Currently, the Annotator is installed on testwiki and Open Media repository.

Installation

ImageAnnotator might be installed like Gadget (per-user usage state - then an entrance into MediaWiki:Gadget-definition is necessary) or like any other JavaScript extension, by installing into MediaWiki: namespace component files. For emergencies cases(unexpected behavior or system crashes) the gadget MediaWiki:Gadget-DisableImageAnnotator.js is necessary to be enabled into MediaWiki:Gadget-definition. For editing annotations ImageAnnotator makes use of templates.

  1. Copy the following files on your system.

JavaScript files to be copied:

  • MediaWiki:Gadget-ImageAnnotator.js
  • MediaWiki:ImageAnnotatorConfig.js
  • MediaWiki:LAPI.js
  • MediaWiki:TextCleaner.js
  • MediaWiki:Tooltips.js
  • MediaWiki:UIElements.js
  • MediaWiki:AjaxSubmit.js
  • MediaWiki:Gadget-DisableImageAnnotator.js

Templates to be copied:

  • Template:ImageNote (replace "File" as appropriate)
  • Template:ImageNoteEnd
  • Template:ImageWithNotes
  • Template:ImageAnnotations
  • Template:InlineImageAnnotations
  • Template:ImageNoteControl
  • Template:ImageNoteColors

Message files used:

  • MediaWiki:ImageAnnotatorTexts
  • MediaWiki:ImageAnnotatorUITexts
  • MediaWiki:ImageAnnotatorEditSummaries
  1. Sets the variable $wgEnableAPI to true in LocalSettings.php
  2. Install the ParserFunctions extension
  3. Change the variable LAPI_file_store at the beginning of MediaWiki:LAPI.js on your wiki to match the image URLs served by your Wiki. For example, on OpenMedia:
 var LAPI_file_store = "(http?://species-id\\.net)?/o/media/";
  1. Adapt the configuration MediaWiki:ImageAnnotatorConfig.js on wiki is needed: For example, on OpenMedia:
if (wgNamespaceNumber != -1 && $.inArray(mw.config.get('wgAction'), ['view', 'purge']) != -1 ) {
 if (typeof ImageAnnotator_disable == 'undefined' || !ImageAnnotator_disable) {
 // Don't even import it if it's disabled.
 importScript('MediaWiki:Gadget-ImageAnnotator.js');
 }
}
    • Modify MediaWiki:ImageAnnotatorTexts to adapt it to your Wiki's default language;
    • Translate the texts in the edit summaries into the content language of the wiki language.