Mathematics tools

New Geogebra plugin

 
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
Picture of Mauno Korpelainen
New Geogebra plugin
 

I have managed to create a tinymce plugin that can be used to edit geogebra applets directly online (like JSXGraph/GeoNext-plugin) and save the result as a base64 string (like ggb-files)

Geogebra

There is however one "problem" - if the strings are opened with JSXGraphs and GeogebraReader.js they are crossbrowser compatible but GeogebraReader does not support all options of Geogebra. On the other hand if I set a filter to change strings to Geogebra applets in moodle we have that old Java problem, all those nice mobile and tablet devices do not support Java. And mobile Geogebra is not ready yet...

Any suggestions? Should I use 2 buttons: "Insert applet" and "Insert JSXGraph" in the place of "Insert image" and let users choose which format to save?

One benefit of tinymce plugin compared to plain Geogebra filter is that the plugin can be modified to set most settings of Geogebra applets or GeogebraReader scripts (in tabs) - but ggb files can also be opened directly from local computers from File menu in applet toolbar...

 
Average of ratings: Useful (2)
Picture of Jean-Michel Védrine
Re: New Geogebra plugin
Group Core developersGroup Plugin developers

Hello Mauno,

When I saw your message, I was thinking to let other answer first, but as nobody answers...

First let me say I found this very interesting.Thanks a lot for doing this.

Personnaly I would use the Insert JSXGraph button a lot because more and more of my students are using tablets and smartphones. But it would be good to have the choice. So my vote goes for the 2 buttons.

 
Average of ratings: -
Picture of Ketan Deore
Re: New Geogebra plugin
 

Hello Mauno

First Really Thanks to make the maths Tools.as per your instruction in forum i insert maths plugin in Moodle 2.3 , but when i open the Wiris plugin there is some Error are popup.

Error : Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/iitpace/public_html/lib/editor/tinymath/tiny_mce/3.4.9/plugins/tiny_mce_wiris/integration/editor.php:2) in /home/iitpace/public_html/lib/sessionlib.php on line 184

Please help Me,,


 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

Is it possible to do this as a cross browser fallback? Let a script determine whether geogebra is capable of loading and if not try to load GeogebraReader.js instead.  It may or may not load on all devices, but if you want students to be able to use this plugin, I don't think it is reasonable to expect them to be able to determine which is the appropriate button to press. Most users don't know Java from Javascript.

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

It might be possible to create such a fallback. I just need to change the filter to check first if java is enabled in browser (with javascript because server side php can't detect java) and if java is enabled output java applet and if not enabled use geogebrareader.js

The plugin saves a string anyway with delimiters. On the other hand it might be good to add some optional parameter to force a jsxgraph instead of geogebra applet because javascript based graphs are faster to render than applets.

I must test if it works during the weekend and send you the package for testing on Saturday or Sunday

 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

I have played a little with the idea of having javascript translate all the embedded links to geobebra files into jsxgraphs only to find that javascript alone could not do this for security reasons (GeogebraReader loads files from the same directory).

I realized your initial question is not trivial.  There are different contexts that are appropriate for jsxgraph and geobebra. It might be good to have the extra functionality of geobebra available to teachers and as assignments for students. However, I question whether it may be appropriate to have geobebra easily accessible in a forum where a reader might have forty java applets on a page. Geobebra has a much higher perfomance cost than than jsxgraph.  The two buttons are not the same. Previously this sort of thing was controlled by the teacher/administrator through the enableing/disabling of filters (Dragmath/TeX filter). The buttons that you have are presumably controlled by an administrator by not installing the editor plugin, but it should be controlled also by the teacher enabling the student to see both, either or neither of the buttons.

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

It is possible to make the plugin either totally role based (so that students do not see the button in editor toolbar) or to enable the filter only context based (leave it available but not enabled site wide) so that all users of context (for example course where teacher has enabled the filter) can see the button in editor toolbar and filtered strings are changed to JSXGraphs with GeogebraReader.js

You are right - I too would not like to see 20 applets loading in forum big grin

The plugin is not using files at all - it is saving all data from Geogebra applet in plugin as a plain base64 string inside delimiters, a filter changes these strings to JSXGraph script tags and GeogebraReader.js is used to render the JSXGraphs. When you need to edit the graph, the plugin renders a Geogebra applet using the selected string - temporarely saved to a place holder (image) alt tag - and you are ready to use fully functional Geogebra applet to edit it. Or to open some external ggb file or save your content from plugin to a local ggb file, upload it as file to your site and use normal geogebra filter to render the file. But the plugin is not saving files to server - only strings to database.

Detection of Java in browser is as simple as

<script>
if (navigator.javaEnabled()) {do something};
</script>

but it may not be good enough because we need to detect also a proper version of Java ( Geogebra 4 requires Java 5+ ) and there are issues like https://addons.mozilla.org/en-US/firefox/blocked/p182 and finally we might need to use object tags with Geogebra... if possible.

Time-out required wink

 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

The navigator.javaEnabled() method should be all you need. I would not bother with checking the Java version.  Firefox disables Java automatically because of the vunerability so javaEnabled should be false in that case and using Geogebra with an outdated plugin or browser is probably not a security issue.  If Geogebra will not run because of Java, users should be prompted to upgrade Java or they can disable Java manually and go with Jsxgraph which may be good for them again for security reasons.

My question is if inserting a string is what you are doing for the editor plugin thus enabling support for mobile devices, couldn't this be done also by the geobebra filter. In which case the plugin does not need to distinguish between whether it outputs a jsxgraph string or a geobebra file. The filter would fix it.

 

 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

I made a silly error yesterday.  It is indeed possible to load a Geogebra file with javascript from the same server into GeogebraReader.js which is what the Moodle geogebra filter does. I am attaching the script that I made.  It may be included in the footer or an html block, page, etc. where you want geobebra to display as jsxgraph on mobile or other non java devices.

I have tested it on Firefox(Linux/Windows 7) w/ and wo/ java, and Samsumg Galaxy 10.1 on which it works as expected.  It does not seem to work on Chrome/Chromnium browsers with Java disabled.  They just show panels complaining Java disabled. IE 9 seems to still run Geogebra even with java supposedly disabled.

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

Since moodle 2.4 is already using HTML5 I decided to test the 3rd option and changed the filter to use HTML5 and javascript with one exception: IE7 and IE8 use applet tags because they don't support HTML5. The editor plugin is still a fully functional Geogebra applet, it creates a ggbBase64-filestring and "Geograph"-filter changes the "geograph-tags" to HTML5 article-tags like http://wiki.geogebra.org/en/Tutorial:Creating_HTML5_documents_with_GeoGebraWeb (and applets for IE7/8)

These tags are re-editable in plugin and you can open any geogebra files in plugin (File open...) and save them in moodle 2.4 as ggbBase64-filestrings- tags.

To install the plugin and filter download attached geograph.zip and unzip the files to your moodle 2.4 (filter and lib folders).

1) Go to Site administration > Notifications ( admin/index.php ) if moodle does not automatically install the plugin and filter

You should see Geograph plugin in Site administration > Plugins > Text editors > TinyMCE HTML editor > General settings
In Site administration > Plugins > Text editors > TinyMCE HTML editor > Geograph you should have "Require Geograph filter" enabled by default so that moodle shows the plugin in editor only if Geograph filter is enabled. If you want to use only the plugin with some custom filter you can disable this setting.

2) Go to Site administration > Plugins > Filters > Manage filters and ENABLE Geograph filter (set it "On" globally or "Off,but available" if you want to use the filter and plugin only with some content/course and enable the filter there separately)

3) Go to Site administration > Appearance > Additional HTML and add the following script tags (within HEAD):

<script type="text/javascript" language="javascript" src="http://www.geogebra.org/web/4.2/web/web.nocache.js"></script>

Done!

Now when you open editor the toolbar has new button

Button

and when you click this button you get a Geogebra applet with default string

applet

Do what ever you like with it and click Insert Image (still there...) and filestring goes to editor content area and alt tag of a placeholder image.

The height and width of this placeholder image can be changed either in fullscreen mode with mouse (drag the botton right corner) or in HTML mode by changing the dimensions manually.

buttons

This is of course a little too clumsy way and the plugin should have better options to change most "default settings" but keep in mind that this is just the first public prototype - at least I have not seen any this kind of tinymce plugins anywhere... wink

Enjoy!

 

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

Just to clarify the difference between HTML5 and applet tags this example is rendered with HTML5 and javascript (GeoGebraWeb) :

http://www.geogebratube.org/student/m17496?mobile=true

and this example is rendered with geogebra applet:

http://www.geogebratube.org/student/m17496?mobile=false

 

 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

Mauno,

This is wonderful. This method seems completely transparent to the end user once the admin has set it up properly. I had almost written Geogebra off because of lack of support for mobile platforms and other problems with Java. It appears that geobebra.org may may still have some more work to do to implement all features in HTML5, but I believe your approach is what is needed for support in Moodle.

A small note for future. I was able to reopen a geogebra string by clicking the taskbar, but right clicking the in the editor brought up a menu saying edit picture or table.

Thank you again for your work.

 

 
Average of ratings: -
Picture of Adam Wojtkiewicz
Odp: Re: New Geogebra plugin
 

Hello, I recently upgraded my moodle to 2.5 and i had to update your geograph filter code. I attach the updated code. Thank you for your filter.

 
Average of ratings: -
Picture of Mikael Kurula
Re: Odp: Re: New Geogebra plugin
 

Fantastic, thank you very much!

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Hi!

I now noticed that the plugin works perfectly for me in Windows 7, but it does not work at all in Ubuntu 12.04. In the latter I only get the "use picture" (the button you use to put the app in place) and "cancel" buttons at the bottom, but no geogebra plugin. Oracle Java is installed and works fine on other sites. Also, running Geogebra on my linux computer (that I use for all other work) outside of the geogebra plugin works fine. I am also running latest Firefox in linux.

Now a student pointed out that when she tries to open the moodle page where the geogebra app is embedded, she does not see the app. I tried in linux and could also not see it. Then I rebooted windows, and there it is.

So, what I now wonder is what the geogebra plugin requires of the teacher/student. Any clue what my linux and my student (probably windows with latest firefox) are missing?

Thanks a lot in advance!

Mikael

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

Hi Mikael,

basicly the editor plugin is just using java to launch a geogebra applet and once you get the string to moodle content filter should use geogebraweb (HTML5 and javascript) for other browsers < IE9 and < IE9 should render applet since < IE9 does not support HTML5 but... it really is not so simple. I noticed myself that the current browser detection in filter fails in Windows phones like Lumia using IE10 and you just get a notice that there should be an applet (not supported by windows phones) ...

It's a prototype - not stable and crossbrowser compatible code - and in many cases using direct links to sites like www.geogebratube.org can be more reliable.

A good start for making the filter/plugin better could be a browser test for simple exampes like

http://www.geogebratube.org/student/m17496?mobile=false (java)

http://www.geogebratube.org/student/m17496?mobile=true (HTML5)

Some browsers (versions) / OS /  may not support java OR/AND HTML5 & javascript ... or some javascript conflict (browser plugin) might break geogebra javascript ???

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

One workaround for teachers could also be to use Geogebratube for saving material and use the embedding code that you get from Geogebratube:

If you add /at/preferhtml5 then the HTML5 version will be served except on very old browsers (eg IE6, IE7, IE8):

<iframe src="http://www.geogebratube.org/material/iframe/id/17496/width/949/height/532/border/888888/rc/false/ai/false/sdz/false/smb/false/stb/false/stbh/true/ld/false/sri/false/at/preferhtml5" style="border: 0px;" height="532px" scrolling="no" width="949px"> </iframe>

You get the embed code with preferjava by default in Geogebratube:

<iframe src="http://www.geogebratube.org/material/iframe/id/17496/width/949/height/532/border/888888/rc/false/ai/false/sdz/false/smb/false/stb/false/stbh/true/ld/false/sri/false/at/preferjava" style="border: 0px;" height="532px" scrolling="no" width="949px"> </iframe>

This won't work in all resources of moodle and only administrators/teachers can add iframes - unless you give students the ability to embed code. That's one of the reasons why I originally wanted to test a plugin for creating geogebra graphs directly in moodle with strings.

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Thanks a lot for the quick and friendly reply, Mauno!

I was aware of the possibility to use geogebratube from the previous discussion in the plugin thread, but I was hesitant, because I have only borrowed from other people and made some trivial modifications.

In my previous post I forgot to mention that I'm using the plugin for Moodle 2.5 posted by Adam Wojtkiewicz in case this matters. We all use computers, so mobile browsers are not an issue for us. Also I was confused about the fact that we would all be using the same latest firefox in windows7, this is not true.

In fact, what it seems is that the filter:

does not work with firefox 23.0.1/win7, 23.0/ubuntu1204,or Chrome 29.0.1547.62/win7

works with firefox 10.16.4.519, firefox 17.0.1, and IE 10.0.9200.16660, all win7

Strange that it works with the older firefoxes, but not with the latest one; I was under the impression the plugin should work with new browsers but not necessarily with old ones?

Friendly greetings,

Mikael

Ps. I don't know how the browser identification works, but here are two user agent strings, the first one from a working example and the second one from a not working example:

Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0

Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:23.0) Gecko/20100101 Firefox/23.0

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

Yes, I have also tested this 2.5 code and tried som tiny modifications lately but have not noticed any major problems with rendering code - changing different default values like width and height more user friendly was my main concern. I was just testing with Firefox 23.0.1 / Windows 7 on our home site and did not find any errors so I suspect some local browser plugin ( in finnish version of Firefox these are in Työkalut > Lisäosat > Liitännäiset ) - people sometimes use different performance tools etc that can break javascript...

Can you debug any errors with browser error debugging ( for filter rendering geogebra content on pages ) ?

Errors

Errors2

And if you have problems with the actual editor plugin (applet) - not filter -  java debugging might give also some clue (version of java etc). I am not sure what requirements for java current latest Geogebra has but at least this link tells:

GeoGebra requires Sun Java runtime for compilation, version 1.5 or above. OpenJDK is incompatible: the xawt/libmawt library is missing... updating java might help also if the same computer had problems with dragmath applet...

This PC I am testing with has Java Standard Edition Version 7 Update 9 (build 1.7.0_09-b05)

java

Edit: http://wiki.geogebra.org/en/Release_Notes_GeoGebra_4.0 tells that

GeoGebra 4 will not run on Java 1.4.2, so you need to install at least Java 5 from java.com

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Ah, the error console was a good idea. Now I saw that immediately when I go to the login page of the moodle server, I get the following errors, and also on every subsequent page I visit on the server including when I tried to open a page that has a geogebra app that should be rendered by the filter:

And when I try to start the geogebra plugin in tinymce, I get the following:

Googling gave the explanation: it's a new security feature in FF23, and googling again gave that there exists a plugin that makes it possible to allow mixed content loading on a per-page basis. This allowed me to see the filter and plugin working, but having to give permissions for every webpage, i.e., every geogebra app, is extremely laborous. The stackoverflow hit in the first google link suggests it might be possible to implement the geogebra filter/editor in such a way that it doesn't get blocked...

(This testing was done on an updated Ubuntu 12.04 with Oracle Java 1.7.0_25.)

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Turns out I was confused again. I installed this plugin for Firefox, which allows toggling mixed content loading on and off. But I didn't see the little icon with a capital A on a green background that appeared at the bottom of the screen, but instead I was using the shield icon on the location bar (which turns on blocking again if you reload the page or visit a different page). With the new green icon I can turn the blocking off for all sites, not on a per-page basis, so this is practically usable.

What do you think, will you try to implement the filter/plugin differently or should I just instruct my students to install the Firefox plugin linked above? This post suggests it might not be that difficult (for somebody who knows something about programming) to avoid loading mixed content altogether, but unfortunately I don't have the skills to do this with confidence that I don't break something else myself.

 
Average of ratings: -
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

This explains it why I had no problems with our http-site...

Loading jquery locally is not a problem - you could simply download for example file jquery-1.8.3.min.js ( see http://jquery.com/download/ ) to any folder of your https-web site and change the link in line 23 in lib/editor/tinymce/plugins/geograph/geograph.php

<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script> to use your local file - or https file like https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js ... or //ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js (in this case the browser will use the page's protocol to try to obtain the file. On non-secure pages, http. On secure pages, https. )

Geogebra applets are on a http-site and use paths like

http://www.geogebra.org/webstart/4.2/ ( I am not aware of a https applet site)

but you could try to go to Site administration > Appearance > Additional HTML and add the following script tags / change the old script tags (within HEAD) to:

<script type="text/javascript" language="javascript" src="https://www.geogebra.org/web/4.2/web/web.nocache.js"></script>

I suppose changing https://stack.abo.fi/moodle/ to http://stack.abo.fi/moodle/ is not an option for you... mixed

EDIT: I just checked and https://www.geogebra.org/webstart/4.2/ in fact exists so changing codebase to https path in filter/geograph/filter.php and lib/editor/tinymce/plugins/geograph/geograph.php should fix also the applet issue for https sites...

In the future this http/https switch could be easily added to filter settings.

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Hi again!

Just for the sake of brief documentation, and maybe helping others out. Now I did the following two changes as you proposed:

1. I changed the link on line 23 of lib/editor/tinymce/plugins/geograph/geograph.php to

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

so that the appropriate version http: or https: is chosen automatically.

2. I changed http to https in the script tags within HEAD in Additional HTML on the Moodle server, resulting in

<script type="text/javascript" language="javascript" src="https://www.geogebra.org/web/4.2/web/web.nocache.js"></script>

I can confirm that this solved both problems; both the filter and the editor works like a charm in Firefox 23 on Ubuntu 12.04 now!

Now I only have one much less important question left: I get the impression that the applet shown by the filter is somewhat unsharp, compared e.g. to the Java version, see screenshots below (neither picture is rescaled). Can something be easily done about this?

Thank you very much again for your extremely fast and friendly help! smile

Friendly greetings,

Mikael

 
Average of ratings: Useful (1)
Picture of Mauno Korpelainen
Re: New Geogebra plugin
 

Have you pressed CTRL + lately?

I don't think this is caused by geogebra javascript itself - more likely screen is not in 100% scale (applet does not care about that)

Try to press CTRL 0 or a couple of times CTRL -

In my previous post screenshot was taken from a HTML5/javascript screen.

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

CTRL 0 did the trick, thanks again! smile

(Yes, I usually press CTRL + everywhere since the standard font size is too small for me nowadays... And setting a larger minimum font size seems to screw up mathjax spacing.)

 
Average of ratings: -
Picture of Ketan Deore
Re: New Geogebra plugin
 

Hi,

My Geonext tool not working.when I open the Geonext  only Insert Image button are shown

I provide the image following :

 

 


 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

If you are using Firefox 23 and your Moodle is configured to use https, check if you are having the same mixed content loading issue that we just sorted out with Mauno in this thread. That is how it looked for me too before I fixed the problem using Mauno's instructions.

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

I am again mixed content loading issues, in Firefox 25.0 this time.

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

Hello!

Now I am unfortunately having another problem with the plugin. When I press the Insert image button nothing happens. In the web console I instead get the error on the last line:

Sorry that I am unable to fix this myself, but I will be happy to provide more details if needed.

(The mixed content issue I mentioned above seems to have disappeared by itself?)

Friendly greetings,

Mikael

 
Average of ratings: -
Picture of Mikael Kurula
Re: New Geogebra plugin
 

This is strange. On another computer (an updated Ubuntu 12.04.3 in 32 bit) I do get the mixed content issue, but not the issue I described in my previous post. My previous post appeared on an updated Ubuntu 13.10. 64 bit. I believe I have the latest firefox and latest oracle java on both machines.

 
Average of ratings: -
Picture of Ketan Deore
Re: New Geogebra plugin
 

Hi Mauno,

Thanks for my previous question solution.

Now I installed Moodle 2.6.1 and i try to installed Maths plugin as per your instruction but its not working on moodle 2.6.1.Even Wiris plugin also not working on moodle 2.6.1.Please give the solution.

 
Average of ratings: -
Picture of Daniel Thies
Re: New Geogebra plugin
Group Core developersGroup Particularly helpful MoodlersGroup Plugin developersGroup Testers

If you upgraded from Moodle 2.3 or earlier you may have been using the WIRIS maths tools plugins which is no longer available in the database and is probably not compatible with 2.6.1.  WIRIS has replaced this with the WIRIS filter.  You should uninstall the old package and try the new one to see if that fixes your problem.

Mauno has posted quite a lot of plugins, and I am not sure which you are attempting to use now Geobegra? Geonext? SEE? MathQuill? Some of these were prototypes that are now dated and may or may not work with the current versions of Moodle. Please tell us what you are trying to do.

Mauno, may be able to help update an old version, but probably will not if he does not know what there is a real interest in using it.

 
Average of ratings: -