\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; var WrapperScorpPath = "parent.opener.parent.adapterFrame"; var DEBUG_FLAG = false; //時間 var StartTime = 0; var EndTime = 0; var SessionTime = 0; var send_flg = false; var status = ""; function ExitAU(){ if(send_flg == false){ frame_DoFSCommand("CMIFinish", ""); } } function TimeStart(){ StartTime = (new Date()).getTime(); } // ミリ秒を「HH:MM:SS」に変換する function MilliToTimeformat( time_milli ){ var Seconds = Math.floor( time_milli / 1000 ); var LMSSessionSeconds = Seconds % 60; var Minutes = Math.floor( Seconds / 60 ); var LMSSessionMinutes = Minutes % 60; var Hours = Math.floor( Minutes / 60 ); var LMSSessionHours = Hours % 60; // 2桁に固定 if ( LMSSessionHours < 10 ) { LMSSessionHours = "0" + LMSSessionHours; } if ( LMSSessionMinutes < 10 ) { LMSSessionMinutes = "0" + LMSSessionMinutes; } if ( LMSSessionSeconds < 10 ) { LMSSessionSeconds = "0" + LMSSessionSeconds; } //--LMSSessionTimes hh:mm:ssの形式 return LMSSessionHours + ":" + LMSSessionMinutes + ":" + LMSSessionSeconds; } 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; } if( DEBUG_FLAG == false ){ 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; } var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; // Handle all the the FSCommand messages in a Flash movie function frame_DoFSCommand(command, args){ var frameObj = InternetExplorer ? frame : document.frame; args = String(args); command = String(command); var F_intData = args.split(";"); //alert('command='+command); // debug mode if( command.toUpperCase() == "GETDEBUGFLAG" ){ window.document.frame.SetVariable( F_intData[0] , DEBUG_FLAG ); return; } if(command == "workbook_open"){ workbook_open(); }else if(command == "mini_open"){ mini_open(); }else if(command == "help_open"){ help_open(); }else{ // check for existence of scorm api mm_API = getAPI(); if (mm_API == null){ mm_API = WrapperScorpPath; //return; switch (command){ case "CMIInitialize": //CMIInitialize() //alert('Initialize'); var apiVal = "LMSInitialize" var name = "" var value ="" eval(mm_API).LMSSetValue(apiVal,name, value); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMICommit": //CMICommit() //mm_API.LMSCommit(args); var apiVal ="LMSCommit" var name = "" var value ="" eval(mm_API).LMSSetValue(apiVal,name, value); break; case "CMIFinish": case "CMIExitAU": var apiVal ="LMSSetValue"; var name = "cmi.core.lesson_status"; eval(mm_API).LMSSetValue(apiVal,name,status); EndTime = (new Date()).getTime(); SessionTime = MilliToTimeformat(EndTime - StartTime); var name = "cmi.core.session_time"; var result = eval(mm_API).LMSSetValue(apiVal,name,SessionTime); var apiVal ="LMSFinish" var name = "" var value ="" eval(mm_API).LMSSetValue(apiVal,name, value); break; case "LMSGetLastError" : //var value = mm_API.LMSGetLastError(); //window.document.frame.SetVariable( F_intData[0] , value ); var apiVal ="LMSGetLastError" var name = "" var value ="" eval(mm_API).LMSSetValue(apiVal,name, value); return _GeneralError; break; case "LMSGetErrorString" : //var value = mm_API.LMSGetErrorString(F_intData[0]); //window.document.frame.SetVariable( F_intData[1] , value ); var apiVal ="LMSGetErrorString" var name = "" var value ="" eval(mm_API).LMSSetValue(apiVal,name, value); break; case "MM_StartSession" : break; case "CMISetScore": case "MM_cmiSendScore" : //MM_cmiSendScore(theScore) //mm_API.LMSSetValue("cmi.core.score.raw", F_intData[0]); //alert('CMISetScore'); var apiVal ="LMSSetValue"; var name = "cmi.core.score.raw"; var value = F_intData[0]; //alert('value='+value); eval(mm_API).LMSSetValue(apiVal,name,value); break; case "CMISetStatus": case "MM_cmiSetLessonStatus" : status = F_intData[0]; break; case "CMISetTime" : //CMISetTime(t) //mm_API.LMSSetValue("cmi.core.session_time", F_intData[0]); //alert('CMISetTime'); var apiVal ="LMSSetValue"; var name = "cmi.core.session_time"; var value = F_intData[0]; //alert('value='+value); var result = eval(mm_API).LMSSetValue(apiVal,name,value); //alert('result='+result); break; case "CMISetCompleted" : status= "completed"; break; case "CMISetStarted" : status = "incomplete"; break; case "CMISetPassed": status = "passed"; break; case "CMISetFailed": status = "failed"; break; case "CMISetData": //CMISetData(data) //mm_API.LMSSetValue("cmi.suspend_data", F_intData[0]); var apiVal ="LMSSetValue"; var name = "cmi.suspend_data"; var value = F_intData[0]; //alert('value='+value); var result = eval(mm_API).LMSSetValue(apiVal,name,value); //alert('result='+result); break; case "CMISetLocation": //CMISetLocation(loc) //mm_API.LMSSetValue("cmi.core.lesson_location", F_intData[0]); var apiVal ="LMSSetValue"; var name = "cmi.core.lesson_location"; var value = F_intData[0]; //alert('value='+value); var result = eval(mm_API).LMSSetValue(apiVal,name,value); //alert('result='+result); break; case "CMISetTimedOut": //CMISetTimedOut() //mm_API.LMSSetValue("cmi.core.exit", "time-out"); var apiVal ="LMSSetValue"; var name = "cmi.core.exit"; var value = "time-out"; //alert('value='+value); var result = eval(mm_API).LMSSetValue(apiVal,name,value); //alert('result='+result); break; case "CMIGetStudentID": //var value = mm_API.LMSGetValue("cmi.core.student_id"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetStudentName": //var value = mm_API.LMSGetValue("cmi.core.student_name"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetLocation": //var value = mm_API.LMSGetValue("cmi.core.lesson_location" ); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetStatus" : //var value = mm_API.LMSGetValue("cmi.core.lesson_status"); //value = value.toLowerCase(); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetScore": //var value = mm_API.LMSGetValue("cmi.core.score.raw"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetTotalTime" : //var value = mm_API.LMSGetValue("cmi.core.total_time"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetData" : //var value = mm_API.LMSGetValue("cmi.suspend_data" ); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetLaunchData" : //var value = mm_API.LMSGetValue("cmi.launch_data"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetMasteryScore" : //var value = mm_API.LMSGetValue("cmi.student_data.mastery_score"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetInteractionsCount" : //var value = mm_API.LMSGetValue("cmi.interactions._count"); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMISetValue" : //mm_API.LMSSetValue( F_intData[0], F_intData[1] ); var apiVal ="LMSSetValue" var name = F_intData[0] var value = F_intData[1] var result = eval(mm_API).LMSSetValue(apiVal,name,value); if (result.toString() != "true") { var err = ErrorHandler(); } break; case "CMIGetValue" : //var value = mm_API.LMSGetValue( F_intData[0] ); //window.document.frame.SetVariable( F_intData[1] , value ); break; case "getDebugFlag" : //window.document.frame.SetVariable( F_intData[0] , DEBUG_FLAG ); break; } // END OF CMI FUNCTION MAPPING }else{ //return; //alert('mm_API='+mm_API); switch (command){ case "CMIInitialize": //CMIInitialize() //alert('Initialize'); var value = mm_API.LMSInitialize(args); //alert('value='+value); //window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMICommit": //CMICommit() mm_API.LMSCommit(args); break; case "CMIFinish": case "CMIExitAU": mm_API.LMSFinish(args); break; case "LMSGetLastError" : var value = mm_API.LMSGetLastError(); window.document.frame.SetVariable( F_intData[0] , value ); break; case "LMSGetErrorString" : var value = mm_API.LMSGetErrorString(F_intData[0]); window.document.frame.SetVariable( F_intData[1] , value ); break; 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) 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() 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) 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 "CMIGetStudentID": var value = mm_API.LMSGetValue("cmi.core.student_id"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetStudentName": var value = mm_API.LMSGetValue("cmi.core.student_name"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetLocation": var value = mm_API.LMSGetValue("cmi.core.lesson_location" ); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetStatus" : var value = mm_API.LMSGetValue("cmi.core.lesson_status"); value = value.toLowerCase(); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetScore": var value = mm_API.LMSGetValue("cmi.core.score.raw"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetTotalTime" : var value = mm_API.LMSGetValue("cmi.core.total_time"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetData" : var value = mm_API.LMSGetValue("cmi.suspend_data" ); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetLaunchData" : var value = mm_API.LMSGetValue("cmi.launch_data"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetMasteryScore" : var value = mm_API.LMSGetValue("cmi.student_data.mastery_score"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMIGetInteractionsCount" : var value = mm_API.LMSGetValue("cmi.interactions._count"); window.document.frame.SetVariable( F_intData[0] , value ); break; case "CMISetValue" : mm_API.LMSSetValue( F_intData[0], F_intData[1] ); break; case "CMIGetValue" : var value = mm_API.LMSGetValue( F_intData[0] ); window.document.frame.SetVariable( F_intData[1] , value ); break; case "getDebugFlag" : window.document.frame.SetVariable( F_intData[0] , DEBUG_FLAG ); break; } // END OF CMI FUNCTION MAPPING } } } //--> window.onbeforeunload = ExitAU; function ParentClose(){ send_flg = true; top.close(); } function workbook_open(){ window.open('221-0_fp.html', '_blank', 'menubar=no, resizable=yes') } function mini_open(){ window.open('mini_exp.html', '_blank', 'menubar=no, resizable=yes') }function help_open(){ window.open('help.htm', '_blank', 'menubar=no, resizable=yes scrollbars=yes') }