Subversion Repositories wimsdev

Rev

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

  1. !reset inputsize
  2. !set force_mathml=yes
  3. !if $wims_read_parm=$empty
  4.  !exit
  5. !endif
  6. !if $wims_read_parm=help
  7.  !read help/$lang/special/mathmlinput.phtml
  8.  !exit
  9. !endif
  10. !set parm=!replace internal ,   r by $  r in $wims_read_parm
  11. !set parm=!replace internal $   $ by $\
  12. $ in $parm
  13.  
  14. !set code=!item 1 of $parm
  15. !set code=!declosing $code
  16.  
  17. !set inputsize=!item 2 to -1 of $parm
  18. !set parm=!line 2 to -1 of $inputsize
  19. !set inputsize=!line 1 of $inputsize
  20.  
  21. !if noanswer iswordof $inputsize
  22.    !set noanswer=1
  23. !endif
  24. !set inputsize=!item 1 of $inputsize
  25. !set inputsize=!text select 0123456789 in $inputsize
  26. !default inputsize=5
  27. !set inputsize=!items2words $inputsize
  28.  
  29. !set parmcnt=!linecnt $parm
  30. !set parm=!sort reverse line $parm
  31.  
  32. !set pretext=!replace internal reply by REPLY in $code
  33.  
  34. !for tt = 1 to $parmcnt
  35.    !set ld=!line $tt of $parm
  36.    !set upcase=!uppercase $(ld[1])
  37.    !reset inputsize_tmp
  38.    !distribute item $ld into m_,inputsize_tmp,css
  39.    !default inputsize_tmp=$inputsize
  40.    !set reply_tmp=!nospace $m_
  41.    !set rep_tmp=!replace internal reply by r in $reply_tmp
  42.    !set n_=!text select 0123456789 in $reply_tmp
  43.    !set n_=$[$n_]
  44.    !bound n_ between integer 1 and 100 default $
  45.    !if $n_!=$empty and $(replytype$n_) iswordof numeric nocase case atext \
  46.      range litexp algexp formal equation function raw symtext default aset fset set numexp
  47.     !set embedded=!append item r$n_ to $embedded
  48.     !if debug iswordof $m_oefenv and ?analyze notin $(replygood$n_)
  49.       !read oef/special/debug.input $n_
  50.     !endif
  51.     !set pretext=!replace internal REPLY$n_ by $ \input{$(inputsize_tmp)}{$n_}{$(css)}{$(reply$n_)}{0} $ in $pretext
  52.     !set hlist=$hlist<input type="hidden" name="reply$n_" value="" />
  53.     !set formm=$formm document.forms['replyform'].reply$n_.value=document.getElementById("mathml"+$n_).value;
  54.     !set nrep=!append item $n_ to $nrep
  55.   !endif
  56. !next tt
  57. !if $q_form=yes
  58. <script type="text/javascript">\
  59. function read_mathml(){ $formm }\
  60. </script>
  61. \( $pretext )
  62. $hlist
  63. !set oef_js_submit=$oef_js_submit read_mathml();
  64. !else
  65.  !read themes/$wims_theme/oefcolors
  66.  !if $oef_indbad=$empty
  67.    !read themes/oefcolors
  68.  !endif
  69.  !distribute item $oef_indbad,$oef_indgood,$oef_indforget, $oef_indpartial, $oef_indprec\
  70.    into colorr_bad,colorr_good,colorr_forget,colorr_partial,colorr_prec
  71.  !set codegood=$code
  72.  !set codereply=$code
  73.  !set test=0
  74.  !for tt = 1 to $parmcnt
  75.      !reset inputsize_tmp
  76.      !set ld=!line $tt of $parm
  77.      !distribute item $ld into m_,inputsize_tmp,css
  78.      !default inputsize_tmp=$inputsize
  79.      !set m_=!text select 0123456789 in $m_
  80.      !set m_=$[$m_]
  81.      !if $m_ isitemof $nrep
  82.       !default reply_$m_=$(reply$m_)
  83.       !set tt=!word 1 of $(replygood$m_)
  84.       !if $tt!=?analyze
  85.        !set cl=$(colorr_$(diareply$m_))
  86.       !else
  87.        !set cl=$colorr_ana
  88.       !endif
  89.       !if $(diareply$m_)!=good
  90.        !set test=1
  91.       !endif
  92.      !set replytolatex=!texmath $(reply$m_)
  93.      !set rgoodtolatex=!texmath $(replyGood$m_)
  94.      !set codereply=!replace internal reply$m_ by $ \special{color=$cl}{$replytolatex} $ in $codereply
  95.      !set codegood=!replace internal reply$m_ by $ $(rgoodtolatex)$ in $codegood
  96.     !endif m_
  97.  !next tt
  98.  !if $test=1 and $noanswer!=1
  99.    \( $codereply \quad\) \(\quad $codegood\)
  100.  !else
  101.    \( $codereply \)
  102.  !endif
  103. !endif
  104.