On Mon, Nov 22, 2010 at 1:03 PM, Nicolas Vervelle <nvervelle(a)gmail.com>wrote;wrote:
Molecular files exist in several formats : pdb, cif,
mol, xyz, cml, ...
Usually they are detected as simple MIME types (either text/plain or
application/xml) by MediaWiki and not as more precise types (even if this
types exist : chemical/x-pdb, chemical/x-xyz, ...).
It seems that to register a Media handler, I have to add an entry to
$wgMediaHandlers : $wgMediaHandler['text/plain'] = 'MolecularHandler';
Will it be a problem to use such a general MIME type to register the
? Especially for files of the same MIME type but that are not molecular
You'd want to make sure the type detection correctly identifies your files
so you can associate the handler types, or it's going to make things
For XML files, you should usually be able to add to the $wgXMLMimeTypes
array, which by default recognizes the root elements for HTML, SVG, and Dia
vector drawings -- see the entries in DefaultSettings.php as examples. It
can recognize XML files by either bare or namespaced root element name, and
associates the files with the given MIME type.
For plaintext types that aren't currently recognized I'm not 100% sure how
best to proceed; might have to override $wgMimeTypesFile or even make some
changes to MimeMagic.php (the class that encapsulates most of the file type
I want to use the Jmol <http://www.jmol.org/>
applet for displaying the
molecule in 3d, and allowing the user to manipulate it.
But the applet is about 1M in size, so it takes time to load the first
then to start and load the molecular file.
I would like to start showing a still image (generated on the server) and a
button to let the user decide when loading the applet if interested in.
Several questions for doing this with MediaWiki :
- What hook / event should I use to be able to add this content in the
File:... page ?
- Is there a way to start displaying the File:... page, compute the still
image in the background,and add it in the File:... page after ?
- Are there any good practices for doing this kind of things ?
You might want to look at OggHandler as an example. It too needs to create
still-image thumbnails and delay loading of the actual video via Java
applet, direct embedding, or HTML 5 <video> tag, and hooks various spots in
order to do so.