Details
Description
When the content is configured to be displayed in a new window, it is possible for the user to get back into the parent window and navigate away from it.
Such a behavior correctly fires a close command against the SCORM content window but... this will happen when the SCORM RTE (API) has been already removed from the parent window and the content - which usually "close" the session using code called in body@unonload - is not able to correctly "finish" the tracking session being LMSFinish() no more available.
The same applies with SCORM 2004 and potentially with 2.0.x.
Issue Links
| This issue will be resolved by: | ||||
| MDL-28295 | SCORM crashing in IE 7 and above when httpreq is called under certain conditions when using SCORM popups |
|
|
|
A possible solution is to delay the browser "someway" in unloading the parent window, to let the content close its session correctly.
It seems that the patch proposal below does the trick:
Index: /trunk/src/moodle/mod/scorm/player.php =================================================================== --- /trunk/src/moodle/mod/scorm/player.php (revision original) +++ /trunk/src/moodle/mod/scorm/player.php (revision proposal) @@ -63,4 +63,5 @@ $strscorms = get_string('modulenameplural', 'scorm'); $strscorm = get_string('modulename', 'scorm'); + $straltpopup = get_string('altpopup', 'scorm'); $strpopup = get_string('popup','scorm'); $strexit = get_string('exitactivity','scorm'); @@ -147,5 +148,5 @@ $bodyscript = ''; if ($scorm->popup == 1) { - $bodyscript = 'onunload="main.close();"'; + $bodyscript = 'onunload="closepopup();"'; } @@ -166,4 +167,13 @@ scorm_resize(<?php echo $scorm->width.", ".$scorm->height; ?>); }; + + function closepopup() { + // check if popup is still opened + if (!main.closed) { + main.close(); + alert('<?php echo addslashes($straltpopup) ?>'); + return false; + } + } --> </script> Index: /trunk/src/moodle/lang/en_utf8/scorm.php =================================================================== --- /trunk/src/moodle/lang/en_utf8/scorm.php (revision original) +++ /trunk/src/moodle/lang/en_utf8/scorm.php (revision proposal) @@ -5,4 +5,5 @@ $string['activation'] = 'Activation'; $string['advanced'] = 'Parameters'; +$string['altpopup'] = 'Please close the course popup window before navigating away from here, thank you.'; $string['asset'] = 'Asset'; $string['assetlaunched'] = 'Asset - Viewed';Index: /trunk/src/moodle/mod/scorm/player.php =================================================================== --- /trunk/src/moodle/mod/scorm/player.php (revision original) +++ /trunk/src/moodle/mod/scorm/player.php (revision proposal) @@ -63,4 +63,5 @@ $strscorms = get_string('modulenameplural', 'scorm'); $strscorm = get_string('modulename', 'scorm'); + $straltpopup = get_string('altpopup', 'scorm'); $strpopup = get_string('popup','scorm'); $strexit = get_string('exitactivity','scorm'); @@ -147,5 +148,5 @@ $bodyscript = ''; if ($scorm->popup == 1) { - $bodyscript = 'onunload="main.close();"'; + $bodyscript = 'onunload="closepopup();"'; } @@ -166,4 +167,13 @@ scorm_resize(<?php echo $scorm->width.", ".$scorm->height; ?>); }; + + function closepopup() { + // check if popup is still opened + if (!main.closed) { + main.close(); + alert('<?php echo addslashes($straltpopup) ?>'); + return false; + } + } --> </script> Index: /trunk/src/moodle/lang/en_utf8/scorm.php =================================================================== --- /trunk/src/moodle/lang/en_utf8/scorm.php (revision original) +++ /trunk/src/moodle/lang/en_utf8/scorm.php (revision proposal) @@ -5,4 +5,5 @@ $string['activation'] = 'Activation'; $string['advanced'] = 'Parameters'; +$string['altpopup'] = 'Please close the course popup window before navigating away from here, thank you.'; $string['asset'] = 'Asset'; $string['assetlaunched'] = 'Asset - Viewed';