Subversion Repositories wimsdev

Rev

Rev 11068 | Rev 13260 | 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.    !imgrename <div class="inline $cl">$p_</div>
  158.    !exit
  159.   !endif
  160.  !endif
  161.  !if $(replytype$i) iswordof code
  162.   !set p_=!replace internal & by &amp; in $p_
  163.   !set p_=!replace internal &amp;#36; by &#36; in $p_
  164.   !set p_=!replace internal < by &lt; in $p_
  165.   !set p_=<pre>$p_</pre>
  166.  !endif
  167.  !set tt=!word 1 of $(replygood$i)
  168.  !if $tt!=?analyze
  169.   !set cl=$(colorr_$(diareply$i))
  170.   !if $(replytype$i) iswordof mark flashcard checkbox
  171.    !if $inputsize!=$empty
  172.      !if $inputsize isitemof $ts
  173.        !set cl = $colorr_good
  174.      !else
  175.        !set cl = $colorr_bad
  176.      !endif
  177.    !else
  178.      !set cl=$(colorr_$(diareply$i))
  179.      !default display_forget=no
  180.     !endif
  181.   !endif
  182.   !if $(partialgood$i)=yes
  183.     !set cl=$(colorr_partial)
  184.   !endif
  185.   !if $(precreply$i)=yes
  186.     !set cl=$(colorr_prec)
  187.   !endif
  188.  !else
  189.   !set embedded_analyze=!append item $i to $embedded_analyze
  190.   !if noanalyzeprint notwordof $(replyoption$i)
  191.    !set embedded_bracket=$embedded_bracket [$embcnt]
  192.   !endif
  193.  !endif
  194.  !set replyname$i=[$embcnt]
  195. !endif
  196. !set embcnt1=&nbsp;<sup><small>[$embcnt]</small></sup>
  197. !if $(replytype$i) notwordof correspond crossword
  198.   !if bad isin $cl
  199.    !set instex_color=red
  200.   !endif
  201.   !if good isin $cl
  202.    !set instex_color=green
  203.   !endif
  204.   !if forget isin $cl
  205.    !set instex_color=blue
  206.   !endif
  207.  !imgrename <div class="inline $cl">$p_</div>$embcnt1
  208.  !else
  209.  !imgrename $p_ $embcnt1
  210. !endif
  211. !set instex_color=black
  212. !if $(replytype$i) iswordof correspond
  213.  !set noshow$i=yes
  214. !endif
  215. !endif
  216.