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