Extension talk:Jmol

To the author of this extension
This extension is built on Extension:StubManager but does not seem to really leverage its capabilities. Why bother with it then? Jean-Lou Dupont 10:53, 3 May 2008 (UTC)
 * Honestly, no real reason, this is my first extension and I just tried to work with StubManager. Do you think that I should modify it to be without the dependency ? --NicoV 16:53, 3 May 2008 (UTC)
 * Well, it depends what is your goal: is it to write more extensions? If YES, then you can consider getting more comfortable with StubManager or ExtensionManager because those can help you churn out extensions much faster. Jean-Lou Dupont 16:58, 3 May 2008 (UTC)
 * I removed the dependency on StubManager when I updated the extension to work with MW 1.16. So now, the Jmol extension can work on its own without any dependency. --NicoV 12:09, 27 November 2010 (UTC)

jmol no longer works with mediawiki
I'm using media 1.17 (but I think the same is going to happen to 1.16 and maybe 1.15). I installed StubManager and Jmol and I get the following error:

Warning: Parameter 1 to Jmol::tag_jmol expected to be a reference, value given in /var/www/mediawiki/extensions/StubManager/StubManager.php on line 783

removing the '&' references from the jmol.body.php file make the error go away but nothing is displayed (though I really don't know much php). --24.188.149.43
 * The Jmol extension has been updated to have no dependency on StubManager, and to work with MediaWiki 1.16. It should work correctly now. --NicoV 12:10, 27 November 2010 (UTC)

Jmol broken in Mediawiki 1.19
The fix is easy, though. On lines 354 and 692 of Jmol.body.php, you need to replace $file = new Image($title); with $file = wfFindFile($title);

Out of date documentation
@ NicoV Your last edit to the documentation was almost 5 years ago, and it seems like as though the documentation is now out-of-date as I have followed your instructions step-by-step, as has a staff member at Orain Wiki who was trying to set it up on a Wiki I requested from them, and we both failed (e.g., see https://meta.orain.org/wiki/Request_features#Jmol_extension_on_HMWiki if you'd like details of this staff member's effort). For me the biggest problem was the fact that whenever I added jmol-related tags (e.g., or 3EIG ) to a page and tried to save the page, I was left at a blank submit page (i.e., .../wiki/PAGENAME?action=submit (where PAGENAME is the name of the page where I was attempting to add said tags) was in the address bar with no page content whatsoever). I attempted adding these tags to a page on the orain wiki that was set-up for me (after they had tried to add this extension too) and encountered the same problem. I hope I don't seem antagonistic, as any help you can give me will be much appreciated. Fuse809 (talk) 18:01, 4 February 2015 (UTC)
 * Hi Fuse809, I haven't followed what has been done with the extension for quite some time (and if it's compatible with latest versions of MW). Right now, I'm travelling until mid February, so I can't do much until them. --NicoV (talk) 01:21, 6 February 2015 (UTC)


 * Dear Fuse809, if it helps I can confirm that JSmol works on MediaWiki 1.23.8 (LTS). For example see this page on SklogWiki --Carl McBride (talk) 18:44, 6 February 2015 (UTC)

Jmol extension, hope for continuation?
I am using Mediawiki 1.28 and I would like to use Jmol/Jsmol in my Mediawiki, but I have the feeling, that this extension is unfortunately no longer continued. Is there hope for resumption?

=Update for MediaWiki 1.32= I will (slowly) be testing a local installation of MediaWiki 1.32 to find out what changes are needed in the JSmol Extension. Among other things, MW1.32 needs PHP7, which brings changes in some functions. --AngelHerraez (talk) 20:41, 19 February 2019 (UTC)

The area below will be the temporary space for collecting my notes of editions needed in the page. When ready, I will move the changes to the page.

Installing Jmol extension
Note: The latest version of the Jmol extension has been tested against MediaWiki 1.32. There are significant changes in MediaWiki, so this procedure will not work with older versions.

To install the Jmol extension:
 * Download the latest stable release of Jmol
 * Extract into a temporary location the  file from the Jmol release.
 * Create a  folder in the   folder of your MediaWiki installation.
 * Extract into this  folder the following contents from the   file:
 * the  file,
 * the,   and   folders
 * Download all the source files of the Jmol extension and place them in the  folder.
 * Add the following line to your LocalSettings.php file (near the end):

Managing molecular files
MediaWiki authorizes the uploading of a very limited set of file types, based on file extensions and MIME types. By default, uploading molecular files is not authorized, so the configuration must be modified to take advantage of all the Jmol extension features.

Configuration of file uploading for MediaWiki can be quite complex and may also depend on the servers configuration hosting the wiki. You can read several MediaWiki manual pages for correctly configuring file uploading for your own MediaWiki setup:
 * Manual:Configuring file uploads
 * Manual:Mime type detection

First, you need to authorize new file extensions being uploaded in the wiki, using $wgFileExtensions.

For example, if you want to authorize uploading of CML files, you can add the following line in your LocalSettings.php file: You can check what file extensions are authorized in the Special:Upload page.

By default, the MIME type detection configuration of MediaWiki only detects molecular files as basic MIME types (,  , …). Having a more precise MIME type detection is better, especially for the Media Handler.

For molecular files formats based on XML, the MIME type detection can be enhanced using $wgXMLMimeTypes which allows the mapping between the root element of the file and the MIME type.

For example, for enhancing detection for CML files, you can add the following lines in your LocalSettings.php file:

Note: This description needs to be completed, especially for dealing with MIME types which is quite complex and depends on your server configuration.

By default, MediaWiki checks that the file extension matches the MIME type that has been detected. For this, MediaWiki uses the  file in MediaWiki installation. File extensions for molecular models are probably missing from this file by default, so you need to modify it.

For example,  can be detected as   or   (depending on your MIME type detection configuration), so you need to make the following additions to  : application/xml xml xsl xsd cml chemical/x-cml cml

Now that new file extensions being uploaded have been authorized, you can do a last modification so that molecular files are shown with a specific icon in categories (see example on the Jmol wiki). You can add an icon in the  folder for each extension for molecular files (for example  ). You can use.

Configuration
There are some options you can specify in your LocalSettings.php file (after the  line you've already added): Note: This list is not complete.
 * wgJmolAuthorizeJmolTag: Authorize the use of the  tag. Default is.
 * wgJmolAuthorizeJmolFileTag: Authorize the use of the  tag. Default is.
 * wgJmolAuthorizeJmolPdbTag: Authorize the use of the  tag. Default is  . Note: this tag requires the signed applet to be installed.
 * wgJmolAuthorizeJmolSmilesTag: Authorize the use of the  tag. Default is  . Note: this tag requires the signed applet to be installed.