home *** CD-ROM | disk | FTP | other *** search
- <html>
- <head>
- <title>Eval Code Page</title>
- <script language='JavaScript'>
- if(parent.frames.length < 2)
- this.location.href = "./poolframeset.html";
- </script>
-
- <script language='JavaScript' src='./scripts/APIWrapper.js'></script>
- <script language='JavaScript' src='./scripts/inc_Eval.js'></script>
- <script language='JavaScript' src='./scripts/inc_Questions.js'></script>
- <script language='JavaScript'>
- var passingscore = Math.ceil(.8 * intNumQuestions);
-
- function initPage()
- {
- if (useSCORM)
- {
- if (!evalCompleted)
- var result = LMSInitialize();
- LMSSetValue('cmi.core.lesson_status', "browsed");
- }
- }
-
- function quitQuizAU() {
- if (useSCORM)
- LMSFinish();
- }
-
- function SubmitCompletion()
- {
- if (useSCORM)
- {
- var arrQuestItem, arrDisItem;
- for(arrQuestItem in arrQuestions)
- {
- if(arrQuestItem < intNumQuestions)
- {
- var arrSelected = new Array();
- var txtThisID, idxQuest, txtThisResult, txtResult, txtThisStudentResponse, txtSelected, txtEvalStatus, txtCompStatus, txtNormalizedScore;
- var parentObject = "cmi.interactions." + arrQuestItem + ".";
-
- //Send ID
- txtThisID = parentObject + "id";
- idxQuest = arrQuestions[arrQuestItem].evalUniqueID;
- LMSSetValue(txtThisID, idxQuest);
-
- //Send Result
- txtThisResult = parentObject + "result";
- txtResult = (arrQuestions[arrQuestItem].answeredCorrectly) ? "correct": "wrong";
- LMSSetValue(txtThisResult, txtResult);
-
- //Get Selected Responses
- for(arrDisItem in arrQuestions[arrQuestItem].evalDistractors)
- {
- if(arrQuestions[arrQuestItem].evalQuestionType == 'text')
- {
- arrSelected[arrSelected.length] = arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtInput;
- }else{
- if(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isSelected)
- arrSelected[arrSelected.length] = arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtValue;
- }
- }
- //Send Response
- txtThisStudentResponse = parentObject + "student_response";
- txtSelected = arrSelected.join("|");
- LMSSetValue(txtThisStudentResponse, txtSelected);
- }
- }
- LMSSetValue('cmi.core.score.raw', correctAnswers);
- LMSSetValue('cmi.core.score.max', intNumQuestions);
- LMSSetValue('cmi.core.score.min', 0);
- if(correctAnswers >= passingscore)
- {
- txtEvalStatus = "passed";
- txtCompStatus = "completed";
- }else{
- txtEvalStatus = "failed";
- txtCompStatus = "incomplete";
- }
- LMSSetValue('cmi.core.success_status', txtEvalStatus);
- LMSSetValue('cmi.core.completion_status', txtCompStatus);
-
- txtNormalizedScore = correctAnswers/intNumQuestions;
- LMSSetValue('cmi.core.score.normalized', txtNormalizedScore);
- LMSSetValue('cmi.core.lesson_status', txtEvalStatus);
- LMSFinish();
- }
- }
-
- function SubmitQuestionData()
- {
- if (useSCORM)
- {
- var arrQuestItem, arrDisItem;
- for(arrQuestItem in arrQuestions)
- {
- var arrSelected = new Array();
- var arrCorrect = new Array();
- var txtThisID, txtThisType, txtThisResult, txtThisQuestionText, txtThisQuestDistractorValueDisplay, txtThisCorrectResponse;
- var idxQuest, txtQuestType, txtResult, txtQuestionText, txtQuestDistractorValueDisplay, txtCorrect, txtTempQuestDistractorValueDisplay;
- var parentObject = "cmi.interactions." + arrQuestItem + ".";
- var gecObject = "gec.interactions." + arrQuestItem + ".";
-
- //Send ID
- txtThisID = parentObject + "id";
- idxQuest = arrQuestions[arrQuestItem].evalUniqueID;
- LMSSetValue(txtThisID, idxQuest);
-
- //Send Type
- txtThisType = parentObject + "type";
- txtQuestType = (arrQuestions[arrQuestItem].evalQuestionType == "text") ? "fill-in": "choice";
- if(arrQuestions[arrQuestItem].evalQuestionType == "radio")
- {
- if(arrQuestions[arrQuestItem].evalDistractors.length == 2)
- {
- var disOption0 = arrQuestions[arrQuestItem].evalDistractors[0].txtDisplay.toLowerCase();
- var disOption1 = arrQuestions[arrQuestItem].evalDistractors[1].txtDisplay.toLowerCase();
- if(((disOption0 == "true")&&(disOption1 == "false"))||((disOption0 == "false")&&(disOption1 == "true")))
- txtQuestType = "true-false";
- }
- }
-
- LMSSetValue(txtThisType, txtQuestType);
-
- //Send Question Text
- txtThisQuestionText = gecObject + "question_text";
- txtQuestionText = escape(arrQuestions[arrQuestItem].evalQuestion);
- LMSSetValue(txtThisQuestionText, txtQuestionText);
-
- //Get Distractor Value and Display
- for(arrDisItem in arrQuestions[arrQuestItem].evalDistractors)
- {
- if(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isCorrect)
- arrCorrect[arrCorrect.length] = (arrQuestions[arrQuestItem].evalQuestionType == "text") ? escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtDisplay): escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtValue);
- //Set Value and Display variables
- txtThisQuestDistractorValueDisplay = gecObject + "possible_responses.value_display_correct";
- txtQuestDistractorValueDisplay = (arrQuestions[arrQuestItem].evalQuestionType == 'text') ? escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtDisplay) + "||" + escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtDisplay) + "||": escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtValue) + "||" + escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtDisplay) + "||";
- txtTempQuestDistractorValueDisplay = (arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isCorrect) ? "correct": "wrong";
- txtQuestDistractorValueDisplay = txtQuestDistractorValueDisplay + txtTempQuestDistractorValueDisplay;
- LMSSetValue(txtThisQuestDistractorValueDisplay, txtQuestDistractorValueDisplay);
- }
- //Send Correct
- txtThisCorrectResponse = parentObject + "correct_responses.0.pattern";
- txtCorrect = arrCorrect.join("|");
- LMSSetValue(txtThisCorrectResponse, txtCorrect);
- }
- LMSFinish();
- }
- }
-
- var arrImageLocations = new Array("./images/correctanswer-horiz.gif","./images/correctanswer3.gif","./images/kleer.gif","./images/top.gif",
- "./images/youranswer-horiz.gif","./images/pgnumbers/0.gif","./images/pgnumbers/1.gif","./images/pgnumbers/2.gif",
- "./images/pgnumbers/3.gif","./images/pgnumbers/4.gif","./images/pgnumbers/5.gif","./images/pgnumbers/6.gif",
- "./images/pgnumbers/7.gif","./images/pgnumbers/8.gif","./images/pgnumbers/9.gif","./images/pgnumbers/endcap.gif",
- "./images/pgnumbers/of.gif","./images/pgnumbers/overview.gif","./images/pgnumbers/results.gif",
- "./images/pgnumbers/startcap.gif","./images/radiotrue.gif","./images/checkboxtrue.gif","./images/radiofalse.gif",
- "./images/checkboxfalse.gif");
- var arrAllImages = new Array();
- var currentImage;
- for(currentImage = 0; currentImage < arrImageLocations; currentImage++)
- {
- arrAllImages[currentImage] = new Image();
- arrAllImages[currentImage].src = arrImageLocations[currentImage];
- }
- </script>
- </head>
- <body onload='initPage();'>
- <script language='JavaScript'>parent.frames.evalFrame.location.href = "./evalDisplay.html";</script>
-
- </body>
- </html>