Equation editor in ATTO not working

Equation editor in ATTO not working

by Peter Halverson -
Number of replies: 17

Hello,

I just installed Moodle 2.7.5+ (Build: 20150205), and I can't get the equation editor to work.

I am using the TeX filter, which does work with STACK and also when I edit TeX equations "by hand".

But within the ATTO editor, the equation editor is just not doing anything.  I'm attaching a screen shot.

Any ideas?

Thanks,

Peter Halverson

screen shot of equation editor not working

Average of ratings: Useful (1)
In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Mauno Korpelainen -

No ideas why - but have you tried to enable site debugging (to ALL) and checked your browser javascript debugging / error console (for example in FF and IE press F12 or use mouse right click - Inspect element... )

Might be some javascript conflict there.

In reply to Mauno Korpelainen

Re: Equation editor in ATTO not working

by Peter Halverson -

I have looked at the "inspect element" window as the ATTO equation editor runs and see no errors.  (But I'm really sure what I would be looking for.

I also turned on site debugging and I see no errors.

I have noticed that occasionally, perhaps once in ten tries, the equation editor actually functions a little bit.

I once got it to do "2+2=".   But it was with a long time lag.  So maybe there is something tremendously slowing down the rendering of the equation, and as a result it looking like its just not working.

In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Mauno Korpelainen -

When you inspect elements check that your inspector has errors enabled and warnings disabled (there may be lots of css warnings anyway)

errors1

errors2

If rendering equations (in preview etc) is very slow your browser might have some extra plugins, some program (for exaple performance testing tools) might cause that delay or for example some malware might cause that trouble. In your screenshot all buttons look ok (from cache?) and if Tex filter renders new equations ok on your site it's not probably caused by problems on your site.

Have you tried MathJax (instead of Tex filter or with Tex filter) ?

In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers
Peter,

How is your internet connection?  A slow enough connection may be causing a timeout, but I would be surprised by that.
If you look at the console, there may be an error displayed, or there should be a message that says 'filter-content-updated' indicating that there was a new preview loaded whenever the preview is suppose to update.
Another thing to check might be the web server access and error logs. The file ajax.php ought to be accessed when it updates, and error logs might sshow TeX filter problem. 
In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Hello Peter, 


I have not been able to figure out how to reproduce the problem.  Does it depend on the browser used? Does it happen everywhere or just in essay questions for example?

In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Peter Halverson -
Hi everyone,

Thank you for your replies.

My students have been using my Moodle site so I have not yet been able to try switching to MathJax.  And I have a grading deadline, so I can't do much right now.

BUT:  here is something interesting.

If I go to the moodle.org sandbox demo moodle, the equation editor works OK.  (Its running moodle 2.8.3)

On the other hand, on the moodle that is running this forum, its equation editor does not work for me.   You try it.   Does the equation editor in this forum work for you?

What version Moodle is this forum running on?

I will do more troubleshooting as soon as I have submitted grades...   Sigh.

Peter Halverson
In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Yes, this site has the same problem and it is running MathJax and not TeX filter.   There does not seem to be any js error reported in the console. I also tried to looked at the javascript source but it appears to have all the comments stripped and be partially compressed. It is not normally. You might try updating your site again when you get the chance.

In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Mauno Korpelainen -
Testing with Firefox 35.0.1 , IE11 and Chrome 40.0.2214.111 works fine for me here

\( \alpha \beta \gamma \)

Atto
In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Apparently it is the time out problem.  Mauno, you may have been the only one on moodle.org early on a Sunday morning.  I have had a similar experience as Peter. It works on demo.moodle.net, but not moodle.org.  I checked the Network access in Firefox and ajax.php is loading much slower on moodle.org.  There is a 500 ms timeout in the program which is suppose to retry if the server is busy, but apparently has a logic problem.

I suppose that it is not coincidental  that Peter found the problem during a grading period.  The timeout is supposed to be a feature to prevent the editor preview from hanging the server or browser with a race condition when the server is loaded.

In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Peter Halverson -

Yes....

I can see that a 1/2 second timeout would cause the problem. 

I just checked and now that it is Sunday evening, and I am the only user, the equation editor is functioning on my Moodle site.

Thank you Daniel for homing in on this bug!

Peter Halverson


In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Peter Halverson -

Umm...

Is there an easy way to fix the timeout problem?  Can I go into the moodle code and change 500 milliseconds to something longer?

Thanks,

Peter H.

In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Mauno Korpelainen -
It seems to be in 4 files:

1) lib/editor/atto/plugins/equation/yui/src/button/js/button.js
2) lib/editor/atto/plugins/equation/yui/built/moodle-atto-equation-button/moodle-atto-equation-button.js
3) lib/editor/atto/plugins/equation/yui/built/moodle-atto-equation-button/moodle-atto-equation-button-min.js
4) lib/editor/atto/plugins/equation/yui/built/moodle-atto-equation-button/moodle-atto-equation-button-debug.js

In 1), 2) and 4):

timeout: 500,
            on: {
                complete: this._loadPreview
            }

and in 3) (minified):

timeout:500,on:{complete:this._loadPreview}

I am not sure when Atto is using each one of these but I suspect it might use either minified file 3) or the first file.

If you change 500 to for example 5000 in all of these and purge all caches it might help - but I can't test this because I don't get the delay.
Average of ratings: Useful (2)
In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Daniel Thies -
Picture of Core developers Picture of Plugin developers Picture of Testers

Yes, you can change the value of the delay or delete it to fix your problem.  The file src/button/js/button.js file is the source file for shifter from which the build file are generate by running shifter.  If you do not want to run shifter, you can edit the build files directly until there is a fix distributed. 

The file moodle-atto-equation-button/moodle-atto-equation-button-debug.js is used by moodle when debugging is enabled so you can make changes here when you have debbugging on to test it.  The file moodle-atto-equation-button/moodle-atto-equation-button-min.js is used with debugging off. It is the same as the debug file with comments and spaces stripped, variable names shortend etc. Once you have fixed the debug file, you can copy it over the -min.js file and disable debugging in Moodle. The minification is just a nicity that speeds loading.

Rather that accepting the credit for identifying the the bug, I perhaps the deserve the blame for creating it. Thank you Peter and Mauno for acting on it.

Average of ratings: Useful (2)
In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Peter Halverson -

Well...

I changed the timeouts from 500 to 5000 ms and it helped, but it didn't completely solve the problem.

Now that I made the change, the equation editor works with with Safari 6.2.2 and 6.0.5.

It works with Firefox 32.0.3

But not in Firefox 35.01, unless Firefox is in "safe mode".

All of these tests were done with my server under no-load conditions.

With Firefox 35.01, I tried it with all extensions and add-on deactivated, and the equation editor still doesn't work.   Perhaps I will "downgrade" to an earlier version of Firefox.

Fortunately my students' computers are frozen into older versions of Firefox and Safari so I'm hoping it will OK for them.

So altogether, I think that the timeout was part of the problem but that there are other problems too, some in Firefox and maybe some in other places.

By the way, I noticed that there is a difference in the equation editor's performance depending on where it it being used.  For example when I'm editing the front page of my Moodle site, the equation editor seems more robust than when I'm previewing a quiz essay question.

Thanks for the help...

Peter Halverson

PS:  I did switch to MathJax, and it didn't make any difference.

In reply to Peter Halverson

Re: Equation editor in ATTO not working

by Mauno Korpelainen -
But in my Firefox 35.0.1 editor does render preview images ok big grin
I still suspect some local plugin (addon or extension) - for example virus scanner plugin - or some other program causing trouble to Firefox https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-caused-malware

If Firefox does not behave right you can uninstall it ( + remove all personal data and customizations ) and reinstall the latest version.
If your Firefox 35.0.1 works in Safe mode as expected the delay problem might be in some plugin/toolbar etc that is not used in Safe mode (for example https://helpx.adobe.com/security/products/flash-player/apsa15-02.html )

You could also try https://support.mozilla.org/en-US/kb/firefox-health-report-understand-your-browser-perf
In reply to Daniel Thies

Re: Equation editor in ATTO not working

by Peter Halverson -

Hello Daniel,

I just upgraded to from Moodle 2.9 to Moodle 3.1.  Actually I installed 3.1 from scratch so that all the little mods to code were gone.

So, to get the Atto equation editor working again, I again had to change the timeouts.  I changed the 500 ms timouts to 5000 in these files:

In /moodle/lib/editor/atto/plugins/equation/yui/src/button/js/
  button.js
In /moodle/lib/editor/atto/plugins/equation/yui/build/moodle-atto_equation-button
  moodle-atto_equation-button-debug.js          
  moodle-atto_equation-button.js          
  moodle-atto_equation-button-min.js

It did fix the problem (again).  But I mention this because I feel an increased timeout should be incorporated into the standard Moodle distribution.  5000 ms might be tooo long, but 500 will be too short for many users.

Sincerely,

Peter Halverson