Rev 11253 | Rev 11262 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11253 | bpr | 1 | option:align=" " noorder transparent split |
20 | reyssat | 2 | |
3 | good=!singlespace $(replygood$i) |
||
4 | good=!trim $good |
||
5 | good=!rows2lines $good |
||
6 | good=!line 1 of $good |
||
7 | good=!translate | to $\ |
||
8 | $ in $good |
||
9 | good=!nonempty lines $good |
||
11255 | bpr | 10 | replyGood$i=!line 1 of $good |
11 | |||
11197 | bpr | 12 | !distribute items $(oef_answer_option$i) into sizeh,sizev,sizei,sizej |
13 | !set rightcolor=#87ceeb |
||
14 | !set align_option=!getopt align in $(replyoption$i) |
||
15 | !set align_option=!tolower $align_option |
||
16 | !bound align_option within left,right,center default center |
||
17 | |||
11253 | bpr | 18 | # sizej represent the number of objects per line |
11208 | obado | 19 | # $sizeh+2 represent an object width + its margin in px |
11255 | bpr | 20 | !if $sizei=$sizej |
21 | !! case of 1 line. |
||
22 | !set sizerep=!itemcnt $(reply$i) |
||
23 | !set sizegood=!itemcnt $(replyGood$i) |
||
24 | !set container_width_g = $[($sizeh+2) * $sizegood] |
||
25 | !set container_width_r = $[($sizeh+2) * $sizerep] |
||
26 | !else |
||
27 | !set container_width_g = $[($sizeh+2) * $sizej] |
||
28 | !set container_width_r = $container_width_g |
||
29 | !endif |
||
30 | |||
31 | !set container_width_g = class="fill_container" style="width:$(container_width_g)px" |
||
32 | !set container_width_r = class="fill_container" style="width:$(container_width_r)px" |
||
33 | |||
11207 | obado | 34 | tmp=class="drag_label" style="text-align:$align_option;width:$(sizeh)px;height:$(sizev)px;" |
11255 | bpr | 35 | replyGood$i=!replace internal , by </div><div $tmp> in <div $container_width_g><div $tmp>$(replyGood$i)</div></div> |
11197 | bpr | 36 | !reset tmp |
37 | |||
20 | reyssat | 38 | dd=$(reply$i) |
39 | |||
40 | !if r$i notitemof $thisstep |
||
11208 | obado | 41 | !goto nocheck |
20 | reyssat | 42 | !endif |
43 | |||
44 | !if $i notitemof $fill_checked |
||
11208 | obado | 45 | fill_checked=!append item $i to $fill_checked |
46 | dd2= |
||
47 | !for d_ in $dd |
||
48 | !if $d_ isitemof $fill_check |
||
49 | dd2=!append item $d_ to $dd2 |
||
50 | !if $(replytype$i)=dragfill |
||
51 | pos=!positionof item $d_ in $fill_check |
||
52 | pos=!item 1 of $pos |
||
53 | !if $pos!=$empty |
||
54 | fill_check=!replace item number $pos by $ in $fill_check |
||
55 | !endif |
||
56 | !endif |
||
57 | !else |
||
58 | !set default_$i= !replace internal   by in $(default_$i) |
||
59 | dd2=!append item $(default_$i) to $dd2 |
||
20 | reyssat | 60 | !endif |
11208 | obado | 61 | !next d_ |
62 | dd=$dd2 |
||
63 | !if $(replytype$i)=dragfill |
||
64 | fill_check=!nonempty items $fill_check |
||
20 | reyssat | 65 | !endif |
66 | !endif |
||
67 | |||
68 | :nocheck |
||
69 | reply$i=$dd |
||
70 | m_reply$i=$dd |
||
71 | |||
11171 | bpr | 72 | !!reply_$i=!items2words $dd |
73 | !set dd_cnt=!itemcnt $dd |
||
11180 | obado | 74 | |
75 | !if $fill_css_defined!=yes |
||
76 | !set reply_$i=<style type="text/css">\ |
||
77 | .drag_label{\ |
||
11208 | obado | 78 | display:inline-block;\ |
11207 | obado | 79 | padding:2px;\ |
80 | border:1px solid;\ |
||
11208 | obado | 81 | box-sizing: border-box;\ |
11207 | obado | 82 | margin:1px;\ |
83 | background-color:$rightcolor;\ |
||
11180 | obado | 84 | }\ |
11208 | obado | 85 | .fill_container{font-family:sans-serif;background-color:#ffd080;margin:2px;};\ |
86 | </style>\ |
||
87 | |||
11180 | obado | 88 | !set fill_css_defined=yes |
89 | !else |
||
90 | !set reply_$i= |
||
91 | !endif |
||
92 | |||
20 | reyssat | 93 | !if $wims_read_parm=nocompare |
11208 | obado | 94 | !exit |
20 | reyssat | 95 | !endif |
96 | |||
97 | !if $good=$empty |
||
11208 | obado | 98 | Test=bad $i |
99 | !exit |
||
20 | reyssat | 100 | !endif |
101 | |||
102 | diag= |
||
4849 | bpr | 103 | diaratio=-1 |
20 | reyssat | 104 | t_=!linecnt $good |
105 | good=!replace internal , $ by , in $good |
||
106 | dd=!replace internal , $ by , in $dd |
||
1802 | bpr | 107 | ddo=!sort items $dd |
20 | reyssat | 108 | !for n=1 to $t_ |
11208 | obado | 109 | g=!line $n of $good |
110 | g=!trim $g |
||
111 | !if $dd issametext $g |
||
112 | diag=yes |
||
113 | !endif |
||
114 | !if noorder iswordof $(replyoption$i) |
||
115 | go=!sort items $g |
||
116 | !if $ddo issametext $go |
||
117 | diag=yes |
||
118 | !else |
||
11253 | bpr | 119 | !! more precisely, but will used only if there is only one good answer) |
120 | !if $t_=1 |
||
121 | !reset gr |
||
122 | !for j=1 to $dd_cnt |
||
123 | !if $(dd[$j]) isitemof $g |
||
124 | !set gr=!append item oef_indgood to $gr |
||
125 | !else |
||
126 | !set gr=!append item oef_indbad to $gr |
||
127 | !endif |
||
128 | !next j |
||
129 | !endif |
||
11208 | obado | 130 | !endif |
131 | !endif |
||
132 | !if $diag notwordof yes and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i)) |
||
133 | !! nombre de reponses |
||
134 | poscnt1=!itemcnt $ddo |
||
135 | lint=!listintersect $ddo and $go |
||
136 | !! nombre de bonnes reponses |
||
137 | poscnt2=!itemcnt $lint |
||
138 | !! nombre demande de bonnes reponses |
||
139 | poscnt3=!itemcnt $go |
||
140 | !if eqweight iswordof $(replyoption$i) |
||
141 | diaratio_=$[2*$poscnt2 - $poscnt1] |
||
142 | !else |
||
143 | diaratio_=$[3*$poscnt2 - 2*$poscnt1] |
||
144 | !endif |
||
145 | !if $diaratio_ > 0 |
||
146 | diaratio=$[max($diaratio,$[$diaratio_/max($poscnt3,1)])] |
||
147 | !endif |
||
148 | !endif split |
||
20 | reyssat | 149 | !next n |
7139 | bpr | 150 | |
11255 | bpr | 151 | reply_$i=$(reply_$i)<div $container_width_r> |
11253 | bpr | 152 | !for a = 1 to $dd_cnt |
153 | reply_$i=$(reply_$i)<div\ |
||
154 | class="drag_label $(gr[$a])" style="text-align:$align_option;width:$(sizeh)px;height:$(sizev)px;">\ |
||
155 | $(dd[$a])\ |
||
156 | </div> |
||
157 | !next |
||
158 | reply_$i=$(reply_$i)</div> |
||
159 | |||
20 | reyssat | 160 | !if $diag=yes |
11208 | obado | 161 | diareply$i=good |
162 | !advance freegot |
||
20 | reyssat | 163 | !else |
4849 | bpr | 164 | !if $diaratio > 0 and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i)) |
165 | diareply$i=good |
||
166 | partialgood$i=yes |
||
167 | freegot=$[$freegot+ max(0,$diaratio)] |
||
168 | !else |
||
169 | diareply$i=bad |
||
170 | !endif |
||
7139 | bpr | 171 | !endif |