Subversion Repositories wimsdev

Rev

Rev 10177 | 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
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
4616 bpr 29
 !goto end
4612 bpr 30
!endif
31
!if $step <=1
32
 !set wims_form_method=file
4645 bpr 33
 !set already=!sh mkdir -p $wims_home/$wims_sesdir/$sesdir; ls $wims_home/$wims_sesdir/$sesdir
4612 bpr 34
 !set already=!words2items $already
35
 !set already=!nospace $already
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
44
 error=
45
 compute=
46
 !if $wims_deposit_old=0
47
   !reset wims_deposit_old
48
 !endif
49
 !default wims_deposit=$wims_deposit_old
4645 bpr 50
 f_wims_deposit=!replace internal . by , in $wims_deposit
51
 f_wims_deposit=!item 1 of $f_wims_deposit
4612 bpr 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
4616 bpr 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
4612 bpr 86
       dessin=!append line fcircle $(c_[2..3]),10,black to $dessin
87
      !endif
8823 bpr 88
      !if $type iswordof 3
89
       dessin=!append line polyline black,$(c_[2..3]) to $dessin
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
 
4612 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
4645 bpr 106
   !endif / isin
4612 bpr 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
7885 bpr 119
   !endif
4612 bpr 120
   !increase step
4645 bpr 121
 !endif step=1
4612 bpr 122
:2
4616 bpr 123
 !if $step>=2
124
  !if $erase=yes
8823 bpr 125
   !if $type iswordof 0 2 3
4612 bpr 126
    dessin=!line 1 to -2 of $dessin
4616 bpr 127
   !else
4612 bpr 128
    dessin=!line 1 to -3 of $dessin
7952 bpr 129
   !endif type
4645 bpr 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
   !!!!
4612 bpr 139
    !exit
4645 bpr 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
8823 bpr 148
  !reset data
4612 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
154
     !if $type!=3
155
      test=nosize
156
     !endif
4645 bpr 157
   !endif click!=0 ..
158
 !else
8823 bpr 159
  !if $type iswordof 2 3
4645 bpr 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
8823 bpr 172
     !if $javaoption=brokenline
173
        javaout2=$(javaoutput)
174
     !endif
4645 bpr 175
     dessin=!append line $javaoption $javaout2 to $dessin
176
     !increase step
177
     ext=1
178
     begin=1
179
     !reset legend begin test
4612 bpr 180
   !endif
4645 bpr 181
  !endif type=2
182
 
8823 bpr 183
  !if ($legend!=$empty and ($click_x!=0 or $click_y!=0 or $type iswordof 3))
4645 bpr 184
    !if $ext<=1
8823 bpr 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
4645 bpr 190
     !if $type=1
8823 bpr 191
       dessin=!append line fcircle $click_x,$click_y,5,black to $dessin
4612 bpr 192
     !endif
193
     !increase step
4811 bpr 194
     !if $type iswordof 0
4612 bpr 195
       !reset legend
196
dessin=!append line fcircle $click_x,$click_y,10,black to $dessin
4645 bpr 197
     !endif
198
     !if $type=1
4612 bpr 199
dessin=!append line arrow $click_x,$click_y to $dessin
200
     !endif
8823 bpr 201
     !if $type iswordof 1 2 3
4645 bpr 202
      !increase ext
7885 bpr 203
        !if $type iswordof 2
7952 bpr 204
    dessin_p=!append line circle $click_x,$click_y,5,red to $dessin_p
8823 bpr 205
       !endif
206
       !if $type iswordof 2 3
8045 bpr 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
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
4612 bpr 218
   !else
219
     data=!append item $click_x,$click_y to $data
4645 bpr 220
     !if $type iswordof 1
4612 bpr 221
dessin=!append item $click_x,$click_y,10,black to $dessin
4645 bpr 222
     !endif
8823 bpr 223
     !if $type iswordof 2 3
4645 bpr 224
 !insdraw $dessin
225
 !set imgsrc=$ins_filename
226
     !endif
4612 bpr 227
     !reset legend
4645 bpr 228
     ext=1
229
    !endif ext <=1
230
  !else legend
231
   !if $legend=$empty and $begin!=1
4612 bpr 232
     test=nolegend
233
   !endif
8823 bpr 234
   !if ($click_x=0 and $click_y=0) and $begin!=1 and $type!=3
4612 bpr 235
     test=noclick
236
   !endif
4645 bpr 237
  !endif legend
7885 bpr 238
!endif cmd=reply
239
 
4612 bpr 240
!if $step >= $limit
241
  end=1
7885 bpr 242
!endif
4612 bpr 243
 
244
:end
245
 
246
!if $end!=0 and $end!=$empty
4616 bpr 247
 name_title=!line 1 of $(name_description$end)
248
 exo=!record 0 to -1 of data/example$end.oef
249
 exo_begin=!record 0 of data/example$end.oef
250
 exo=!record 1 to -1 of data/example$end.oef
251
 exo=!replace internal &lt; by < in $exo_begin\
4612 bpr 252
:$(name_description$end)\
253
$exo
254
 
4616 bpr 255
 !writefile wimshome/sessions/$wims_session/submit.oef $exo
256
 !writefile wimshome/sessions/$wims_session/data_$f_wims_deposit $data
4645 bpr 257
 insdraw_size=!line 1 of $data
258
 !insdraw $dessin
259
 !set imgfilename=$ins_filename
8823 bpr 260
 !if $type iswordof 2 3
4645 bpr 261
  !sh cd $wims_home/\
4697 bpr 262
     cp s2/$wims_session/$imgfilename sessions/$wims_session/getfile/click/z_$wims_deposit
4645 bpr 263
 !endif
4612 bpr 264
!endif
4645 bpr 265
!reset click_x click_y erase javaoutput
7952 bpr 266