Subversion Repositories wimsdev

Rev

Rev 4697 | Rev 5324 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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