Rev 15458 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3134 | bpr | 1 | |
10249 | obado | 2 | !! This script handle OEF embed{t, inputsize, [prompt]} instruction |
3 | |||
11068 | obado | 4 | !! replace oef variables by their associated value |
5 | !set parm=!replace internal \ by $$m_ in $wims_read_parm |
||
10249 | obado | 6 | |
11068 | obado | 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 |
||
10249 | obado | 11 | |
2054 | bpr | 12 | !if $(replytype$i) iswordof flashcard |
13 | !set inputsize1=!word 1 of $inputsize |
||
14 | !else |
||
15 | !set inputsize1=$inputsize |
||
16 | !endif |
||
14006 | bpr | 17 | !!! i -> iii |
18 | !!! i_ -> i dans print version |
||
20 | reyssat | 19 | !if $printing=yes or $cmd=hint |
14006 | bpr | 20 | !set cnt_$iii= !linecnt $(Rg$iii) |
13798 | bpr | 21 | !! i__ is the question number |
14006 | bpr | 22 | !! iii is the exercise number (print version) |
13723 | bpr | 23 | !! does not exist in case cmd=hint |
13804 | bpr | 24 | !reset prompt___ |
12348 | bpr | 25 | !set i__=!replace internal reply by in $t_ |
26 | !set i__=!replace internal r by in $i__ |
||
27 | !set i__=!trim $i__ |
||
13723 | bpr | 28 | !if $cmd!=hint |
14006 | bpr | 29 | !set replytype$i__=!item $i__ of $(Replytype$iii) |
30 | !set replystyle$i__=!item $i__ of $(Replystyle$iii) |
||
13723 | bpr | 31 | !endif |
13891 | bpr | 32 | !reset anstyle |
12348 | bpr | 33 | !readproc anstype/$(replytype$i__).input def |
13891 | bpr | 34 | !set replystyle$i__=$anstyle |
35 | !default replystyle$i__=$(replytype$i__) |
||
13880 | bpr | 36 | !! mc=checkbox click flashcard mark menu radio |
37 | !if mc iswordof $(replystyle$i__) \ |
||
14006 | bpr | 38 | or $(replytype$i__) iswordof dragfill clickfill |
13894 | bpr | 39 | !if $inputsize1>0 |
12348 | bpr | 40 | !if $prompt_=$empty |
13723 | bpr | 41 | !if $cmd=hint |
42 | !set g_=!rows2lines $(replygood$i__) |
||
43 | !set prompt_=!line 2 of $g_ |
||
44 | !else |
||
14006 | bpr | 45 | !set prompt_=!line $i__ of $(Rg$iii) |
13723 | bpr | 46 | !endif |
12348 | bpr | 47 | !set prompt_=!item $inputsize1 of $prompt_ |
13891 | bpr | 48 | !set prompt_=<span style="display:inline-block;">$prompt_</span> |
12348 | bpr | 49 | !endif |
50 | !else |
||
51 | !if $prompt_=$empty |
||
14006 | bpr | 52 | !set prompt_=!line $i__ of $(Rg$iii) |
13799 | bpr | 53 | !set prompt_=!items2lines $prompt_ |
54 | !set prompt__=$prompt_ |
||
13880 | bpr | 55 | !if $(replytype$i__) iswordof menu checkbox radio click |
14021 | bpr | 56 | !set tmp=class="wims_list wims_$(replytype$i__)" |
13793 | bpr | 57 | !set prompt_=!replace internal $\ |
14007 | bpr | 58 | $ by </li>$ $<li> in <div class="inline"><ul $tmp><li>$prompt_</li></ul></div> |
59 | !reset tmp |
||
60 | !else |
||
61 | !set prompt_$iii=!append line $prompt__ to $(prompt_$iii) |
||
13793 | bpr | 62 | !set inputsize1_=!replace internal x by , in $inputsize1 |
63 | !if $(inputsize1_[4])!=$empty and $(inputsize1_[4])>1 |
||
64 | !set prompt_=<table class="wimsborder"> |
||
65 | !for j=1 to $(inputsize1_[4]) |
||
66 | !set prompt_=$prompt_<tr> |
||
67 | !for h=1 to $[ceil($(inputsize1_[3])/$(inputsize1_[4]))] |
||
68 | !set prompt_=$prompt_<td> </td> |
||
69 | !next |
||
70 | !set prompt_=$prompt_ </tr> |
||
71 | !next |
||
72 | !set prompt_=$prompt_</table> |
||
73 | !endif |
||
13880 | bpr | 74 | !! regroupe les prompts des dragfill et de clickfill |
14006 | bpr | 75 | !if $i__>=$(cnt_$iii) |
76 | !set prompt_$iii=!lines2items $(prompt_$iii) |
||
77 | !set prompt_$iii=!listuniq $(prompt_$iii) |
||
78 | !set prompt_$iii=!shuffle $(prompt_$iii) |
||
13793 | bpr | 79 | !set prompt___=!replace internal , \ |
13815 | bpr | 80 | by </div>$ $<div class="drag_label" style="display:inline-block;"> \ |
14006 | bpr | 81 | in <div class="drag_label" style="display:inline-block;">$(prompt_$iii)</div> |
13793 | bpr | 82 | !endif |
13894 | bpr | 83 | !reset prompt_ |
13793 | bpr | 84 | !endif |
12348 | bpr | 85 | !endif |
86 | !endif |
||
13276 | obado | 87 | !else |
14006 | bpr | 88 | !set prompt_=!line $i__ of $(Rg$iii) |
13799 | bpr | 89 | !if $(replytype$i__) iswordof compose reorder |
90 | !set prompt_=!shuffle $prompt_ |
||
13816 | bpr | 91 | !set prompt_=!replace internal , by </div>$ $ <div class="drag_label" style="display:inline-block;"> \ |
92 | in <div class="drag_label" style="display:inline-block;">$prompt_</div> |
||
12348 | bpr | 93 | !endif |
2588 | bpr | 94 | !endif |
13999 | bpr | 95 | !if $(replytype$i__) iswordof jsxgraph jsxgraphcurve clock draw |
14006 | bpr | 96 | $(oefcss_$iii) |
97 | !read anstype/$(replytype$i__).input $i__ |
||
13891 | bpr | 98 | !exit |
99 | !endif |
||
13801 | bpr | 100 | !if $prompt_ issametext $empty |
13809 | bpr | 101 | !set prompt_=$prompt_empty |
13801 | bpr | 102 | !endif |
13799 | bpr | 103 | $prompt_ |
12348 | bpr | 104 | !exit |
20 | reyssat | 105 | !endif |
3134 | bpr | 106 | !!end of print section |
20 | reyssat | 107 | |
108 | !if $wims_read_parm=$empty |
||
12348 | bpr | 109 | !exit |
20 | reyssat | 110 | !endif |
111 | |||
112 | !set n_=!char 2 to -1 of $t_ |
||
113 | !set t_=!char 1 of $t_ |
||
114 | !set t_=!lower $t_ |
||
115 | !set t_=!translate a to r in $t_ |
||
116 | !set n_=!text select 0123456789()+-* in $n_ |
||
117 | !set n_=$[$n_] |
||
118 | !bound n_ between integer 1 and 100 default $ |
||
119 | !if $t_ notitemof r,c or $n_=$empty |
||
12348 | bpr | 120 | !exit |
20 | reyssat | 121 | !endif |
122 | |||
123 | !if $t_=c and $(choicelist$n_)=$empty or\ |
||
12348 | bpr | 124 | $t_=r and $(replygood$n_)=$empty |
125 | !exit |
||
20 | reyssat | 126 | !endif |
14574 | bpr | 127 | !set inputprompt$n_=!append item $(wims_read_parm[3]) to $(inputprompt$n_) |
20 | reyssat | 128 | |
129 | !if $t_$n_ notitemof $embedded |
||
12348 | bpr | 130 | !set embedded=!append item $t_$n_ to $embedded |
131 | !set embcnt=!itemcnt $embedded |
||
20 | reyssat | 132 | !endif |
133 | !set i=$n_ |
||
134 | !if $q_form=yes |
||
12348 | bpr | 135 | !if $t_=c |
136 | !set p_=$ch_choose,$(choicelist$i) |
||
137 | !if $idontknow>0 and noidontknow notwordof $(choiceoption$i) |
||
138 | !set p_=$p_,$ch_noidea |
||
139 | !endif |
||
140 | !if $qcmgood<1 |
||
141 | !set p_=$p_,$ch_none |
||
142 | !endif |
||
143 | !set N_=!itemcnt $p_ |
||
144 | !set C_=$(choice$i) |
||
145 | !if debug iswordof $m_oefenv |
||
146 | !set replydefaulted=yes |
||
147 | !if $oef_default=yes |
||
148 | !set T_=!positionof item $(choicegood$i[1]) in $(choicelist$i) |
||
149 | !default choice$i=$(T_[1]) |
||
150 | !endif |
||
151 | !endif |
||
152 | !formselect choice$i from 0 to $[$N_-1] prompt $p_ |
||
153 | !set choice$i=$C_ |
||
154 | !else |
||
14312 | bpr | 155 | !read anstype/$(replytype$i).input noprompt |
20 | reyssat | 156 | !endif |
157 | !else |
||
15146 | obado | 158 | !if $presentgood>0 |
159 | !distribute item oef_indgood, oef_indbad, oef_indforget, oef_indneutral, oef_empty, oef_indprec, oef_indpartial\ |
||
12348 | bpr | 160 | into colorr_good, colorr_bad, colorr_forget, colorr_neutral, colorr_none, colorr_prec, colorr_partial |
15146 | obado | 161 | !else |
162 | !distribute item oef_indneutral, oef_indneutral, oef_indneutral, oef_indneutral, oef_empty, oef_indprec, oef_indpartial\ |
||
163 | into colorr_good, colorr_bad, colorr_forget, colorr_neutral, colorr_none, colorr_prec, colorr_partial |
||
164 | !endif |
||
12348 | bpr | 165 | !set cl=colorr_none |
166 | !if $t_=c |
||
167 | !set cl=$(colorr_$(diachoice$i)) |
||
168 | !set p_=!item $(choice$i) of $(choicelist$i),$ch_noidea,$ch_none |
||
169 | !set choicename$i=[$embcnt] |
||
170 | !else |
||
171 | !default reply_$i=$(reply$i) |
||
172 | !set p_=$(reply_$i) |
||
173 | !if dprompt iswordof $(replystyle$i) |
||
174 | !set reply_$i=$(reply__$i) |
||
175 | !endif |
||
13591 | bpr | 176 | !if mc iswordof $(replystyle$i) and $inputsize1!=$empty and $[$inputsize1]!=NaN and $[$inputsize1] >= 1 and $[$inputsize1] <= 1000 |
12348 | bpr | 177 | !set tt=!rows2lines $(replygood$i) |
178 | !distribute lines $tt into ts,tt |
||
179 | !default prompt_=!item $inputsize1 of $tt |
||
180 | !set p_=$prompt_ |
||
181 | !reset tv |
||
182 | !if $(replytype$i) iswordof mark flashcard |
||
183 | !set tv=$(reply$i) |
||
184 | !else |
||
185 | !for r_ in $(reply$i) |
||
186 | !set tu=!positionof item $r_ in $tt |
||
187 | !set tv=!append item $tu to $tv |
||
188 | !next r_ |
||
189 | !endif |
||
190 | !set p_=!replace internal ; by ; in $p_ |
||
191 | !if $inputsize1 notitemof $tv |
||
192 | !if $presentgood=0 |
||
193 | !set cl= $colorr_none |
||
13260 | bpr | 194 | !else |
12348 | bpr | 195 | !if $inputsize1 isitemof $ts and $(replytype$i) iswordof mark flashcard checkbox |
196 | !set cl = $colorr_forget |
||
197 | !else |
||
198 | !set cl = $colorr_neutral |
||
199 | !endif |
||
200 | !endif |
||
13260 | bpr | 201 | !set p__=!detag $p_ |
202 | !if $p__!=$empty |
||
15181 | bpr | 203 | !imgrename <div class="inline $cl">$p_</div> |
13260 | bpr | 204 | !else |
205 | $p_ |
||
206 | !endif |
||
12348 | bpr | 207 | !exit |
208 | !endif |
||
209 | !endif |
||
210 | !if $(replytype$i) iswordof code |
||
211 | !set p_=!replace internal & by & in $p_ |
||
212 | !set p_=!replace internal &#36; by $ in $p_ |
||
213 | !set p_=!replace internal < by < in $p_ |
||
214 | !set p_=<pre>$p_</pre> |
||
215 | !endif |
||
216 | !set tt=!word 1 of $(replygood$i) |
||
14437 | bpr | 217 | !if ?analyze notin $tt |
12348 | bpr | 218 | !set cl=$(colorr_$(diareply$i)) |
219 | !if $(replytype$i) iswordof mark flashcard checkbox |
||
220 | !if $inputsize!=$empty |
||
221 | !if $inputsize isitemof $ts |
||
222 | !set cl = $colorr_good |
||
223 | !else |
||
224 | !set cl = $colorr_bad |
||
225 | !endif |
||
226 | !else |
||
227 | !set cl=$(colorr_$(diareply$i)) |
||
228 | !default display_forget=no |
||
229 | !endif |
||
230 | !endif |
||
231 | !if $(partialgood$i)=yes |
||
232 | !set cl=$(colorr_partial) |
||
233 | !endif |
||
234 | !if $(precreply$i)=yes |
||
235 | !set cl=$(colorr_prec) |
||
236 | !endif |
||
20 | reyssat | 237 | !else |
12348 | bpr | 238 | !set embedded_analyze=!append item $i to $embedded_analyze |
239 | !if noanalyzeprint notwordof $(replyoption$i) |
||
240 | !set embedded_bracket=$embedded_bracket [$embcnt] |
||
8700 | obado | 241 | !endif |
20 | reyssat | 242 | !endif |
12348 | bpr | 243 | !set replyname$i=[$embcnt] |
20 | reyssat | 244 | !endif |
12348 | bpr | 245 | !set embcnt1= <sup><small>[$embcnt]</small></sup> |
246 | !if $(replytype$i) notwordof correspond crossword |
||
247 | !if bad isin $cl |
||
248 | !set instex_color=red |
||
249 | !endif |
||
250 | !if good isin $cl |
||
251 | !set instex_color=green |
||
252 | !endif |
||
253 | !if forget isin $cl |
||
254 | !set instex_color=blue |
||
255 | !endif |
||
16842 | obado | 256 | !if $(replytype$i) notwordof jsxgraph jsxgraphcurve |
257 | !imgrename <div class="inline $cl">$p_</div>$embcnt1 |
||
258 | !else |
||
259 | !imgrename <div class="$cl">$p_</div>$embcnt1 |
||
260 | !endif |
||
20 | reyssat | 261 | !else |
12348 | bpr | 262 | !imgrename $p_ $embcnt1 |
20 | reyssat | 263 | !endif |
12348 | bpr | 264 | !set instex_color=black |
265 | !if $(replytype$i) iswordof correspond |
||
266 | !set noshow$i=yes |
||
267 | !endif |
||
20 | reyssat | 268 | !endif |