File: checkbox

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (205 lines) | stat: -rw-r--r-- 5,728 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
!!for the documentation
option:color=" " eqweight nolegend shuffle show sort split nolabel

!!!!!!
!! Checkbox generic anstype (also used by flashcard, mark, multipleclick)
!!!!!!

!!!!!!
!! After changes made, please test these exercices :

!! for multipleclick :
!! * http://127.0.0.1/wims/?module=E3/geometry/oefspatial.fr&cmd=new&exo=deplacement5
!! * ...

!!!!!!
good=!rows2lines $(replygood$i)
!if $(replytype$i) iswordof flashcard
  !set option1=!line 1 of $oef_fill_option
  !set option2=!line 2 of $oef_fill_option
  good=!line 1 to 2 of $good
!endif
menulist=!line 2 to -1 of $good
menulist=!translate internal $\
$ to ; in $menulist
good=!line 1 of $good
replyGood$i=!item $good of $menulist
replyGood$i=!replace internal \\( by \( in $(replyGood$i)
!if $(replytype$i) iswordof flashcard
  replygood$i=$good\
$menulist
  replygood$i=!replace internal ; by &#59; in $(replygood$i)
!endif
!if $wims_read_parm=nocompare
  reply$i=!replace internal \\( by \( in $(reply$i)
  !default m_reply$i=$(reply$i)
  !exit
!endif

!if $(replyGood$i)=$empty
  Test=bad $i
  !exit
!endif

!reset menupos
!if $(replytype$i) iswordof mark flashcard multipleclick
  menupos=$(reply$i)
  !if $(replytype$i) iswordof flashcard
    click=$(menupos[2;])
    menupos=$(menupos[1;])
    reply$i=$menupos
  !endif
  m_reply$i=!item $menupos of $menulist
  reply_$i=$(m_reply$i)
  !if $(replytype$i) iswordof flashcard
    m_reply$i=$(m_reply$i)\
$click
    reply$i=$(reply$i)
    reply_$i=!makelist <div $option2>x</div> for x in $(reply_$i)
    reply_$i=!items2words $(reply_$i)
  !endif
!else
  reply$i=!replace internal \\( by \( in $(reply$i)
  m_reply$i=$(reply$i)
  !if $(replytype$i) notwordof checkbox menu
    !if &#39; isin $menulist
      reply$i=!replace internal ' by &#39; in $(reply$i)
    !endif
    !if &#44; isin $menulist
      reply$i=!replace internal , by &#44; in $(reply$i)
    !endif
  !endif
  cnti_ = !itemcnt $(reply$i)
  !for u_ = 1 to $cnti_
    ri_ =!item $u_ of $(reply$i)
    mp_=!positionof item $ri_ in $menulist
    menupos=!append item $mp_ to $menupos
  !next u_
!endif
menupos=!nonempty items $menupos
!if $menupos=$empty
  test=NaN
  !exit
!endif

!if $(inputprompt$i)!=$empty
  reply_$i=$(inputprompt$i[$menupos])
  !if , isin $menupos
    reply_$i=!replace internal , by </li><li> in <ul><li>$(reply_$i)</li></ul>
  !endif
  replyGood$i=$(inputprompt$i[$good])
  !if , isin $good
    replyGood$i=!replace internal , by </li><li> in <ul><li>$(replyGood$i)</li></ul>
  !endif
!endif

!!!should be in the file oef/embed.phtml ??
!if $(replytype$i) iswordof multipleclick
  image=$(oef_answer_option$i)
  image=!line 1 of $image
  legende=!line 3 of $(oef_answer_option$i)
  2_=!line 2 of $(oef_answer_option$i)
  !distribute items $2_ into ny, nx, width, height
  !! ans_multipleclick is for generic class,
  !! ans_multipleclick$i for a particular question (in case of 2 questions with this type)
  reply_$i=<table style="width:$width; height:$(height);" class="ans_multipleclick ans_multipleclick$i" id="ans_multipleclick$i">
  replyGood$i=<table style="width:$width; height:$(height);" class="ans_multipleclick ans_multipleclick$i" id="ans_multipleclick_good_$i">
  !for y=1 to $ny
    reply_$i=$(reply_$i)<tr>
    replyGood$i=$(replyGood$i)<tr>
    !if $(legende[2;])!=
      reply_$i=$(reply_$i)\
      <th scope="row">$(legende[2;$y])</th>
      replyGood$i=$(replyGood$i)\
      <th scope="row">$(legende[2;$y])</th>
    !endif
    !for x=1 to $nx
      !set t=$[$x+($y-1)*($nx)]

      !set cc_type=neutral
      !set cc1_type=neutral
      !if $t isitemof $menupos and $t isitemof $good
        !set cc_type=good
      !endif
      !if $t isitemof $menupos and $t notitemof $good
        !set cc_type=bad
      !endif
      !if $t isitemof $good and $t notitemof $menupos
        !set cc_type=forget
      !endif
      !if $t isitemof $good
        !set cc1_type=good
      !endif
      cc=class="ans_label oef_ind$cc_type" style="padding:3px;border:2px solid"
      cc1=class="ans_label oef_ind$cc1_type" style="padding:3px;border:2px solid"
      reply_$i=$(reply_$i)\
      <td id="r$(i)_$t">\
        <div id="img$(i)_$(x)_$(y)" $cc>$(image[$t])</div>\
      </td>
      replyGood$i=$(replyGood$i)\
      <td id="g$(i)_$t">\
        <div id="img$(i)_$(x)_$(y)" $cc1>$(image[$t])</div>\
      </td>
    !next x
    reply_$i=$(reply_$i)\
    </tr>
    replyGood$i=$(replyGood$i)\
    </tr>
  !next y
  !if $(legende[1;])!=
    reply_$i=$(reply_$i)\
    <tr><th scope="col"></th>
    replyGood$i=$(replyGood$i)\
    <tr><th></th>
    !for x=1 to $nx
      reply_$i=$(reply_$i)\
      <th scope="col">$(legende[1;$x])</th>
      replyGood$i=$(replyGood$i)\
      <th>$(legende[1;$x])</th>
    !next
    reply_$i=$(reply_$i)\
    </tr>
    replyGood$i=$(replyGood$i)\
    </tr>
  !endif
  reply_$i=$(reply_$i)\
  </table>
  replyGood$i=$(replyGood$i)\
  </table>

  reply$i=
  m_reply$i=$menupos
!endif multipleclick

poscnt1=!itemcnt $menupos
menupos=!listintersect $menupos and $good
poscnt2=!itemcnt $menupos
poscnt3=!itemcnt $good
!if split iswordof $(replyoption$i) or partialscore iswordof $(replyoption$i)
  !if $poscnt1=$poscnt2 and $poscnt1=$poscnt3
    diareply$i=good
    !advance freegot
  !else
    !if eqweight iswordof $(replyoption$i)
      diaratio=$[2*$poscnt2 - $poscnt1]
    !else
      diaratio=$[3*$poscnt2 - 2*$poscnt1]
    !endif
    !if $diaratio > 0
      diareply$i=good
      partialgood$i=yes
      freegot=$[$freegot+ max(0,$diaratio/max($poscnt3,1))]
    !else
      diareply$i=bad
    !endif
  !endif
!else
  !if $poscnt1=$poscnt2 and $poscnt1=$poscnt3
    diareply$i=good
    !advance freegot
  !else
    diareply$i=bad
  !endif
!endif

!reset anstype_shuffle_$i