Rev 15695 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11269 | bpr | 1 | option:align=" " noorder transparent |
20 | reyssat | 2 | |
13276 | obado | 3 | !! ClickFill generic anstype (also used by Dragfill) |
4 | |||
13848 | obado | 5 | !!!!!! |
6 | !! After changes made, please test these exercices: |
||
7 | |||
8 | !! for dragfill: |
||
9 | !! * http://127.0.0.1/wims/wims.cgi?module=H1/geometry/OEFtriang5.fr&exo=demo1&cmd=new |
||
10 | !!!!!! |
||
16048 | bpr | 11 | !! for clickfill H5/algebra/OEFevalwimssecdeg.fr (espace) |
20 | reyssat | 12 | good=!singlespace $(replygood$i) |
13 | good=!trim $good |
||
14 | good=!rows2lines $good |
||
15 | good=!line 1 of $good |
||
16 | good=!translate | to $\ |
||
17 | $ in $good |
||
18 | good=!nonempty lines $good |
||
11255 | bpr | 19 | replyGood$i=!line 1 of $good |
20 | |||
11197 | bpr | 21 | !distribute items $(oef_answer_option$i) into sizeh,sizev,sizei,sizej |
22 | !set rightcolor=#87ceeb |
||
23 | !set align_option=!getopt align in $(replyoption$i) |
||
24 | !set align_option=!tolower $align_option |
||
25 | !bound align_option within left,right,center default center |
||
26 | |||
11448 | bpr | 27 | # padding of each label in px |
28 | !set label_padding=1 |
||
29 | # border width of each label in px |
||
30 | !set label_border_width=1 |
||
31 | # margin of each label in px |
||
32 | !set label_margin=1 |
||
33 | |||
13727 | obado | 34 | !set sizegood=!itemcnt $(replyGood$i) |
11448 | bpr | 35 | |
11253 | bpr | 36 | # sizej represent the number of objects per line |
11448 | bpr | 37 | # $sizeh+... represent an object width + its padding+margin+border in px |
11255 | bpr | 38 | !if $sizei=$sizej |
12533 | bpr | 39 | !! case of 1 line. |
11255 | bpr | 40 | !set sizerep=!itemcnt $(reply$i) |
11448 | bpr | 41 | !set container_width_g = $[($sizeh+2*$label_padding+2*$label_border_width+2*$label_margin) * $sizegood] |
42 | !set container_width_r = $[($sizeh+2*$label_padding+2*$label_border_width+2*$label_margin) * $sizerep] |
||
11255 | bpr | 43 | !else |
11448 | bpr | 44 | !set container_width_g = $[($sizeh+2*$label_padding+2*$label_border_width+2*$label_margin) * $sizej] |
11255 | bpr | 45 | !set container_width_r = $container_width_g |
46 | !endif |
||
47 | |||
48 | !set container_width_g = class="fill_container" style="width:$(container_width_g)px" |
||
49 | !set container_width_r = class="fill_container" style="width:$(container_width_r)px" |
||
50 | |||
11448 | bpr | 51 | !set label_width=$[$(sizeh) + 2*$label_padding + 2*$label_border_width] |
52 | !set label_height=$[$(sizev) + 2*$label_padding + 2*$label_border_width] |
||
53 | |||
54 | !if $(sizeh)<30 or $(sizev)<30 |
||
55 | !set label_overflow = overflow:hidden; |
||
56 | !else |
||
57 | !reset label_overflow |
||
58 | !endif |
||
59 | |||
13727 | obado | 60 | !reset rGood$i |
61 | !for a=1 to $sizegood |
||
62 | rGood$i=$(rGood$i)<div class="drag_label oef_indgood" style="$(label_overflow)justify-content:$align_option;width:$(label_width)px;height:$(label_height)px;">\ |
||
63 | <div class="drag_content 3" style="text-align:$align_option">$(replyGood$i[$a])</div>\ |
||
64 | </div> |
||
65 | !next |
||
66 | replyGood$i=<div $container_width_g>$(rGood$i)</div> |
||
11197 | bpr | 67 | |
20 | reyssat | 68 | dd=$(reply$i) |
69 | |||
70 | !if r$i notitemof $thisstep |
||
11208 | obado | 71 | !goto nocheck |
20 | reyssat | 72 | !endif |
73 | |||
74 | !if $i notitemof $fill_checked |
||
11208 | obado | 75 | fill_checked=!append item $i to $fill_checked |
76 | dd2= |
||
77 | !for d_ in $dd |
||
78 | !if $d_ isitemof $fill_check |
||
79 | dd2=!append item $d_ to $dd2 |
||
80 | !if $(replytype$i)=dragfill |
||
81 | pos=!positionof item $d_ in $fill_check |
||
82 | pos=!item 1 of $pos |
||
83 | !if $pos!=$empty |
||
84 | fill_check=!replace item number $pos by $ in $fill_check |
||
85 | !endif |
||
86 | !endif |
||
87 | !else |
||
11376 | bpr | 88 | !set default_$i=!replace internal   by in $(default_$i) |
11208 | obado | 89 | dd2=!append item $(default_$i) to $dd2 |
20 | reyssat | 90 | !endif |
11208 | obado | 91 | !next d_ |
92 | dd=$dd2 |
||
93 | !if $(replytype$i)=dragfill |
||
94 | fill_check=!nonempty items $fill_check |
||
20 | reyssat | 95 | !endif |
96 | !endif |
||
97 | |||
98 | :nocheck |
||
99 | reply$i=$dd |
||
100 | m_reply$i=$dd |
||
11448 | bpr | 101 | |
11376 | bpr | 102 | !set style=.drag_label{\ |
15695 | bpr | 103 | padding:$(label_padding)px;\ |
104 | border-width:$(label_border_width)px;\ |
||
105 | background-color:$rightcolor;\ |
||
106 | } |
||
13473 | obado | 107 | |
11376 | bpr | 108 | !if $style notin $oef_anstype_css |
13473 | obado | 109 | !set oef_anstype_css=!append line $style to $oef_anstype_css |
11180 | obado | 110 | !endif |
111 | |||
11376 | bpr | 112 | !!reply_$i=!items2words $dd |
113 | !set dd_cnt=!itemcnt $dd |
||
114 | !set reply_$i=<div $container_width_r> |
||
20 | reyssat | 115 | !if $wims_read_parm=nocompare |
13727 | obado | 116 | !for a=1 to $dd_cnt |
11320 | bpr | 117 | reply_$i=$(reply_$i)<div\ |
13280 | obado | 118 | class="drag_label" style="$(label_overflow)justify-content:$align_option;width:$(label_width)px;height:$(label_height)px;">\ |
13641 | obado | 119 | <div class="drag_content" style="text-align:$align_option">$(dd[$a])</div>\ |
11320 | bpr | 120 | </div> |
121 | !next |
||
122 | reply_$i=$(reply_$i)</div> |
||
11208 | obado | 123 | !exit |
20 | reyssat | 124 | !endif |
125 | |||
126 | !if $good=$empty |
||
15695 | bpr | 127 | default=!getopt default in $(replyoption$i) |
128 | good=$default |
||
16048 | bpr | 129 | good=!replace internal   $ by in $good |
15695 | bpr | 130 | !endif |
131 | !if $good= |
||
11208 | obado | 132 | Test=bad $i |
133 | !exit |
||
20 | reyssat | 134 | !endif |
135 | |||
136 | diag= |
||
4849 | bpr | 137 | diaratio=-1 |
20 | reyssat | 138 | t_=!linecnt $good |
139 | good=!replace internal , $ by , in $good |
||
140 | dd=!replace internal , $ by , in $dd |
||
16048 | bpr | 141 | dd=!replace internal   $ by in $dd |
1802 | bpr | 142 | ddo=!sort items $dd |
20 | reyssat | 143 | !for n=1 to $t_ |
11208 | obado | 144 | g=!line $n of $good |
145 | g=!trim $g |
||
146 | !if $dd issametext $g |
||
147 | diag=yes |
||
148 | !endif |
||
149 | !if noorder iswordof $(replyoption$i) |
||
150 | go=!sort items $g |
||
151 | !if $ddo issametext $go |
||
152 | diag=yes |
||
153 | !else |
||
11253 | bpr | 154 | !! more precisely, but will used only if there is only one good answer) |
155 | !if $t_=1 |
||
156 | !reset gr |
||
157 | !for j=1 to $dd_cnt |
||
158 | !if $(dd[$j]) isitemof $g |
||
13473 | obado | 159 | !set gr=!append item oef_indgood to $gr |
11253 | bpr | 160 | !else |
13473 | obado | 161 | !set gr=!append item oef_indbad to $gr |
11253 | bpr | 162 | !endif |
163 | !next j |
||
164 | !endif |
||
11208 | obado | 165 | !endif |
166 | !endif |
||
167 | !if $diag notwordof yes and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i)) |
||
168 | !! nombre de reponses |
||
169 | poscnt1=!itemcnt $ddo |
||
170 | lint=!listintersect $ddo and $go |
||
171 | !! nombre de bonnes reponses |
||
172 | poscnt2=!itemcnt $lint |
||
173 | !! nombre demande de bonnes reponses |
||
174 | poscnt3=!itemcnt $go |
||
175 | !if eqweight iswordof $(replyoption$i) |
||
176 | diaratio_=$[2*$poscnt2 - $poscnt1] |
||
177 | !else |
||
178 | diaratio_=$[3*$poscnt2 - 2*$poscnt1] |
||
179 | !endif |
||
180 | !if $diaratio_ > 0 |
||
181 | diaratio=$[max($diaratio,$[$diaratio_/max($poscnt3,1)])] |
||
182 | !endif |
||
183 | !endif split |
||
20 | reyssat | 184 | !next n |
7139 | bpr | 185 | |
13727 | obado | 186 | !for a=1 to $dd_cnt |
11448 | bpr | 187 | reply_$i=$(reply_$i)<div\ |
13280 | obado | 188 | class="drag_label $(gr[$a])" style="$(label_overflow)justify-content:$align_option;width:$(label_width)px;height:$(label_height)px;">\ |
13641 | obado | 189 | <div class="drag_content" style="text-align:$align_option">$(dd[$a])</div>\ |
11448 | bpr | 190 | </div> |
191 | !next |
||
192 | reply_$i=$(reply_$i)</div> |
||
11253 | bpr | 193 | |
20 | reyssat | 194 | !if $diag=yes |
11208 | obado | 195 | diareply$i=good |
196 | !advance freegot |
||
20 | reyssat | 197 | !else |
4849 | bpr | 198 | !if $diaratio > 0 and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i)) |
199 | diareply$i=good |
||
200 | partialgood$i=yes |
||
201 | freegot=$[$freegot+ max(0,$diaratio)] |
||
202 | !else |
||
203 | diareply$i=bad |
||
204 | !endif |
||
7139 | bpr | 205 | !endif |