Mathematics tools

DragMath integration now available

 
Picture of John Isner
DragMath integration now available
 
DragMath is an applet-based WYSIWYG equation editor written by Chris Sangwin and his colleagues at the University of Birmingham. Read about it here.

I have integrated DragMath with Moodle and am making it available for you to try and hopefully to improve.

The attached zip file contains two files. They replace existing files, so you may want to back up the originals before trying this.

$CFG->dirroot/lib/editor/popups/dlg_ins_smile.php
Replaces the smiley chooser popup with a DragMath editor popup

$CFG->dirroot/lib/editor/images/em.icon.smile.gif
Replaces the smiley icon on the HTML editor toolbar with a math icon

As you may have guessed, you will sacrifice your ability to insert smileys into your text through the GUI. For me, this is no great loss smile. I did it this way to avoid modifying any other files. It is just a simple replacement.

The reason for integrating the equation editor with the Moodle HTML editor (rather than using a filter, like GeoGebra and Jmol) is quite simple: You want the equation editor to be available whenever you're entering text.

The screenshot below shows the sequence of operations in using DragMath.
  • While entering text into the HTML editor, you decide to insert some mathematical notation.
  • press the "pi" button on the toolbar to pop up the DragMath editor (Note: the first time you use it, you will experience a delay as the Java runtime environment initializes. On subsequent uses, you will get the popus very quickly)
  • resize the popup window (it will be too small because it was designed for smileys)
  • create your equation graphically
  • press the LaTeX button. Note: because Moodle currently does not support the other markup languages, you must press LaTeX.
  • press the Insert button. This inserts LaTeX into the HTML editor and adds the $$$ at both ends.
Here are some areas for improvement. Note that because editor popups aren't designed with a plugin architecture, some of these changes will require code changes to editor files. Other changes will require changes to the DragMath applet.
  • The size of the popup should be changed so that it does not have to be resized.
  • We should be able to have both the smiley button and the DragMath button
  • Be able to hide the MathML and Maxima buttons at the bottom of the DragMath editor so that only LaTeX is visible
  • Eliminate the Insert button (pressing the LaTeX button should do the editor insertion)
  • Advance the cursor in the HTML editor so that it is now AFTER the LaTeX just inserted (currently, the cursor remains at its position prior to the insertion)
  • There may be some characters in the generated LaTeX that need escaping. For example, \frac{3}{4}. Let me know about these.
Feedback please!

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Oops, I just noticed that the method I used for retrieving LaTeX markup from the DragMath applet is actually returning text in some human-readable linear syntax. As soon as I clear this up, I will post the zip file.
 
Average of ratings: -
Picture of Christopher Sangwin
Re: DragMath integration now available
Particularly helpful MoodlersPlugin developers

John,

Do you still need anything from me to get this work?

Chris

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Hi Chris,

Do you still need anything from me to get this work?

Yes indeed! I need a tiny change to MainApplet.java. Details are in the e-mail I sent to you @bham.ac.uk over the weekend.

In a nutshell, I need a public method that can be called from javascript to access the markup generated by the applet. I do not want to access the clipboard from javascript, since IE, Safari, Opera, and Firefox each has a different way of accessing the clipboard, and it would be a nightmare for me to program.

I decompiled the applet to see if the needed method exists. I could only find one that generates human-readable linear syntax (it sure isn't LaTeX).

Will you add the method?

The new method will permit much closer integration with the Moodle HTML editor (see my screenshots).

Thanks!

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available (really)
 
With Chris Sangwin's help, we ironed out some of the problems and even simplified the interface (the extra button push in step 4 is no longer required).

The zip file is attached. As I mentioned in my first post, installation is trivial. Try it. You'll like it!
 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available (really)
 
Dear John

I think, where is the folder popups ... i hope you allow that i correct the path John!?

$CFG->dirroot/lib/editor/htmlarea/popups/

I will try it in the night (my time) or latest tomorrow and will give you a feedback. In front again thank you very much John!

Andy

 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available (really)
 
John see my problem, i find time to make it quick. Moodle 1.8.2 in Firefox 2.0.0.6 and Java 1.6.02, the windows looks not yours, i make a screenshot. I clear my cache, browser and java, nothing change.

Andy


 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available (really)
 
John

This are the code of the php file, line 1 to line 18
MathExpression<?php

#################################################################################
##
## $Id: dlg_ins_smile.php,v 1.6 2007-01-27 23:23:45 skodak Exp $
##
#################################################################################

require("../../../../config.php");

$id = optional_param('id', SITEID, PARAM_INT);

require_course_login($id);
@header('Content-Type: text/html; charset=utf-8');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

With this code the both Buttons Insert and Cancel i can not see. Now see what i modifiy, so i can see the both buttons Insert and Cancel, but only these two buttons, not more!

Now is line 1 to 19:
<?php

#################################################################################
##
## $Id: dlg_ins_smile.php,v 1.6 2007-01-27 23:23:45 skodak Exp $
##
#################################################################################

require("../../../../config.php");

$id = optional_param('id', SITEID, PARAM_INT);

require_course_login($id);
@header('Content-Type: text/html; charset=utf-8');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

I try to resize the windows, no change, i try to modifiy the numbers 540 and 300 with $ in front, with px and % but no changes!

Andy
 
Average of ratings: -
Picture of Sjaak Kamerling
Re: DragMath integration now available (really)
 
I get the same window (in my Moodle 1.6-installation with Java 1.6)

Sjaak
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: DragMath integration now available (really)
 

You also need a little change in 'lib\editor\htmlarea\dialog.js':

Line 34 should probably read:

case "dlg_ins_smile": x = 540; y = 300; break;

Best regards

Morten

 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: DragMath integration now available (really)
 

Sorry, you need the high to be a little larger:

You also need a little change in 'lib\editor\htmlarea\dialog.js':

Line 34 should probably read:

case "dlg_ins_smile": x = 540; y = 340; break;

Best regards

Morten

 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: DragMath integration now available (really)
 
Hi Morten,
I made the change to dialog.js that you suggested. I cleared the browser cache and killed browser and started again (it was necessary). The initial popup has a nice initial size. But I still can't resize it in IE, and I suspect others are unable to resize it in Firefox.

However since the DragMath canvas is fixed in size, being able to resize the window would have little benefit now. So Morten, your fix is really a fix!
 
Average of ratings: -
Picture of Christopher Sangwin
Re: DragMath integration now available
Particularly helpful MoodlersPlugin developers

John,

I am very pleased indeed to see some interest in the DragMath project.  I am sure we can find some way of integrating it into Moodle.

Am I correct in thinking that currently you only want to output LaTeX source code?

If so, it might be less confusing to a user to remove the options for other output formats, eg Maxima.  This can be done with the JavaScript interface, ie there is no need to recompile DragMath.  An example is given in http://web.mat.bham.ac.uk/C.J.Sangwin/dragmath/applet/Latex.html

We also have made sure all the error messages etc are in a language file which can be specified with JavaScript.  See

http://web.mat.bham.ac.uk/C.J.Sangwin/dragmath/applet/classes/lang/

If anyone would like to translate DragMath and email me the files I'd be very happy to add them to the DragMath CVS.  It would be a great help to others I'm sure. Could your code open DragMath with the correct language options?

Chris

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Yes, I read the documentation and I will remove the other output format options. I didn't study the language options yet.

I can assure you that DragMath is going to be very popular third-party solution (it will never become core Moodle because "Java is evil and eats children" -- M. Dougiamas, 03/12/04).

There have been long discussions in this forum about how work around Moodle's lack of an integrated 'equation editor. In my opinion, DragMath meets all of the requirements: It's free, it's platform-independent, and it generates LaTeX. I love it.
 
Average of ratings: -
Picture of Luis Perez
Re: DragMath integration now available
 

Hello John

I don't find the zip file needed to integrate DragMath into Moodle. Can you send me the file.

Thanks

Luis

 
Average of ratings: -
Picture of Stéphane Goussault
Re: DragMath integration now available
 
Hello John

Could you tell me how to enlarge the size of the popup where the dragMath editor is displayed ?

Thanks

Stephane
 
Average of ratings: -
Picture of Sjaak Kamerling
Re: DragMath integration now available
 
Great work! This is what my students need.
But I have some problems.

A first in my 1.6-installation:

$CFG->dirroot/lib/editor/popups/dlg_ins_smile.php
should be
$CFG->dirroot/lib/editor/htmlarea/popups/dlg_ins_smile.php

and
$CFG->dirroot/lib/editor/images/em.icon.smile.gif
should be
$CFG->dirroot/lib/editor//htmlarea/images/em.icon.smile.gif

Then the pi-icon appears in the editor-window, and it is possible to enter math in the DragMath-window. But the window cannot be resized and there is also no LaTeX-button. So entering math in Moodle is not possible for me.
I hope there is a solution for these problems.
Sjaak Kamerling
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
The slimey (oops, smiley) popup was not resizable, but I never had trouble resizing the DragMath popup. I did all my testing on Moodle 1.8.2+. I will look into it. Meanwhile, has anyone been able to resize their popup? Sjaak is right: you must be able resize in order to see the Insert button.

Andy, I don't understand your post. Why the code?

As I mentioned in the post with the attached zip file, there is no longer a LaTeX button. You just create the math and then press Insert (if you can see it).

I should have posted a link to the instructions, rather than uploading them. Now I can't change them (e.g., add new screenshot, add 'htmlarea' to the directory paths). Forgive me, I'm new at this.


 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available
 
John

I can feel what you think John. Some minutes not here, and your topic grows up ...

I post the code, that you can see what i did change John. If i make this modification i can see the buttons, i was not sure if you need to see it Hohn, sorry for that!

Andy
 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available
 
Ha .. i´m going one step forward ... i change (I´m sorry Jon, i must paste agaion my changes) line arround 64 in my file:
<param name=showOutputToolBar value="true">

and set the value from false to true and not see my screenshot. Now only the size of the windows is a problem on my moodle. The modification in the dialog.js brings not the solution, but i think this change must be too.

Andy

 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available
 
Morten

When i change the numbers, i cant see anymore the two buttons Insert and Cancel ;-( .. i change it to 540 to 340 in the dialog.js

Andy

Edit//
Morten, can you confirm, im again one step forward, in the file dialog.js i change in line 47 "toolbar" from no to yes, and now the windows goes resize smile ... but i´m not finish i think.
 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available
 
My longest thread i think ... and jaaaaaaaaaaaaaaaaa i got it! In line 47 of dialog.js change resizable from no to yes and everything will be fine big grin

Now i must going to bed, in front waiting 3 days with full of work!
Andy
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: DragMath integration now available
 

Andy,

Changing things in line 47 might influence all dialogs.

I prefer changing the size of the Drag Math dialog window in line 34.

Best regards

Morten

 
Average of ratings: -
Picture of Andy Tagliani
Re: Ang: Re: DragMath integration now available
 
Yes you´re right Morten! I see it, but i think we have now more than one options if in a browser this not work. Line 34 .. thats the best solution, i vote for this what Morten tell us!

Thanks again!
Andy

P.S. The best size for me is 550 to 340 in line 34! I´m really happy ...
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: DragMath integration now available
 

Andy,

Yeah I realized that shortly after.

Besides I also changed the path to 'classes'

//codebase="http://web.mat.bham.ac.uk/C.J.Sangwin/dragmath/applet/classes"
 codebase="classes"

This way I can serve the class files from my own server. I just grabbed the jar-files from the codebase to get the Moodle-customized files. But I might miss the updates then...

It's a pretty nice thing we have in our hands now.

Now we need to make this applet talk to the question module just like the JME editor question type. It copies the chemistry-string build by the student directly into the answer field of a short answer question.

Best regards

Morten

 
Average of ratings: -
Picture of Andy Tagliani
Re: Ang: Re: DragMath integration now available
 
Hi Morten

We all have to thank John, this is really great, thank you very much John and all in this thread here! Thank you Morton and yes, you´re absolutely right with the JME editor!

Best regards from me
Andy
 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: DragMath integration now available
 
I purposely left my codebase pointing to web.mat.bham.ac.uk in case we find some missing features (e.g., math symbols) or suggest improvements. We can ask Chris Sangwin and his team to add them without having to download and install all of those files.

Short answer questions are not appropriate for student-entered LaTeX, since it is difficult or impossible to determine whether the student's answer is equivalent to the "correct" answer without a computer algebra system (CAS). Until we have CAA/CAS integration, use Essay questions and grade them manually.
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: Ang: Re: DragMath integration now available
 

You are absolutely right about the risk of ending up with 'mind reading' for student-entered LaTeX.

However I have really missed some consistent answers like

$$$ \sqrt{31} $$$: $$ \sqrt{31} $$ for my students to answer.

Even typing something like

$$$\left(x-a\right)^{2}+\left(y-b\right)^{2}=r^{2}$$$:

$$\left(x-a\right)^{2}+\left(y-b\right)^{2}=r^{2}$$

seems consistent.

Talking about improvements and new math symbols, may I suggest the possibility to also write nuclear symbols and simple chemical formulas like H2O.

But thanks to you and Andy and whomever for providing this great enhangement.

Best regards

Morten

 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: Ang: Re: DragMath integration now available
 
I suppose you can check trivial LaTeX. But even the simple examples you gave begin to get tricky.

For example, suppose you taught your students that the equation of a circle in Standard Form is

$$\left( x - a \right)^2 + \left( y - b \right)^2 = r^2$$

On a quiz, you specify a circle with radius 2 and center at (-1,-1) and ask them to write the equation of the circle in Standard Form. You even show them the Standard form, as above. Which of the following 'short answers' would you accept?


(1) $${\left( x +1\right)}^2 + {\left( y + 1 \right)}^2 = 4$$

(2) $${\left( x - \left(-1\right) \right)}^2 + {\left( y - \left(-1\right) \right)}^2 = 2^2$$

Most teachers probably woudn't have thought of (2), but it is probably the superior answer! So the best math student in the class gets marked wrong and the teacher has to manually change the grade and apologize. If it were an essay question, the teacher would have marked it right and added a nice comment like "Good answer!"
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 

Very clever, John smile

...then I Would have to put both answers as correct answers.

I do that all the time allready, like '1/2x+4', '0,5x+4','0.5x+4', etc.

What I ment was, that during my short time of testing DragMath it did not come up with multiple LaTeX code for the same expression, thus it seems consistent.

Morten

 
Average of ratings: -
Picture of Andy Tagliani
Re: Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 
Good Morning all

I have a night(mare) behind me, in my dreams i try to resize the window ...

So i give our customers to try Johns new Feature! They are delighted!!!

But John, one problem, maybe it can be it has something to do with our server configuration, i dont know. I must change line 17 like this, otherwise the toolbar down will not show.

Line 14 to 17 looks now:
@header('Content-Type: text/html; charset=utf-8');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

and i must change in (now) line 66 the value from false to true:
<param name=showOutputToolBar value="true">

Now and with the fix from Morten the can see the whole window and the window is resoze in Internet Explorer 7 too. A friend of mine who is moodle too, he must take my advice from line 47 in the file dialog.js to manually resize the window. John, your tool works fine, so thanks again!

Andy

 
Average of ratings: -
James Chan, FCoT, MCollT, MCCC, Teacher Cert. (N.C.E.& S.R.B.C.E.),
Re: DragMath integration now available: Version with Smiley together
 

Hi John

Thanks for your work.

For anyone who doesn't want to give up the smiley icon, you may try the dragmath.zip file here. Both DragMath icon and Smiley icons co-exist together on the toolbar of the htmleditor.

Installation is simple. Just replace your existing files with those from the zip.

The size of the pop up is amended too. However, if you want to maximize the window, you may amend the dialog.js file (as discussed previously)

either changing the size on line 35 (approximately)

        case "dlg_ins_dragmath": x = 540; y = 340; break;       
OR, replacing some "NO" with "yes" on line 48 (approximately)

    var dlg = window.open(url, "ha_dialog", "toolbar=no,menubar=no,personalbar=no, width="+ x +",height="+ y +",scrollbars=no,resizable=no, left="+ lx +", top="+ tx +"");

Thanks to John again. Cheers

James

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
James,
Thank you for your suggestions. I will test them today, along with other suggestions in this forum, on different browsers. I will write updated documentation in the documentation wiki and I will put a link to the zip files in the modules and plugins database.
 
Average of ratings: -
Picture of Jonathan Meyers
Re: DragMath integration now available: Version with Smiley together
 
Is there a new link to the file? The one in the post doesn't work.
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
Unfortunately, everything you write in a forum post will last forever. There's no way to say "Hey, everybody, there's a more recent discussion with up-to-date information. Everything in this discussion is obsolete." I wish I could do something about it, but I can't sad

See this discussion.
 
Average of ratings: -
James Chan, FCoT, MCollT, MCCC, Teacher Cert. (N.C.E.& S.R.B.C.E.),
Re: DragMath integration now available: Version with Smiley together
 

I received some inquiry regarding the file that I removed from my server. I've already put it back for download.

Cheers

 
Average of ratings: -
Picture of Ralf Seliger
Re: DragMath integration now available: Version with Smiley together
 
Thanks for your code, James, but the files htmlarea.php and htmlarea_bak.php (which seems to redundant) in your patch do not work well with Moodle 1.8.2.

I.e. the popup windows open and disappear to the background.

In order to fix this I have put the changes you made in those files into the 1.8.2 files (see attachment).

So for those still using 1.8.2 it is better to replace the two files provided by you with the files in the attachment.

Best regards
Ralf
 
Average of ratings: -
Picture of Marc Grober
Re: DragMath integration now available: Version with Smiley together
 
For those still on 1.8.2 who want to install dragmath, could someone post details about what needs to be done to obtain a working install in one place.... with details about what's what? Are the "1.8.2 files attached" all of dragmath just the files that need to be fixed, etc.
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
The details are in docs.moodle.org. Just click here. The article explains everything you need to know -- where to download, how to install, how to use -- all in one place.

You can get to the same information via the Modules and plugins database. The database and the wiki article reference each other.

If you download code from a forum post, you should probably deal directly with the person who posted it.
 
Average of ratings: -
Picture of Marc Grober
Re: DragMath integration now available: Version with Smiley together
 
I guess I am a bit confused....
I was trying to respond to the recent posting that said that some changes had to be made files in order for dragmath to work in 1.8.2 and referenced the "files". I assumed from the posting that a) the files here were problematic and that b) they had to be patched to work with 1.8.2.

I guess from what you are saying either there is no problem with installing to 1.8.2 or the file in the location above have been adjusted to address the issue raised.... Am I correct on that?

Thanks
 
Average of ratings: -
Picture of Ralf Seliger
Re: DragMath integration now available: Version with Smiley together
 
Sorry if my post was confusing. Let me try to explain the situation:

John Isner's dragmath code replaces the "Insert Smiley-popup" in the editor with the "Dragmath-popup". Now some people would like to have both popups available in the editor. James Chan came up with a solution for this. However, I found yesterday that his solution does not work well with Moodle 1.8.2+ and fixed it. Now here is what you have to do, depending on your preferences:
  • You are content with dragmath without the "Insert Smiley-popup" in the editor: Just follow John Isner's instructions.
  • You want dragmath together with the "Insert Smiley-popup": Follow James Chan's instructions, and see if the popups behave like they should. If they do, great!
  • You want dragmath together with the "Insert Smiley-popup" and you are working with Moodle 1.8.2+: Follow James' instructions first. After that replace his files "htmlarea.php" and "htmlarea_bak.php" with the files I attached to my previous post (htmlarea.zip).
  • Backup all original files first, regardsless what you do.
    Best regards
    Ralf
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
Hi Ralf,
Thanks for the clarification. You said

Follow James' instructions first. After that replace his files "htmlarea.php" and "htmlarea_bak.php" with the files I attached to my previous post (htmlarea.zip).

When you replace whole files in Moodle, you run the risk of version incompatibilty when you upgrade Moodle. It is a bad practice, IMO. If people are going to post code to forums, it is better to post a patch that people can use with any version.
 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available: Version with Smiley together
 
Hello moodler

I have a question, i hope you can follow my problem.

I open the DragMath Editor, i want to define a (what u say in english) a infinite number. I have a Screenshot below, for a better understanding.

The code is (i hope here comes the error too)
$$\int_{-∞}^{\infty} \frac{1}{x} \,dx$$

but he should show me the one below

$$\int_{-\infty}^{\infty} \frac{1}{x} \,dx$$

On the screenshot you see the last symbole on the right, the symbol for the infinite number. A click on this symbol should insert /infty but he insert the prone (a horizontal 8), and this produce a error.

Andy

 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available: Version with Smiley together
 
One Information more, if the users type -∞ and here special the minus sign, comes the error because he did not convert to \infty. If the usere choose the minus sign from the drag math editor, it will work because drag math convert it right.

Andy
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
Hi Andy,
I agree DragMath does not seem to be handling the unary minus correctly. Instead -\infty it gives you -∞ . This confuses the latex parser and up the definite integral.

I found a workaround.
  • click the DragMath binary minus symbol (gives box1 - box2)
  • insert infinity into box2, leaving box1 empty
  • press the Insert button
This inserts -\infty

For your definite integral example, I use the above workaround for the lower bound. This inserted the following latex

$$$ \int_{-\infty}^{\infty} \frac{1}{x} \,dx$$$

which displays properly as

$$ \int_{-\infty}^{\infty} \frac{1}{x} \,dx$$
 
Average of ratings: -
Picture of Marc Grober
Re: DragMath integration now available: Version with Smiley together
 
Sorry guys, but the situation is still very, very confusing, especially in light of this:

"If you want to keep your smiley button...

For those users who want to keep their smiley button, there are postings in this discussion that explain how to do it. You may also download a special version of the DragMath integration package here. Unzip it in your moodle root directory."

Does this really mean what it says; that all you have to do to install the entire dragmath package and integration package with smileys intact is to unzip the dragmath.zip file referenced in the moodle root directory (and ignore the rather extensive list of instructions otherwise listed in the forum?)

Arguably the major benefit in a wiki is that hopefully the text reflects the current status..... threaded discussions can make for poor roadmaps....

Can you give it one more try for me.... If I have 1.8.2 and I want to install dragmath with smileys intacto, do I follow the instructions above or the instructions in the forum?

Obviously I am very confused, because if I try to move the admin directory for example to my moodle root directory as opposed to copying the contents thereof to the directory, it will overwrite my admin directory and that I am sure is certainly not what was intended.... So assuming that I have to unzip on my workstation (let's not assume I have gunzip or telnet access) what then? Can I just upload the new files/replacement to their respective directories after saving the old files?
 
Average of ratings: -
Picture of markus keller
Re: DragMath integration now available: Version with Smiley together
 

I also confuesed abot the notation about to keep the smiley-Button.

Maybe this will helps you in an other way. I tried the commercial Wiris-Tool, and the very complex integration puts the button to the WIRIS-Tool in uper right corner of the html-editor.

Maybe this will be able with DragMath too. But I did not tried this at the moment. if have done it, i will send you some comments.

markus

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
Hi Marc,
I will have a look at the postings here and extract the appropriate patch for keeping the smiley button, and document it in the wiki (if it hasn't already been done). But you're going to have to patch the file. I won't post an entire file for you to replace. I think it is a bad practice.
 
Average of ratings: -
Picture of Andy Tagliani
Re: DragMath integration now available: Version with Smiley together
 
Hi John

I search for one information in the moodle docs. What u mean John?

The moodler they change the smileys with the drag math editor, they should change one entry in language file. In the file editor.php change "Insert Smiley" (in german Emoticons einfügen) to DragMath Editor. I have done this, so they users have no questions about the alt text because it shows insert smiley/emoticons but the drag math editor pop up. There´s some more "Insert Smiley" in the help files, but this is a can not a must ...

Andy
 
Average of ratings: -
Picture of Marc Grober
Re: DragMath integration now available: Version with Smiley together
 
Hey John,

I don't have a problem with editing the files, I am just concerned about the inconsistencies in the instructions. I can see how someone would bithely zip away and be some disconsolate that nothing worked ;=} Frankly I am glad to see the emoticons go byebye, though some will be horrified.....

The instructions with respect to just installing your files are clear enough, it is the last paragraph that I cited which confuses things. What I'd like to do is wait on an install until you have amended the wiki regarding installing the w/smileys and then follow the instructions.....

That being said, at some point there should probably be an installation API that could be used by admins akin to CPAN, wouldn't you agree?

Ultimately, I am wondering about the html editor itself. As I recall, some, like tinyMCE (provide an menu by which one can add or delete buttons to the editor and include or can easily include an image tool. ) I know this isn't the place, but, there has been some effort directed at moodling tinyMCE or other editor ( http://moodle.org/mod/forum/discuss.php?d=88382, http://moodle.org/mod/forum/discuss.php?d=76912, etc ). Since it is pretty clear that there will be a new editor come moodle 2.0 is there info developed on install of dragmath with FCKeditor or tinyMCE?

In any event thanks for the code and assistance.

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
I am completely lost in this discussion, and this will be my final post.

The last time I checked, the article in the documentation wiki has instructions for downloading and installing DragMath. Those instructions work for ANY version of Moodle. They are the original instructions, and they were written by me in consultation with Chris Sangwin and Jonathan Hart, the authors of DragMath. If you follow my instructions, it will replace the "popular and important" smiley button with a DragMath button. [Sorry, I never realized it was either popular OR important.] At the end of my article, there is a short section titled "If you want to keep your smiley button..." that points back to this discussion. However here you will find at least three different people offering zip files for you to download. Which one to take? I have no idea because I am just as confused as you are. Also, I think it is a terrible practice to post an entire php file like htmlarea.php and say "replace the one in Moodle with this one." People should be posting patches.

James, Miguel, Ralf, and possibly others: If you have a patch that retains the smiley button, please message me privately and I will update the wiki article with instructions on how to do it.
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available: Version with Smiley together
 
Edit: Alex Billingsley is the author of DragMath. In my last post, I mistakenly credited Jonathan Hart. Jonathan also works with Chris Sangwin on STACK and has done many amazing things, but DragMath is not one of them! Sorry Alex!
 
Average of ratings: -
Picture of Beng Pu Siang
Re: Ang: Re: Ang: Re: DragMath integration now available
 

I also looking forward to the day where I can write chemical and nuclear equations.

Well done.

I really really appreciate it.

All the way from the other side of the globe....

 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: Ang: Re: DragMath integration now available
 
TeX is a very powerful language , and specialized LaTeX macro packages have been created for chemistry as well as many other fields. Currently, DragMath only supports math, but you can certainly write chemical formulas with it, e.g.,

$$Fe_2^{ + 2} Cr_2 O_4$$


 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 

John,

I'm still puzzled how you wrote Cr2O4 using DragMath.

Morten

 
Average of ratings: -
Picture of Andy Tagliani
Re: Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 
Good Morning Morten

I think, but i did not know it ecaxtly, that John make in the simpliest way if you can do it ...

He open the DragMath Editor, click on the Insert Button and paste the formula between the $$$$ <- Fe_2^{ + 2} Cr_2 O_4

The result is $$ Fe_2^{ + 2} Cr_2 O_4$$

Andy
 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 
Good joke smile
 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 
You should be puzzled because I did not use DragMath to create the formula! I wrote it directly in LaTeX because Moodle forum post didn't have the small blue button.

But I accept your challenge. I created the formula in DragMath and transferred the generated LaTeX here:

$$Cr_{2}$$ $$O_{4}$$

Hold your mouse over the above to see how I did it. I cheated by inserting two expressions side-by-side. It was a clumsy and unnatural thing to do and I think it's an improper use of DragMath. You're right: We need a separate chemistry equation editor.
 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: Ang: Re: Ang: Re: Ang: Re: DragMath integration now available
 

Hehe smile

I guess DragChem = 2 x DragMath.

Morten

 
Average of ratings: -
Picture of John Isner
Re: Ang: Re: DragMath integration now available
 
Here is what the teacher sees when grading a math "essay" question


 
Average of ratings: -
Picture of Morten Brydensholt
Ang: Re: Ang: Re: DragMath integration now available
 

John,

No doubt - we have finally received something very very useful smile

Morten

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Hello everybody,
Sorry for the confusion.

Popups not resizing

Before posting the zip file, I tested on Moodle 1.8.2+ with Firefox. My popup was always resizable. Just now, I tested it using IE, and it was NOT resizable. It's a mystery why I was ever able to resize. I didn't touch any other code outside of these two files.

I had hoped to avoid changing any php code, but the resizing is probably controlled by htmlarea.php. I will try to find it and post an answer. If anybody else figures it out first, please post the solution.

Corruption at beginning of file dlg_ins_smile.php

I don't know how it happened. Thanks for catching it, Andy.
I attached a new zip file.
 
Average of ratings: -
Picture of Christopher Sangwin
Re: DragMath integration now available
Particularly helpful MoodlersPlugin developers

Dear all,

Gosh, in twelve hours a lot has happened!

Thank you John, and everyone else, for your interest in the DragMath project.  I am very pleased you think it is useful.  I knew there was a need for this applet, which is why I set up the project.

Alex, who wrote the original code base, now has a very limited time to add new features or to fix bugs.  This is an open source project based on Sourceforge.  Please report bugs and add feature requests there.  I suggest that this forum is perhaps not the best place!  (although I will of course respond smile).

http://sourceforge.net/projects/dragmath/

I certainly welcome other people who are interested and able to further develop DragMath to add the new features that you want!  Please download the code from the CVS, add your features and let me have a look..... 

I wrote DragMath to provide an input entry method for the STACK computer aided assessment system which I am currently incorporating into Moodle.  Please see 

http://stack.bham.ac.uk/

Because DragMath has potential applications outside the STACK assessment system I decided to make it flexible and to create a separate project. 

The LaTeX output is not the "right thing" to do for assessment!  For this I think we need one of the output formats which has content, eg the Maxima format.   For an example of how the DragMath might look in an assessment item, see

http://web.mat.bham.ac.uk/C.J.Sangwin/dragmath/applet/Maxima.html

In this kind of application the output format should be transparent to the user, and hence they do not need to choose which they want.  Just as with turning off the output buttons when integrating LaTeX into the editor.

We wanted a way of having different output formats all encoded in easy to edit .xml files.  So LaTeX was an obvious example.  If you have another markup format for mathematics, eg OpenMath, and you would like to create an OpenMath.xml file DragMath can load this via the JavaScript interface as the custom output format.  You don't need to recompile DragMath to make changes to the output.....   You do to add new buttons - we didn't have time in the first version to create a custom interface for the buttons.

I think we should all thank Alex Billingsley who has done such a first class job writing the code.  Thanks Alex!

Regards,

Chris

 
Average of ratings: -
Picture of ian lake
Re: DragMath error message
 

I have installed DragMath on my 182 xampp installation. Everything appears to be in the right place, however when accessing the applet, I receive the following message

To use this page you need a Java-enabled browser. Download the latest Java plug-in from href="Java.com">http://www.java.com">Java.com

When I go to Java.com and check the Java installation, I receive this

Congratulations! 
You have the recommended Java installed (Version 6 Update 2).

How do I get round this?

ian

 
Average of ratings: -
Picture of John Isner
Re: DragMath error message
 
If you recently installed the java RTE, you need to restart your browser. If you already did that, then you are getting the message because the applet failed to initialize for some other reason.

Two questions:
  • what is the value of the codebase parameter in dlg_ins_smile.php?
  • Where are your jar files?

If you installed DragMath according to the
article in the documentation wiki, which was announced in this more recent discussion, the values should be
  • ./DragMath/applet/classes
  • $CFG->wwwroot/lib/editor/htmlarea/popups/DragMath/applet/classes/

(where $CFG->wwwroot is the "moodle" directory, as defined in your config.php)






 
Average of ratings: -
Picture of Guido van der Waals
Re: DragMath error message
 
Average of ratings: -
Picture of ian lake
Re: DragMath error message
 

Thank you once again. You pointed me in the right direction. My home machine does not use Micro$oft VM and Java was not enabled for IE in the Java control panel.

The real problem is, I was testing this for college and when I tried enabling it there I discovered that Java has been disabled!

Damn security

ian

 
Average of ratings: -
Picture of John Isner
Re: DragMath error message
 
That's too bad. Not only are you back to square one with LaTeX, but you are missing out on some of the best visualization and simulation resources for math and science, most of which have also been done using Java applets. It's sad that your college would deny math students access to these resources, but I'm sure they're not the only ones doing it. Maybe you could convince your administrator to install the Java plugin only on selected computers -- e.g., in a math lab.
 
Average of ratings: -
Picture of Guido van der Waals
Re: DragMath error message
 

IN the documentation: http://docs.moodle.org/en/DragMath_equation_editor

stays: in the zip archive, you will find two files: dgl_ins_smil.php and icon_smile.gif

In my zip archive I find: dgl_ins_smil.php and em.icon.smile.gif

Have you made some little changes?

 
Average of ratings: -
Picture of John Isner
Re: DragMath error message
 
The archive contains these two files
  • dlg_ins_smile.php
  • em.icon.smile.gif
The documentation had a mistake in the name of the gif file. I fixed it. Thanks for bringing it to my attention!
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Hello again everyone,
I am finishing up an article about DragMath in the documentation Wiki. It will have new screenshots and corrected installation instructions.

The installation instructions will describe a two-steps:
  • install DragMath (from sourceforge)
  • install DragMath integration (which you will get from the Modules and Plugins database, once I put it there)
Installing your own copy DragMath (as Morten already did) will cut down on the traffic to Chris Sangwin's site.

I will publish links to the wiki article and the plugins page in this forum as soon as both are ready, which should be within the next 48h.
 
Average of ratings: -
Picture of Sjaak Kamerling
Re: DragMath integration now available
 
It's working! Thanks, thanks, thanks to all who made this integration possible.

Sjaak Kamerling
 
Average of ratings: -
Picture of Christopher Sangwin
Re: DragMath integration now available
Particularly helpful MoodlersPlugin developers

Dear all,

We have released an updated version of DragMath.

DragMath 0.5 released 20/09/2007

New Features:
 - Support for Java Runtime Environment (JRE) 1.4 or higher
 - Save/Load expressions to .drgm files
 - Parameter to open applet with an expression which is parsed by the JEP parser. 

The release can be downloaded from Sourceforge.

Thank you for your continued interest.

Chris

 
Average of ratings: -
Picture of wolfgang fabian
Re: DragMath 0.5 released
 
Hi
I tried to install DragMath 0.5 for my pupils but I always got an error message when starting the applet. The error-message in short:
Execption in java.lang NullPointer exception.

Then I switched back to Version 0.4 and everything works well !? So I don't know what I can change/try

Nevertheless, Thanks a lot for Version 0.4
Wolfgang
 
Average of ratings: -
Picture of Ahti Paju
Re: DragMath integration now available
 

Hi!

I installed everything correctly, but i get error: Applet dragmath Notinited and Loading Java Applet Failed
I use Java 1.6.

I do not find any solution for this,
Can anybody help me please?

Thank you

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Please give more information. Did you install the DragMath 0.5 or 0.4? Did you follow these directions?
 
Average of ratings: -
Picture of Ahti Paju
Re: DragMath integration now available
 

Thank you for reply.

I have latest version 0.5 and I follow directions.
Everything seems correct, the DragMath folder path is correct.

Also i attach java log, perhaps it helps.
I change my site URL for security reason.

 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Mystery solved.

After seeing your post and the Wolfgang Fabian's post about problems with 0.5, I tried it myself this morning. I had problems too. The DragMath 0.5 release is incompatible with the integration package, which is never supposed to happen smile The incompatibility is trivial and will be fixed ASAP. Meanwhile, here's what you should do.

When you unzip the DragMath.zip
  • change the name of the the top level folder from Release0.5 to DragMath
  • in the applet/classes directory, rename JEP.jar to jep.jar
I'm sorry for the confusion.

 
Average of ratings: -
Picture of Ahti Paju
Re: DragMath integration now available
 

Thank you very mutch!

It's working now.

 
Average of ratings: -
Picture of Miguel Rosa
Re: DragMath integration now available
 

Hi,

First of all, congratulations for you work. We guess that schools will make big use of this feature.

I didn't saw explanation (at least direct) about introducing DragMath without losing the popular and important Smiley icon. So, after some experiment this is what I think is needed (worked on version 1.7.2).

Attached you have a ZIP with the two original files from DragMath Integration but renamed in order to avoid mistakes, plus the files needed to be edited. The recipe is as follows:

1. Unzip
unzip DragMath0.5.zip -d $CFG->dirroot/lib/editor/htmlarea/popups/;

2. Copy
cp dlg_ins_dragmath.php $CFG->dirroot/lib/editor/htmlarea/popups/;
cp em.icon.dragmath.gif $CFG->dirroot/lib/editor/htmlarea/images/;

3a. Overwrite (zipped files based on Moodle 1.7.2)
cp -f dialog.js $CFG->dirroot/lib/editor/htmlarea/;
cp -f htmlarea.php $CFG->dirroot/lib/editor/htmlarea/;

OR
3b. Edit
Edit $CFG->dirroot/lib/editor/htmlarea/dialog.js. Add line 35:
case "dlg_ins_dragmath": x = 540; y = 340; break;

In line 47 where is
var dlg = window.open(url, "ha_dialog", ...
replace "resizable=no" by "resizable=yes"

Edit $CFG->dirroot/lib/editor/htmlarea/htmlarea.php. In line 158 where is
"insertsmile", "insertchar", "search_replace",
Replace to
"insertsmile", "insertchar", "insertdragmath", "search_replace",

In line 246 (after line "insertchar:...") add line:
insertdragmath: ["Insert DragMATH", "em.icon.dragmath.gif", false, function(e) {e.execCommand("insertdragmath");} ],

After line 1686 add lines (based on function insertSmiley):
/// Moodle hack - insertDragMath
HTMLArea.prototype._insertDragMath = function() {
// Make sure that editor has focus
this.focusEditor();
var sel = this._getSelection();
var range = this._createRange(sel);
var editor = this; // for nested functions
this._popupDialog("dlg_ins_dragmath.php", function(imgString) {
if(!imgString) {
return false;
}
if (HTMLArea.is_ie) {
range.pasteHTML(imgString);
} else {
editor.insertHTML(imgString);
}
return true;
}, null);
};

In line 1912 (after line with "case "insertchar"...") add line:
case "insertdragmath": this._insertDragMath(); break;


Picture of JOseas Ramírez Assad
Re: DragMath integration now available
 
Thanks Miguel!

I tried in my 1.8.+ (2007021505) Moodle and the pi Icon showed up correctly and it did open a new resizable popup windows. However, the app does not work.
The popup windows shows the Insert and Cancel button but on the bottom it says "Applet Dragmath noninited" and "Loading Java applet failed"... (check attached screenshot at the end of this post)

I think this does not have to do with a JRE issue because I can use dragmath, it just didn't work in my Moodle install.

I've tried it with firefox 2.0.0.9 and IE 7

Any ideas on what may be wrong?

I also include the output of the java console:

java.lang.NoClassDefFoundError: Tree/MathObject
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.applet.AppletPanel.createApplet(Unknown Source)
at sun.plugin.AppletViewer.createApplet(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-79" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-Display.MainApplet.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)




 
Average of ratings: -
Picture of Miguel Rosa
Re: DragMath integration now available
 

Hi Joseas,

I'm not expert with DragMath and I haven't tried Moodle 1.8+ but here's a hint that worked with me with another app: clear your Java cache and try again.

- Go to Control Panel -> Java;
- Select 'Settings' in tab 'General - Temporary Interner Files ';
- Select 'Delete Files';

Anyway the error seems to me to be a JRE problem and not DragMath module but I can be mistaken.
 
Average of ratings: -
Picture of John Isner
Re: DragMath integration now available
 
Hi JOseas,
There is a more recent discussion with a pointer to new installation instructions in the documention wiki. If you follow those instructions, you should not have any trouble. Unfortunately, I cannot erase this discussion, or I would do it! Sorry for the confusion.
 
Average of ratings: -
Picture of Paulo Matos
Re: DragMath integration now available
 
Seems the only thing that is missing from Miguel's instructions, is a small change on lib/adminlib.php, on function admin_setting_special_editorhidebuttons(), which gives admin the option to hide/unhide dragmath button on editor.

--- lib.orig/adminlib.php 2008-05-05 08:39:29.000000000 +0100
+++ lib/adminlib.php 2008-05-05 08:40:58.000000000 +0100
@@ -2060,6 +2060,7 @@
'insertimage' => 'ed_image.gif',
'inserttable' => 'insert_table.gif',
'insertsmile' => 'em.icon.smile.gif',
+ 'insertdragmath' => 'em.icon.dragmath.gif',
'insertchar' => 'icon_ins_char.gif',
'spellcheck' => 'spell-check.gif',
'htmlmode' => 'ed_html.gif',
 
Average of ratings: -
Picture of Marc Grober
Re: DragMath integration now available
 
The changes you referenced above were incorporated in the current version which also retains the smileys. See the documentation here:
http://docs.moodle.org/en/Dragmath

For anyone using 1.8.4+ this is a simple install and everything should work without any changes. For any version using the adminlib.php present in 1.8.2 and earlier, do the same install but do not use the copy of adminlib.php included in the zip.

One benefit of using the new package is that it includes the most recent version of dragmath which includes options for using asciimathml text expressions (blazingly fast conversion from a simple text expression - asciimathml or latex - to presentation MathML for display) and filters instead of LaTex and the ability to insert the expressions with and without filter tokens. So, if you tend to use the quadratic formula or a specific integration commonly yu can save that as a dgrm file and then insert once in your text with token to have it parsed, and to show the text expression you employed, if that is an issue, insert again without the tokens.

Tip o' the hat to John and everyone else who worked on this.....

If you subscribe to the html editor forum you will note that there are quite a few folks working on the next generation html editor and they are looking for folks who will test these with Dragmath and Equation Editor.
 
Average of ratings: -