Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
13798 bpr 1
!!! Rg$i contains the data for questions embeddings of
2
!!! exercise $i (one line for each question)
3
!!! ans_$i contains the data for the answer
13809 bpr 4
!set prompt_empty=___________
13798 bpr 5
 
20 reyssat 6
!advance prcnt
7
!if $prcnt>6 and $wims_user!=supervisor
12325 bpr 8
  error=too_many_print
9
  printing=yes
10
  !exit
20 reyssat 11
!endif
12
 
13
printmax=40
14
!reset savedrawcnt print
15
printing=yes
16
exo=!listintersect $exo and $exolist
17
!default exo=$defaultlist
2650 bpr 18
wims_intro_parm=$exo
2646 bpr 19
!default exo=$exolist
20
exo_cnt=!itemcnt $exo
21
!!at least 1 exercise of each type
13764 bpr 22
!if $random=0
23
  exo_=!makelist x for x=1 to $exo_cnt
24
!else
25
  exo_=!shuffle $exo_cnt
26
!endif
2646 bpr 27
qnum1=$[$qnum-$exo_cnt]
28
!if $qnum1 >= 1
12325 bpr 29
  exo__=!randint 1,$exo_cnt repeat $qnum1
30
  exo_=$exo_,$exo__
2646 bpr 31
!endif
32
exo=$(exo[$(exo_)])
20 reyssat 33
exo=!item 1 to $printmax of $exo
34
n=!itemcnt $exo
35
 
36
!if $n<1
12325 bpr 37
  !exit
20 reyssat 38
!endif
39
 
40
M=0
41
m_step=1
874 bpr 42
test_print=0
2656 bpr 43
!if $wims_developer!= or $wims_user=supervisor
44
  latex_exists=0
45
  !readproc oef/latex.proc begin
46
!else
47
  latex_exists=-1
48
!endif
49
 
20 reyssat 50
!for i=1 to $n
12325 bpr 51
  question_$i=
52
  e_=!item $i of $exo
53
  name_$i=$e_
54
  !if $lang_choice!=$empty
55
    title_$i=!defof title_$lang_choice in $(class_header)def/$e_.def
56
  !else
57
    title_$i=!defof title_$lang in $(class_header)def/$e_.def
58
  !endif
59
  !if $(title_$i)=$empty
60
    title_$i=!defof title in $(class_header)def/$e_.def
61
  !endif
62
  !reset question testcondition format
63
  thisexo=$e_
64
  !readproc oef/imagedir.proc
65
  varcnt=!defof varcnt in $(class_header)def/$e_.def
66
  !default varcnt=0
67
  !for v=2 to $varcnt+5
68
    val$v=
69
  !next v
70
  status=prep
71
  !read $(class_header)def/$e_.def
72
  !if $format=html
73
    question_$i=$question
74
    !if __EXECUTED_ isin $question
75
      varcnt_$i=$varcnt
76
      var_$i=$val1
77
      !for v=2 to $varcnt+5
78
        v_=!translate internal $\
20 reyssat 79
$ to $	$ in $(val$v)
12325 bpr 80
        var_$i=$(var_$i)\
20 reyssat 81
$v_
12325 bpr 82
      !next v
83
    !endif  __EXECUTED_
84
    !ifval $replycnt=0 and $choicecnt=1
85
      rep=!item 1 to 6 of $choicebad1
86
      rep=!append item $choicegood1 to $rep
87
      rep=!listuniq $rep
88
      rep=!sort items $rep
89
      rep=!replace , by </li><li> in <ul style="list-style-type: square;"><li>$rep</li></ul>
90
      chce_$i=$rep
91
      test_print=1
92
    !else
93
      chce_$i=
94
    !endif replycnt=0 and choicecnt=1
95
    rep=
12460 bpr 96
    !!FIXME
12325 bpr 97
    !if 3 isin $intro_check or $intro_check=$empty
98
      !for k=1 to $choicecnt
99
        !if $(choicename$k)!=
100
          rep=!append line <em>$(choicename$k)</em>: $(choicegood$k) to $rep
101
        !else
102
          rep=!append line $(choicegood$k) to $rep
103
        !endif
104
      !next k
105
      !for k=1 to $replycnt
106
        thisstep=!line 1 of $oefsteps
107
        !if r$k isitemof $thisstep or $oefsteps=$empty
108
          rg_=$(replygood$k)
109
          Replytype$i=!append item $(replytype$k) to $(Replytype$i)
110
          Replystyle$i=!append item $anstyle to $(Replystyle$i)
111
          !if $(replytype$k) iswordof checkbox mark click menu radio clickfill dragfill
112
            rg_=!translate internal ; to $\
20 reyssat 113
$ in $rg_
12325 bpr 114
            rg1_=!line 1 of $rg_
115
            rg2_=!line 2 to -1 of $rg_
116
            rg2_=!translate internal $\
20 reyssat 117
$ to ; in $rg2_
13795 bpr 118
            !if $(replytype$k) iswordof checkbox mark click menu radio
13794 bpr 119
              rg_=!item $rg1_ of $rg2_
120
            !else
121
              rg_=$rg1_
122
            !endif
13788 bpr 123
            rg_tmp=$rg2_
13793 bpr 124
            !if $(replytype$k) iswordof clickfill dragfill
13788 bpr 125
              rg_tmp=!listuniq $rg1_,$rg2_
126
            !endif
127
            Rg$i=!append line $rg_tmp to $(Rg$i)
13723 bpr 128
            !goto endRg
13799 bpr 129
          !endif checkbox and als
130
 
13798 bpr 131
          !if $(replytype$k) iswordof coord
132
            rg_=<img src="$(rg_[1;])" />
133
            Rg$i=!append line $rg_ to $(Rg$i)
134
            !goto endRg
135
          !endif
13799 bpr 136
 
12325 bpr 137
          !if $(replytype$k) iswordof atext wlist nocase case
138
            rg_=!translate internal ;| to $\
20 reyssat 139
\
140
$ in $rg_
12325 bpr 141
            rg_=!line 1 of $rg_
142
          !endif atext
13799 bpr 143
 
13804 bpr 144
          !if $(replytype$k) iswordof function default equation sigunits numexp or $(replystyle$k) iswordof numeric
12325 bpr 145
            rg_=!item 1 of $rg_
13799 bpr 146
            Rg$i=!append line $ $ to $(Rg$i)
13723 bpr 147
            !goto endRg
13801 bpr 148
          !endif
13799 bpr 149
 
150
          !if $(replytype$k) iswordof imgcomp textcomp compose reorder
12325 bpr 151
            rg_=!translate internal | to $\
20 reyssat 152
$ in $rg_
12325 bpr 153
            rg_=!rows2lines $rg_
13788 bpr 154
            rg_tmp=!lines2items $rg_
12325 bpr 155
            rg_=!line 1 of $rg_
156
            !if $(replytype$k)=imgcomp
157
              rg_=!item 2 to -1 of $rg_
158
              rg_=!nospace $rg_
159
              rg_=!replace , by " />,<img src="$imagedir/ in <img src="$imagedir/$rg_" />
160
              rg__=!shuffle $rg_
161
              Rg$i=!append line $rg__ to $(Rg$i)
162
            !else
13788 bpr 163
              rg_cnt_=!itemcnt $rg_tmp
12325 bpr 164
              rg__=!shuffle $rg_cnt_
13788 bpr 165
              rg_tmp=!listuniq $(rg_tmp[$rg__])
166
              Rg$i=!append line $rg_tmp to $(Rg$i)
13723 bpr 167
              !goto endRg
13799 bpr 168
            !endif
12325 bpr 169
            rg_=!translate , to $ $ in $rg_
13799 bpr 170
          !endif
171
 
12325 bpr 172
          !if $(replytype$k) iswordof correspond
173
            !set rg__=!replace internal ; by $\
3134 bpr 174
$ in $rg_
12325 bpr 175
            !distribute lines $rg__ into rg1__,rg2__
176
            !set rg__cnt=!itemcnt $rg1__
177
            !set rg_2_=!shuffle $rg__cnt
13796 bpr 178
            !set rg__=<table class="wimsborder"><tr>
179
            !set rgg_=<table class="wimsborder"><tr>
180
            !for tmp=1 to $rg__cnt
181
              !set rg__=$rg__<td>$(rg1__[$tmp])</td>
182
              !set rgg_=$rgg_<td>$(rg_[1;$tmp])</td>
183
            !next
184
            !set rg__=$rg__</tr><tr>
185
            !set rgg_=$rgg_</tr><tr>
186
            !for tmp =1 to $rg__cnt
187
              !set rg__=$rg__<td>$(rg2__[$(rg_2_[$tmp])])</td>
188
              !set rgg_=$rgg_<td>$(rg2__[$tmp])</td>
189
            !next
190
            !set rg__=$rg__</tr></table>
191
            !set rg_=$rgg_</tr></table>
12325 bpr 192
            Rg$i=!append line $(rg__) to $(Rg$i)
13723 bpr 193
            !goto endRg
12325 bpr 194
          !endif
13799 bpr 195
 
13798 bpr 196
          !if $(replytype$k) iswordof draw
197
            rg__=$(rg_[2;])
198
            tmp=!item 1 of $rg__
199
            !if $tmp=arrows
200
              !default arrow_head=10
201
              arrow_head=!getopt arrowhead in $(replyoption$k)
202
              comp=,$arrow_head
203
            !endif
204
            rg__=!replace internal $tmp by $tmp blue$comp in $rg__
205
            !reset comp
206
            rg_=!declosing $(rg_[1;])
13801 bpr 207
            !! FIXME inputsize is in the field embed not accessible here
13798 bpr 208
            rg_=200,200$	$ $rg_
209
            !readproc oef/canvasdraw.phtml $rg_
210
            canvasdraw=!replace internal $\
211
$ by in $canvasdraw_out
212
            Rg$i=!append line $canvasdraw to $(Rg$i)
213
            !readproc oef/canvasdraw.phtml $rg_$	$ $rg__
214
            rg_=!replace internal $\
215
$ by in $canvasdraw_out
216
            !goto endRg
217
          !endif
13799 bpr 218
 
219
          Rg$i=!append line $ $ to $(Rg$i)
13723 bpr 220
:endRg
12325 bpr 221
          !if $conditioncnt<1
222
            !if noanalyzeprint notwordof $(replyoption$k)
223
              !if $(replyname$k)$rg_ !=
224
                !if http isin $(replyname$k)$rg_
13798 bpr 225
                  rep=$rg_
12325 bpr 226
                !else
227
                  !if $(replyname$k)!=
228
                    rep=!append line <em>$(replyname$k)</em>: $rg_ to $rep
229
                  !else
230
                    rep=!append line $rg_ to $rep
13799 bpr 231
                  !endif
13794 bpr 232
                !endif
233
              !endif
234
            !endif
235
          !endif
12348 bpr 236
        !else
237
          Replytype$i=!append item $(replytype$k) to $(Replytype$i)
238
          Replystyle$i=!append item $(replystyle$k) to $(Replystyle$i)
239
        !endif r$k isitemof $thisstep
240
        !reset replyoption$k
241
      !next k
242
    !endif intro_check
243
    rep=!imgrename $rep
244
    ans_$i=!trim $rep
12325 bpr 245
    !if $(ans_$i)!=
246
      test_print=1
247
    !endif
248
  !endif html
249
  !reset intro_check
250
  !if $latex_exists>=0
251
    !readproc oef/latex.proc exo
874 bpr 252
  !endif
12325 bpr 253
  Rg$i=!imgrename $(Rg$i)
20 reyssat 254
!next i
2656 bpr 255
!if $latex_exists>=1
256
  !readproc oef/latex.proc end
3128 bpr 257
!endif