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