Subversion Repositories wimsdev

Rev

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