Subversion Repositories wimsdev

Rev

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