Moodle 2.7.1 Scorm Irregularites

Moodle 2.7.1 Scorm Irregularites

by Brian Merritt -
Number of replies: 6
Picture of Particularly helpful Moodlers

Moodle 2.71 has made a lot of improvements on SCORM, especially for mobile users, but some former settings appear to have bugs or changed functions.

Moodle Setting  "Student Skip Content Structure Page" has the following help text - 

"This setting specifies whether the content structure page should ever be skipped (not displayed). If the package contains only one learning object, the content structure page can always be skipped."

However, that does not seem to work as advertised, even if the SCORM module has only one content section.

Secondly, if we "disable preview mode" which should hide the preview button, then the "Enter" button for the course also disappears.

Also, when open in new window is selected, some of the SCORM settings prevent this working.

Finally (and most importantly) - students expect the pop up when they click on the link, not to see the course structure information.  So the bug above forces the teacher to use the wrong settings (otherwise no pop up window), which then means students have to do multiple clicks to launch the scorm window.




Average of ratings: -
In reply to Brian Merritt

Re: Moodle 2.7.1 Scorm Irregularites

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

preview mode/new window issues - please see: MDL-46760 (fixed this week and will be in the next released stable build on Fri)

also, the skip content structure page setting has that prefix "student" - as the setting will only work for students. The content structure page is currently the only place that a teacher sees the links to reports... so if we skipped it for teachers/admins then they would never be able to view reports.

In reply to Dan Marsden

Re: Moodle 2.7.1 Scorm Irregularites

by Brian Merritt -
Picture of Particularly helpful Moodlers

Hi Dan

That is great!

In the meantime, I cooked this up in (pure) Javascript, which does the job.  Might come in handy for someone with older versions of Moodle or elsewhere to find a button on a page and automate a mouse click.


<script type="text/javascript">

/* Function to find "input" elements with value = "value" 
function getInputWithValue(value) {
    var inputs = document.getElementsByTagName("input");
    var i = inputs.length;
    while (i--) {
        if (inputs[i].value === value) {
            return inputs[i];
        }
    }
    return null;
} /* Brilliant Javascript function to simulate any event ("etype") on any element ("el") and it came from http://stackoverflow.com/questions/2705583/how-to-simulate-a-click-with-javascript/2706236#2706236 */
function eventFire(el, etype){
  if (el.fireEvent) {
    el.fireEvent('on' + etype);
  } else {
    var evObj = document.createEvent('Events');
    evObj.initEvent(etype, true, false);
    el.dispatchEvent(evObj);
  }
} /* Code that checks if we are on a SCORM module and presses the click */
var scormPathArray = window.location.pathname.split( '/' ) ;
if (scormPathArray[1] == "mod" && scormPathArray[2] == "scorm" ) {
    var input = getInputWithValue("Enter");
    window.alert(input.type);
    eventFire(input,'click') ;
}
</script>
In reply to Brian Merritt

Re: Moodle 2.7.1 Scorm Irregularites

by Brian Merritt -
Picture of Particularly helpful Moodlers

Hi Dan

The new code fixes the "open window" problem if disable preview is set to yes in Chrome, but not for firefox.

There is still a bug when the setting is "Student skip content structure page" to Always if "New Window" is set.  Instead of the new window opening, the Scorm content structure page appears without the content and with no Enter button to kick off the Scorm package.

If the teacher has set Scorm to "current window" then behaviour is as expected in Chrome.


So - happy to raise a Tracker, but what should happen when the teacher sets "New Window" and "Student Skip Content Structure Page" ?  My thoughts are the Scorm window opens automatically (like it did in Moodle 1.x), and the main Moodle page should still output the "Your scorm module has opened in another window.  Click this when you are done with it" message...


In reply to Brian Merritt

Re: Moodle 2.7.1 Scorm Irregularites

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators

I haven't seen that before - make sure the custom code changes you have made aren't interfering - clear the moodle cache (after removing all your custom changes) - then make sure it's not your Browsers pop-up blocker that it getting in the way.

When using skip content structure page and "new window" the pop-up isn't launched on "user-action" like the other pop-ups so will get blocked by normal blockers. (make sure you don't have any other security plugins in your browser causing problems)




In reply to Dan Marsden

Re: Moodle 2.7.1 Scorm Irregularites

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
just had this reported which might be related: https://tracker.moodle.org/browse/MDL-46961
In reply to Dan Marsden

Re: Moodle 2.7.1 Scorm Irregularites

by Brian Merritt -
Picture of Particularly helpful Moodlers

Thanks Dan for the update!


ps - the Javascript definitely was not causing issues, but it didn't work in Firefox, so I changed the event function to "MouseEvents" and added code to log to the console if anything else is preventing the trigger to help debugging.


function eventFire(el, etype){
  if (el.fireEvent) {
    el.fireEvent('on' + etype);
  } else {
    var evObj = document.createEvent('MouseEvents');
    evObj.initEvent(etype, true, false);
    var canceled = !el.dispatchEvent(evObj);
    if (canceled) {
      // A handler called preventDefault.
      console.log("automatic click canceled");
    } else {
      // None of the handlers called preventDefault.
    } 
  }
}