\n'); } // FS SCORM - fscommand adapter for ADL SCORM // version 1.1.1 11/25/01 // Copyright 2002 Pathlore Software Corporation All Rights Reserved // Copyright 2002 Macromedia Inc. All rights reserved. // Developed by Tom King, Macromedia and Leonard Greenberg, Pathlore // Modified by Jeff Burton and Andrew Chemey, Macromedia (01/09/02) // ----------------------------------------------------------------- var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; var findAPITries = 0; //added by Platte Canyon var hasFinished = "false" function findAPI(win) { // Check to see if the window (win) contains the API // if the window (win) does not contain the API and // the window (win) has a parent window and the parent window // is not the same as the window (win) while ( (win.API == null) && (win.parent != null) && (win.parent != win) ) { // increment the number of findAPITries findAPITries++; // Note: 7 is an arbitrary number, but should be more than sufficient if (findAPITries > 7) { alert("Error finding API -- too deeply nested."); return null; } // set the variable that represents the window being // being searched to be the parent of the current window // then search for the API again win = win.parent; } return win.API; } function getAPI() { // start by looking for the API in the current window var theAPI = findAPI(window); // if the API is null (could not be found in the current window) // and the current window has an opener window if ( (theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined") ) { // try to find the API in the current window's opener theAPI = findAPI(window.opener); } // if the API has not been found if (theAPI == null) { // Alert the user that the API Adapter could not be found alert("Unable to find an API adapter"); } return theAPI; } var mm_API = getAPI(); // make sure status conforms to scorm standards function normalizeStatus(status) { switch (status.toUpperCase().charAt(0)) { case 'C': return "completed"; case 'I': return "incomplete"; case 'N': return "not attempted"; case 'F': return "failed"; case 'P': return "passed"; } return status; } // make sure the question type conforms to scorm standards function normalizeType(theType) { switch (theType.toUpperCase().charAt(0)) { case 'T': return "true-false"; case 'C': return "choice"; case 'F': return "fill-in"; case 'M': return "matching"; case 'P': return "peformance"; case 'S': return "sequencing"; case 'L': return "likert"; case 'N': return "numeric"; } return theType; } // make sure the question result conforms to scorm standards function normalizeResult(result) { switch (result.toUpperCase().charAt(0)) { case 'C': return "correct"; case 'W': return "wrong"; case 'U': return "unanticipated"; case 'N': return "neutral"; } return result; } /* Learnways Print function */ function ViewPrint(param) { //alert(param); var pwin = window.frames[0]; _ut = param.replace(/(<([^>]+)>)/ig,""); while (_ut .indexOf("\[") > -1) _ut = _ut .replace("\[","<"); while (_ut.indexOf("\]") > -1) _ut = _ut .replace("\]",">"); pwin.document.getElementById("Content").innerHTML = _ut; pwin.focus(); pwin.print(); } var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; // Handle all the the FSCommand messages in a Flash movie function template_DoFSCommand(command, args) { var templateObj = InternetExplorer ? template : document.template; args = String(args); command = String(command); /* Learnways print function 1.0 By Robert Pohl - Learnways in Sweden AB 2005 */ if(command=="LW_PrintPages") { ViewPrint(args); return; } var F_intData = args.split(";"); // check for existence of scorm api if (mm_API == null) return; switch (command) { case "MM_StartSession" : break; case "MM_cmiSendInteractionInfo" : //MM_cmiSendInteractionInfo(date, time, intid, objid, intrtype, correct, student, result, weight, latency) var n = mm_API.LMSGetValue("cmi.interactions._count"); mm_API.LMSSetValue("cmi.interactions." + n + ".id", F_intData[2]); mm_API.LMSSetValue("cmi.interactions." + n + ".objectives.0.id", F_intData[3]); mm_API.LMSSetValue("cmi.interactions." + n + ".time", F_intData[1]); mm_API.LMSSetValue("cmi.interactions." + n + ".type", normalizeType(F_intData[4])); mm_API.LMSSetValue("cmi.interactions." + n + ".correct_responses.0.pattern", F_intData[5]); mm_API.LMSSetValue("cmi.interactions." + n + ".weighting", F_intData[8]); mm_API.LMSSetValue("cmi.interactions." + n + ".student_response", F_intData[6]); mm_API.LMSSetValue("cmi.interactions." + n + ".result", normalizeResult(F_intData[7])); mm_API.LMSSetValue("cmi.interactions." + n + ".latency", F_intData[9]); break; case "MM_cmiSendObjectiveInfo" : //MM_cmiSendObjectiveInfo(index, objid, score, status) var n = mm_API.LMSGetValue("cmi.objectives._count"); mm_API.LMSSetValue("cmi.objectives." + n + ".id", F_intData[1]); mm_API.LMSSetValue("cmi.objectives." + n + ".score.raw", F_intData[2]); mm_API.LMSSetValue("cmi.objectives." + n + ".status", normalizeStatus(F_intData[3])); break; case "CMISetScore": case "MM_cmiSendScore" : //MM_cmiSendScore(theScore) //alert("Score is : " + F_intData[0]); mm_API.LMSSetValue("cmi.core.score.raw", F_intData[0]); break; case "CMISetStatus": case "MM_cmiSetLessonStatus" : //MM_cmiSetLessonStatus(theStatus) mm_API.LMSSetValue("cmi.core.lesson_status", normalizeStatus(F_intData[0])); break; case "CMISetTime" : //CMISetTime(t) mm_API.LMSSetValue("cmi.core.session_time", F_intData[0]); break; case "CMISetCompleted" : //CMISetCompleted() // alert("javaScript Debug: kursens status sätts till completed"); mm_API.LMSSetValue("cmi.core.lesson_status", "completed"); break; case "CMISetStarted" : //CMISetCompleted() mm_API.LMSSetValue("cmi.core.lesson_status", "incomplete"); break; case "CMISetPassed": //CMISetCompleted() mm_API.LMSSetValue("cmi.core.lesson_status", "passed"); break; case "CMISetFailed": //CMISetCompleted() mm_API.LMSSetValue("cmi.core.lesson_status", "failed"); break; case "CMISetData": //CMISetData(data) //alert("sending suspend data"); //alert(F_intData[0]); mm_API.LMSSetValue("cmi.suspend_data", F_intData[0]); break; case "CMISetLocation": //CMISetLocation(loc) mm_API.LMSSetValue("cmi.core.lesson_location", F_intData[0]); break; case "CMISetTimedOut": //CMISetTimedOut() mm_API.LMSSetValue("cmi.core.exit", "time-out"); break; case "CMIInitialize": //CMIInitialize() var result = mm_API.LMSInitialize(args); break; case "CMIFinish": break; case "CMIExitAU": var result = mm_API.LMSFinish(args); //Added by Platte Canyon hasFinished = "true" window.close(); break; //ADDED BY PLATTE CANYON case "CMIAudio": returnVal = mm_API.LMSSetValue("cmi.student_preference.audio", F_intData[0]); break; case "getVolumeSetting": var returnVal = mm_API.LMSGetValue("cmi.student_preference.audio"); window.document.template.SetVariable("volSetFromOutside", (returnVal)); break; case "getStudentName": var returnVal = mm_API.LMSGetValue("cmi.core.student_name"); window.document.template.SetVariable("studentName", (returnVal)); break; // ADDED BY CODE&DATA case "getMasteryScore": var returnVal = mm_API.LMSGetValue("cmi.student_data.mastery_score"); //alert(returnVal); window.document.template.SetVariable("masteryScore", (returnVal)); break; case "getBookmark": var returnVal = mm_API.LMSGetValue("cmi.core.lesson_location"); //alert(returnVal); window.document.template.SetVariable("bookmark", (returnVal)); break; case "getSuspendData": var returnVal = mm_API.LMSGetValue("cmi.suspend_data"); //alert("suspendData : " + returnVal); window.document.template.SetVariable("suspendData", (returnVal)); break; case "CMISetLoggedOut": //alert("logged out"); mm_API.LMSSetValue("cmi.core.exit", "logout"); break; case "CMISetMinScore" : //alert("set min score"); //alert(F_intData[0]); mm_API.LMSSetValue("cmi.core.score.min", F_intData[0]); break; case "CMISetMaxScore" : //alert("set max score"); //alert(F_intData[0]); mm_API.LMSSetValue("cmi.core.score.max", F_intData[0]); break; case "SetVariable" : //generic function to set a variable in the LMS //alert("setting variable : " + F_intData[0] + " to value " + F_intData[1]); mm_API.LMSSetValue(F_intData[0], F_intData[1]); break; case "GetVariable": //generic function for get a variable from the LMS var returnVal = mm_API.LMSGetValue(F_intData[0]); window.document.template._global.T_SetVariable(F_intData[1], (returnVal)); break; case "traceVar" : //generic function to just display a javascript alert //alert("Tracing : " + F_intData[0]); break; // Added by Learnways case "LWSetCourseStart" : //If the user has not started, the set incomplete var returnVal = mm_API.LMSInitialize(""); if(returnVal=="true") { // alert("javaScript Debug: Initierar kursens status"); var returnVal = mm_API.LMSGetValue("cmi.core.lesson_status"); if(returnVal=="not attempted") { mm_API.LMSSetValue("cmi.core.lesson_status","incomplete"); } } else { alert("Debug: LMSInitialize misslyckades!"); } break; case "LMSGetValue": //generic function for get a variable from the LMS var returnVal = mm_API.LMSGetValue(args); // alert("got variable : " + command + " and it is : " + returnVal+F_intData[0]+F_intData[1]); window.document.template.SetVariable(F_intData[1], returnVal); break; } // END OF CMI FUNCTION MAPPING } function sendExitLesson() { try{ mm_API.LMSFinish(""); } catch(e) { alert("Kunde inte sätta LMSFinish!"); } } //-->