Difference between revisions of "MediaWiki"

From Jmol
Jump to navigation Jump to search
(New format for jmol extension)
(Evolution of Jmol extension)
Line 21: Line 21:
  
 
'''''This following documentation is subject to change since the Jmol Extension is currently under development'''''
 
'''''This following documentation is subject to change since the Jmol Extension is currently under development'''''
 +
 +
== Simple usage ==
  
 
To add a Jmol applet to a MediaWiki page, just add the following:
 
To add a Jmol applet to a MediaWiki page, just add the following:
  
  <jmol>
+
  {{Tag|jmol}}
   <jmolApplet>
+
   {{Tag|jmolApplet}}
     <onlineContents>contents of the current.xyz file</onlineContents>
+
     {{Tag|onlineContents}}contents of the molecular file{{Tag|/onlineContents}}
    <script>script to execute</script>
+
  {{Tag|/jmolApplet}}
    <name>applet name</name>
+
{{Tag|/jmol}}
    <size>applet size</size>
+
 
     <color>applet background color</color>
+
or
   </jmolApplet>
+
 
  &lt;/jmol&gt;
+
{{Tag|jmol}}
 +
  {{Tag|jmolApplet}}
 +
     {{Tag|urlContents}}URL of the molecular file{{Tag|/urlContents}}
 +
   {{Tag|/jmolApplet}}
 +
  {{Tag|/jmol}}
  
 
To add buttons to send scripts to the applet, just add the following:
 
To add buttons to send scripts to the applet, just add the following:
  
  &lt;jmol&gt;
+
  {{Tag|jmol}}
   <jmolButton>
+
   {{Tag|jmolButton}}
     <script>script to execute</script>
+
     {{Tag|script}}script to execute{{Tag|/script}}
     <text>text of the button</text>
+
     {{Tag|text}}text of the button{{Tag|/text}}
    <name>applet name</name>
+
   {{Tag|/jmolButton}}
   </jmolButton>
+
  {{Tag|/jmol}}
  &lt;/jmol&gt;
 
  
 
Applets and buttons can be combined in a single &lt;jmol&gt; tag.
 
Applets and buttons can be combined in a single &lt;jmol&gt; tag.
 +
 +
== Reference ==
 +
 +
The {{Tag|jmol}} can contain the following:
 +
* {{Tag|jmolApplet}} : Jmol Applet.
 +
** {{Tag|signed}} (<tt>true</tt>, <tt>false</tt>) : On the first Jmol applet to use the signed or unsigned version of the applet. This attribute can be disabled by the Wiki administrator with the <tt>$wgJmolAuthorizeChoosingSignedApplet</tt> setting.
 +
** {{Tag|color}} : To change the background color of the Jmol applet.
 +
** {{Tag|urlContents}} : URL of the molecular file to load. This attribute can be disabled by the Wiki administrator with the <tt>$wgJmolAuthorizeUrl</tt> setting.
 +
** {{Tag|onlineContents}} : molecular data to load in the Jmol applet.
 +
** {{Tag|size}} : Size of the applet.
 +
** {{Tag|script}} : Script to execute at startup.
 +
** {{Tag|name}} : Name of the Jmol applet (useful if you want to use several Jmol applets in the same page).
 +
* {{Tag|jmolButton}} : Button.
 +
** {{Tag|script}} : Jmol script to execute when the button is clicked.
 +
** {{Tag|text}} : Text of the button.
 +
** {{Tag|name}} : Name of the Jmol applet linked with the button (useful if you want to use severak Jmol applets in the same page).
 +
  
 
= Installation =
 
= Installation =
Line 50: Line 72:
 
[http://www.jmol.org/files/ Download Jmol] and extract all the files in a temporary directory.
 
[http://www.jmol.org/files/ Download Jmol] and extract all the files in a temporary directory.
  
Create the directory <tt>Jmol</tt> in <tt>$mediawiki/extensions</tt>, and copy the following files in it:
+
Create the directory {{Directory|Jmol}} in {{Directory|$mediawiki/extensions}}, and copy the following files in it:
* <tt>COPYRIGHT.txt</tt>
+
* {{File|COPYRIGHT.txt}}
* <tt>Jmol.js</tt>
+
* {{File|Jmol.js}}
* <tt>JmolApplet_i18n.jar</tt>
+
* {{File|JmolApplet_i18n.jar}} and {{File|JmolApplet0.jar}} to {{File|JmolApplet6.jar}}
* <tt>JmolApplet0.jar</tt> to <tt>JmolApplet6.jar</tt>
+
* {{File|JmolAppletSigned_i18n.jar}} and {{File|JmolAppletSigned0.jar}} to {{File|JmolAppletSigned6.jar}}, if you want to be able to use the signed applet.
* <tt>LICENSE.txt</tt>
+
* {{File|LICENSE.txt}}
* <tt>README.txt</tt>
+
* {{File|README.txt}}
  
Add the following line to the end of <tt>LocalSettings.php</tt>:
+
 
 +
Add the following line to the end of {{File|LocalSettings.php}}:
 
  require_once('extensions/Jmol/JmolExtension.php');
 
  require_once('extensions/Jmol/JmolExtension.php');
  
Copy the following code and paste it into <tt>extensions/Jmol/JmolExtension.php</tt>:
+
 
 +
You can configure the Jmol extension with several settings added after the above line (default value in '''bold'''):
 +
* <tt>$wgJmolAuthorizeUrl</tt> (<tt>true</tt>, '''<tt>false</tt>''') : Authorize the use of {{Tag|urlContents}}.
 +
* <tt>$wgJmolAuthorizeChoosingSignedApplet</tt> (<tt>true</tt>, '''<tt>false</tt>''') : Authorize users to choose between the unsigned and the signed Jmol applet.
 +
* <tt>$wgJmolDefaultAppletSize</tt> ('''<tt>400</tt>''') : Size in pixels of the Jmol applet.
 +
* <tt>$wgJmolUsingSignedAppletByDefault</tt> (<tt>true</tt>, '''<tt>false</tt>''') : Choose if the signed Jmol applet will be used by default. ''Note: the signed Jmol applet is signed with a default certificat. If you want to use the signed Jmol applet in your wiki, I suggest resigning the Jmol applet with your own certificate.''
 +
 
 +
 
 +
Copy the following code and paste it into {{File|extensions/Jmol/JmolExtension.php}}:
  
 
  <pre><?php
 
  <pre><?php
Line 86: Line 117:
 
   
 
   
 
if (defined('MEDIAWIKI')) {
 
if (defined('MEDIAWIKI')) {
 +
 +
global $wgJmolAuthorizeUrl;
 +
global $wgJmolAuthorizeChoosingSignedApplet;
 +
global $wgJmolDefaultAppletSize;
 +
global $wgJmolUsingSignedAppletByDefault;
 +
 +
/* Global configuration parameters */
 +
$wgJmolAuthorizeUrl = false;
 +
$wgJmolAuthorizeChoosingSignedApplet = false;
 +
$wgJmolDefaultAppletSize = "400";
 +
$wgJmolUsingSignedAppletByDefault = false;
  
 
/* Class containing all the code for the Jmol Extension */
 
/* Class containing all the code for the Jmol Extension */
Line 92: Line 134:
 
   var $mCurrentObject, $mCurrentTag;
 
   var $mCurrentObject, $mCurrentTag;
  
 +
  var $mValColor;
 +
  var $mValName;
 
   var $mValOnlineContents;
 
   var $mValOnlineContents;
 
   var $mValScript;
 
   var $mValScript;
   var $mValName;
+
   var $mValSigned;
 
   var $mValSize;
 
   var $mValSize;
  var $mValColor;
 
 
   var $mValText;
 
   var $mValText;
 +
  var $mValUrlContents;
  
 
   function JmolExtension() {
 
   function JmolExtension() {
Line 124: Line 168:
  
 
   function renderJmolApplet() {
 
   function renderJmolApplet() {
 +
    global $wgJmolAuthorizeUrl;
 +
   
 
     $this->mValOnlineContents = trim($this->mValOnlineContents);
 
     $this->mValOnlineContents = trim($this->mValOnlineContents);
 
     $this->mValOnlineContents = preg_replace("/\t/", " ", $this->mValOnlineContents);
 
     $this->mValOnlineContents = preg_replace("/\t/", " ", $this->mValOnlineContents);
Line 129: Line 175:
 
     $this->mOutput .=
 
     $this->mOutput .=
 
       "<script src='/extensions/Jmol/Jmol.js'></script>\n".
 
       "<script src='/extensions/Jmol/Jmol.js'></script>\n".
       "<script>\n".
+
       "<script>\n";
       "jmolInitialize('/extensions/Jmol');\n".
+
    if ($this->mValSigned) {
 +
      $this->mOutput .= "jmolInitialize('/extensions/Jmol', true);\n";
 +
    } else {
 +
       $this->mOutput .= "jmolInitialize('/extensions/Jmol', false);\n";
 +
    }
 +
    $this->mOutput .=
 
       "jmolCheckBrowser('popup', '/extensions/Jmol/browsercheck', 'onClick');\n".
 
       "jmolCheckBrowser('popup', '/extensions/Jmol/browsercheck', 'onClick');\n".
       "jmolSetAppletColor('".$this->mValColor."');\n".
+
       "jmolSetAppletColor('".$this->mValColor."');\n";
       "jmolAppletInline(".$this->mValSize.", \n'".
+
    if (($this->mValUrlContents != "") && ($wgJmolAuthorizeUrl == true)) {
                           $this->mValOnlineContents."', \n'".
+
      $this->mOutput .=
                           $this->mValScript."', \n'".
+
        "jmolApplet(".$this->mValSize.", \n".
                          $this->mValName."');\n".
+
                    "'load ".$this->mValUrlContents."; ".$this->mValScript."'";
 +
    } else {
 +
       $this->mOutput .=
 +
        "jmolAppletInline(".$this->mValSize.", \n".
 +
                           "'".$this->mValOnlineContents."', \n".
 +
                           "'".$this->mValScript."'";
 +
    }
 +
    if ($this->mValName != "") {
 +
      $this->mOutput .= ",\n'".$this->mValName."'";
 +
    }
 +
    $this->mOutput .=
 +
      ");\n".
 
       "jmolBr();\n".
 
       "jmolBr();\n".
 
       "</script>\n";
 
       "</script>\n";
Line 142: Line 204:
  
 
   function renderJmolButton() {
 
   function renderJmolButton() {
 +
    $this->mOutput .= "<script>\n";
 +
    if ($this->mValName != "") {
 +
      $this->mOutput .= "jmolSetTarget('".$this->mValName."');\n";
 +
    }
 
     $this->mOutput .=
 
     $this->mOutput .=
      "<script>\n".
+
       "jmolButton('".$this->mValScript."', '".$this->mValText."');\n".
      "jmolSetTarget('".$this->mValName."');\n".
 
       "jmolButton('".$this->mValScript."', '".$this->mValText."');\n" .
 
 
       "</script>\n";
 
       "</script>\n";
 
   }
 
   }
Line 194: Line 258:
  
 
   function characterData($parser, $data) {
 
   function characterData($parser, $data) {
 +
    global $wgJmolAuthorizeChoosingSignedApplet;
 +
   
 
     switch ($this->mDepth) {
 
     switch ($this->mDepth) {
 
     case 3:
 
     case 3:
 
       // Details of the interesting tags
 
       // Details of the interesting tags
 
       switch ($this->mCurrentTag) {
 
       switch ($this->mCurrentTag) {
 +
      case "COLOR":
 +
        $this->mValColor = $data;
 +
        break;
 +
      case "NAME":
 +
        $this->mValName = $data;
 +
        break;
 
       case "ONLINECONTENTS":
 
       case "ONLINECONTENTS":
 
         $data = trim($data);
 
         $data = trim($data);
Line 207: Line 279:
 
         $this->mValScript = $data;
 
         $this->mValScript = $data;
 
         break;
 
         break;
       case "NAME":
+
       case "SIGNED":
         $this->mValName = $data;
+
         if ($wgJmolAuthorizeChoosingSignedApplet) {
 +
          $this->mValSigned = $data;
 +
        }
 
         break;
 
         break;
 
       case "SIZE":
 
       case "SIZE":
 
         $this->mValSize = $data;
 
         $this->mValSize = $data;
        break;
 
      case "COLOR":
 
        $this->mValColor = $data;
 
 
         break;
 
         break;
 
       case "TEXT":
 
       case "TEXT":
 
         $this->mValText = $data;
 
         $this->mValText = $data;
 +
        break;
 +
      case "URLCONTENTS":
 +
        $this->mValUrlContents = $data;
 
         break;
 
         break;
 
       }
 
       }
Line 225: Line 299:
  
 
   function resetValues() {
 
   function resetValues() {
 +
    global $wgJmolDefaultAppletSize;
 +
    global $wgJmolUsingSignedAppletByDefault;
 +
   
 
     $this->mCurrentObject = "";
 
     $this->mCurrentObject = "";
 
     $this->mCurrentTag = "";
 
     $this->mCurrentTag = "";
 +
    $this->mValColor = "black";
 +
    $this->mValName = "";
 
     $this->mValOnlineContents = "";
 
     $this->mValOnlineContents = "";
 
     $this->mValScript = "";
 
     $this->mValScript = "";
     $this->mValName = "JmolWiki";
+
     $this->mValSigned = $wgJmolUsingSignedAppletByDefault;
     $this->mValSize = "400";
+
     $this->mValSize = $wgJmolDefaultAppletSize;
    $this->mValColor = "black";
 
 
     $this->mValText = "";
 
     $this->mValText = "";
 +
    $this->mValUrlContents = "";
 
   }
 
   }
 
};
 
};
Line 241: Line 320:
 
   'author'      => 'Nicolas Vervelle, Jmol Development Team'
 
   'author'      => 'Nicolas Vervelle, Jmol Development Team'
 
);
 
);
 
$wgJmolExtension = new JmolExtension;
 
  
 
/* Test to modify between Dev and Release versions */
 
/* Test to modify between Dev and Release versions */
 
if (true) {
 
if (true) {
 
   $wgExtensionFunctions[] = "wfJmolExtension";
 
   $wgExtensionFunctions[] = "wfJmolExtension";
 +
 +
  $wgJmolExtension = new JmolExtension;
  
 
   function wfJmolExtension() {
 
   function wfJmolExtension() {
Line 259: Line 338:
 
} else {
 
} else {
 
   $wgExtensionFunctions[] = "wfJmolDevExtension";
 
   $wgExtensionFunctions[] = "wfJmolDevExtension";
 +
 +
  $wgJmolDevExtension = new JmolDevExtension;
  
 
   function wfJmolDevExtension() {
 
   function wfJmolDevExtension() {
Line 266: Line 347:
  
 
   function wfRenderJmolDev($input) {
 
   function wfRenderJmolDev($input) {
     global $wgJmolExtension;
+
     global $wgJmolDevExtension;
     return $wgJmolExtension->renderJmol($input);
+
     return $wgJmolDevExtension->renderJmol($input);
 
   }
 
   }
 
}
 
}

Revision as of 21:11, 12 April 2006

Description

MediaWiki is an open source wiki engine licensed under the GNU General Public License. It is used by many websites, including this one.

The Jmol Mediawiki Extension enables the use of the Jmol applet inside of Mediawiki pages. This simple page demonstrates how to use the extension.

Note: The Jmol Mediawiki Extension is currently under development. It will go under several changes, different versions will probably be incompatible between each other


Wikis using the Jmol Extension

If you know a Wiki using the Jmol MediaWiki Extension, please add it in the following list:


How to use the Jmol Extension

Once the Jmol Extension is installed in the Wiki, you can start adding Jmol applets and controls.

This following documentation is subject to change since the Jmol Extension is currently under development

Simple usage

To add a Jmol applet to a MediaWiki page, just add the following:

<jmol>
  <jmolApplet>
    <onlineContents>contents of the molecular file</onlineContents>
  </jmolApplet>
</jmol>

or

<jmol>
  <jmolApplet>
    <urlContents>URL of the molecular file</urlContents>
  </jmolApplet>
</jmol>

To add buttons to send scripts to the applet, just add the following:

<jmol>
  <jmolButton>
    <script>script to execute</script>
    <text>text of the button</text>
  </jmolButton>
</jmol>

Applets and buttons can be combined in a single <jmol> tag.

Reference

The <jmol> can contain the following:

  • <jmolApplet> : Jmol Applet.
    • <signed> (true, false) : On the first Jmol applet to use the signed or unsigned version of the applet. This attribute can be disabled by the Wiki administrator with the $wgJmolAuthorizeChoosingSignedApplet setting.
    • <color> : To change the background color of the Jmol applet.
    • <urlContents> : URL of the molecular file to load. This attribute can be disabled by the Wiki administrator with the $wgJmolAuthorizeUrl setting.
    • <onlineContents> : molecular data to load in the Jmol applet.
    • <size> : Size of the applet.
    • <script> : Script to execute at startup.
    • <name> : Name of the Jmol applet (useful if you want to use several Jmol applets in the same page).
  • <jmolButton> : Button.
    • <script> : Jmol script to execute when the button is clicked.
    • <text> : Text of the button.
    • <name> : Name of the Jmol applet linked with the button (useful if you want to use severak Jmol applets in the same page).


Installation

Download Jmol and extract all the files in a temporary directory.

Create the directory Jmol in $mediawiki/extensions, and copy the following files in it:

  • File icon.gifCOPYRIGHT.txt
  • File icon.gifJmol.js
  • File icon.gifJmolApplet_i18n.jar and File icon.gifJmolApplet0.jar to File icon.gifJmolApplet6.jar
  • File icon.gifJmolAppletSigned_i18n.jar and File icon.gifJmolAppletSigned0.jar to File icon.gifJmolAppletSigned6.jar, if you want to be able to use the signed applet.
  • File icon.gifLICENSE.txt
  • File icon.gifREADME.txt


Add the following line to the end of File icon.gifLocalSettings.php:

require_once('extensions/Jmol/JmolExtension.php');


You can configure the Jmol extension with several settings added after the above line (default value in bold):

  • $wgJmolAuthorizeUrl (true, false) : Authorize the use of <urlContents>.
  • $wgJmolAuthorizeChoosingSignedApplet (true, false) : Authorize users to choose between the unsigned and the signed Jmol applet.
  • $wgJmolDefaultAppletSize (400) : Size in pixels of the Jmol applet.
  • $wgJmolUsingSignedAppletByDefault (true, false) : Choose if the signed Jmol applet will be used by default. Note: the signed Jmol applet is signed with a default certificat. If you want to use the signed Jmol applet in your wiki, I suggest resigning the Jmol applet with your own certificate.


Copy the following code and paste it into File icon.gifextensions/Jmol/JmolExtension.php:

<?php

/*
 * Copyright (C) 2006 Nicolas Vervelle,  The Jmol Development Team
 *
 * Contact: nico@jmol.org, jmol-developers@lists.sf.net
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
if (defined('MEDIAWIKI')) {

global $wgJmolAuthorizeUrl;
global $wgJmolAuthorizeChoosingSignedApplet;
global $wgJmolDefaultAppletSize;
global $wgJmolUsingSignedAppletByDefault;

/* Global configuration parameters */
$wgJmolAuthorizeUrl = false;
$wgJmolAuthorizeChoosingSignedApplet = false;
$wgJmolDefaultAppletSize = "400";
$wgJmolUsingSignedAppletByDefault = false;

/* Class containing all the code for the Jmol Extension */
class JmolExtension {
  var $mOutput, $mDepth;
  var $mCurrentObject, $mCurrentTag;

  var $mValColor;
  var $mValName;
  var $mValOnlineContents;
  var $mValScript;
  var $mValSigned;
  var $mValSize;
  var $mValText;
  var $mValUrlContents;

  function JmolExtension() {
    $this->mOutput = "";
    $this->mDepth = 0;
    $this->resetValues();
  }

  function renderJmol($input) {
    $this->mOutput = "";
    $this->mDepth = 0;
    $xmlParser = xml_parser_create();
    xml_set_object($xmlParser, &$this);
    xml_set_element_handler($xmlParser, "startElement", "endElement");
    xml_set_character_data_handler($xmlParser, "characterData");
    $input = "<jmol>$input<jmol>";
    if (!xml_parse($xmlParser, $input)) {
      die(sprintf(
        "XML error: %s at line %d",
        xml_error_string(xml_get_error_code($xmlParser)),
        xml_get_current_line_number($xmlParser)));
    }
    xml_parser_free($xmlParser);
    return $this->mOutput;
  }

  function renderJmolApplet() {
    global $wgJmolAuthorizeUrl;
    
    $this->mValOnlineContents = trim($this->mValOnlineContents);
    $this->mValOnlineContents = preg_replace("/\t/", " ", $this->mValOnlineContents);
    $this->mValOnlineContents = preg_replace("/\n/", "\\n'+\n'", $this->mValOnlineContents);
    $this->mOutput .=
      "<script src='/extensions/Jmol/Jmol.js'></script>\n".
      "<script>\n";
    if ($this->mValSigned) {
      $this->mOutput .= "jmolInitialize('/extensions/Jmol', true);\n";
    } else {
      $this->mOutput .= "jmolInitialize('/extensions/Jmol', false);\n";
    }
    $this->mOutput .=
      "jmolCheckBrowser('popup', '/extensions/Jmol/browsercheck', 'onClick');\n".
      "jmolSetAppletColor('".$this->mValColor."');\n";
    if (($this->mValUrlContents != "") && ($wgJmolAuthorizeUrl == true)) {
      $this->mOutput .=
        "jmolApplet(".$this->mValSize.", \n".
                    "'load ".$this->mValUrlContents."; ".$this->mValScript."'";
    } else {
      $this->mOutput .=
        "jmolAppletInline(".$this->mValSize.", \n".
                          "'".$this->mValOnlineContents."', \n".
                          "'".$this->mValScript."'";
    }
    if ($this->mValName != "") {
      $this->mOutput .= ",\n'".$this->mValName."'";
    }
    $this->mOutput .=
      ");\n".
      "jmolBr();\n".
      "</script>\n";
  }

  function renderJmolButton() {
    $this->mOutput .= "<script>\n";
    if ($this->mValName != "") {
      $this->mOutput .= "jmolSetTarget('".$this->mValName."');\n";
    }
    $this->mOutput .=
      "jmolButton('".$this->mValScript."', '".$this->mValText."');\n".
      "</script>\n";
  }

  function startElement($parser, $name, $attrs) {
    $this->mDepth += 1;
    switch ($this->mDepth) {
    case 1:
      // JMOL tag itself
      $this->resetValues();
      break;
    case 2:
      // The interesting tags
      $this->resetValues();
      $this->mCurrentObject = $name;
      break;
    case 3:
      // Details of the interesting tags;
      $this->mCurrentTag = $name;
    }
  }

  function endElement($parser, $name) {
    switch ($this->mDepth) {
    case 1:
      // JMOL tag itself
      $this->resetValues();
      break;
    case 2:
      // The interesting tags
      switch ($this->mCurrentObject) {
      case "JMOLAPPLET":
        $this->renderJmolApplet();
        break;
      case "JMOLBUTTON":
        $this->renderJmolButton();
        break;
      }
      $this->resetValues();
      break;
    case 3:
      // Details of the interesting tags
      $this->mCurrentTag = "";
      break;
    }
    $this->mDepth -= 1;
  }

  function characterData($parser, $data) {
    global $wgJmolAuthorizeChoosingSignedApplet;
    
    switch ($this->mDepth) {
    case 3:
      // Details of the interesting tags
      switch ($this->mCurrentTag) {
      case "COLOR":
        $this->mValColor = $data;
        break;
      case "NAME":
        $this->mValName = $data;
        break;
      case "ONLINECONTENTS":
        $data = trim($data);
        if ($data != "") {
          $this->mValOnlineContents .= "\n" . $data;
        }
        break;
      case "SCRIPT":
        $this->mValScript = $data;
        break;
      case "SIGNED":
        if ($wgJmolAuthorizeChoosingSignedApplet) {
          $this->mValSigned = $data;
        }
        break;
      case "SIZE":
        $this->mValSize = $data;
        break;
      case "TEXT":
        $this->mValText = $data;
        break;
      case "URLCONTENTS":
        $this->mValUrlContents = $data;
        break;
      }
      break;
    }
  }

  function resetValues() {
    global $wgJmolDefaultAppletSize;
    global $wgJmolUsingSignedAppletByDefault;
    
    $this->mCurrentObject = "";
    $this->mCurrentTag = "";
    $this->mValColor = "black";
    $this->mValName = "";
    $this->mValOnlineContents = "";
    $this->mValScript = "";
    $this->mValSigned = $wgJmolUsingSignedAppletByDefault;
    $this->mValSize = $wgJmolDefaultAppletSize;
    $this->mValText = "";
    $this->mValUrlContents = "";
  }
};

$wgExtensionCredits['other'][] = array(
  'name'        => 'Jmol Extension for MediaWiki',
  'description' => 'adds the possibility to include Jmol applets in MediaWiki.',
  'author'      => 'Nicolas Vervelle, Jmol Development Team'
);

/* Test to modify between Dev and Release versions */
if (true) {
  $wgExtensionFunctions[] = "wfJmolExtension";

  $wgJmolExtension = new JmolExtension;

  function wfJmolExtension() {
    global $wgParser;
    $wgParser->setHook( "jmol", "wfRenderJmol" );
  }

  function wfRenderJmol($input) {
    global $wgJmolExtension;
    return $wgJmolExtension->renderJmol($input);
  }
} else {
  $wgExtensionFunctions[] = "wfJmolDevExtension";

  $wgJmolDevExtension = new JmolDevExtension;

  function wfJmolDevExtension() {
    global $wgParser;
    $wgParser->setHook( "jmolDev", "wfRenderJmolDev" );
  }

  function wfRenderJmolDev($input) {
    global $wgJmolDevExtension;
    return $wgJmolDevExtension->renderJmol($input);
  }
}

}
?>


External links