Subversion Repositories wimsdev

Rev

Rev 9002 | Rev 13884 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. !reset inputsize
  2. !if $wims_read_parm=$empty
  3.  !exit
  4. !endif
  5. !if $wims_read_parm=help
  6.  !read help/$lang/special/drawinput.phtml
  7.  !exit
  8. !endif
  9.  
  10. !set parm=!replace internal $   $ by $\
  11. $ in $wims_read_parm
  12.  
  13. !set code=!item 1 of $parm
  14. !set code=!declosing $code
  15. !set code=!rows2lines $code
  16. !set code=!trim $code
  17.  
  18. !set inputsize=!item 2 to -1 of $parm
  19. !set parm=!line 2 to -1 of $inputsize
  20. !set inputsize=!line 1 of $inputsize
  21.  
  22. !distribute items $inputsize into bigsize,inputsize,option
  23.  
  24. !set bigsize=!translate x, to $  $ in $bigsize
  25. !distribute words $bigsize into bigsizex,bigsizey
  26.  
  27. !set inputsize=!item 1 of $inputsize
  28. !default inputsize=1x5
  29. !set inputsize=!translate x to , in $inputsize
  30. !!set inputsize=!items2words $inputsize
  31.  
  32. !if $printing=yes or $cmd=hint
  33.  !read oef/canvasdraw.phtml $bigsizex,$bigsizey\
  34. $code
  35.  !exit
  36. !endif
  37.  
  38. !! one parse the data for canvadraw to find the number of the line
  39. !! where input are written.
  40. !set parmcnt=!linecnt $parm
  41.  
  42. !reset hlist positionlist
  43. !set m__=0
  44. !reset codeinput
  45.  
  46. !for tt = 1 to $parmcnt
  47.    !set ld=!line $tt of $parm
  48.    !reset inputsize_tmp
  49.    !distribute item $ld into m_,xy_,inputsize_tmp,css
  50.    !if $css!=$empty and $tt=1
  51.      !set codeinputcss=inputstyle $css
  52.    !endif
  53.    !set xy_=!replace internal x by , in $xy_
  54.    !distribute items $xy_ into x_,y_
  55.    !default inputsize_tmp=$inputsize
  56.    !set reply_tmp=!nospace $m_
  57.    !set rep_tmp=!replace internal reply by r in $reply_tmp
  58.    !set n_=!text select 0123456789 in $reply_tmp
  59.    !set n_=$[$n_]
  60.    !if debug iswordof $m_oefenv and ?analyze notin $(replygood$n_)
  61.      !read oef/special/debug.input $n_
  62.    !endif
  63.    !set inputsize_tmp=!translate x to , in $inputsize_tmp
  64.    !if $(inputsize_tmp[2])=$empty and $(inputsize_tmp[1])!=$empty
  65.        !set inputsize_tmp=1,$inputsize_tmp
  66.    !endif
  67.    !set inputsize_tmp=!nospace $inputsize_tmp
  68.    !default inputsize_tmp=$inputsize
  69.  
  70.    !if $n_!=$empty and $(replytype$n_) iswordof numeric nocase case atext \
  71.      range litexp algexp formal equation function default raw symtext set aset fset
  72.     !set embedded=!append item r$n_ to $embedded
  73.     !increase m__
  74.     !set codeinput=!append line input $[$x_],$[$y_],$(inputsize_tmp[2]),1,$(reply$n_)$ $ to $codeinput
  75.     !set hlist=$hlist<input type="hidden" id="oefvar$[$m__]" name="reply$n_" value="" />
  76.     !set oef_js_submit=!append word my_canvasdraw$m__(); to $oef_js_submit
  77.     !set list_$n_=$m__
  78.   !endif
  79. !next
  80. !default codeinputcss=inputstyle background-color:white;font-size:1.1em;
  81.  
  82. !set oef_js_submit=!append word my_canvasdraw(); to $oef_js_submit
  83. <script type="text/javascript">
  84. /*<![CDATA[*/
  85. !for m = 1 to $m__
  86.    function my_canvasdraw$m() {
  87.      fun = eval('read_canvas'+canvas_scripts[0]);
  88.      var p= new Array(); p = fun();
  89.      document.getElementById('oefvar' + $m).value=p[$m-1];
  90.    }
  91. !next
  92. /*]]>*/
  93. </script>
  94. !set code_=!nonempty lines $bigsizex,$bigsizey\
  95. $code\
  96. $codeinputcss\
  97. $codeinput
  98.  
  99. !if $q_form=yes
  100.  $hlist
  101.  !read oef/canvasdraw.phtml $code_ $ $
  102. !else
  103.  !reset code_r
  104.  !read themes/$wims_theme/oefcolors
  105.  !if $oef_indbad=$empty
  106.    !read themes/oefcolors
  107.  !endif
  108.  !distribute item $oef_indbad,$oef_indgood,$oef_indforget, $oef_indpartial, $oef_indprec\
  109.    into colorr_bad, colorr_good, colorr_forget, colorr_partial, colorr_prec
  110.  !for c in $embedded
  111.    !set ii=!replace internal r by in $c
  112.    !set rep$ii=!replace internal $\
  113. $  by , in $(reply$ii)
  114.    !default reply_$ii=$(reply$ii)
  115.    !set tt=!word 1 of $(replygood$ii)
  116.    !if $tt!=?analyze
  117.     !set cl=$(colorr_$(diareply$ii))
  118.     !if $(precreply$ii)=yes
  119.        !set cl=$(colorr_prec)
  120.     !endif
  121.     !if $(partialgood$ii)=yes
  122.        !set cl=$(colorr_partial)
  123.     !endif
  124.    !else
  125.     !set cl=$colorr_ana
  126.    !endif
  127.    !!  if nextline is decommented, no analyze at the end.
  128.    !!set embedded_analyze=!append item $i to $embedded_analyze
  129.    !set embedded_bracket=$embedded_bracket [$ii]
  130.    !set replyname$ii=[$ii]
  131.    !set code_r_=!line $(list_$ii) of $codeinput
  132.    !set code_r_=!item 1 to 3 of $code_r_
  133.  
  134.    !set code_r=$code_r\
  135. inputstyle color:$cl;\
  136. $code_r_,0,$(reply_$ii) $(replyname$ii)
  137.    !set replyname$m_=[$m_]
  138.  !next
  139.  
  140. !set code_r_=!nonempty lines $bigsizex,$bigsizey\
  141. $code\
  142. $code_r
  143.  
  144.  !read oef/canvasdraw.phtml $bigsizex,$bigsizey\
  145. $code_r_
  146.  
  147. !endif
  148.