Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-38745 SCORM: fixed appending 'API logging is on|off', once per la…

…unch
  • Loading branch information...
commit fd10686843443415ff526a2efd0307048494bc1b 1 parent cc351ed
Matteo Scaramuccia scara authored
Showing with 12 additions and 11 deletions.
  1. +12 −11 mod/scorm/datamodels/debug.js.php
23 mod/scorm/datamodels/debug.js.php
View
@@ -741,15 +741,16 @@ function LogAPICall(func, nam, val, 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 = '<?php echo addslashes_js(get_string('scormloggingon', 'scorm')); ?>';
-} else {
- logButton.innerHTML = '<?php echo addslashes_js(get_string('scormloggingoff', 'scorm')); ?>';
+if (!document.getElementById('mod-scorm-log-toggle')) {
+ var logButton = document.createElement('a');
+ logButton.id = 'mod-scorm-log-toggle';
+ logButton.name = 'logToggle';
+ logButton.href = 'javascript:toggleLog();';
+ if (getLoggingActive() == "A") {
+ logButton.innerHTML = '<?php echo addslashes_js(get_string('scormloggingon', 'scorm')); ?>';
+ } else {
+ logButton.innerHTML = '<?php echo addslashes_js(get_string('scormloggingoff', 'scorm')); ?>';
+ }
+ var content = safeGetElement(document, 'scormpage');
+ content.insertBefore(logButton, content.firstChild);
}
-var content = safeGetElement(document, 'scormpage');
-content.insertBefore(logButton, content.firstChild);
-
Please sign in to comment.
Something went wrong with that request. Please try again.