Subversion Repositories wimsdev

Rev

Rev 13810 | Rev 13816 | 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
13810 bpr 112
            rg_=!rows2lines $rg_
12325 bpr 113
            rg1_=!line 1 of $rg_
114
            rg2_=!line 2 to -1 of $rg_
115
            rg2_=!translate internal $\
20 reyssat 116
$ to ; in $rg2_
13795 bpr 117
            !if $(replytype$k) iswordof checkbox mark click menu radio
13794 bpr 118
              rg_=!item $rg1_ of $rg2_
119
            !else
120
              rg_=$rg1_
121
            !endif
13788 bpr 122
            rg_tmp=$rg2_
13793 bpr 123
            !if $(replytype$k) iswordof clickfill dragfill
13788 bpr 124
              rg_tmp=!listuniq $rg1_,$rg2_
125
            !endif
126
            Rg$i=!append line $rg_tmp to $(Rg$i)
13723 bpr 127
            !goto endRg
13799 bpr 128
          !endif checkbox and als
129
 
13798 bpr 130
          !if $(replytype$k) iswordof coord
131
            rg_=<img src="$(rg_[1;])" />
132
            Rg$i=!append line $rg_ to $(Rg$i)
133
            !goto endRg
134
          !endif
13799 bpr 135
 
12325 bpr 136
          !if $(replytype$k) iswordof atext wlist nocase case
137
            rg_=!translate internal ;| to $\
20 reyssat 138
\
139
$ in $rg_
12325 bpr 140
            rg_=!line 1 of $rg_
141
          !endif atext
13799 bpr 142
 
13804 bpr 143
          !if $(replytype$k) iswordof function default equation sigunits numexp or $(replystyle$k) iswordof numeric
12325 bpr 144
            rg_=!item 1 of $rg_
13799 bpr 145
            Rg$i=!append line $ $ to $(Rg$i)
13723 bpr 146
            !goto endRg
13801 bpr 147
          !endif
13799 bpr 148
 
149
          !if $(replytype$k) iswordof imgcomp textcomp compose reorder
12325 bpr 150
            rg_=!translate internal | to $\
20 reyssat 151
$ in $rg_
12325 bpr 152
            rg_=!rows2lines $rg_
13788 bpr 153
            rg_tmp=!lines2items $rg_
12325 bpr 154
            rg_=!line 1 of $rg_
155
            !if $(replytype$k)=imgcomp
156
              rg_=!item 2 to -1 of $rg_
157
              rg_=!nospace $rg_
158
              rg_=!replace , by " />,<img src="$imagedir/ in <img src="$imagedir/$rg_" />
159
              rg__=!shuffle $rg_
160
              Rg$i=!append line $rg__ to $(Rg$i)
161
            !else
13788 bpr 162
              rg_cnt_=!itemcnt $rg_tmp
12325 bpr 163
              rg__=!shuffle $rg_cnt_
13788 bpr 164
              rg_tmp=!listuniq $(rg_tmp[$rg__])
165
              Rg$i=!append line $rg_tmp to $(Rg$i)
13723 bpr 166
              !goto endRg
13799 bpr 167
            !endif
12325 bpr 168
            rg_=!translate , to $ $ in $rg_
13799 bpr 169
          !endif
170
 
12325 bpr 171
          !if $(replytype$k) iswordof correspond
172
            !set rg__=!replace internal ; by $\
3134 bpr 173
$ in $rg_
12325 bpr 174
            !distribute lines $rg__ into rg1__,rg2__
175
            !set rg__cnt=!itemcnt $rg1__
176
            !set rg_2_=!shuffle $rg__cnt
13796 bpr 177
            !set rg__=<table class="wimsborder"><tr>
178
            !set rgg_=<table class="wimsborder"><tr>
179
            !for tmp=1 to $rg__cnt
180
              !set rg__=$rg__<td>$(rg1__[$tmp])</td>
181
              !set rgg_=$rgg_<td>$(rg_[1;$tmp])</td>
182
            !next
183
            !set rg__=$rg__</tr><tr>
184
            !set rgg_=$rgg_</tr><tr>
185
            !for tmp =1 to $rg__cnt
186
              !set rg__=$rg__<td>$(rg2__[$(rg_2_[$tmp])])</td>
187
              !set rgg_=$rgg_<td>$(rg2__[$tmp])</td>
188
            !next
189
            !set rg__=$rg__</tr></table>
190
            !set rg_=$rgg_</tr></table>
12325 bpr 191
            Rg$i=!append line $(rg__) to $(Rg$i)
13723 bpr 192
            !goto endRg
12325 bpr 193
          !endif
13799 bpr 194
 
13798 bpr 195
          !if $(replytype$k) iswordof draw
196
            rg__=$(rg_[2;])
197
            tmp=!item 1 of $rg__
198
            !if $tmp=arrows
199
              !default arrow_head=10
200
              arrow_head=!getopt arrowhead in $(replyoption$k)
201
              comp=,$arrow_head
202
            !endif
203
            rg__=!replace internal $tmp by $tmp blue$comp in $rg__
204
            !reset comp
205
            rg_=!declosing $(rg_[1;])
13801 bpr 206
            !! FIXME inputsize is in the field embed not accessible here
13798 bpr 207
            rg_=200,200$	$ $rg_
208
            !readproc oef/canvasdraw.phtml $rg_
209
            canvasdraw=!replace internal $\
210
$ by in $canvasdraw_out
211
            Rg$i=!append line $canvasdraw to $(Rg$i)
212
            !readproc oef/canvasdraw.phtml $rg_$	$ $rg__
213
            rg_=!replace internal $\
214
$ by in $canvasdraw_out
215
            !goto endRg
216
          !endif
13799 bpr 217
 
13815 bpr 218
          Rg$i=!append line $ $ to $(Rg$i)
13723 bpr 219
:endRg
12325 bpr 220
          !if $conditioncnt<1
221
            !if noanalyzeprint notwordof $(replyoption$k)
222
              !if $(replyname$k)$rg_ !=
223
                !if http isin $(replyname$k)$rg_
13798 bpr 224
                  rep=$rg_
12325 bpr 225
                !else
226
                  !if $(replyname$k)!=
227
                    rep=!append line <em>$(replyname$k)</em>: $rg_ to $rep
228
                  !else
229
                    rep=!append line $rg_ to $rep
13799 bpr 230
                  !endif
13794 bpr 231
                !endif
232
              !endif
233
            !endif
234
          !endif
12348 bpr 235
        !else
236
          Replytype$i=!append item $(replytype$k) to $(Replytype$i)
237
          Replystyle$i=!append item $(replystyle$k) to $(Replystyle$i)
238
        !endif r$k isitemof $thisstep
239
        !reset replyoption$k
240
      !next k
241
    !endif intro_check
242
    rep=!imgrename $rep
243
    ans_$i=!trim $rep
12325 bpr 244
    !if $(ans_$i)!=
245
      test_print=1
246
    !endif
247
  !endif html
248
  !reset intro_check
249
  !if $latex_exists>=0
250
    !readproc oef/latex.proc exo
874 bpr 251
  !endif
12325 bpr 252
  Rg$i=!imgrename $(Rg$i)
20 reyssat 253
!next i
2656 bpr 254
!if $latex_exists>=1
255
  !readproc oef/latex.proc end
3128 bpr 256
!endif