Subversion Repositories wimsdev

Rev

Rev 9994 | Rev 13895 | 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>function read_mathml(){ $formm }</script>
  59. \( $pretext )
  60. $hlist
  61.   !set oef_js_submit=$oef_js_submit read_mathml();
  62. !else
  63.   !read themes/$wims_theme/oefcolors
  64.   !if $oef_indbad=$empty
  65.     !read themes/oefcolors
  66.   !endif
  67.   !distribute item $oef_indbad,$oef_indgood,$oef_indforget, $oef_indpartial, $oef_indprec\
  68.     into colorr_bad,colorr_good,colorr_forget,colorr_partial,colorr_prec
  69.   !set codegood=$code
  70.   !set codereply=$code
  71.   !set test=0
  72.   !for tt = 1 to $parmcnt
  73.     !reset inputsize_tmp
  74.     !set ld=!line $tt of $parm
  75.     !distribute item $ld into m_,inputsize_tmp,css
  76.     !default inputsize_tmp=$inputsize
  77.     !set m_=!text select 0123456789 in $m_
  78.     !set m_=$[$m_]
  79.     !if $m_ isitemof $nrep
  80.       !default reply_$m_=$(reply$m_)
  81.       !set tt=!word 1 of $(replygood$m_)
  82.       !if $tt!=?analyze
  83.         !set cl=$(colorr_$(diareply$m_))
  84.       !else
  85.         !set cl=$colorr_ana
  86.       !endif
  87.       !if $(diareply$m_)!=good
  88.         !set test=1
  89.       !endif
  90.       !set replytolatex=!texmath $(reply$m_)
  91.       !set rgoodtolatex=!texmath $(replyGood$m_)
  92.       !set codereply=!replace internal reply$m_ by $ \special{color=$cl}{$replytolatex} $ in $codereply
  93.       !set codegood=!replace internal reply$m_ by $ $(rgoodtolatex)$ in $codegood
  94.     !endif m_
  95.   !next tt
  96.   !if $test=1 and $noanswer!=1
  97.     \( $codereply \quad\) \(\quad $codegood\)
  98.   !else
  99.     \( $codereply \)
  100.   !endif
  101. !endif
  102.