# Interactive labs (Java applet)/MediWiki JAR support

This page discusses and coordinates the effort to add JAR file support to MediaWiki.

## Integration of an applet in a wiki

* See for example:
** http://www.earthdawn-wiki.de/Wiki.jsp?page=AppletPlugin , the fixed version at the bottom of this page: http://jspwiki.org/wiki/SebastianBaltes
** http://moinmoin.wikiwikiweb.de/OliverGraf/TWikiDrawPlugin
** http://twiki.org/cgi-bin/view/Plugins/JGraphpadPluginDev
And yes, there are much much more uses for applets in Wikiversity than simply science labs. You can have a chat box for students, quiz applets, shared whiteboards, concept mapping, games, etc.
I would like to see a chat forum for people setting up and creating stuff at wikiversity. IRC is nice, but so few know about it or how to use an irc client and connect to an irc server.
Also, it would be nice if applets could have some sort of access to the database, or at least be able to email data. So for example students could submit a quiz or an essay.
DouglasHolton 19:07, 23 September 2006 (UTC)
    That is great information! Do you know which one of those wikis uses PHP as MediaWiki does? It seems for instance that JSPWiki can easily integrate applets, since it's based on JSP.
    I also had bigger plans for those applets than just simulations. For instance, a study or note book into which one can cut-and-paste results would be nice, too. Awolf002 21:27, 23 September 2006 (UTC)

### Applet tag in wiki

Proposal: (See also first link in above list) [[Applet:WaveApplet.jar|code=org.wikiversity.curator.WaveApplet|align=center|Language=en]]
Parameters:
* Applet:XXX.jar: The JAR archive containing the applet, uploaded to the server's DB.
* Code="org.Wikiversity.xxx.Xyz": Class name of applet to start
* Align : Align image of applet inside page.
* Width : Width of image of applet in pixels.
* Height: Height of image of applet in pixels.
* all other parameters are just passed to the HTML by adding
<param name="name" value="value"> which includes the Language parameter to select the language used within the applet.

### Steps towards applet support

* Add new PHP file Applet.php (similar to Image.php) to support all functions needed to make the above tag work. This includes generation of the HTML text, DB interactions, and signature verification (see below).

## Uploading of new JAR files

To avoid malware and other unwanted code being downloaded to a learner's web browser, Wikiversity must have a trustworthy process of adding new, and updating any existing JAR file being served by MediaWiki. Here is a proposal to manage this step of the JAR creation process.

### Trusting the originator

Only a small set of selected, community-trusted learners should be allowed to upload JAR files to the server. Note: This does not limit the participation of all volunteers in creating these applets.

### Trusting the JAR file

In contrast to "signed JAR files", the Wikiversity files should be unsigned. This automatically forces the web browser to keep the executed code within the "Java sandbox", and limits the opportunities of the applet to access sensitive data on the learner's computer.
However, we do want to make sure that each JAR file is delivered by a trusted user, was not compromised in its integrity, and came from the user that claims to be the source. For this purpose, the MediaWiki upload page must require a GnuPG generated signature file, that signs the JAR file. It shall be generated with a trusted private key, certified by a "Bureaucrat" within Wikiversity. JAR files, either signed with an uncertified or revoked key or failing the signature test, must be rejected by the upload mechanism! The needed PHP API is available as a PECL extension. A user trusted to upload JAR files should be a Custodian that is elected by the community to also manage JAR files. (Proposed title for this function: Curator).
Additionally, to audit the integrity of the JAR file, the signature file should be saved on the server and all certified public keys shall be accessible to the learner. She can then check all code before it is potentially uploaded to her web browser.