Extension:GeoGebra

What can this extension do?
Add a GeoGebra applet to your MediaWiki page.

GeoGebra applets use Java technology to combine an interactive geometry environment with the ability to directly enter equations and coordinates making it very useful in math education and math explorations.

Add a GeoGebra Applet tag to your MediaWiki page
With GeoGebra 3.2.33.0 or later you can export a GeoGebra file to a wiki very comfortably.

Use the new Export function of GeoGebra:

Use File - Export - Dynamic Worksheet as Webpage... Then go to "Advanced" and choose "Clipboard:MediaWiki" (bottom right).

Paste the clipoard to your wiki in edit mode. Done! This will create a tag like this:

You do not have to upload ggb files like in version 2.0p!

You can also pass other GeoGebra applet parameters. Example:

Usage of useLocalJar = true/false
By default,. That means, geogebra.jar is fetched from www.geogebra.org.

If geogebra.jar is not found at www.geogebra.org or if  is set explicitly, geogebra.jar will be searched in the same directory as GeoGebra.php.

Example:

If there is no connection to the Internet, and the Wiki is installed on a local server (e.g. using XAMPP), UseLocalJar="true" can be used with benefit.

Usage of useSignedJar = true/false
The parameter 'useSignedJar' has precedence over parameter 'useLocalJar'. If useSignedJar='true', the signed JAR files from www.geogebra.org are used. Digital signing makes it possible for the GeoGebra applet to change to an application by doubleclicking. This application is able to write GGB files to the local hard disc.

Status changed to stable
Version 2.7 was tested with more then 6 wikis. See Examples.

There were no reports of critical errors, only minor changes (see history above).

So I decided to change status from beta to stable at 2011-03-05.

Here you find the old stable version 2.0p.

Download instructions
Please cut and paste the code found below and place it in.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

If you want your users to be able to use parameter useLocalJar=true, then upload the following files

from http://www.geogebra.org/webstart/unsigned/unpacked/ to.
 * geogebra.jar
 * geogebra_cas.jar
 * geogebra_export.jar
 * geogebra_gui.jar
 * geogebra_main.jar
 * geogebra_properties.jar

If you want to use fast loading of Java applets, also upload the following packed files

from http://www.geogebra.org/webstart/unsigned/packed/
 * geogebra.jar.pack.gz
 * geogebra_cas.jar.pack.gz
 * geogebra_export.jar.pack.gz
 * geogebra_gui.jar.pack.gz
 * geogebra_main.jar.pack.gz
 * geogebra_properties.jar.pack.gz

Make sure you use unsigned JAR files.

Installation
To install this extension, add the following to LocalSettings.php:

Changes from 1.0u to 2.0p
See Version 2.0p

Use of unsigned JAR files
Digitally signed JAR files were used by GeoGebra to allow an applet to "turn into an application" and write to the local hard disc. But some users were frightened by the security alerts caused by the digital signature. In addition, a digital signature uses to expire, causing the security alerts to look even more frightening. Markus Hohenwarter and his team decided to deliver new, unsigned JAR files. Now the applets cause no security alerts, but cannot save a GeoGebra (ggb) file. If you want to create and save a ggb file, you have to use GeoGebra as an application.

New parameter ggbBase64 replaces filename
Use of filename="foo.ggb" is easy, if the JAR fileand the GGB fileare in the same subdirectory. But things become more complicated, if the GGB file is for example in a file repository of a wiki. The mechanism of retrieving the path to the GGB file sometimes sucked. (Very hard to debug, if the wiki is not your own and you have no admin rights to install new versions of the extension.)

Using the new parameter ggbBase64, you cam pass the content of a GGB file as a base64-encoded String. No filename is needed. No upload is needed.

Change from 2.6m to 2.6n

 * Avoiding errors in apache error log, suggestion of PrimeMogul, see Bigvir

Change from 2.6n to 2.7c

 * Function url_exists was not reliable and caused some traffic at the GeoGebra server.
 * Function url_exists was deleted. If geogebra.jar is not found at www.geogebra.org, the browser (or the Java plugin) will generate an error message. (In version 2.6n the error message was generated by the PHP code of the extension.)

Change from 2.7c to 2.7f (Chrome error)

 * Some redundant CRLFs (Carriage return /Line feed) used by assembling the applet tag caused MediaWiki to render the tags in a wrong order: 2.7c: ... ... ...
 * Internet Explorer, Firefox, and Opera ignored this HTML syntax error, but not the Chrome browser.
 * 2.7f fixes this bug: 2.7f: ... ... ...

Change from 2.7f to 2.7g
The following code caused an error if the file with name $ggbBinary did not exist. $ggbFile = Image::newFromName($ggbBinary); if (!($ggbFile->exists)) {    $error_message = "File not found: ". $ggbFile; } The following code fixes this: $ggbFile = Image::newFromName($ggbBinary); if (!($ggbFile->exists)) {    $error_message = "File not found: ". $ggbBinary; }

Change from 2.7g to 2.7h
Using Image::newFromName($imgBinary) caused an error message with new versions of MediaWiki (maybe since version 1.18).

So I commented out lines 56-75. Parameter substimage will not often be used.

If anyone knows a substitute for the Image class, let me know.

Change from 2.7h to 2.7i
Adding this code: Suggested by Joejoebob. See discussion page.

Incompatibility with MediaWiki 1.19
Zbynek Konecny from the GeoGebra team told me that this line did not work after updating to MediaWiki 1.19 (line 61):
 * $ggbFile =  Image::newFromName($ggbBinary);

He told me to replace the line by
 * $ggbFile =  wfLocalFile($ggbBinary);

as a workaround.

I will fix the bug when I have time enough to test the fixed version. But for testing I will need a MediaWiki 1.19 with admin rights - not so easy to achieve. I think I will use XAMPP, but this all is time consuming.