Untitled diff

Created Diff never expires


var SCORM_LOGOUT = "logout";
var SCORM_LOGOUT = "logout";
var SCORM_SUSPEND = "suspend";
var SCORM_SUSPEND = "suspend";
var SCORM_NORMAL_EXIT = "";
var SCORM_NORMAL_EXIT = "";
var SCORM_TIMEOUT = "time-out";
var SCORM_TIMEOUT = "time-out";


var SCORM_PASSED = "passed";
var SCORM_PASSED = "passed";
var SCORM_FAILED = "failed";
var SCORM_FAILED = "failed";
var SCORM_COMPLETED = "completed";
var SCORM_COMPLETED = "completed";
var SCORM_BROWSED = "browsed";
var SCORM_BROWSED = "browsed";
var SCORM_INCOMPLETE = "incomplete";
var SCORM_INCOMPLETE = "incomplete";
var SCORM_NOT_ATTEMPTED = "not attempted";
var SCORM_NOT_ATTEMPTED = "not attempted";


var SCORM_CREDIT = "credit";
var SCORM_CREDIT = "credit";
var SCORM_NO_CREDIT = "no-credit";
var SCORM_NO_CREDIT = "no-credit";


var SCORM_BROWSE = "browse";
var SCORM_BROWSE = "browse";
var SCORM_NORMAL = "normal";
var SCORM_NORMAL = "normal";
var SCORM_REVIEW = "review";
var SCORM_REVIEW = "review";


var SCORM_ENTRY_ABINITIO = "ab-initio";
var SCORM_ENTRY_ABINITIO = "ab-initio";
var SCORM_ENTRY_RESUME = "resume";
var SCORM_ENTRY_RESUME = "resume";
var SCORM_ENTRY_NORMAL = "";
var SCORM_ENTRY_NORMAL = "";




var SCORM_TLA_EXIT_MESSAGE = "exit,message";
var SCORM_TLA_EXIT_MESSAGE = "exit,message";
var SCORM_TLA_EXIT_NO_MESSAGE = "exit,no message";
var SCORM_TLA_EXIT_NO_MESSAGE = "exit,no message";
var SCORM_TLA_CONTINUE_MESSAGE = "continue,message";
var SCORM_TLA_CONTINUE_MESSAGE = "continue,message";
var SCORM_TLA_CONTINUE_NO_MESSAGE = "continue,no message";
var SCORM_TLA_CONTINUE_NO_MESSAGE = "continue,no message";


var SCORM_RESULT_CORRECT = "correct";
var SCORM_RESULT_CORRECT = "correct";
var SCORM_RESULT_WRONG = "wrong";
var SCORM_RESULT_WRONG = "wrong";
var SCORM_RESULT_UNANTICIPATED = "unanticipated";
var SCORM_RESULT_UNANTICIPATED = "unanticipated";
var SCORM_RESULT_NEUTRAL = "neutral";
var SCORM_RESULT_NEUTRAL = "neutral";


var SCORM_INTERACTION_TYPE_TRUE_FALSE = "true-false";
var SCORM_INTERACTION_TYPE_TRUE_FALSE = "true-false";
var SCORM_INTERACTION_TYPE_CHOICE = "choice";
var SCORM_INTERACTION_TYPE_CHOICE = "choice";
var SCORM_INTERACTION_FILL_IN = "fill-in";
var SCORM_INTERACTION_FILL_IN = "fill-in";
var SCORM_INTERACTION_TYPE_MATCHING = "matching";
var SCORM_INTERACTION_TYPE_MATCHING = "matching";
var SCORM_INTERACTION_TYPE_PERFORMANCE = "performance";
var SCORM_INTERACTION_TYPE_PERFORMANCE = "performance";
var SCORM_INTERACTION_TYPE_SEQUENCING = "sequencing";
var SCORM_INTERACTION_TYPE_SEQUENCING = "sequencing";
var SCORM_INTERACTION_TYPE_LIKERT = "likert";
var SCORM_INTERACTION_TYPE_LIKERT = "likert";
var SCORM_INTERACTION_TYPE_NUMERIC = "numeric";
var SCORM_INTERACTION_TYPE_NUMERIC = "numeric";




var SCORM_NO_ERROR = "0";
var SCORM_NO_ERROR = "0";
var SCORM_ERROR_INVALID_PREFERENCE = "-1";
var SCORM_ERROR_INVALID_PREFERENCE = "-1";
var SCORM_ERROR_INVALID_STATUS = "-2";
var SCORM_ERROR_INVALID_STATUS = "-2";
var SCORM_ERROR_INVALID_SPEED = "-3";
var SCORM_ERROR_INVALID_SPEED = "-3";
var SCORM_ERROR_INVALID_TIMESPAN = "-4";
var SCORM_ERROR_INVALID_TIMESPAN = "-4";
var SCORM_ERROR_INVALID_TIME_LIMIT_ACTION = "-5";
var SCORM_ERROR_INVALID_TIME_LIMIT_ACTION = "-5";
var SCORM_ERROR_INVALID_DECIMAL = "-6";
var SCORM_ERROR_INVALID_DECIMAL = "-6";
var SCORM_ERROR_INVALID_CREDIT = "-7";
var SCORM_ERROR_INVALID_CREDIT = "-7";
var SCORM_ERROR_INVALID_LESSON_MODE = "-8";
var SCORM_ERROR_INVALID_LESSON_MODE = "-8";
var SCORM_ERROR_INVALID_ENTRY = "-9";
var SCORM_ERROR_INVALID_ENTRY = "-9";


var SCORM_TRUE = "true";
var SCORM_TRUE = "true";
var SCORM_FALSE = "false";
var SCORM_FALSE = "false";


var SCORM_findAPITries = 0;
var SCORM_findAPITries = 0;
var SCORM_objAPI = null;
var SCORM_objAPI = null;


var intSCORMError = SCORM_NO_ERROR;
var intSCORMError = SCORM_NO_ERROR;
var strSCORMErrorString = "";
var strSCORMErrorString = "";
var strSCORMErrorDiagnostic = "";
var strSCORMErrorDiagnostic = "";


var blnReviewModeSoReadOnly = false;
var blnReviewModeSoReadOnly = false;


function SCORM_Initialize(){
function SCORM_Initialize(){


var blnResult = true;
var blnResult = true;
WriteToDebug("In SCORM_Initialize");
WriteToDebug("In SCORM_Initialize");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
WriteToDebug("Grabbing API");
WriteToDebug("Grabbing API");
try{
try{
SCORM_objAPI = SCORM_GrabAPI();
SCORM_objAPI = SCORM_GrabAPI();
}
}
catch (e){
catch (e){
WriteToDebug("Error grabbing 1.2 API-" + e.name + ":" + e.message);
WriteToDebug("Error grabbing 1.2 API-" + e.name + ":" + e.message);
}
}
if (typeof(SCORM_objAPI) == "undefined" || SCORM_objAPI == null){
if (typeof(SCORM_objAPI) == "undefined" || SCORM_objAPI == null){
WriteToDebug("Unable to acquire SCORM API:")
WriteToDebug("Unable to acquire SCORM API:")
WriteToDebug("SCORM_objAPI=" + typeof(SCORM_objAPI));
WriteToDebug("SCORM_objAPI=" + typeof(SCORM_objAPI));
InitializeExecuted(false, "Error - unable to acquire LMS API, content may not play properly and results may not be recorded. Please contact technical support.");
InitializeExecuted(false, "Error - unable to acquire LMS API, content may not play properly and results may not be recorded. Please contact technical support.");
return false;
return false;
}
}
WriteToDebug("Calling LMSInit");
WriteToDebug("Calling LMSInit");
blnResult = SCORM_CallLMSInitialize();
blnResult = SCORM_CallLMSInitialize();
if (! blnResult){
if (! blnResult){
WriteToDebug("ERROR Initializing LMS");
WriteToDebug("ERROR Initializing LMS");
InitializeExecuted(false, "Error initializing communications with LMS");
InitializeExecuted(false, "Error initializing communications with LMS");
return false;
return false;
}
}
//only reset status and such if we are not reviewing
//only reset status and such if we are not reviewing
if (SCORM_GetLessonMode() != MODE_REVIEW){
if (SCORM_GetLessonMode() != MODE_REVIEW){
if (SCORM_IsContentInBrowseMode()){
if (SCORM_IsContentInBrowseMode()){
WriteToDebug("Setting Status to Browsed");
WriteToDebug("Setting Status to Browsed");
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", SCORM_BROWSED);
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", SCORM_BROWSED);
}
}
else{
else{
//only set the status to incomplete if it's not attempted yet
//only set the status to incomplete if it's not attempted yet
if (SCORM_GetStatus() == LESSON_STATUS_NOT_ATTEMPTED){
if (SCORM_GetStatus() == LESSON_STATUS_NOT_ATTEMPTED){
WriteToDebug("Setting Status to Incomplete");
WriteToDebug("Setting Status to Incomplete");
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", SCORM_INCOMPLETE);
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", SCORM_INCOMPLETE);
}
}
}
}
//we want to set the exit type to suspend immediately because some LMS's only store data if they get a suspend request
//we want to set the exit type to suspend immediately because some LMS's only store data if they get a suspend request
blnResult = SCORM_CallLMSSetValue("cmi.core.exit", SCORM_TranslateExitTypeToSCORM(DEFAULT_EXIT_TYPE)) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.exit", SCORM_TranslateExitTypeToSCORM(DEFAULT_EXIT_TYPE)) && blnResult;
}
}
else{
else{
//mode is review, check if we should go to read only mode
//mode is review, check if we should go to read only mode
if (!(typeof(REVIEW_MODE_IS_READ_ONLY) == "undefined") && REVIEW_MODE_IS_READ_ONLY === true){
if (!(typeof(REVIEW_MODE_IS_READ_ONLY) == "undefined") && REVIEW_MODE_IS_READ_ONLY === true){
blnReviewModeSoReadOnly = true;
blnReviewModeSoReadOnly = true;
}
}
}
}
WriteToDebug("Calling InitializeExecuted with parameter-" + blnResult);
WriteToDebug("Calling InitializeExecuted with parameter-" + blnResult);
InitializeExecuted(blnResult, "");
InitializeExecuted(blnResult, "");
return;
return;
}
}








function SCORM_Finish(strExitType, blnStatusWasSet){
function SCORM_Finish(strExitType, blnStatusWasSet){


var strStatusAfterCompletion;
var strStatusAfterCompletion;
var blnResult = true;
var blnResult = true;
WriteToDebug("In SCORM_Finish strExitType=" + strExitType + ", blnStatusWasSet=" + blnStatusWasSet);
WriteToDebug("In SCORM_Finish strExitType=" + strExitType + ", blnStatusWasSet=" + blnStatusWasSet);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
if ( (strExitType == EXIT_TYPE_FINISH) && ! blnStatusWasSet ){
if ( (strExitType == EXIT_TYPE_FINISH) && ! blnStatusWasSet ){
WriteToDebug("Getting completion status");
WriteToDebug("Getting completion status");
strStatusAfterCompletion = SCORM_GetCompletionStatus();
strStatusAfterCompletion = SCORM_GetCompletionStatus();
WriteToDebug("Setting completion status to " + strStatusAfterCompletion);
WriteToDebug("Setting completion status to " + strStatusAfterCompletion);
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", strStatusAfterCompletion) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.lesson_status", strStatusAfterCompletion) && blnResult;
}
}
WriteToDebug("Setting Exit");
WriteToDebug("Setting Exit");
blnResult = SCORM_CallLMSSetValue("cmi.core.exit", SCORM_TranslateExitTypeToSCORM(strExitType)) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.exit", SCORM_TranslateExitTypeToSCORM(strExitType)) && blnResult;
WriteToDebug("Calling Commit");
WriteToDebug("Calling Commit");
blnResult = SCORM_CallLMSCommit() && blnResult;
blnResult = SCORM_CallLMSCommit() && blnResult;
WriteToDebug("Calling Finish");
WriteToDebug("Calling Finish");
blnResult = SCORM_CallLMSFinish() && blnResult;
blnResult = SCORM_CallLMSFinish() && blnResult;
WriteToDebug("Returning " + blnResult);
WriteToDebug("Returning " + blnResult);
return blnResult;
return blnResult;


}
}




function SCORM_CommitData(){
function SCORM_CommitData(){
WriteToDebug("In SCORM_CommitData");
WriteToDebug("In SCORM_CommitData");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSCommit();
return SCORM_CallLMSCommit();
}
}






//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
//General Get and Set Values
//General Get and Set Values


function SCORM_GetStudentID(){
function SCORM_GetStudentID(){
WriteToDebug("In SCORM_GetStudentID");
WriteToDebug("In SCORM_GetStudentID");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.core.student_id");
return SCORM_CallLMSGetValue("cmi.core.student_id");
}
}


function SCORM_GetStudentName(){
function SCORM_GetStudentName(){
WriteToDebug("In SCORM_GetStudentName");
WriteToDebug("In SCORM_GetStudentName");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.core.student_name");
return SCORM_CallLMSGetValue("cmi.core.student_name");
}
}


function SCORM_GetBookmark(){
function SCORM_GetBookmark(){
WriteToDebug("In SCORM_GetBookmark");
WriteToDebug("In SCORM_GetBookmark");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.core.lesson_location");
return SCORM_CallLMSGetValue("cmi.core.lesson_location");
}
}


function SCORM_SetBookmark(strBookmark){
function SCORM_SetBookmark(strBookmark){
WriteToDebug("In SCORM_SetBookmark strBookmark=" + strBookmark);
WriteToDebug("In SCORM_SetBookmark strBookmark=" + strBookmark);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSSetValue("cmi.core.lesson_location", strBookmark);
return SCORM_CallLMSSetValue("cmi.core.lesson_location", strBookmark);
}
}


function SCORM_GetDataChunk(){
function SCORM_GetDataChunk(){
WriteToDebug("In SCORM_GetDataChunk");
WriteToDebug("In SCORM_GetDataChunk");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.suspend_data");
return SCORM_CallLMSGetValue("cmi.suspend_data");
}
}


function SCORM_SetDataChunk(strData){
function SCORM_SetDataChunk(strData){
//need to check for character limits here 4096 characters
//need to check for character limits here 4096 characters
WriteToDebug("In SCORM_SetDataDChunk");
WriteToDebug("In SCORM_SetDataDChunk");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSSetValue("cmi.suspend_data", strData);
return SCORM_CallLMSSetValue("cmi.suspend_data", strData);
}
}




function SCORM_GetLaunchData(){
function SCORM_GetLaunchData(){
WriteToDebug("In SCORM_GetLaunchData");
WriteToDebug("In SCORM_GetLaunchData");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.launch_data");
return SCORM_CallLMSGetValue("cmi.launch_data");
}
}


function SCORM_GetComments(){
function SCORM_GetComments(){
WriteToDebug("In SCORM_GetComments");
WriteToDebug("In SCORM_GetComments");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.comments");
return SCORM_CallLMSGetValue("cmi.comments");
}
}


function SCORM_WriteComment(strComment){
function SCORM_WriteComment(strComment){
WriteToDebug("In SCORM_WriteComment strComment=" + strComment);
WriteToDebug("In SCORM_WriteComment strComment=" + strComment);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSSetValue("cmi.comments", strComment);
return SCORM_CallLMSSetValue("cmi.comments", strComment);
}
}


function SCORM_GetLMSComments(){
function SCORM_GetLMSComments(){
WriteToDebug("In SCORM_GetLMSComments");
WriteToDebug("In SCORM_GetLMSComments");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.comments_from_lms");
return SCORM_CallLMSGetValue("cmi.comments_from_lms");
}
}




function SCORM_GetAudioPlayPreference(){
function SCORM_GetAudioPlayPreference(){


var intTempPreference;
var intTempPreference;
WriteToDebug("In SCORM_GetAudioPlayPreference");
WriteToDebug("In SCORM_GetAudioPlayPreference");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.audio");
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.audio");
if (intTempPreference == ""){
if (intTempPreference == ""){
intTempPreference = 0;
intTempPreference = 0;
}
}
intTempPreference = parseInt(intTempPreference, 10);
intTempPreference = parseInt(intTempPreference, 10);
WriteToDebug("intTempPreference=" + intTempPreference);
WriteToDebug("intTempPreference=" + intTempPreference);
if (intTempPreference > 0){
if (intTempPreference > 0){
WriteToDebug("Returning On");
WriteToDebug("Returning On");
return PREFERENCE_ON;
return PREFERENCE_ON;
}
}
else if (intTempPreference == 0){
else if (intTempPreference == 0){
WriteToDebug("Returning Default");
WriteToDebug("Returning Default");
return PREFERENCE_DEFAULT;
return PREFERENCE_DEFAULT;
}
}
else if (intTempPreference < 0) {
else if (intTempPreference < 0) {
WriteToDebug("returning Off");
WriteToDebug("returning Off");
return PREFERENCE_OFF;
return PREFERENCE_OFF;
}
}
else{
else{
WriteToDebug("Error: Invalid preference");
WriteToDebug("Error: Invalid preference");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
"Invalid audio preference received from LMS",
"Invalid audio preference received from LMS",
"intTempPreference=" + intTempPreference);
"intTempPreference=" + intTempPreference);
return null;
return null;
}
}
}
}






function SCORM_GetAudioVolumePreference(){
function SCORM_GetAudioVolumePreference(){
var intTempPreference;
var intTempPreference;
WriteToDebug("In SCORM_GetAudioVollumePreference");
WriteToDebug("In SCORM_GetAudioVollumePreference");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.audio");
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.audio");
WriteToDebug("intTempPreference=" + intTempPreference);
WriteToDebug("intTempPreference=" + intTempPreference);
if (intTempPreference == "") {
if (intTempPreference == "") {
intTempPreference = 100;
intTempPreference = 100;
}
}
intTempPreference = parseInt(intTempPreference, 10);
intTempPreference = parseInt(intTempPreference, 10);
if (intTempPreference <= 0){
if (intTempPreference <= 0){
WriteToDebug("Setting to 100");
WriteToDebug("Setting to 100");
intTempPreference = 100;
intTempPreference = 100;
}
}
if (! (intTempPreference > 0 && intTempPreference <= 100)){
if (! (intTempPreference > 0 && intTempPreference <= 100)){
WriteToDebug("ERROR: invalid preference");
WriteToDebug("ERROR: invalid preference");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
"Invalid audio preference received from LMS",
"Invalid audio preference received from LMS",
"intTempPreference=" + intTempPreference);
"intTempPreference=" + intTempPreference);
return null;
return null;
}
}
WriteToDebug("Returning " + intTempPreference);
WriteToDebug("Returning " + intTempPreference);
return intTempPreference;
return intTempPreference;
}
}


function SCORM_SetAudioPreference(PlayPreference, intPercentOfMaxVolume){
function SCORM_SetAudioPreference(PlayPreference, intPercentOfMaxVolume){
WriteToDebug("In SCORM_SetAudioPreference PlayPreference=" + PlayPreference + ", intPercentOfMaxVolume=" + intPercentOfMaxVolume);
WriteToDebug("In SCORM_SetAudioPreference PlayPreference=" + PlayPreference + ", intPercentOfMaxVolume=" + intPercentOfMaxVolume);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
if (PlayPreference == PREFERENCE_OFF){
if (PlayPreference == PREFERENCE_OFF){
WriteToDebug("Setting percent to -1");
WriteToDebug("Setting percent to -1");
intPercentOfMaxVolume = -1;
intPercentOfMaxVolume = -1;
}
}
return SCORM_CallLMSSetValue("cmi.student_preference.audio", intPercentOfMaxVolume);
return SCORM_CallLMSSetValue("cmi.student_preference.audio", intPercentOfMaxVolume);
}
}






function SCORM_SetLanguagePreference(strLanguage){
function SCORM_SetLanguagePreference(strLanguage){
WriteToDebug("In SCORM_SetLanguagePreference strLanguage=" + strLanguage);
WriteToDebug("In SCORM_SetLanguagePreference strLanguage=" + strLanguage);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSSetValue("cmi.student_preference.language", strLanguage);
return SCORM_CallLMSSetValue("cmi.student_preference.language", strLanguage);


}
}




function SCORM_GetLanguagePreference(){
function SCORM_GetLanguagePreference(){
WriteToDebug("In SCORM_GetLanguagePreference");
WriteToDebug("In SCORM_GetLanguagePreference");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.student_preference.language");
return SCORM_CallLMSGetValue("cmi.student_preference.language");


}
}




function SCORM_SetSpeedPreference(intPercentOfMax){
function SCORM_SetSpeedPreference(intPercentOfMax){
var intSCORMSpeed; //SCORM's scale is -100 to +100, our range is 1 to 100
var intSCORMSpeed; //SCORM's scale is -100 to +100, our range is 1 to 100
WriteToDebug("In SCORM_SetSpeedPreference intPercentOfMax=" + intPercentOfMax);
WriteToDebug("In SCORM_SetSpeedPreference intPercentOfMax=" + intPercentOfMax);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
intSCORMSpeed = (intPercentOfMax * 2) - 100;
intSCORMSpeed = (intPercentOfMax * 2) - 100;
WriteToDebug("intSCORMSpeed=" + intSCORMSpeed);
WriteToDebug("intSCORMSpeed=" + intSCORMSpeed);
return SCORM_CallLMSSetValue("cmi.student_preference.speed", intSCORMSpeed);
return SCORM_CallLMSSetValue("cmi.student_preference.speed", intSCORMSpeed);


}
}




function SCORM_GetSpeedPreference(){
function SCORM_GetSpeedPreference(){


var intSCORMSpeed;
var intSCORMSpeed;
var intPercentOfMax;
var intPercentOfMax;
WriteToDebug("In SCORM_GetSpeedPreference");
WriteToDebug("In SCORM_GetSpeedPreference");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
intSCORMSpeed = SCORM_CallLMSGetValue("cmi.student_preference.speed");
intSCORMSpeed = SCORM_CallLMSGetValue("cmi.student_preference.speed");
WriteToDebug("intSCORMSpeed=" + intSCORMSpeed);
WriteToDebug("intSCORMSpeed=" + intSCORMSpeed);
if (intSCORMSpeed == ""){
if (intSCORMSpeed == ""){
WriteToDebug("Detected empty string, defaulting to 100");
WriteToDebug("Detected empty string, defaulting to 100");
intSCORMSpeed = 100;
intSCORMSpeed = 100;
}
}
if ( ! ValidInteger(intSCORMSpeed) ){
if ( ! ValidInteger(intSCORMSpeed) ){
WriteToDebug("ERROR - invalid integer");
WriteToDebug("ERROR - invalid integer");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,
"Invalid speed preference received from LMS - not an integer",
"Invalid speed preference received from LMS - not an integer",
"intSCORMSpeed=" + intSCORMSpeed);
"intSCORMSpeed=" + intSCORMSpeed);
return null;
return null;
}
}
intSCORMSpeed = parseInt(intSCORMSpeed, 10);
intSCORMSpeed = parseInt(intSCORMSpeed, 10);
if (intSCORMSpeed < -100 || intSCORMSpeed > 100){
if (intSCORMSpeed < -100 || intSCORMSpeed > 100){
WriteToDebug("ERROR - out of range");
WriteToDebug("ERROR - out of range");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_SPEED,
"Invalid speed preference received from LMS - out of range",
"Invalid speed preference received from LMS - out of range",
"intSCORMSpeed=" + intSCORMSpeed);
"intSCORMSpeed=" + intSCORMSpeed);
return null;
return null;
}
}


intPercentOfMax = (intSCORMSpeed + 100) / 2;
intPercentOfMax = (intSCORMSpeed + 100) / 2;
intPercentOfMax = parseInt(intPercentOfMax, 10);
intPercentOfMax = parseInt(intPercentOfMax, 10);
WriteToDebug("Returning " + intPercentOfMax);
WriteToDebug("Returning " + intPercentOfMax);
return intPercentOfMax;
return intPercentOfMax;


}
}








function SCORM_SetTextPreference(intPreference){
function SCORM_SetTextPreference(intPreference){
WriteToDebug("In SCORM_SetTextPreference intPreference=" + intPreference);
WriteToDebug("In SCORM_SetTextPreference intPreference=" + intPreference);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSSetValue("cmi.student_preference.text", intPreference);
return SCORM_CallLMSSetValue("cmi.student_preference.text", intPreference);
}
}




function SCORM_GetTextPreference(){
function SCORM_GetTextPreference(){
var intTempPreference;
var intTempPreference;
WriteToDebug("In SCORM_GetTextPreference");
WriteToDebug("In SCORM_GetTextPreference");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.text");
intTempPreference = SCORM_CallLMSGetValue("cmi.student_preference.text");
intTempPreference = parseInt(intTempPreference, 10);
intTempPreference = parseInt(intTempPreference, 10);
WriteToDebug("intTempPreference=" + intTempPreference);
WriteToDebug("intTempPreference=" + intTempPreference);
if (intTempPreference > 0){
if (intTempPreference > 0){
WriteToDebug("Returning On");
WriteToDebug("Returning On");
return PREFERENCE_ON;
return PREFERENCE_ON;
}
}
else if (intTempPreference == 0 || intTempPreference == ""){
else if (intTempPreference == 0 || intTempPreference == ""){
WriteToDebug("Returning Default");
WriteToDebug("Returning Default");
return PREFERENCE_DEFAULT;
return PREFERENCE_DEFAULT;
}
}
else if (intTempPreference < 0) {
else if (intTempPreference < 0) {
WriteToDebug("returning Off");
WriteToDebug("returning Off");
return PREFERENCE_OFF;
return PREFERENCE_OFF;
}
}
else{
else{
WriteToDebug("Error: Invalid preference");
WriteToDebug("Error: Invalid preference");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_PREFERENCE,
"Invalid text preference received from LMS",
"Invalid text preference received from LMS",
"intTempPreference=" + intTempPreference);
"intTempPreference=" + intTempPreference);
return null;
return null;
}
}
}
}






//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
//Time Management Functions
//Time Management Functions
function SCORM_GetPreviouslyAccumulatedTime(){
function SCORM_GetPreviouslyAccumulatedTime(){
var strCMITime;
var strCMITime;
var intMilliseconds;
var intMilliseconds;
WriteToDebug("In SCORM_GetPreviouslyAccumulatedTime");
WriteToDebug("In SCORM_GetPreviouslyAccumulatedTime");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
strCMITime = SCORM_CallLMSGetValue("cmi.core.total_time")
strCMITime = SCORM_CallLMSGetValue("cmi.core.total_time")
WriteToDebug("strCMITime=" + strCMITime);
WriteToDebug("strCMITime=" + strCMITime);


if (! IsValidCMITimeSpan(strCMITime)){
if (! IsValidCMITimeSpan(strCMITime)){
WriteToDebug("ERROR - Invalid CMITimeSpan");
WriteToDebug("ERROR - Invalid CMITimeSpan");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,
"Invalid timespan received from LMS",
"Invalid timespan received from LMS",
"strTime=" + strCMITime);
"strTime=" + strCMITime);
return null;
return null;
}
}
intMilliseconds = ConvertCMITimeSpanToMS(strCMITime);
intMilliseconds = ConvertCMITimeSpanToMS(strCMITime);
WriteToDebug("Returning " + intMilliseconds);
WriteToDebug("Returning " + intMilliseconds);
return intMilliseconds;
return intMilliseconds;


}
}




function SCORM_SaveTime(intMilliSeconds){
function SCORM_SaveTime(intMilliSeconds){


var strCMITime;
var strCMITime;
WriteToDebug("In SCORM_SaveTime intMilliSeconds=" + intMilliSeconds);
WriteToDebug("In SCORM_SaveTime intMilliSeconds=" + intMilliSeconds);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
strCMITime = ConvertMilliSecondsToSCORMTime(intMilliSeconds, true);
strCMITime = ConvertMilliSecondsToSCORMTime(intMilliSeconds, true);
WriteToDebug("strCMITime=" + strCMITime);
WriteToDebug("strCMITime=" + strCMITime);
return SCORM_CallLMSSetValue("cmi.core.session_time", strCMITime);
return SCORM_CallLMSSetValue("cmi.core.session_time", strCMITime);
}
}


function SCORM_GetMaxTimeAllowed(){
function SCORM_GetMaxTimeAllowed(){


var strCMITime;
var strCMITime;
var intMilliseconds;
var intMilliseconds;
WriteToDebug("In SCORM_GetMaxTimeAllowed");
WriteToDebug("In SCORM_GetMaxTimeAllowed");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
strCMITime = SCORM_CallLMSGetValue("cmi.student_data.max_time_allowed")
strCMITime = SCORM_CallLMSGetValue("cmi.student_data.max_time_allowed")
WriteToDebug("strCMITime=" + strCMITime);
WriteToDebug("strCMITime=" + strCMITime);
if (strCMITime == ""){
if (strCMITime == ""){
strCMITime = "9999:99:99.99";
strCMITime = "9999:99:99.99";
}
}


if (! IsValidCMITimeSpan(strCMITime)){
if (! IsValidCMITimeSpan(strCMITime)){
WriteToDebug("ERROR - Invalid CMITimeSpan");
WriteToDebug("ERROR - Invalid CMITimeSpan");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIMESPAN,
"Invalid timespan received from LMS",
"Invalid timespan received from LMS",
"strTime=" + strCMITime);
"strTime=" + strCMITime);
return null;
return null;
}
}
intMilliseconds = ConvertCMITimeSpanToMS(strCMITime);
intMilliseconds = ConvertCMITimeSpanToMS(strCMITime);
WriteToDebug("intMilliseconds=" + intMilliseconds);
WriteToDebug("intMilliseconds=" + intMilliseconds);
return intMilliseconds;
return intMilliseconds;
}
}






function SCORM_DisplayMessageOnTimeout(){
function SCORM_DisplayMessageOnTimeout(){


var strTLA;
var strTLA;
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
WriteToDebug("In SCORM_DisplayMessageOnTimeout");
WriteToDebug("In SCORM_DisplayMessageOnTimeout");
strTLA = SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");
strTLA = SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");
WriteToDebug("strTLA=" + strTLA);
WriteToDebug("strTLA=" + strTLA);
if (strTLA == SCORM_TLA_EXIT_MESSAGE || strTLA == SCORM_TLA_CONTINUE_MESSAGE){
if (strTLA == SCORM_TLA_EXIT_MESSAGE || strTLA == SCORM_TLA_CONTINUE_MESSAGE){
WriteToDebug("returning true");
WriteToDebug("returning true");
return true;
return true;
}
}
else if(strTLA == SCORM_TLA_EXIT_NO_MESSAGE || strTLA == SCORM_TLA_CONTINUE_NO_MESSAGE || strTLA == ""){
else if(strTLA == SCORM_TLA_EXIT_NO_MESSAGE || strTLA == SCORM_TLA_CONTINUE_NO_MESSAGE || strTLA == ""){
WriteToDebug("returning false");
WriteToDebug("returning false");
return false;
return false;
}
}
else{
else{
WriteToDebug("Error invalid TLA");
WriteToDebug("Error invalid TLA");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,
"Invalid time limit action received from LMS",
"Invalid time limit action received from LMS",
"strTLA=" + strTLA);
"strTLA=" + strTLA);
return null;
return null;
}
}
}
}


function SCORM_ExitOnTimeout(){
function SCORM_ExitOnTimeout(){


var strTLA;
var strTLA;
WriteToDebug("In SCORM_ExitOnTimeout");
WriteToDebug("In SCORM_ExitOnTimeout");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
strTLA = SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");
strTLA = SCORM_CallLMSGetValue("cmi.student_data.time_limit_action");
WriteToDebug("strTLA=" + strTLA);
WriteToDebug("strTLA=" + strTLA);
if (strTLA == SCORM_TLA_EXIT_MESSAGE || strTLA == SCORM_TLA_EXIT_NO_MESSAGE){
if (strTLA == SCORM_TLA_EXIT_MESSAGE || strTLA == SCORM_TLA_EXIT_NO_MESSAGE){
WriteToDebug("returning true");
WriteToDebug("returning true");
return true;
return true;
}
}
else if(strTLA == SCORM_TLA_CONTINUE_MESSAGE || strTLA == SCORM_TLA_CONTINUE_NO_MESSAGE || strTLA == ""){
else if(strTLA == SCORM_TLA_CONTINUE_MESSAGE || strTLA == SCORM_TLA_CONTINUE_NO_MESSAGE || strTLA == ""){
WriteToDebug("returning false");
WriteToDebug("returning false");
return false;
return false;
}
}
else{
else{
WriteToDebug("ERROR invalid TLA");
WriteToDebug("ERROR invalid TLA");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_TIME_LIMIT_ACTION,
"Invalid time limit action received from LMS",
"Invalid time limit action received from LMS",
"strTLA=" + strTLA);
"strTLA=" + strTLA);
return null;
return null;
}
}


}
}




function SCORM_GetPassingScore(){
function SCORM_GetPassingScore(){
var fltScore;
var fltScore;
WriteToDebug("In SCORM_GetPassingScore");
WriteToDebug("In SCORM_GetPassingScore");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
fltScore = SCORM_CallLMSGetValue("cmi.student_data.mastery_score")
fltScore = SCORM_CallLMSGetValue("cmi.student_data.mastery_score")
WriteToDebug("fltScore=" + fltScore);
WriteToDebug("fltScore=" + fltScore);
if (fltScore == ""){
if (fltScore == ""){
fltScore = 0;
fltScore = 0;
}
}
if ( ! IsValidDecimal(fltScore)){
if ( ! IsValidDecimal(fltScore)){
WriteToDebug("Error - score is not a valid decimal");
WriteToDebug("Error - score is not a valid decimal");
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_DECIMAL,
SCORM_SetErrorInfoManually(SCORM_ERROR_INVALID_DECIMAL,
"Invalid mastery score received from LMS",
"Invalid mastery score received from LMS",
"fltScore=" + fltScore);
"fltScore=" + fltScore);
return null;
return null;
}
}
fltScore = parseFloat(fltScore);
fltScore = parseFloat(fltScore);
WriteToDebug("returning fltScore");
WriteToDebug("returning fltScore");
return fltScore;
return fltScore;
}
}




function SCORM_SetScore(intScore, intMaxScore, intMinScore){
function SCORM_SetScore(intScore, intMaxScore, intMinScore){
var blnResult;
var blnResult;
WriteToDebug("In SCORM_SetScore intScore=" + intScore + ", intMaxScore=" + intMaxScore + ", intMinScore=" + intMinScore);
WriteToDebug("In SCORM_SetScore intScore=" + intScore + ", intMaxScore=" + intMaxScore + ", intMinScore=" + intMinScore);
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
blnResult = SCORM_CallLMSSetValue("cmi.core.score.raw", intScore);
blnResult = SCORM_CallLMSSetValue("cmi.core.score.raw", intScore);
blnResult = SCORM_CallLMSSetValue("cmi.core.score.max", intMaxScore) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.score.max", intMaxScore) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.score.min", intMinScore) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.core.score.min", intMinScore) && blnResult;
WriteToDebug("Returning " + blnResult);
WriteToDebug("Returning " + blnResult);
return blnResult;
return blnResult;
}
}


function SCORM_GetScore(){
function SCORM_GetScore(){


WriteToDebug("In SCORM_GetScore");
WriteToDebug("In SCORM_GetScore");
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
return SCORM_CallLMSGetValue("cmi.core.score.raw");
return SCORM_CallLMSGetValue("cmi.core.score.raw");


}
}


function SCORM_SetPointBasedScore(intScore, intMaxScore, intMinScore){
function SCORM_SetPointBasedScore(intScore, intMaxScore, intMinScore){
WriteToDebug("SCORM_SetPointBasedScore - SCORM 1.1 and 1.2 do not support SetPointBasedScore, returning false");
WriteToDebug("SCORM_SetPointBasedScore - SCORM 1.1 and 1.2 do not support SetPointBasedScore, returning false");
return false;
return false;
}
}


function SCORM_GetScaledScore(intScore, intMaxScore, intMinScore){
function SCORM_GetScaledScore(intScore, intMaxScore, intMinScore){
WriteToDebug("SCORM_GetScaledScore - SCORM 1.1 and 1.2 do not support GetScaledScore, returning false");
WriteToDebug("SCORM_GetScaledScore - SCORM 1.1 and 1.2 do not support GetScaledScore, returning false");
return false;
return false;
}
}


function SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription,
function SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, scormInteractionType,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, scormInteractionType,
strAlternateResponse, strAlternateCorrectResponse){
strAlternateResponse, strAlternateCorrectResponse){
var blnResult;
var blnResult;
var blnTempResult;
var blnTempResult;
var intInteractionIndex;
var intInteractionIndex;
var strResult;
var strResult;
SCORM_ClearErrorInfo();
SCORM_ClearErrorInfo();
//In SCORM 1.2, we always want to add a new interaction rather than updating an old interaction.
//In SCORM 1.2, we always want to add a new interaction rather than updating an old interaction.
//This is because some LMS vendors have mis-interpreted the "write only" stipulation on interactions to mean "write once"
//This is because some LMS vendors have mis-interpreted the "write only" stipulation on interactions to mean "write once"
intInteractionIndex = SCORM_CallLMSGetValue("cmi.interactions._count");
intInteractionIndex = SCORM_CallLMSGetValue("cmi.interactions._count");
WriteToDebug("intInteractionIndex=" + intInteractionIndex);
WriteToDebug("intInteractionIndex=" + intInteractionIndex);
if (intInteractionIndex == ""){
if (intInteractionIndex == ""){
WriteToDebug("Setting Interaction Index to 0");
WriteToDebug("Setting Interaction Index to 0");
intInteractionIndex = 0;
intInteractionIndex = 0;
}
}
//need to leave support for blnCorrect=t/f for legacy implementations of RSECA
//need to leave support for blnCorrect=t/f for legacy implementations of RSECA
if (blnCorrect == true || blnCorrect == INTERACTION_RESULT_CORRECT){
if (blnCorrect == true || blnCorrect == INTERACTION_RESULT_CORRECT){
strResult = SCORM_RESULT_CORRECT;
strResult = SCORM_RESULT_CORRECT;
}
}
else if (blnCorrect == "" || blnCorrect == "false" || blnCorrect == INTERACTION_RESULT_WRONG){ //compare against the string "false" because ("" == false) evaluates to true
else if (blnCorrect == "" || blnCorrect == "false" || blnCorrect == INTERACTION_RESULT_WRONG){ //compare against the string "false" because ("" == false) evaluates to true
strResult = SCORM_RESULT_WRONG;
strResult = SCORM_RESULT_WRONG;
}
}
else if (blnCorrect == INTERACTION_RESULT_UNANTICIPATED){
else if (blnCorrect == INTERACTION_RESULT_UNANTICIPATED){
strResult = SCORM_RESULT_UNANTICIPATED;
strResult = SCORM_RESULT_UNANTICIPATED;
}
}
else if (blnCorrect == INTERACTION_RESULT_NEUTRAL){
else if (blnCorrect == INTERACTION_RESULT_NEUTRAL){
strResult = SCORM_RESULT_NEUTRAL;
strResult = SCORM_RESULT_NEUTRAL;
}
}
WriteToDebug("strResult=" + strResult);
WriteToDebug("strResult=" + strResult);
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".id", strID);
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".id", strID);
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".type", scormInteractionType) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".type", scormInteractionType) && blnResult;
//try to save the data using the verbose description of the interaciton results (this is not strictly conformant, but most LMS's will allow it and it still passes the Test Suite
//try to save the data using the verbose description of the interaciton results (this is not strictly conformant, but most LMS's will allow it and it still passes the Test Suite
//if the long version errs, try again with the short version (strict adherence to the standard) - this applies to response and correct response
//if the long version errs, try again with the short version (strict adherence to the standard) - this applies to response and correct response
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".student_response", strResponse);
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".student_response", strResponse);
if (blnTempResult == false){
if (blnTempResult == false){
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".student_response", strAlternateResponse);
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".student_response", strAlternateResponse);
}
}
blnResult = blnResult && blnTempResult;
blnResult = blnResult && blnTempResult;
if (strCorrectResponse != undefined && strCorrectResponse != null && strCorrectResponse != ""){
if (strCorrectResponse != undefined && strCorrectResponse != null && strCorrectResponse != ""){
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".correct_responses.0.pattern", strCorrectResponse);
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".correct_responses.0.pattern", strCorrectResponse);
if (blnTempResult == false){
if (blnTempResult == false){
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".correct_responses.0.pattern", strAlternateCorrectResponse);
blnTempResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".correct_responses.0.pattern", strAlternateCorrectResponse);
}
}
blnResult = blnResult && blnTempResult;
blnResult = blnResult && blnTempResult;
}
}


if (strResult != undefined && strResult != null && strResult != ""){
if (strResult != undefined && strResult != null && strResult != ""){
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".result", strResult) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".result", strResult) && blnResult;
}
}
//ignore the description parameter in SCORM 1.2, there is nothing we can do with it
//ignore the description parameter in SCORM 1.2, there is nothing we can do with it
if (intWeighting != undefined && intWeighting != null && intWeighting != ""){
if (intWeighting != undefined && intWeighting != null && intWeighting != ""){
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".weighting", intWeighting) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".weighting", intWeighting) && blnResult;
}
}


if (intLatency != undefined && intLatency != null && intLatency != ""){
if (intLatency != undefined && intLatency != null && intLatency != ""){
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".latency", ConvertMilliSecondsToSCORMTime(intLatency, true)) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".latency", ConvertMilliSecondsToSCORMTime(intLatency, true)) && blnResult;
}
}
if (strLearningObjectiveID != undefined && strLearningObjectiveID != null && strLearningObjectiveID != ""){
if (strLearningObjectiveID != undefined && strLearningObjectiveID != null && strLearningObjectiveID != ""){
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".objectives.0.id", strLearningObjectiveID) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".objectives.0.id", strLearningObjectiveID) && blnResult;
}
}
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".time", ConvertDateToCMITime(dtmTime)) && blnResult;
blnResult = SCORM_CallLMSSetValue("cmi.interactions." + intInteractionIndex + ".time", ConvertDateToCMITime(dtmTime)) && blnResult;
WriteToDebug("Returning " + blnResult);
WriteToDebug("Returning " + blnResult);
return blnResult;
return blnResult;
}
}


function SCORM_RecordTrueFalseInteraction(strID, blnResponse, blnCorrect, blnCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
function SCORM_RecordTrueFalseInteraction(strID, blnResponse, blnCorrect, blnCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
WriteToDebug("In SCORM_RecordTrueFalseInteraction strID=" + strID + ", strResponse=" + strResponse +
WriteToDebug("In SCORM_RecordTrueFalseInteraction strID=" + strID + ", strResponse=" + strResponse +
", blnCorrect=" + blnCorrect + ", strCorrectResponse=" + strCorrectResponse +
", blnCorrect=" + blnCorrect + ", strCorrectResponse=" + strCorrectResponse +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);
var strResponse = "";
var strResponse = "";
var strCorrectResponse = null;
var strCorrectResponse = null;
if (blnResponse == true){
if (blnResponse == true){
strResponse = "t";
strResponse = "t";
}
}
else{
else{
strResponse = "f";
strResponse = "f";
}
}
if (blnCorrectResponse == true){
if (blnCorrectResponse == true){
strCorrectResponse = "t";
strCorrectResponse = "t";
}
}
else if(blnCorrectResponse == false){ //test for false b/c it could be null in which case we want to leave it as ""
else if(blnCorrectResponse == false){ //test for false b/c it could be null in which case we want to leave it as ""
strCorrectResponse = "f";
strCorrectResponse = "f";
}
}
return SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription,
return SCORM_RecordInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, SCORM_INTERACTION_TYPE_TRUE_FALSE,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, SCORM_INTERACTION_TYPE_TRUE_FALSE,
strResponse, strCorrectResponse);
strResponse, strCorrectResponse);
}
}


function SCORM_RecordMultipleChoiceInteraction(strID, aryResponse, blnCorrect, aryCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
function SCORM_RecordMultipleChoiceInteraction(strID, aryResponse, blnCorrect, aryCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
WriteToDebug("In SCORM_RecordMultipleChoiceInteraction strID=" + strID + ", aryResponse=" + aryResponse +
WriteToDebug("In SCORM_RecordMultipleChoiceInteraction strID=" + strID + ", aryResponse=" + aryResponse +
", blnCorrect=" + blnCorrect + ", aryCorrectResponse=" + aryCorrectResponse +
", blnCorrect=" + blnCorrect + ", aryCorrectResponse=" + aryCorrectResponse +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);




var strResponse = "";
var strResponse = "";
var strResponseLong = "";
var strResponseLong = "";
var strCorrectResponse = "";
var strCorrectResponse = "";
var strCorrectResponseLong = "";
var strCorrectResponseLong = "";
for (var i=0; i < aryResponse.length; i++){
for (var i=0; i < aryResponse.length; i++){
if (strResponse.length > 0) {strResponse += ",";}
if (strResponse.length > 0) {strResponse += ",";}
if (strResponseLong.length > 0) {strResponseLong += ",";}
if (strResponseLong.length > 0) {strResponseLong += ",";}
strResponse += aryResponse[i].Short;
strResponse += aryResponse[i].Short;
strResponseLong += aryResponse[i].Long;
strResponseLong += aryResponse[i].Long;
}
}


for (var i=0; i < aryCorrectResponse.length; i++){
for (var i=0; i < aryCorrectResponse.length; i++){
if (strCorrectResponse.length > 0) {strCorrectResponse += ",";}
if (strCorrectResponse.length > 0) {strCorrectResponse += ",";}
if (strCorrectResponseLong.length > 0) {strCorrectResponseLong += ",";}
if (strCorrectResponseLong.length > 0) {strCorrectResponseLong += ",";}
strCorrectResponse += aryCorrectResponse[i].Short;
strCorrectResponse += aryCorrectResponse[i].Short;
strCorrectResponseLong += aryCorrectResponse[i].Long;
strCorrectResponseLong += aryCorrectResponse[i].Long;
}
}
var blnSuccessfullySaved;
var blnSuccessfullySaved;
blnSuccessfullySaved = SCORM_RecordInteraction(strID, strResponseLong, blnCorrect, strCorrectResponseLong, strDescription,
blnSuccessfullySaved = SCORM_RecordInteraction(strID, strResponseLong, blnCorrect, strCorrectResponseLong, strDescription,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, SCORM_INTERACTION_TYPE_CHOICE,
intWeighting, intLatency, strLearningObjectiveID, dtmTime, SCORM_INTERACTION_TYPE_CHOICE,
strResponse, strCorrectResponse);
strResponse, strCorrectResponse);
return blnSuccessfullySaved;
return blnSuccessfullySaved;


}
}




function SCORM_RecordFillInInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
function SCORM_RecordFillInInteraction(strID, strResponse, blnCorrect, strCorrectResponse, strDescription, intWeighting, intLatency, strLearningObjectiveID, dtmTime){
WriteToDebug("In SCORM_RecordFillInInteraction strID=" + strID + ", strResponse=" + strResponse +
WriteToDebug("In SCORM_RecordFillInInteraction strID=" + strID + ", strResponse=" + strResponse +
", blnCorrect=" + blnCorrect + ", strCorrectResponse=" + strCorrectResponse +
", blnCorrect=" + blnCorrect + ", strCorrectResponse=" + strCorrectResponse +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strDescription=" + strDescription + ", intWeighting=" + intWeighting + ", intLatency=" + intLatency +
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);
", strLearningObjectiveID=" + strLearningObjectiveID + ", dtmTime=" + dtmTime);


strResponse = new String(strResponse);
strResponse = new String(strResponse);
if (strResponse.length > 255){strResponse = strResponse.substr(0, 255);}
if (strResponse.length > 255){strResponse = strResponse.substr(0, 255);}
if (strCorrectResponse == null){
if (strCorrectResponse == null){
strCorrectResponse = "";
strCorrectResponse = "";
}
}
strCorrectResponse = new String(strCorrectResponse);
strCorrectResponse = new String(strCorrectResponse);
if (strC
if (strC