-
Bug
-
Resolution: Fixed
-
Critical
-
2.5.6, 2.6.3, 2.6.4, 2.7.1
-
MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
-
MOODLE_26_STABLE, MOODLE_27_STABLE
-
If a previously-attempted scorm is set to appear in a popup, then even if the user selects Normal mode and checks the "Start new attempt" checkbox, the scorm will always open in Review mode and the attempt is not recorded.
It works properly when the scorm is opened in the current window.
TO REPRODUCE:
1. Create new course.
2. Enrol test learner.
3. Create new SCORM activity.
4. Ensure 'Force new attempt' is set to 'No' in SCORM settings.
5. Set scorm to appear in New Window
6. Log in as a test learner and complete SCORM (pass or fail, it doesn't matter).
7. Go back to SCORM once completed and select 'Start new attempt' checkbox and Normal mode.
8. SCORM is actually opened in 'Review mode' and attempt is not recorded.
REASON:
mod/scorm/view.js
The url for the popup window is set on line 11 (2.6)
var launch_url = M.cfg.wwwroot+"/mod/scorm/player.php?a="scorm"¤torg="currentorg"&scoid="sco"&sesskey="M.cfg.sesskey"&display=popup";
Then there is a YUI event handler that triggers when the submit button is pressed:
Y.on('submit', function(e) {
winobj = window.open(launch_url, 'Popup', poptions);
The issue of course is that the mode and newattempt options on the form are not being considered and added if appropriate to the popup URL.
SUGGESTED FIX:
I added a function to the view.js file to do just that:
var check_launchurl = function() {
// Check the current state of the mode and newattempt options if they exist.
var mode = Y.one('#n');
if (mode && mode.get('checked'))
var newattempt = Y.one('#n');
if (newattempt && newattempt.get('checked'))
}
Then called this function on the two places where popups can be launched
if (launch == true) {
check_launchurl();
winobj = window.open(launch_url,'Popup', poptions);
Y.on('submit', function(e) {
check_launchurl();
winobj = window.open(launch_url, 'Popup', poptions);
And now popups launch correctly and accept new attempts.