Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46236

Start New Attempt option is ignored if SCORM is set to appear in a popup

    Details

    • Testing Instructions:
      Hide

      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. Ensure that a new attempt is made and SCORM should open a new popup in "Normal" mode and the progress should be tracked.

      Show
      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. Ensure that a new attempt is made and SCORM should open a new popup in "Normal" mode and the progress should be tracked.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      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"&currentorg="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'))

      { launch_url += '&mode=normal'; }

      var newattempt = Y.one('#n');
      if (newattempt && newattempt.get('checked'))

      { launch_url += '&newattempt=on'; }

      }

      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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  10 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    8/Sep/14