Subversion Repositories wimsdev

Rev

Rev 11207 | Rev 11253 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11194 bpr 1
option:align=" " noorder transparent
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
 
11208 obado 16
# sizej represent the number of object per line
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;"
11208 obado 22
  replyGood$i=!replace internal , by </div><div $tmp> in <div $container_width><div $tmp>$good</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 &nbsp by &nbsp; 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
106
      !! more precisely
107
      !reset gr
108
      !for j=1 to $dd_cnt
109
        !if  $(dd[$j]) isitemof $g
110
          !set gr=!append item oef_indgood to $gr
111
        !else
112
          !set gr=!append item oef_indbad to $gr
113
        !endif
114
      !next j
115
    !endif
116
  !endif
117
 
118
  reply_$i=$(reply_$i)<div $container_width>
119
  !for a = 1 to $dd_cnt
120
    reply_$i=$(reply_$i)<div\
121
      class="drag_label $(gr[$a])" style="text-align:$align_option;width:$(sizeh)px;height:$(sizev)px;">\
122
      $(dd[$a])\
123
      </div>
124
  !next
125
  reply_$i=$(reply_$i)</div>
126
 
127
  !if $diag notwordof yes and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i))
128
    !! nombre de reponses
129
    poscnt1=!itemcnt $ddo
130
    lint=!listintersect $ddo and $go
131
    !! nombre de bonnes reponses
132
    poscnt2=!itemcnt $lint
133
    !! nombre demande de bonnes reponses
134
    poscnt3=!itemcnt $go
135
    !if eqweight iswordof $(replyoption$i)
136
      diaratio_=$[2*$poscnt2 - $poscnt1]
137
    !else
138
      diaratio_=$[3*$poscnt2 - 2*$poscnt1]
139
    !endif
140
    !if $diaratio_ > 0
141
      diaratio=$[max($diaratio,$[$diaratio_/max($poscnt3,1)])]
142
    !endif
143
  !endif split
20 reyssat 144
!next n
7139 bpr 145
 
20 reyssat 146
!if $diag=yes
11208 obado 147
  diareply$i=good
148
  !advance freegot
20 reyssat 149
!else
4849 bpr 150
  !if $diaratio > 0 and (split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i))
151
    diareply$i=good
152
    partialgood$i=yes
153
    freegot=$[$freegot+ max(0,$diaratio)]
154
  !else
155
    diareply$i=bad
156
  !endif
7139 bpr 157
!endif