Subversion Repositories wimsdev

Rev

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