Subversion Repositories wimsdev

Rev

Rev 13248 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5324 bpr 1
!default wims_firstname=$wims_devfirstname
2
!default wims_lastname=$wims_devlastname
7885 bpr 3
 
10177 bpr 4
!set wims_ariane=!append line modtool,1,module=adm/modtool\
5
  to $wims_ariane
6
!set wims_ariane_self=no
7
!if $cmd!=reply
8
   !set wims_ariane=!append line coordclick,8\
9
to $wims_ariane
10
!else
11
   !set wims_ariane=!append line coordclick,1,module=$module\
12
to $wims_ariane
13
!endif
14
 
15
!!$wims_sesdir a mettre partout y a-t-il quelque chose pour s2
13248 bpr 16
!read adm/language lang/names.phtml
17
 
4612 bpr 18
!set limit=50
4645 bpr 19
!reset begin
20
!default ext=1
21
javaoption=$javatype
8823 bpr 22
!if $type=3
23
  javaoption=brokenline
24
!endif
4645 bpr 25
!default javaoption=circle
7885 bpr 26
javaoutput=!getopt free in $(javaoutput)
27
 
4612 bpr 28
!if $end=1
14050 bpr 29
  !goto end
4612 bpr 30
!endif
31
!if $step <=1
14050 bpr 32
  !set wims_form_method=file
33
  !set already=!sh mkdir -p $wims_home/$wims_sesdir/$sesdir; ls $wims_home/$wims_sesdir/$sesdir
34
  !set already=!words2items $already
35
  !set already=!nospace $already
4612 bpr 36
!endif
37
!if $step>$limit
38
  test=limit
39
  !exit
40
!endif
41
# how to detect the need to compute?
7952 bpr 42
 
4612 bpr 43
!if $cmd=reply
14050 bpr 44
  error=
45
  compute=
46
  !if $wims_deposit_old=0
47
    !reset wims_deposit_old
48
  !endif
49
  !default wims_deposit=$wims_deposit_old
50
  f_wims_deposit=!replace internal . by , in $wims_deposit
51
  f_wims_deposit=!item 1 of $f_wims_deposit
52
  !if $data=
53
    !if noname.file isin $wims_deposit or $wims_deposit=$empty
54
      wims_deposit=$wims_deposit_old
55
    !else
56
      !reset wims_deposit_old
57
    !endif
58
  !endif
59
  !if $wims_deposit_old!=
4645 bpr 60
    begin=1
4612 bpr 61
    f_wims_deposit=!replace internal . by , in $wims_deposit_old
4645 bpr 62
    f_wims_deposit=!item 1 of $f_wims_deposit
4612 bpr 63
    data=!sh cat $wims_home/$wims_sesdir/data_$f_wims_deposit
4645 bpr 64
    !reset  wims_deposit_old
4612 bpr 65
    insdraw_size=!line 1 of $data
66
    step=!linecnt $data
67
    test_ext=!line 2 of $data
4645 bpr 68
    test_extcnt=!itemcnt $test_ext
7885 bpr 69
    test_extcnt2=!listintersect $test_ext and $list_curve
4645 bpr 70
    !if ($test_extcnt=3 and $type=1) or ($type<2 and $(test_ext[2]) isitemof $list_curve) \
8823 bpr 71
       or ($type iswordof 2 3 and $test_extcnt2=$empty)
4612 bpr 72
      data=!line 1 of $data
73
      step=3
74
      !goto 2
75
    !endif
7885 bpr 76
    !if $step=0
4612 bpr 77
      step=1
78
      !goto 1
79
    !endif
80
    !for l_ =2 to $step
81
      c_=!line $l_ of $data
4645 bpr 82
      !if $type=1
4612 bpr 83
        dessin=!append line arrow $(c_[2..5]),5,black to $dessin
84
      !endif
4645 bpr 85
      !if $type iswordof 0 2
14050 bpr 86
        dessin=!append line fcircle $(c_[2..3]),10,black to $dessin
4612 bpr 87
      !endif
8823 bpr 88
      !if $type iswordof 3
14050 bpr 89
        dessin=!append line polyline black,$(c_[2..3]) to $dessin
8823 bpr 90
      !endif
4645 bpr 91
      XXXXX
4612 bpr 92
    !next
4645 bpr 93
    !increase step
94
    !!exit
4616 bpr 95
  !endif wims_deposit_old
4645 bpr 96
 
14050 bpr 97
  :1
98
  !if $step=1
99
    !if  / isin $wims_deposit or .. isin $wims_deposit or noname.file isin $wims_deposit or $wims_deposit=$empty
100
      !if $wims_deposit_old!=
101
        wims_deposit=$wims_deposit_old
102
      !else
103
        test=noimage
104
        !exit
105
      !endif
106
    !endif / isin
107
    test_wims_deposit=!replace internal . by , in $wims_deposit
108
    test_wims_deposit=!item -1 of $test_wims_deposit
109
    test_wims_deposit=!lowercase $test_wims_deposit
110
    !if $test_wims_deposit notwordof jpg png jpeg gif
111
      test=bad_image
112
      !exit
113
    !endif
114
    !if $wims_deposit_old=
115
      !sh cd $wims_home/$wims_sesdir\
116
       mkdir -p getfile\
117
       mkdir -p $sesdir\
118
       mv user-deposit $sesdir/$wims_deposit
119
    !endif
120
    !increase step
121
  !endif step=1
122
  :2
123
  !if $step>=2
124
    !if $erase=yes
125
      !if $type iswordof 0 2 3
126
        dessin=!line 1 to -2 of $dessin
127
      !else
128
        dessin=!line 1 to -3 of $dessin
129
      !endif type
130
      data=!line 1 to -2 of $data
131
      !writefile wimshome/sessions/$wims_session/data_$f_wims_deposit $data
132
      step=$[max($[$step-1],2)]
133
      !if $step=2
134
        !reset data
135
        !!!writefile wimshome/sessions/$wims_session/data_$f_wims_deposit $data
136
      !endif step=2
137
      !reset legend test erase
138
      !!!!
139
      !exit
140
    !endif erase=yes
141
  !endif step>=2
142
  !reset wims_form_method
143
  !default imgsrc=$wims_ref_name?session=$session&cmd=getfile&special_parm=$sesdir1/$wims_deposit
144
  click_x=$[$click_x]
145
  click_y=$[$click_y]
146
 
147
  !if $step=2
4645 bpr 148
    !reset data
14050 bpr 149
    !if $click_x != 0 and $click_y != 0
150
      data=!append line $click_x,$click_y to $data
151
      !increase step
152
      insdraw_size=$click_x,$click_y
8823 bpr 153
    !else
14050 bpr 154
      !if $type!=3
155
        test=nosize
156
      !endif
157
    !endif click!=0 ..
158
  !else
159
    !if $type iswordof 2 3
160
      !if $ext=2
161
        data=!append item $javaoption,$(javaoutput) to $data
162
        data=!replace internal ; by , in $data
163
        !if $javaoption=circle
164
          javaout2=$(javaoutput[1]),$(javaoutput[2]),$(javaoutput[3])*2,black
165
        !endif
166
        !if $javaoption=rectangle
167
          javaout2=$(javaoutput),black
168
        !endif
169
        !if $javaoption=polygon
170
          javaout2=!replace internal ; by , in black,$(javaoutput)
171
        !endif
172
        !if $javaoption=brokenline
173
          javaout2=$(javaoutput)
174
        !endif
175
        dessin=!append line $javaoption $javaout2 to $dessin
176
        !increase step
177
        ext=1
178
        begin=1
179
        !reset legend begin test
180
      !endif
181
    !endif type=2
4645 bpr 182
 
14050 bpr 183
    !if ($legend!=$empty and ($click_x!=0 or $click_y!=0 or $type iswordof 3))
184
      !if $ext<=1
185
        !if $type=3
186
          data=!append line $legend to $data
187
        !else
188
          data=!append line $legend,$click_x,$click_y to $data
189
        !endif
190
        !if $type=1
191
          dessin=!append line fcircle $click_x,$click_y,5,black to $dessin
192
        !endif
193
        !increase step
194
        !if $type iswordof 0
195
          !reset legend
196
          dessin=!append line fcircle $click_x,$click_y,10,black to $dessin
197
        !endif
198
        !if $type=1
199
          dessin=!append line arrow $click_x,$click_y to $dessin
200
        !endif
201
        !if $type iswordof 1 2 3
202
          !increase ext
203
            !if $type iswordof 2
204
              dessin_p=!append line circle $click_x,$click_y,5,red to $dessin_p
205
            !endif
206
            !if $type iswordof 2 3
207
              !set insdraw_filebase=!append item $wims_home/sessions/$wims_session/$sesdir to $insdraw_filebase
208
              !set insdraw_filebase=!listuniq $insdraw_filebase
209
              !set insdraw_filebase=!items2words $insdraw_filebase
210
              !insdraw copy 0,0,-1,-1,-1,-1,$wims_deposit\
7885 bpr 211
      $dessin\
212
      $dessin_p
14050 bpr 213
              !sh cd $wims_home/\
214
      cp s2/$wims_session/$ins_filename sessions/$wims_session/getfile/click/$ins_filename
215
              !set imgsrc=$wims_ref_name?session=$session&cmd=getfile&special_parm=$sesdir1/$ins_filename
216
            !endif
217
          !endif
218
        !else
219
          data=!append item $click_x,$click_y to $data
220
          !if $type iswordof 1
221
            dessin=!append item $click_x,$click_y,10,black to $dessin
222
          !endif
223
          !if $type iswordof 2 3
224
            !insdraw $dessin
225
            !set imgsrc=$ins_filename
226
          !endif
227
          !reset legend
228
          ext=1
229
        !endif ext <=1
230
      !else legend
231
        !if $legend=$empty and $begin!=1
232
          test=nolegend
7885 bpr 233
        !endif
14050 bpr 234
        !if ($click_x=0 and $click_y=0) and $begin!=1 and $type!=3
235
          test=noclick
236
        !endif
237
      !endif legend
238
    !endif
239
  !endif
7885 bpr 240
!endif cmd=reply
241
 
4612 bpr 242
!if $step >= $limit
243
  end=1
7885 bpr 244
!endif
4612 bpr 245
 
246
:end
247
 
248
!if $end!=0 and $end!=$empty
14050 bpr 249
  name_title=!line 1 of $(name_description$end)
250
  exo=!record 0 to -1 of data/example$end.oef
251
  exo_begin=!record 0 of data/example$end.oef
252
  exo=!record 1 to -1 of data/example$end.oef
253
  exo=!replace internal &lt; by < in $exo_begin\
4612 bpr 254
:$(name_description$end)\
255
$exo
256
 
14050 bpr 257
  !writefile wimshome/sessions/$wims_session/submit.oef $exo
258
  !writefile wimshome/sessions/$wims_session/data_$f_wims_deposit $data
259
  insdraw_size=!line 1 of $data
260
  !insdraw $dessin
261
  !set imgfilename=$ins_filename
262
  !if $type iswordof 2 3
263
    !sh cd $wims_home/\
264
      cp s2/$wims_session/$imgfilename sessions/$wims_session/getfile/click/z_$wims_deposit
265
  !endif
4612 bpr 266
!endif
4645 bpr 267
!reset click_x click_y erase javaoutput