Permalink
Browse files

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

…unch
  • Loading branch information...
1 parent cc351ed commit fd10686843443415ff526a2efd0307048494bc1b @scara scara committed Mar 26, 2013
Showing with 12 additions and 11 deletions.
  1. +12 −11 mod/scorm/datamodels/debug.js.php
@@ -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);
-

0 comments on commit fd10686

Please sign in to comment.