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

Javascript error during scorm player load

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8, 1.9, 2.0
    • Fix Version/s: 1.8, 1.8.7, 1.9.3, 2.0
    • Component/s: SCORM
    • Labels:
      None
    • Database:
      Any
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE

      Description

      Javascript error during scorm player load. Bug around form parameter scoid, which has no value - locallib.php line 644 <input type="hidden" name="scoid"/>. This parameter needs to be correctly populated for the FORM POST.

      Additional details as reported by Suvrat Sharma:
      Hi,

      I have been getting javascript alert error messages "Unable to find api" when opening scorm player. After some investigation I found that error message comes only when request is send as POST. With GET request it works fine.
      Also I see that in file locallib.php - function scorm_view_display there are two hidden input fields with same name "scoid" and with only one field being initialized with value. here's the sample code of function with two input fields in blue color:

      <form id="theform" method="post" action="<?php echo $CFG->wwwroot ?>/mod/scorm/player.php?scoid=<?php echo $sco->id ?>&id=<?php echo $cm->id ?>"<?php echo $scorm->popup == 1?' target="newwin"':'' ?>>
      <?php
      if ($scorm->hidebrowse == 0) {
      print_string('mode','scorm');
      echo '<input type="hidden" name="scoid" value="'.$sco->id.'" />'."\n";
      echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">'.get_string('browse','scorm').'</label>'."\n";
      echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">'.get_string('normal','scorm')."</label>\n";
      } else {
      echo '<input type="hidden" name="mode" value="normal" />'."\n";
      }
      if (($incomplete === false) && (($result->attemptleft > 0)||($scorm->maxattempt == 0))) {
      ?>
      <br />
      <input type="checkbox" id="a" name="newattempt" />
      <label for="a"><?php print_string('newattempt','scorm') ?></label>
      <?php
      }
      ?>
      <br />
      <input type="hidden" name="scoid"/>
      <input type="hidden" name="currentorg" value="<?php echo $orgidentifier ?>" />
      <input type="submit" value="<?php print_string('entercourse','scorm') ?>" />
      </form>

      I believe in my case form gets posted with two scoid fields and player.php takes the empty value for scoid. Url for js file is like "scorm/api.php?id=48065&scoid=&mode=browse&attempt=1".
      I use moodle 1.8.2 with firefox 3.0.1. I have checked the latest moodle version also and there also I don't find any correction in locallib.php file. So I wonder if two input fields with same name serves any purpose or is just a bug !!

      Thanks,
      Suvrat

        Gliffy Diagrams

          Activity

          Hide
          piers Piers Harding added a comment -

          Hi Suvrat -
          I have patched this in STABLE 1.8 and 1.9, can you test it and let me know how you get on?
          Thanks,
          Piers Harding.

          Show
          piers Piers Harding added a comment - Hi Suvrat - I have patched this in STABLE 1.8 and 1.9, can you test it and let me know how you get on? Thanks, Piers Harding.
          Hide
          suvrat Suvrat Sharma added a comment -

          Hi Piers,

          This change fixes the issue because of which scoid param wasn't getting populated during form submission.

          Thanks,
          Suvrat

          Show
          suvrat Suvrat Sharma added a comment - Hi Piers, This change fixes the issue because of which scoid param wasn't getting populated during form submission. Thanks, Suvrat
          Hide
          piers Piers Harding added a comment -

          Suvrat - thanks for testing.

          Cheers.

          Show
          piers Piers Harding added a comment - Suvrat - thanks for testing. Cheers.
          Hide
          piers Piers Harding added a comment -

          As a result of this fix, there appears to be a problem with the next/prev buttons on the player. I am making a new fix to correct this.

          Show
          piers Piers Harding added a comment - As a result of this fix, there appears to be a problem with the next/prev buttons on the player. I am making a new fix to correct this.
          Hide
          piers Piers Harding added a comment -

          Hi Suvrat - could you retest this with the latest changes.

          Cheers,
          Piers Harding.

          Show
          piers Piers Harding added a comment - Hi Suvrat - could you retest this with the latest changes. Cheers, Piers Harding.
          Hide
          angela.branco Angela added a comment -

          the error persists, still not finding api

          Show
          angela.branco Angela added a comment - the error persists, still not finding api
          Hide
          piers Piers Harding added a comment -

          Hi Angela - please provide the SCORM package that you are having problems with, and the necessary instructions to run it.

          Cheers,
          Piers Harding.

          Show
          piers Piers Harding added a comment - Hi Angela - please provide the SCORM package that you are having problems with, and the necessary instructions to run it. Cheers, Piers Harding.
          Hide
          danmarsden Dan Marsden added a comment -

          flagging this as fixed again - the issues reported by Suvrat and Piers in this particular bug have been fixed, The problem "still not finding api " mentioned by Angela in this bug is likely a different issue, however we cannot investigate further without a SCORM object that allows us to reproduce this. Angela, if you are able to provide a SCORM object (preferably by adding to the SCORM Repository) we are happy to investigate your issue further. However, please make sure you are using the Latest 1.9Weekly available from download.moodle.org

          thanks,

          Dan

          Show
          danmarsden Dan Marsden added a comment - flagging this as fixed again - the issues reported by Suvrat and Piers in this particular bug have been fixed, The problem "still not finding api " mentioned by Angela in this bug is likely a different issue, however we cannot investigate further without a SCORM object that allows us to reproduce this. Angela, if you are able to provide a SCORM object (preferably by adding to the SCORM Repository) we are happy to investigate your issue further. However, please make sure you are using the Latest 1.9Weekly available from download.moodle.org thanks, Dan

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                31/Mar/07