Subversion Repositories wimsdev

Rev

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