Subversion Repositories wimsdev

Rev

Rev 13801 | Rev 13809 | 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
4
 
20 reyssat 5
!advance prcnt
6
!if $prcnt>6 and $wims_user!=supervisor
12325 bpr 7
  error=too_many_print
8
  printing=yes
9
  !exit
20 reyssat 10
!endif
11
 
12
printmax=40
13
!reset savedrawcnt print
14
printing=yes
15
exo=!listintersect $exo and $exolist
16
!default exo=$defaultlist
2650 bpr 17
wims_intro_parm=$exo
2646 bpr 18
!default exo=$exolist
19
exo_cnt=!itemcnt $exo
20
!!at least 1 exercise of each type
13764 bpr 21
!if $random=0
22
  exo_=!makelist x for x=1 to $exo_cnt
23
!else
24
  exo_=!shuffle $exo_cnt
25
!endif
2646 bpr 26
qnum1=$[$qnum-$exo_cnt]
27
!if $qnum1 >= 1
12325 bpr 28
  exo__=!randint 1,$exo_cnt repeat $qnum1
29
  exo_=$exo_,$exo__
2646 bpr 30
!endif
31
exo=$(exo[$(exo_)])
20 reyssat 32
exo=!item 1 to $printmax of $exo
33
n=!itemcnt $exo
34
 
35
!if $n<1
12325 bpr 36
  !exit
20 reyssat 37
!endif
38
 
39
M=0
40
m_step=1
874 bpr 41
test_print=0
2656 bpr 42
!if $wims_developer!= or $wims_user=supervisor
43
  latex_exists=0
44
  !readproc oef/latex.proc begin
45
!else
46
  latex_exists=-1
47
!endif
48
 
20 reyssat 49
!for i=1 to $n
12325 bpr 50
  question_$i=
51
  e_=!item $i of $exo
52
  name_$i=$e_
53
  !if $lang_choice!=$empty
54
    title_$i=!defof title_$lang_choice in $(class_header)def/$e_.def
55
  !else
56
    title_$i=!defof title_$lang in $(class_header)def/$e_.def
57
  !endif
58
  !if $(title_$i)=$empty
59
    title_$i=!defof title in $(class_header)def/$e_.def
60
  !endif
61
  !reset question testcondition format
62
  thisexo=$e_
63
  !readproc oef/imagedir.proc
64
  varcnt=!defof varcnt in $(class_header)def/$e_.def
65
  !default varcnt=0
66
  !for v=2 to $varcnt+5
67
    val$v=
68
  !next v
69
  status=prep
70
  !read $(class_header)def/$e_.def
71
  !if $format=html
72
    question_$i=$question
73
    !if __EXECUTED_ isin $question
74
      varcnt_$i=$varcnt
75
      var_$i=$val1
76
      !for v=2 to $varcnt+5
77
        v_=!translate internal $\
20 reyssat 78
$ to $	$ in $(val$v)
12325 bpr 79
        var_$i=$(var_$i)\
20 reyssat 80
$v_
12325 bpr 81
      !next v
82
    !endif  __EXECUTED_
83
    !ifval $replycnt=0 and $choicecnt=1
84
      rep=!item 1 to 6 of $choicebad1
85
      rep=!append item $choicegood1 to $rep
86
      rep=!listuniq $rep
87
      rep=!sort items $rep
88
      rep=!replace , by </li><li> in <ul style="list-style-type: square;"><li>$rep</li></ul>
89
      chce_$i=$rep
90
      test_print=1
91
    !else
92
      chce_$i=
93
    !endif replycnt=0 and choicecnt=1
94
    rep=
12460 bpr 95
    !!FIXME
12325 bpr 96
    !if 3 isin $intro_check or $intro_check=$empty
97
      !for k=1 to $choicecnt
98
        !if $(choicename$k)!=
99
          rep=!append line <em>$(choicename$k)</em>: $(choicegood$k) to $rep
100
        !else
101
          rep=!append line $(choicegood$k) to $rep
102
        !endif
103
      !next k
104
      !for k=1 to $replycnt
105
        thisstep=!line 1 of $oefsteps
106
        !if r$k isitemof $thisstep or $oefsteps=$empty
107
          rg_=$(replygood$k)
108
          Replytype$i=!append item $(replytype$k) to $(Replytype$i)
109
          Replystyle$i=!append item $anstyle to $(Replystyle$i)
110
          !if $(replytype$k) iswordof checkbox mark click menu radio clickfill dragfill
111
            rg_=!translate internal ; to $\
20 reyssat 112
$ in $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
 
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