diff --git a/mod/scorm/datamodels/debug.js.php b/mod/scorm/datamodels/debug.js.php index dd7cb24ccfe..8976d129765 100644 --- a/mod/scorm/datamodels/debug.js.php +++ b/mod/scorm/datamodels/debug.js.php @@ -721,3 +721,19 @@ function LogAPICall(func, nam, val, rc) { s += ' => ' + String(rc); AppendToLog(s, rc); } + + +// Add in a JS controlled link for toggling the Debug logging +var logButton = document.createElement('a'); +logButton.id = 'mod-scorm-log-toggle'; +logButton.name = 'logToggle'; +logButton.href = 'javascript:toggleLog();'; +if (getLoggingActive() == "A") { + logButton.innerHTML = ''; +} else { + logButton.innerHTML = ''; +} +var content = safeGetElement(document, 'scormpage'); +content.insertBefore(logButton, content.firstChild); +AppendToLog("Moodle SCORM 1.2 API Loaded, Activity: name; ?>, SCO: identifier; ?>", 0); + diff --git a/mod/scorm/datamodels/scorm_12.js.php b/mod/scorm/datamodels/scorm_12.js.php index 2a8596f91b4..c7095e8ee55 100644 --- a/mod/scorm/datamodels/scorm_12.js.php +++ b/mod/scorm/datamodels/scorm_12.js.php @@ -197,13 +197,13 @@ function SCORMapi1_2() { result = StoreData(cmi,true); if (nav.event != '') { if (nav.event == 'continue') { - setTimeout('top.document.location=top.next;',500); + setTimeout('scorm_get_next();',500); } else { - setTimeout('top.document.location=top.prev;',500); + setTimeout('scorm_get_prev();',500); } } else { if (auto ?> == 1) { - setTimeout('top.document.location=top.next;',500); + setTimeout('scorm_get_next();',500); } } dirroot.'/mod/scorm/datamodels/debug.js.php'); - echo 'AppendToLog("Moodle SCORM 1.2 API Loaded, Activity: '.$scorm->name.', SCO: '.$sco->identifier.'", 0);'; + include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php'); } ?> diff --git a/mod/scorm/datamodels/scorm_13.js.php b/mod/scorm/datamodels/scorm_13.js.php index 60f47304783..0d15ea1f937 100644 --- a/mod/scorm/datamodels/scorm_13.js.php +++ b/mod/scorm/datamodels/scorm_13.js.php @@ -1278,6 +1278,5 @@ var API_1484_11 = new SCORMapi1_3(); // pull in the debugging utilities if (scorm_debugging($scorm)) { include_once($CFG->dirroot.'/mod/scorm/datamodels/debug.js.php'); - echo 'AppendToLog("Moodle SCORM 1.3 API Loaded, Activity: '.$scorm->name.', SCO: '.$sco->identifier.'", 0);'; } ?> diff --git a/mod/scorm/module.js b/mod/scorm/module.js index 8ca03291d6e..e26a0e74858 100644 --- a/mod/scorm/module.js +++ b/mod/scorm/module.js @@ -21,6 +21,10 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +mod_scorm_next = null; +mod_scorm_prev = null; +mod_scorm_activate_item = null; + M.mod_scorm = {}; M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launch_sco) { @@ -134,6 +138,8 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc } }; + mod_scorm_activate_item = scorm_activate_item; + /** * Enables/disables navigation buttons as needed. * @return void @@ -282,6 +288,9 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc return null; }; + mod_scorm_next = scorm_next; + mod_scorm_prev = scorm_prev; + // layout YAHOO.widget.LayoutUnit.prototype.STR_COLLAPSE = M.str.moodle.hide; @@ -401,3 +410,26 @@ M.mod_scorm.init = function(Y, hide_nav, hide_toc, toc_title, window_name, launc }; }); }; + + +function scorm_get_prev() { + scorm_tree_node = YAHOO.widget.TreeView.getTree('scorm_tree'); + if (scorm_tree_node) { + var hnode = scorm_tree_node.getHighlightedNode(); + var prev = mod_scorm_prev(hnode); + if (prev) { + mod_scorm_activate_item(prev); + } + } +} + +function scorm_get_next() { + scorm_tree_node = YAHOO.widget.TreeView.getTree('scorm_tree'); + if (scorm_tree_node) { + var hnode = scorm_tree_node.getHighlightedNode(); + var next = mod_scorm_next(hnode); + if (next) { + mod_scorm_activate_item(next); + } + } +} diff --git a/mod/scorm/player.php b/mod/scorm/player.php index 794d69269f8..a7db45f1820 100755 --- a/mod/scorm/player.php +++ b/mod/scorm/player.php @@ -208,26 +208,7 @@ prerequisites) { - if ($scorm->popup == 0) { - if (scorm_debugging($scorm)) { -?> - -popup != 0) { // Clean the name for the window as IE is fussy $name = preg_replace("/[^A-Za-z0-9]/", "", $scorm->name); if (!$name) {