-
Bug
-
Resolution: Duplicate
-
Major
-
None
-
3.4.7, 3.7.2
-
Windows 10. Chrome (v77.0) and Firefox (v60.2.2)
-
Any
-
MOODLE_34_STABLE, MOODLE_37_STABLE
-
-
Moderate
-
When embedding a moodle quiz (provider) into an LTI consumer (in my case Blackboard) if the quiz timer is enabled, a javascript error is thrown and this can break the presentation of some types of question content. In my case, this java script error is breaking the processing of MathJax markup in the custom STACK question type, however, I have also tested the use of MathJax in a simple True/False question type and the problem still occurs i.e. it is not specific to any one question type. MathJax is presented in raw LaTeX marking with broken image place holders. The attached image illustrates this for a STACK question which relies heavily on MathJax. It is also worth noting that if the time isn't enabled, but "Close the quiz" date and time is set, a 1 hour countdown time will appear 1 hour before the quiz close time and the same error will be thrown.
The javascript error message is:
Uncaught TypeError: Cannot read property 'setContent' of null
at Object.update (module.js:5)
at Object.init (module.js:2)
at attempt.php?attempt=1096:204
at YUI._notify (VM4647 yui-moodlesimple-min.js:9)
at T (VM4647 yui-moodlesimple-min.js:9)
at YUI._use (VM4647 yui-moodlesimple-min.js:9)
at YUI.T (VM4647 yui-moodlesimple-min.js:9)
at e.Loader._finish (VM4647 yui-moodlesimple-min.js:16)
at e.Loader._onSuccess (VM4647 yui-moodlesimple-min.js:16)
at e.Loader.p (VM4647 yui-moodlesimple-min.js:17)
The javascript line of code is:
var hours=Math.floor(secondsleft/3600);secondsleft-=hours*3600;var minutes=Math.floor(secondsleft/60);secondsleft-=minutes*60;var seconds=secondsleft;Y.one('#quiz-time-left').setContent(hours+':'M.mod_quiz.timer.two_digit(minutes)':'+M.mod_quiz.timer.two_digit(seconds));M.mod_quiz.timer.timeoutid=setTimeout(M.mod_quiz.timer.update,100)}};M.mod_quiz.nav=M.mod_quiz.nav||{};M.mod_quiz.nav.update_flag_state=function(attemptid,questionid,newstate){var Y=M.mod_quiz.nav.Y;var navlink=Y.one('#quiznavbutton'+questionid);navlink.removeClass('flagged');if(newstate==1)
{navlink.addClass('flagged');navlink.one('.accesshide .flagstate').setContent(M.util.get_string('flagged','question'))}else{navlink.one('.accesshide .flagstate').setContent('')}};M.mod_quiz.nav.init=function(Y){M.mod_quiz.nav.Y=Y;Y.all('#quiznojswarning').remove();var form=Y.one('#responseform');if(form){function nav_to_page(pageno)
{Y.one('#followingpage').set('value',pageno);var submit=form.one('input[name="next"]');submit.set('name','');submit.getDOMNode().click()};Y.delegate('click',function(e){if(this.hasClass('thispage'))
{return}My best guess is that this error is caused because when a quiz is embedded via LTI, the side-blocks are hidden and this includes the side block where the QUIZ NAVIGATION and Time left are displayed. If these blocks don't get included, there is nothing to update and a javascript error is thrown. A solution could be to stop the QUIZ NAVIGATION block from being stripped out when a quiz is presented as embedded inside a consumer service.
- duplicates
-
MDL-68792 Display fake blocks on embedded layout
- Closed