Subversion Repositories wimsdev

Rev

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