Commit c178ba72 authored by Amy Groshek's avatar Amy Groshek

MDL-57785 scorm: Prevents SCORM nav refresh when nav not shown.

This improvement prevents refresh of SCORM 1.2 navigation menu
when the navigation menu is not displayed.
parent e7059ec5
......@@ -16,7 +16,8 @@
//
// SCORM 1.2 API Implementation
//
function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride) {
function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey,
scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride, hidetoc) {
var prerequrl = cfgwwwroot + "/mod/scorm/prereqs.php?a=" + scormid + "&scoid=" + scoid + "&attempt=" + attempt + "&mode=" + viewmode + "&currentorg=" + currentorg + "&sesskey=" + sesskey;
var datamodelurl = cfgwwwroot + "/mod/scorm/datamodel.php";
......@@ -413,12 +414,17 @@ function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebu
if (param == "") {
if (Initialized) {
result = StoreData(cmi,false);
// trigger TOC update
var callback = M.mod_scorm.connectPrereqCallback;
YUI().use('io-base', function(Y) {
Y.on('io:complete', callback.success, Y);
Y.io(prerequrl);
});
// Trigger TOC update only if TOC is displayed.
// Checks against setting Display course structure in player:
// 0 = To the side, 1 = Hidden, 2 = In a drop down menu, 3 = Disabled
if (hidetoc !== '3') {
Y.log('Refreshing toc');
var callback = M.mod_scorm.connectPrereqCallback;
YUI().use('io-base', function(Y) {
Y.on('io:complete', callback.success, Y);
Y.io(prerequrl);
});
}
if (scormdebugging) {
LogAPICall("Commit", param, "", 0);
}
......@@ -660,6 +666,8 @@ function SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebu
M.scorm_api = {};
M.scorm_api.init = function(Y, def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride) {
window.API = new SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot, sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride);
M.scorm_api.init = function(Y, def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot,
sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride, hidetoc) {
window.API = new SCORMapi1_2(def, cmiobj, cmiint, cmistring256, cmistring4096, scormdebugging, scormauto, scormid, cfgwwwroot,
sesskey, scoid, attempt, viewmode, cmid, currentorg, autocommit, masteryoverride, hidetoc);
}
......@@ -55,11 +55,12 @@ $scorm->autocommit = ($scorm->autocommit === "1") ? true : false;
$scorm->masteryoverride = ($scorm->masteryoverride === "1") ? true : false;
$PAGE->requires->js_init_call('M.scorm_api.init', array($def, $cmiobj, $cmiint, $cmistring256, $cmistring4096,
scorm_debugging($scorm), $scorm->auto, $scorm->id, $CFG->wwwroot,
sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $scorm->autocommit, $scorm->masteryoverride));
sesskey(), $scoid, $attempt, $mode, $id, $currentorg, $scorm->autocommit,
$scorm->masteryoverride, $scorm->hidetoc));
// Pull in the debugging utilities.
if (scorm_debugging($scorm)) {
require_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php');
echo html_writer::script('AppendToLog("Moodle SCORM 1.2 API Loaded, Activity: '.
$scorm->name.', SCO: '.$sco->identifier.'", 0);');
}
\ No newline at end of file
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment