📄 debug.js.php
字号:
+ ' if(result == "true") { \n' + ' msg = "LMSFinish Successful!"; \n' + ' document.otherForm.msgtxt.value = msg; \n' + ' } else { \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' var msg = "LMSFinish Failed! Error Code: "+err; \n' + ' msg += " Error Description: " + errString; \n' + ' document.otherForm.msgtxt.value = msg; \n' + ' } \n' + ' } \n' + ' \n' + ' function tryLMSTerminate() { \n' + ' var result = doLMSTerminate(); \n' + ' var msg; \n' + ' if(result == "true") { \n' + ' msg = "Terminate Successful!"; \n' + ' document.otherForm.msgtxt.value = msg; \n' + ' } else { \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' var msg = "Terminate Failed! Error Code: "+err; \n' + ' msg += " Error Description: " + errString; \n' + ' document.otherForm.msgtxt.value = msg; \n' + ' } \n' + ' } \n' + ' \n' + ' function tryLMSGetValue() { \n' + ' var value = document.elemForm.API_ELEMENT.value; \n' + ' var msg; \n' + ' var result = doLMSGetValue(value); \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' msg = "<?php echo $LMS_prefix; ?>GetValue Returned: " + result; \n' + ' msg += "\\nError Code: " + err; \n' + ' msg += "\\nError Description: " + errString; \n' + ' document.elemForm.msgtxt.value = msg; \n' + ' document.elemForm.API_ELEMENT.value = saveElement; \n' + ' } \n' + ' \n' + ' function tryLMSSetValue() { \n' + ' // Get the element that is to be set \n' + ' var setValue = document.elemForm.SET_VAL.value; \n' + ' var item = document.elemForm.API_ELEMENT.value; \n' + ' var msg; \n' + ' var api = getAPIHandle(); \n' + ' if (api == null) { \n' + ' alert("Unable to locate the LMS\'s API Implementation.\\n"+ \n' + ' "<?php echo $LMS_prefix; ?>SetValue was not successful."); \n' + ' return false; \n' + ' } \n' + ' // Try to set the element \n' + ' var result = api.<?php echo $LMS_prefix; ?>SetValue( item, setValue ); \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' msg = "<?php echo $LMS_prefix; ?>SetValue returned: " + result; \n' + ' msg += "\\nError Code: " + err; \n' + ' msg += "\\nError Description: " + errString; \n' + ' document.elemForm.msgtxt.value = msg; \n' + ' document.elemForm.API_ELEMENT.value = saveElement; \n' + ' } \n' + ' \n' + ' function tryLMSGetLastError() { \n' + ' var err = doLMSGetLastError(); \n' + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetLastError returned Error Code: " + err; \n' + ' } \n' + ' \n' + ' function tryLMSGetErrorString() { \n' + ' var err = doLMSGetLastError(); \n' + ' var errString = doLMSGetErrorString(err); \n' + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetErrorString returned: " + errString; \n' + ' } \n' + ' \n' + ' function tryLMSGetDiagnostic() { \n' + ' var err = doLMSGetLastError(); \n' + ' var diagnostic = doLMSGetDiagnostic(err); \n' + ' document.otherForm.msgtxt.value = "<?php echo $LMS_prefix; ?>GetDiagnostic returned: " + diagnostic; \n' + ' } \n' + ' \n' + '</script>\n' + '<\/head><body STYLE="background-color: ffffff; color: black"' + 'marginwidth="0" leftmargin="0" hspace="0">' + '<h1>SCORM Debugging interface</h1>' + '<h2>SCORM Version Detected: <?php echo $scorm->version; ?></h2>' + '<input type="hidden" id="mod-scorm-logstate" name="mod-scorm-logstate" value="A" \/>' + '<form name="initForm" onsubmit="return false;">' + ' <table width="100%" border="0">' + ' <tr>' + ' <td>' + ' <input type = "button" value = "Call <?php echo $LMS_prefix; ?>Initialize()" onclick = "tryLMSInitialize();" id="Initialize" name="Initialize" />' + ' </td>' + ' <td>' + ' <label>Result: </label><input type="text" name="msgtxt" id="msgtxt" size="80" readonly value="NotCalled" />' + ' </td>' + ' </tr>' + ' </table>' + '</form>' + '<hr />' + '<form name="elemForm" id="elemForm" onsubmit="return false;">' + ' <table width="100%" border="0">' + ' <tr>' + ' <td><b>Select Data Model Element to Get or Set</b> ' + ' <select name = "ELEMENT_LIST" id="ELEMENT_LIST" onchange="setAPIValue()">' + ' <option value="NONE">--None Selected--</option> <option value="">******************************************</option>'<?php foreach ($LMS_elements as $element) { echo ' + \' <option value="'.$element.'">'.$element.'</option>\\n\''; }?> + ' </select>' + ' <input type="text" name="API_ELEMENT" id="API_ELEMENT" size="40"><br />' + ' <br />' + ' <label><b>Select API Function to Call</b></label> <input type = "button" value = "<?php echo $LMS_prefix; ?>GetValue()"' + ' onclick = "tryLMSGetValue();" id="lmsGetButton"' + ' name="lmsGetButton"> -- OR -- ' + ' <input type="button" value="<?php echo $LMS_prefix; ?>SetValue()"' + ' onclick="tryLMSSetValue();" id="lmsSetButton"' + ' name="lmsSetButton">' + ' <label><b> value to Set: </b></label> <input type="text" name="SET_VAL" id="SET_VAL" size="25">' + ' <br />' + ' <label>Result: </label><br />' + ' <textarea name="msgtxt" id="msgtxt" rows="2" cols="150" wrap="VIRTUAL" readonly>None</textarea>' + ' </td>' + ' </tr>' + ' </table>' + '</form>' + '<hr />' + '<form name="otherForm" onsubmit="return false;">' + ' <h3>Additional API Functions</h3>' + ' <table width="100%" border="0">' + ' <tr>' + ' <td><input type="button"' + ' value="<?php echo $LMS_prefix; ?>GetLastError() "' + ' onclick="tryLMSGetLastError();"' + ' id="lastErrorButton"' + ' name="lastErrorButton">' + ' <input type="button"' + ' value="<?php echo $LMS_prefix; ?>GetErrorString() "' + ' onclick="tryLMSGetErrorString();"' + ' id="getErrorStringButton"' + ' name="getErrorStringButton">' + ' <input type="button"' + ' value="<?php echo $LMS_prefix; ?>GetDiagnostic() "' + ' onclick="tryLMSGetDiagnostic();"' + ' id="getDiagnosticButton"' + ' name="getDiagnosticButton">' + ' <input type="button"' + ' value="<?php echo $LMS_prefix; ?>Commit() "' + ' onclick="tryLMSCommit();"' + ' id="commitButton"' + ' name="commitButton">' + ' <input type="button"' + ' value="<?php echo $scorm->version == 'scorm_12' ? 'LMSFinish' : 'Terminate'; ?>() "' + ' onclick="try<?php echo $scorm->version == 'scorm_12' ? 'LMSFinish' : 'LMSTerminate'; ?>();"' + ' id="finishButton"' + ' name="finishButton">' + ' </td>' + ' </tr>' + ' <tr>' + ' <td>' + ' <label>Result: </label><br />' + ' <textarea name="msgtxt" id="msgtxt" rows="2" cols="150" wrap="VIRTUAL" readonly>None</textarea>' + ' </td>' + ' </tr>' + ' </table>' + '</form>' + '<h3 id="mod-scorm-marker">SCORM API Activity Log<\/h3>'; // Is logging active? if (getLoggingActive() != "A") { return; } var popupdoc = ''; logString += s; if (logPopUpWindow != 'N' && !logPopUpWindow.closed) { popupdoc = logPopUpWindow.document; popupdoc.body.innerHTML += s; } else { logPopUpWindow = open( '', 'scormlogpopupwindow', '' ); popupdoc = logPopUpWindow.document; // Is logging active? var marker = safeGetElement(popupdoc, 'mod-scorm-marker'); if (marker) { popupdoc.body.innerHTML += s; } else { popupdoc.open(); popupdoc.write(s1); popupdoc.write(logString); popupdoc.write('<\/body><\/html>') popupdoc.close(); popupdoc.title = 'SCORM API Activity Log'; logPopUpWindow.focus(); } } if (popupdoc.body && popupdoc.body.childNodes.length > 0) { popupdoc.body.lastChild.scrollIntoView(); };}//add an individual log entryfunction AppendToLog(s, rc) { var sStyle; if (rc != 0) { sStyle = 'class="error'; } else if (logRow % 2 != 0) { sStyle = 'class="even"'; } else { sStyle = 'class="odd"'; } sStyle += '"'; var now = new Date(); now.setTime( now.getTime() ); s = '<div ' + sStyle + ' id="<?php echo $scorm->version;?>">' + now.toGMTString() + ': ' + s + '<\/div>'; UpdateLog(s); // switch colours for a new section of work if (s.match(/Commit|Loaded|Initialize|Terminate|Finish|Moodle SCORM|Moodle Logging/)) { logRow++; }}// format a log entryfunction LogAPICall(func, nam, val, rc) { // drop call to GetLastError for the time being - it produces too much chatter if (func.match(/GetLastError/)) { return; } var s = func + '("' + nam + '"'; if (val != null && ! (func.match(/GetValue|GetLastError/))) { s += ', "' + val + '"'; } s += ')'; if (func.match(/GetValue/)) { s += ' - ' + val; } s += ' => ' + String(rc); AppendToLog(s, rc);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -