Subversion Repositories wimsdev

Rev

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

  1.  
  2. !! This script handle OEF embed{t, inputsize, [prompt]} instruction
  3.  
  4. !! replace oef variables by their associated value
  5. !set parm=!replace internal \ by $$m_ in $wims_read_parm
  6.  
  7. !set t_=!item 1 of $parm
  8. !set inputsize=!item 2 of $parm
  9. !! To let LaTeX instructions working, "\" must not be replaced in prompt.
  10. !set prompt_=!item 3 of $wims_read_parm
  11.  
  12. !set inputsize1=!word 1 of $inputsize
  13. !if $(replytype$i) iswordof flashcard
  14.  !set inputsize1=!word 1 of $inputsize
  15. !else
  16.  !set inputsize1=$inputsize
  17. !endif
  18. !if $printing=yes or $cmd=hint
  19.  !! i__ is the question numero
  20.  !! i is the exercise numero (print version)
  21.  !! does not exist in case cmd=hint
  22.  !set i__=!replace internal reply by in $t_
  23.  !set i__=!replace internal r by in $i__
  24.  !set i__=!trim $i__
  25.  !if $cmd!=hint
  26.    !set replytype$i__=!item $i__ of $(Replytype$i)
  27.    !set replystyle$i__=!item $i__ of $(Replystyle$i)
  28.  !endif
  29.  !readproc anstype/$(replytype$i__).input def
  30.  !default replystyle$i__=$anstyle
  31.  !if mc iswordof $(replystyle$i__) or $(replytype$i__) iswordof dragfill clickfill
  32.    !if $inputsize1>0
  33.      !if $prompt_=$empty
  34.        !if $cmd=hint
  35.          !set g_=!rows2lines $(replygood$i__)
  36.          !set prompt_=!line 2 of $g_
  37.        !else
  38.          !set prompt_=!line $i__ of $(Rg$i)
  39.        !endif
  40.        !set prompt_=!item $inputsize1 of $prompt_
  41.      !endif
  42.    !else
  43.      !if $prompt_=$empty
  44.        !set g_=!rows2lines $(replygood$i__)
  45.        !set g_=!line 2 of $g_
  46.        !set prompt_=$g_
  47.        !set prompt_=!line $i__ of $(Rg$i)
  48.        !set prompt_=!items2lines $prompt_
  49.        !set prompt_=!replace internal $\
  50. $ by  </span>$  $ <span style="color:blue">/</span> $ $<span style="text-decoration:underline"> in <span style="text-decoration:underline">$prompt_</span>
  51.      !endif
  52.    !endif
  53.    <div class="inline" style="font-style:italic">$prompt_</div>
  54.  !else
  55.    !if $(replytype$i__) iswordof compose correspond
  56.      !if $(replytype$i__)=compose
  57.        !set prompt_=!line $i__ of $(Rg$i)
  58.        !set prompt_cnt=!wordcnt $prompt
  59.        !set prompt_=!shuffle $prompt_
  60.        !set prompt_=!replace internal , by $ $ / $ $ in $prompt_
  61.        $prompt_
  62.      !endif
  63.      !if $(replytype$i__)=correspond
  64.        !set prompt_=!line $i__ of $(Rg$i)
  65.        $prompt_
  66.      !endif
  67.    !else
  68.   ___________
  69.    !endif
  70.  !endif
  71.  !exit
  72. !endif
  73. !!end of print section
  74.  
  75. !if $wims_read_parm=$empty
  76.  !exit
  77. !endif
  78.  
  79. !set n_=!char 2 to -1 of $t_
  80. !set t_=!char 1 of $t_
  81. !set t_=!lower $t_
  82. !set t_=!translate a to r in $t_
  83. !set n_=!text select 0123456789()+-* in $n_
  84. !set n_=$[$n_]
  85. !bound n_ between integer 1 and 100 default $
  86. !if $t_ notitemof r,c or $n_=$empty
  87.  !exit
  88. !endif
  89.  
  90. !if $t_=c and $(choicelist$n_)=$empty or\
  91.           $t_=r and $(replygood$n_)=$empty
  92.  !exit
  93. !endif
  94.  
  95. !if $t_$n_ notitemof $embedded
  96.  !set embedded=!append item $t_$n_ to $embedded
  97.  !set embcnt=!itemcnt $embedded
  98. !endif
  99. !set i=$n_
  100.  
  101. !if $q_form=yes
  102.  !if $t_=c
  103.    !set p_=$ch_choose,$(choicelist$i)
  104.    !if $idontknow>0 and noidontknow notwordof $(choiceoption$i)
  105.      !set p_=$p_,$ch_noidea
  106.    !endif
  107.    !if $qcmgood<1
  108.      !set p_=$p_,$ch_none
  109.    !endif
  110.    !set N_=!itemcnt $p_
  111.    !set C_=$(choice$i)
  112.    !if debug iswordof $m_oefenv
  113.      !set replydefaulted=yes
  114.      !if $oef_default=yes
  115.        !set T_=!positionof item $(choicegood$i[1]) in $(choicelist$i)
  116.        !default choice$i=$(T_[1])
  117.      !endif
  118.    !endif
  119.    !formselect choice$i from 0 to $[$N_-1] prompt $p_
  120.    !set choice$i=$C_
  121.  !else
  122.    !read anstype/$(replytype$i).input noprompt
  123.  !endif
  124. !else
  125.  !distribute item oef_indgood, oef_indbad, oef_indforget, oef_indneutral, oef_empty, oef_indprec, oef_indpartial\
  126.    into colorr_good, colorr_bad, colorr_forget, colorr_neutral, colorr_none, colorr_prec, colorr_partial
  127.  !set cl=colorr_none
  128.  !if $t_=c
  129.    !set cl=$(colorr_$(diachoice$i))
  130.    !set p_=!item $(choice$i) of $(choicelist$i),$ch_noidea,$ch_none
  131.    !set choicename$i=[$embcnt]
  132.  !else
  133.    !default reply_$i=$(reply$i)
  134.    !set p_=$(reply_$i)
  135.    !if dprompt iswordof $(replystyle$i)
  136.      !set reply_$i=$(reply__$i)
  137.    !endif
  138.    !if mc iswordof $(replystyle$i) and $inputsize1!=$empty and $[$inputsize1]!=NaN and $[$inputsize1] >= 1 and $[$inputsize1] <= 1000
  139.      !set tt=!rows2lines $(replygood$i)
  140.      !distribute lines $tt into ts,tt
  141.      !default prompt_=!item $inputsize1 of $tt
  142.      !set p_=$prompt_
  143.      !reset tv
  144.      !if $(replytype$i) iswordof mark flashcard
  145.        !set tv=$(reply$i)
  146.      !else
  147.        !for r_ in $(reply$i)
  148.          !set tu=!positionof item $r_ in $tt
  149.          !set tv=!append item $tu to $tv
  150.        !next r_
  151.      !endif
  152.  
  153.      !set p_=!replace internal &#59; by ; in $p_
  154.      !if $inputsize1 notitemof $tv
  155.        !if $presentgood=0
  156.          !set cl= $colorr_none
  157.        !else
  158.          !if $inputsize1 isitemof $ts and $(replytype$i) iswordof mark flashcard checkbox
  159.            !set cl = $colorr_forget
  160.          !else
  161.            !set cl = $colorr_neutral
  162.          !endif
  163.        !endif
  164.        !set p__=!detag $p_
  165.        !if $p__!=$empty
  166.          !imgrename <span class="$cl">$p_</span>
  167.        !else
  168.          $p_
  169.        !endif
  170.        !exit
  171.      !endif
  172.    !endif
  173.    !if $(replytype$i) iswordof code
  174.      !set p_=!replace internal & by &amp; in $p_
  175.      !set p_=!replace internal &amp;#36; by &#36; in $p_
  176.      !set p_=!replace internal < by &lt; in $p_
  177.      !set p_=<pre>$p_</pre>
  178.    !endif
  179.    !set tt=!word 1 of $(replygood$i)
  180.    !if $tt!=?analyze
  181.      !set cl=$(colorr_$(diareply$i))
  182.      !if $(replytype$i) iswordof mark flashcard checkbox
  183.        !if $inputsize!=$empty
  184.          !if $inputsize isitemof $ts
  185.            !set cl = $colorr_good
  186.          !else
  187.            !set cl = $colorr_bad
  188.          !endif
  189.        !else
  190.          !set cl=$(colorr_$(diareply$i))
  191.          !default display_forget=no
  192.        !endif
  193.      !endif
  194.      !if $(partialgood$i)=yes
  195.        !set cl=$(colorr_partial)
  196.      !endif
  197.      !if $(precreply$i)=yes
  198.        !set cl=$(colorr_prec)
  199.      !endif
  200.    !else
  201.      !set embedded_analyze=!append item $i to $embedded_analyze
  202.      !if noanalyzeprint notwordof $(replyoption$i)
  203.        !set embedded_bracket=$embedded_bracket [$embcnt]
  204.      !endif
  205.    !endif
  206.    !set replyname$i=[$embcnt]
  207.  !endif
  208.  !set embcnt1=&nbsp;<sup><small>[$embcnt]</small></sup>
  209.  !if $(replytype$i) notwordof correspond crossword
  210.    !if bad isin $cl
  211.      !set instex_color=red
  212.    !endif
  213.    !if good isin $cl
  214.      !set instex_color=green
  215.    !endif
  216.    !if forget isin $cl
  217.      !set instex_color=blue
  218.    !endif
  219.    !imgrename <span class="$cl">$p_</span>$embcnt1
  220.  !else
  221.    !imgrename $p_ $embcnt1
  222.  !endif
  223.  !set instex_color=black
  224.  !if $(replytype$i) iswordof correspond
  225.    !set noshow$i=yes
  226.  !endif
  227. !endif
  228.