On Mon, Nov 22, 2010 at 11:57 PM, Brion Vibber <br...@pobox.com> wrote:

> On Mon, Nov 22, 2010 at 1:03 PM, Nicolas Vervelle <nverve...@gmail.com
> >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
> > handler
> > ? Especially for files of the same MIME type but that are not molecular
> > files ?
> >
>
> 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
> confusing.
>
> 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.
>

Oh, good, that's what I need for file types like CML (Chemical Markup
Language).
I will start working on the media handler only with this kind of files,
easier to begin with them.



> 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
> detection).
>
>
Ok, but detection of mime type for some chemical file formats will be quite
difficult.
Some file formats are just a list of atom coordinates with bonds (each line
is simply several numbers separated by a tab).
I will take a look at $wgMimeTypesFile or MimeMagic.php after I manage to
work with XML files.



>
>
> > 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
> > time,
> > 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.
>

Ok, thanks, I will try to understand how OggHandler works.

Nico
_______________________________________________
Wikitech-l mailing list
Wikitech-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to