Subversion Repositories wimsdev

Rev

Rev 7086 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. !set n=$counter
  2. <script>
  3. //<![CDATA[
  4. <!-- no validator -->
  5.     var descr_list="$description";
  6.     var descr_cnt = 30;
  7.     var description = make_description(descr_list,descr_cnt);
  8.  
  9.     function dontknow(){
  10.         myConfirm('$dontknow','?','$wims_ref_name','$session','$module','$counter','$nok_send_color');
  11.     }
  12.    
  13.     function TexAppInputs(num){
  14.         if( document.getElementById('TexApp1') ){ // starts with 1
  15.             var p = 1;
  16.             while ( document.getElementById('TexApp'+p) ){
  17.                 document.getElementById('TexApp'+p).changeInputfields(num);
  18.                 p++;
  19.             }
  20.         }
  21.     }
  22.    
  23.     function sendanswer(){
  24.         var reply = new Array();var show ="<ol>";
  25.         var p = 1;
  26.         var tmp;var tmp1;var cnt = 0;var ans = new Array();
  27.         if( document.getElementById('TexApp1') ){ // starts with 1
  28.             document.getElementById('wait_for_applet').style.display = "none";
  29.             while ( document.getElementById('TexApp'+p) ){
  30.                 tmp1 = document.getElementById('TexApp'+p).ReadApplet()+"";
  31.                 ans = tmp1.split(',');
  32.                 if(ans.length>100){setAlarm(r2);dontknow();}
  33.                 for(var s = 0; s < ans.length; s++){
  34.                     tmp = ans[s];tmp=tmp.replace(/\ /g,'');
  35.                     if(tmp.length == 0){setAlarm(r1+" "+ parseInt(cnt+1));return;}
  36.                     if(tmp.indexOf(',')!=-1){setAlarm(r4);return;}
  37.                     if(check_x(tmp) == 0){return;}
  38.                     if(tmp.indexOf('error')!=-1){setAlarm(tmp);return;}
  39.                     tmp = science(tmp);if(tmp == "error"){return;}
  40.                     if(tmp.indexOf("[") != -1){
  41.                         if(tmp.indexOf("sqrt[")!=-1){tmp = specialroot(tmp);if(tmp == "error"){return;}}
  42.                         if(tmp.indexOf("log[") !=-1){tmp = speciallog(tmp) ;if(tmp == "error"){return;}}
  43.                         if(tmp.indexOf("[") != -1){setAlarm(r13);return;}
  44.                     }
  45.                     tmp = arrows(tmp,2,"","");if(tmp == "error"){return;}
  46.                     reply[cnt] = tmp;
  47.                     show = show + "<li>" + tmp + "</li>";
  48.                     cnt++;
  49.                 }
  50.                 p++;
  51.             }
  52.             document.getElementById('wait_for_applet').style.display = "block";
  53.         }
  54.         if( document.getElementById('myinput0') ){ // using other inputfields as well ? use wims array-list description for use in confirm div
  55.             var inputfieldnumber=0;
  56.             while( document.getElementById('myinput'+inputfieldnumber) ){
  57.                 tmp = document.getElementById('myinput'+inputfieldnumber).value;
  58.                 if(tmp.length == 0){setAlarm(r1+" "+ parseInt(cnt+1));return;}
  59.                 if(tmp.indexOf(',')!=-1){setAlarm(r4);return;}
  60.                 if(check_x(tmp) == 0){return;}
  61.                 if(tmp.indexOf('error')!=-1){setAlarm(tmp);return;}
  62.                 tmp = science(tmp);if(tmp == "error"){return;}
  63.                 if(tmp.indexOf("[") != -1){
  64.                     if(tmp.indexOf("sqrt[")!=-1){tmp = specialroot(tmp);if(tmp == "error"){return;}}
  65.                     if(tmp.indexOf("log[") !=-1){tmp = speciallog(tmp) ;if(tmp == "error"){return;}}
  66.                     if(tmp.indexOf("[") != -1){setAlarm(r13);return;}
  67.                 }
  68.                 tmp = arrows(tmp,2,"","");if(tmp == "error"){return;}
  69.                 reply[cnt] = tmp;
  70.                 show = show + "<li>" + description[inputfieldnumber] +  tmp + "</li>";
  71.                 cnt++;
  72.                 inputfieldnumber++;
  73.                 if(cnt>100){setAlarm(r2);dontknow();}
  74.             }
  75.         }
  76.         show = show + "</ol>";
  77.         myConfirm(show,reply,'$wims_ref_name','$session','$module','$counter','$ok_send_color');
  78.     }
  79. //]]>
  80. </script>
  81.  
  82. <div id="wait_for_applet" style="text-align:center;display:block;"><img src="$gifdir/wait.gif" alt="wait...wait"></div>
  83. !! TexApp is in exotext or in object_n
  84. <table id="exercise" class="exercise" ><!-- begin table id="exercise" -->
  85.     <tr>
  86.     <td class="exercise_t">
  87.         !if $(question$n) != $empty
  88.             $(question$n)
  89.             <br />
  90.         !endif
  91.         !if $(formula$n) != $empty
  92.             !if $display = 1234
  93.                 !insmath $$$$ $(formula$n) $$$$
  94.             !else
  95.                 !insmath $(formula$n)
  96.             !endif
  97.             <br />
  98.         !endif
  99.         !if $exotext != $empty
  100.             <br />
  101.             $exotext
  102.         !endif
  103.     </td>
  104. !if $image=1
  105.     !if $make_tr=1
  106.     </tr>
  107.     <tr>
  108.     !endif
  109.     <td class="exercise_c">
  110.     !if $draw=1
  111.         !set insdraw_size=$xsize,$ysize
  112.         !set ins_attr= id="myimage"
  113.         !insdraw $(image$n)
  114.     !endif
  115.     !if $plot=1
  116.         !set insplot_set=$(image_settings$n)
  117.         !set ins_attr= id="myimage"
  118.         !insplot $(image$n)
  119.     !endif
  120.     </td>
  121. !endif
  122. !if $(object$n) != $empty
  123.     !if $make_tr=1
  124.     </tr>
  125.     <tr>
  126.     !endif
  127.     <td class="exercise_c">
  128.         $(object$n)
  129.     </td>
  130. !endif
  131.     </tr>
  132. </table><!-- begin table id="exercise" -->
  133.  
  134. <div id="send_buttons" class="embedded_central">
  135.     <input type="button" id="schaersvoorde_ok_button" onclick="javascript:sendanswer();" value="$send">
  136.     <input type="button" id="schaersvoorde_nok_button" onclick="javascript:dontknow();"  value="$dontknow">
  137. !if $control_inputs = 1
  138.     <input type="button" id="schaersvoorde_extra_button" onclick="javascript:TexAppInputs(1)" value="+">
  139.     <input type="button" id="schaersvoorde_extra_button" onclick="javascript:TexAppInputs(-1);" value="&minus;">
  140. !endif
  141. </div>
  142.