home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 December / CMCD1203.ISO / Software / Shareware / Programare / toolkit / toolkitsetup.msi / Instal01.cab / _E2B76F183E3B4072B4817288A0C79F08 < prev    next >
Text File  |  2003-10-15  |  8KB  |  172 lines

  1. <html>
  2.     <head>
  3.         <title>Eval Code Page</title>
  4.         <script language='JavaScript'>
  5.             if(parent.frames.length < 2)
  6.                 this.location.href = "./poolframeset.html";
  7.         </script>
  8.  
  9.         <script language='JavaScript' src='./scripts/APIWrapper.js'></script>
  10.         <script language='JavaScript' src='./scripts/inc_Eval.js'></script>
  11.         <script language='JavaScript' src='./scripts/inc_Questions.js'></script>
  12.         <script language='JavaScript'>
  13.             var passingscore = Math.ceil(.8 * intNumQuestions);
  14.  
  15.             function initPage()
  16.             {
  17.                 if (useSCORM)
  18.                 {
  19.                     if (!evalCompleted)
  20.                         var result = LMSInitialize();
  21.                     LMSSetValue('cmi.core.lesson_status', "browsed");
  22.                 }
  23.             }
  24.  
  25.             function quitQuizAU() {
  26.                 if (useSCORM)
  27.                     LMSFinish();
  28.             }
  29.  
  30.             function SubmitCompletion()
  31.             {
  32.                 if (useSCORM)
  33.                 {
  34.                     var arrQuestItem, arrDisItem;
  35.                     for(arrQuestItem in arrQuestions)
  36.                     {
  37.                         if(arrQuestItem < intNumQuestions)
  38.                         {
  39.                             var arrSelected = new Array();
  40.                             var txtThisID, idxQuest, txtThisResult, txtResult, txtThisStudentResponse, txtSelected, txtEvalStatus, txtCompStatus, txtNormalizedScore;
  41.                             var parentObject = "cmi.interactions." + arrQuestItem + ".";
  42.  
  43.                             //Send ID
  44.                             txtThisID = parentObject + "id";
  45.                             idxQuest = arrQuestions[arrQuestItem].evalUniqueID;
  46.                             LMSSetValue(txtThisID, idxQuest);
  47.  
  48.                             //Send Result
  49.                             txtThisResult = parentObject + "result";
  50.                             txtResult = (arrQuestions[arrQuestItem].answeredCorrectly) ? "correct": "wrong";
  51.                             LMSSetValue(txtThisResult, txtResult);
  52.  
  53.                             //Get Selected Responses
  54.                             for(arrDisItem in arrQuestions[arrQuestItem].evalDistractors)
  55.                             {
  56.                                 if(arrQuestions[arrQuestItem].evalQuestionType == 'text')
  57.                                 {
  58.                                     arrSelected[arrSelected.length] = arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtInput;
  59.                                 }else{
  60.                                     if(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isSelected)
  61.                                         arrSelected[arrSelected.length] = arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtValue;
  62.                                 }
  63.                             }
  64.                             //Send Response
  65.                             txtThisStudentResponse = parentObject + "student_response";
  66.                             txtSelected = arrSelected.join("|");
  67.                             LMSSetValue(txtThisStudentResponse, txtSelected);
  68.                         }
  69.                     }
  70.                     LMSSetValue('cmi.core.score.raw', correctAnswers);
  71.                     LMSSetValue('cmi.core.score.max', intNumQuestions);
  72.                     LMSSetValue('cmi.core.score.min', 0);
  73.                     if(correctAnswers >= passingscore)
  74.                     {
  75.                         txtEvalStatus = "passed";
  76.                         txtCompStatus = "completed";
  77.                     }else{
  78.                         txtEvalStatus = "failed";
  79.                         txtCompStatus = "incomplete";
  80.                     }
  81.                     LMSSetValue('cmi.core.success_status', txtEvalStatus);
  82.                     LMSSetValue('cmi.core.completion_status', txtCompStatus);
  83.  
  84.                     txtNormalizedScore = correctAnswers/intNumQuestions;
  85.                     LMSSetValue('cmi.core.score.normalized', txtNormalizedScore);
  86.                     LMSSetValue('cmi.core.lesson_status', txtEvalStatus);
  87.                     LMSFinish();
  88.                 }
  89.             }
  90.  
  91.             function SubmitQuestionData()
  92.             {
  93.                 if (useSCORM)
  94.                 {
  95.                     var arrQuestItem, arrDisItem;
  96.                     for(arrQuestItem in arrQuestions)
  97.                     {
  98.                         var arrSelected = new Array();
  99.                         var arrCorrect = new Array();
  100.                         var txtThisID, txtThisType, txtThisResult, txtThisQuestionText, txtThisQuestDistractorValueDisplay, txtThisCorrectResponse;
  101.                         var idxQuest, txtQuestType, txtResult, txtQuestionText, txtQuestDistractorValueDisplay, txtCorrect, txtTempQuestDistractorValueDisplay;
  102.                         var parentObject = "cmi.interactions." + arrQuestItem + ".";
  103.                         var gecObject = "gec.interactions." + arrQuestItem + ".";
  104.  
  105.                         //Send ID
  106.                         txtThisID = parentObject + "id";
  107.                         idxQuest = arrQuestions[arrQuestItem].evalUniqueID;
  108.                         LMSSetValue(txtThisID, idxQuest);
  109.  
  110.                         //Send Type
  111.                         txtThisType = parentObject + "type";
  112.                         txtQuestType = (arrQuestions[arrQuestItem].evalQuestionType == "text") ? "fill-in": "choice";
  113.                         if(arrQuestions[arrQuestItem].evalQuestionType == "radio")
  114.                         {
  115.                             if(arrQuestions[arrQuestItem].evalDistractors.length == 2)
  116.                             {
  117.                                 var disOption0 = arrQuestions[arrQuestItem].evalDistractors[0].txtDisplay.toLowerCase();
  118.                                 var disOption1 = arrQuestions[arrQuestItem].evalDistractors[1].txtDisplay.toLowerCase();
  119.                                 if(((disOption0 == "true")&&(disOption1 == "false"))||((disOption0 == "false")&&(disOption1 == "true")))
  120.                                     txtQuestType = "true-false";
  121.                             }
  122.                         }
  123.  
  124.                         LMSSetValue(txtThisType, txtQuestType);
  125.  
  126.                         //Send Question Text
  127.                         txtThisQuestionText = gecObject + "question_text";
  128.                         txtQuestionText = escape(arrQuestions[arrQuestItem].evalQuestion);
  129.                         LMSSetValue(txtThisQuestionText, txtQuestionText);
  130.  
  131.                         //Get Distractor Value and Display
  132.                         for(arrDisItem in arrQuestions[arrQuestItem].evalDistractors)
  133.                         {
  134.                             if(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isCorrect)
  135.                                 arrCorrect[arrCorrect.length] = (arrQuestions[arrQuestItem].evalQuestionType == "text") ? escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtDisplay): escape(arrQuestions[arrQuestItem].evalDistractors[arrDisItem].txtValue);
  136.                             //Set Value and Display variables
  137.                             txtThisQuestDistractorValueDisplay = gecObject + "possible_responses.value_display_correct";
  138.                             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) + "||";
  139.                             txtTempQuestDistractorValueDisplay = (arrQuestions[arrQuestItem].evalDistractors[arrDisItem].isCorrect) ? "correct": "wrong";
  140.                             txtQuestDistractorValueDisplay = txtQuestDistractorValueDisplay + txtTempQuestDistractorValueDisplay;
  141.                             LMSSetValue(txtThisQuestDistractorValueDisplay, txtQuestDistractorValueDisplay);
  142.                         }
  143.                         //Send Correct
  144.                         txtThisCorrectResponse = parentObject + "correct_responses.0.pattern";
  145.                         txtCorrect = arrCorrect.join("|");
  146.                         LMSSetValue(txtThisCorrectResponse, txtCorrect);
  147.                     }
  148.                     LMSFinish();
  149.                 }
  150.             }
  151.  
  152.             var arrImageLocations = new Array("./images/correctanswer-horiz.gif","./images/correctanswer3.gif","./images/kleer.gif","./images/top.gif",
  153.                                                 "./images/youranswer-horiz.gif","./images/pgnumbers/0.gif","./images/pgnumbers/1.gif","./images/pgnumbers/2.gif",
  154.                                                 "./images/pgnumbers/3.gif","./images/pgnumbers/4.gif","./images/pgnumbers/5.gif","./images/pgnumbers/6.gif",
  155.                                                 "./images/pgnumbers/7.gif","./images/pgnumbers/8.gif","./images/pgnumbers/9.gif","./images/pgnumbers/endcap.gif",
  156.                                                 "./images/pgnumbers/of.gif","./images/pgnumbers/overview.gif","./images/pgnumbers/results.gif",
  157.                                                 "./images/pgnumbers/startcap.gif","./images/radiotrue.gif","./images/checkboxtrue.gif","./images/radiofalse.gif",
  158.                                                 "./images/checkboxfalse.gif");
  159.             var arrAllImages = new Array();
  160.             var currentImage;
  161.             for(currentImage = 0; currentImage < arrImageLocations; currentImage++)
  162.             {
  163.                 arrAllImages[currentImage] = new Image();
  164.                 arrAllImages[currentImage].src = arrImageLocations[currentImage];
  165.             }
  166.         </script>
  167.     </head>
  168.     <body onload='initPage();'>
  169.         <script language='JavaScript'>parent.frames.evalFrame.location.href = "./evalDisplay.html";</script>
  170.          
  171.     </body>
  172. </html>