Subversion Repositories wimsdev

Rev

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