Rev 18148 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2368 | bpr | 1 | !read adm/class/classlang names.phtml |
10303 | guerimand | 2 | wims_prefix=class user tmp techvar |
23 | reyssat | 3 | !default activeexo=10 |
4 | optionlist=autogen |
||
17117 | guerimand | 5 | !if $wims_class=$empty |
6 | !reset job name_title |
||
7 | error=noclass |
||
8 | !exit |
||
9 | !endif |
||
23 | reyssat | 10 | !read tabletheme |
11 | sh=!itemcnt $asheets |
||
12 | !if $sh<1 |
||
12384 | bpr | 13 | error=no_sheet |
14 | !exit |
||
23 | reyssat | 15 | !endif |
16 | |||
9671 | guerimand | 17 | scnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams |
13396 | bpr | 18 | !if $scnt=0 |
19 | !sh mkdir -p $wims_home/log/classes/$wims_class/exams |
||
20 | !endif |
||
9671 | guerimand | 21 | !if $exam>$scnt |
12384 | bpr | 22 | wims_infoshow=yes |
23 | !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat |
||
9671 | guerimand | 24 | !endif |
9656 | guerimand | 25 | !if $cmd=resume |
12384 | bpr | 26 | !bound infoshow within yes,no default $wims_infoshow |
27 | wims_infoshow=$infoshow |
||
28 | !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat |
||
9656 | guerimand | 29 | !endif |
30 | |||
11970 | guerimand | 31 | tmp=!defof MAX_EXAMS\ |
32 | MIN_WEIGHT\ |
||
33 | MAX_WEIGHT\ |
||
34 | DF_SEVERITY in wimshome/public_html/bases/sys/define.conf |
||
35 | !distribute line $tmp into max_exams,min_weight,max_weight,df_severity |
||
13370 | guerimand | 36 | df_weight=!word 1 of $df_severity |
23 | reyssat | 37 | title_limit=80 |
38 | desc_limit=4000 |
||
39 | etitle_limit=100 |
||
40 | edesc_limit=400 |
||
9957 | obado | 41 | |
42 | duration_min=2 |
||
43 | duration_max=600 |
||
44 | duration_default=90 |
||
45 | |||
46 | tries_min=1 |
||
47 | tries_max=100 |
||
48 | tries_default=3 |
||
49 | |||
17553 | bpr | 50 | minscore_min=0 |
51 | minscore_max=100 |
||
52 | minscore_default=100 |
||
9957 | obado | 53 | !default duration=$duration_default |
23 | reyssat | 54 | wims_helper=chapter=3 |
55 | |||
56 | !if $wims_user!=supervisor |
||
12384 | bpr | 57 | !bound job within student, score, scorereg default student |
10116 | bpr | 58 | !endif |
59 | |||
10396 | bpr | 60 | !!if $job iswordof student score or $cmd=resume |
10095 | bpr | 61 | wims_ariane_self=no |
10396 | bpr | 62 | !!endif |
1407 | bpr | 63 | !if $seq>0 |
64 | wims_sequence=$seq |
||
65 | !endif |
||
23 | reyssat | 66 | |
17429 | guerimand | 67 | !if $job isitemof duplicate,coursewatch |
12384 | bpr | 68 | !changeto $job.proc |
9687 | guerimand | 69 | !endif |
70 | |||
23 | reyssat | 71 | today=!char 1 to 8 of $wims_now |
72 | thisyear=!char 1 to 4 of $today |
||
73 | |||
11841 | guerimand | 74 | !if $class_expiration=$empty or $class_creation=$empty |
12384 | bpr | 75 | !defread wimshome/log/classes/$wims_class/.def |
76 | !if $wims_superclass!=$empty |
||
77 | class_expiration=!defof class_expiration in wimshome/log/classes/$wims_superclass/.def |
||
78 | !endif |
||
23 | reyssat | 79 | !endif |
11841 | guerimand | 80 | |
23 | reyssat | 81 | !if $class_expiration=$empty |
12384 | bpr | 82 | error=bad_class |
83 | !exit |
||
23 | reyssat | 84 | !endif |
85 | |||
86 | sharers= |
||
87 | sharing1=!defof sharable_sheet in wimshome/log/classes/$wims_class/neighbors |
||
88 | !for c in $sharing1 |
||
12384 | bpr | 89 | d=!defof sharing_sheet in wimshome/log/classes/$c/neighbors |
90 | !if $d issametext $wims_class |
||
91 | sharers=!append item $c to $sharers |
||
92 | !endif |
||
23 | reyssat | 93 | !next c |
11807 | guerimand | 94 | jquery_defined=!defof jquery_defined in themes/$wims_theme/header.phtml |
13369 | guerimand | 95 | default_expdate=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
96 | default_expdate=!line 2 of $default_expdate |
||
17310 | guerimand | 97 | expdate=!text select char 0123456789 in $expdate |
13369 | guerimand | 98 | !default expdate=$default_expdate |
17310 | guerimand | 99 | expmon=!char 5 to 6 of $expdate |
100 | expday=!char 7 to 8 of $expdate |
||
101 | expyear=!char 1 to 4 of $expdate |
||
23 | reyssat | 102 | expmon=!char 2,3 of $[abs(floor($expmon))+100] |
103 | expday=!char 2,3 of $[abs(floor($expday))+100] |
||
104 | expyear=!char -4 to -1 of $[abs(floor($expyear))+100000] |
||
105 | !if $expday>=1 and $expday<=31 and $expmon>=1 and $expmon<=12 \ |
||
10398 | bpr | 106 | and $expyear>=$thisyear and $expyear<=$thisyear+1 \ |
107 | and $expyear$expmon$expday>$today \ |
||
12090 | guerimand | 108 | and $expyear$expmon$expday<=$class_expiration \ |
10398 | bpr | 109 | and N notin $expmon$expday$expyear |
12384 | bpr | 110 | expiration=$expyear$expmon$expday |
12091 | guerimand | 111 | !else |
12384 | bpr | 112 | expiration=$class_expiration |
23 | reyssat | 113 | !endif |
12091 | guerimand | 114 | expdate=$expiration |
23 | reyssat | 115 | |
8264 | bpr | 116 | !if $exam<1 or $exam>$max_exams |
12384 | bpr | 117 | error=bad_exam |
118 | !exit |
||
23 | reyssat | 119 | !endif |
120 | |||
121 | # menu preparation |
||
122 | !if $job!=$empty and $job iswordof \ |
||
10398 | bpr | 123 | prep_activate prep_erase prep_expire |
12384 | bpr | 124 | title=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
125 | title=!line 4 of $title |
||
126 | error=$job |
||
127 | !exit |
||
23 | reyssat | 128 | !endif |
129 | |||
130 | !if $job=erase and $exam>=1 and $exam<=$scnt |
||
12384 | bpr | 131 | test= |
132 | !for s=$exam+1 to $scnt |
||
133 | l=!record $s of wimshome/log/classes/$wims_class/exams/.exams |
||
134 | l=!line 1 of $l |
||
135 | !if $l>0 |
||
136 | test=notclean |
||
137 | !endif |
||
138 | !next s |
||
139 | !if $test=$empty |
||
140 | update_field=0 |
||
141 | !read update.exam |
||
23 | reyssat | 142 | !endif |
12384 | bpr | 143 | !readproc adm/updatesequence.proc exam,$exam |
144 | !restart module=home |
||
23 | reyssat | 145 | !endif |
146 | |||
147 | !if $job=expire |
||
12384 | bpr | 148 | !distribute item 1,2 into update_field,update_content |
149 | !read update.exam |
||
150 | job= |
||
23 | reyssat | 151 | !endif |
152 | |||
153 | !if $job=hide |
||
12384 | bpr | 154 | !distribute item 1,3 into update_field,update_content |
155 | !read update.exam |
||
156 | job= |
||
23 | reyssat | 157 | !endif |
158 | |||
159 | !if $job=reactivate |
||
12384 | bpr | 160 | !distribute item 1,1 into update_field,update_content |
161 | !read update.exam |
||
162 | job= |
||
23 | reyssat | 163 | !endif |
164 | |||
165 | activetest=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
||
166 | a_=!line 1 of $activetest |
||
167 | a_=!trim $a_ |
||
168 | expp=!line 2 of $activetest |
||
169 | !default expiration=$expp |
||
170 | !if $expiration>$class_expiration |
||
12384 | bpr | 171 | expiration=$class_expiration |
23 | reyssat | 172 | !endif |
173 | ecnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$exam |
||
174 | activetest=!replace line 4 by $ecnt in $activetest |
||
175 | |||
176 | !if $job=putsource and $a_=0 |
||
12384 | bpr | 177 | source=!trim $source |
178 | !writefile $srcname $source |
||
179 | putcnt=!recordcnt $srcname |
||
180 | !for i=1 to $putcnt |
||
181 | s_=!record $i of $srcname |
||
182 | n_=!linecnt $s_ |
||
183 | bad_source=$i |
||
184 | !if $n_>=5 and $n_<10 |
||
185 | !distribute lines $s_ into di,pa,re,we,ti,de |
||
186 | !for k in re,we,di,pa,ti,de |
||
187 | $k=!trim $($k) |
||
188 | w$k=!wordcnt $($k) |
||
189 | !next k |
||
190 | !if NaN isin $[$re]$[$we] or $[$wre*$wwe*$wdi]!=1 or $wpa>1 or $ti=$empty \ |
||
191 | or isin $di or $re<0 or $we<0 or ($re>0 and $we=0) |
||
192 | error=bad_source |
||
193 | !exit |
||
194 | !endif |
||
195 | ti=!char 1 to $etitle_limit of $ti |
||
196 | de=!char 1 to $edesc_limit of $de |
||
197 | source_$i=$s_ |
||
198 | last=$i |
||
199 | !else |
||
200 | # last record may be empty |
||
201 | !if $i!=$putcnt |
||
202 | error=bad_source |
||
203 | !exit |
||
204 | !endif |
||
205 | !endif |
||
206 | !next i |
||
207 | !for i=1 to $last |
||
208 | !appendfile wimshome/log/classes/$wims_class/exams/.exam$exam :$(source_$i) |
||
209 | !next i |
||
23 | reyssat | 210 | !endif |
211 | |||
16006 | guerimand | 212 | !readproc adm/vfilter/listvarfilter.proc |
213 | |||
17382 | guerimand | 214 | !if $activetest!=$empty |
12384 | bpr | 215 | exam_exist=yes |
216 | !default expiration=!line 2 of $activetest |
||
16006 | guerimand | 217 | exam_hidetechvar=!line 8 of $activetest |
17382 | guerimand | 218 | exam_mode=!line 9 of $activetest |
17556 | bpr | 219 | !if $mode!= |
220 | exam_mode=$mode |
||
221 | !endif |
||
17382 | guerimand | 222 | !default exam_mode=0 |
12384 | bpr | 223 | activetest=!line 1 of $activetest |
224 | exocnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$exam |
||
225 | !if $job=student |
||
17542 | bpr | 226 | !!relecture du fichier lang pour utiliser mode_exam |
227 | !read lang/names.phtml.$moduclass_lang |
||
16878 | guerimand | 228 | !if $wims_exrandomlist=$empty or $(wims_exrandomlist[2;])!=$exam |
17490 | guerimand | 229 | !if exrandomlist iswordof $class_option and $exam_mode!=1 |
16878 | guerimand | 230 | wims_exrandomlist=!shuffle $exocnt |
231 | !else |
||
232 | wims_exrandomlist=!makelist x for x = 1 to $exocnt |
||
233 | !endif |
||
17410 | guerimand | 234 | wims_exrandomlist=$wims_exrandomlist;$exam;$exam_mode |
16878 | guerimand | 235 | !setdef wims_exrandomlist=$wims_exrandomlist in wimshome/sessions/$wims_session/var.stat |
12384 | bpr | 236 | !endif |
18150 | bpr | 237 | !set tmp_examstatus=!getsheetstatus exam=$exam |
238 | !if $tmp_examstatus=3 |
||
239 | activetest=-1 |
||
240 | exocnt=0 |
||
241 | error=exam_hidden |
||
242 | !default expiration=$class_expiration |
||
243 | exam_exist=no |
||
244 | !exit |
||
16006 | guerimand | 245 | !endif |
6172 | czzmrn | 246 | !endif |
23 | reyssat | 247 | !else |
12384 | bpr | 248 | exam_exist=no |
249 | activetest=-1 |
||
250 | exocnt=0 |
||
251 | !default expiration=$class_expiration |
||
23 | reyssat | 252 | !endif |
253 | |||
17542 | bpr | 254 | !!----desactivation d'examen soumis à condition : |
255 | !!pas de partage, pas de score élève, |
||
256 | !! certains types de classe (FG). |
||
14033 | bpr | 257 | !!----desactivation possible dans un programme sans cours |
258 | !! tests faits differemment dans adm/class/sheet ... |
||
957 | guerimand | 259 | testsharing=!defof sharable_exam\ |
260 | sharing_exam in wimshome/log/classes/$wims_class/neighbors |
||
261 | testsharing=!lines2items $testsharing |
||
14033 | bpr | 262 | testsharing=!nonempty items $testsharing |
14079 | bpr | 263 | !! test for main class or program in a class group or a portal |
264 | testrecshare=!defof class_recshare in wimshome/log/classes/$wims_class/.def |
||
957 | guerimand | 265 | deactivate=yes |
14079 | bpr | 266 | !if $testsharing!=$empty or main isin $testrecshare or $activetest<1 |
12384 | bpr | 267 | deactivate=sharing |
957 | guerimand | 268 | !else |
14033 | bpr | 269 | !if $class_type!=0 and ($class_type!=1 or $wims_superclass!=$class_parent) \ |
270 | and /0// notin $wims_class// |
||
271 | !if $class_typename=program |
||
272 | test1=!record 0 of wimshome/log/classes/$wims_class/courses |
||
273 | test2=!record 0 of wimshome/log/classes/$wims_class/icourses |
||
274 | !if $test1$test2!=$empty |
||
275 | deactivate=badstructure |
||
276 | !endif |
||
277 | !else |
||
278 | deactivate=badstructure |
||
279 | !endif |
||
12384 | bpr | 280 | !else |
281 | test=!sh cd $wims_home/log/classes/$wims_class/;\ |
||
957 | guerimand | 282 | list=`ls noscore | grep -v supervisor`;\ |
283 | cd noscore;\ |
||
8504 | bpr | 284 | awk 'length($$1)==18{if($$3==$exam){print "no";exit};}' $$list; |
12384 | bpr | 285 | !if no isin $test |
286 | deactivate=score |
||
287 | !endif |
||
957 | guerimand | 288 | !endif |
289 | !endif |
||
290 | !if $job=deactivate |
||
12384 | bpr | 291 | !if yes isin $deactivate |
292 | !distribute item 1,0 into update_field,update_content |
||
293 | !read update.exam |
||
294 | job= |
||
295 | !read var.proc |
||
296 | !else |
||
297 | error=nodeactivate |
||
298 | !endif |
||
957 | guerimand | 299 | !endif |
300 | !! --------------------------- |
||
301 | |||
16006 | guerimand | 302 | |
12999 | obado | 303 | !readproc adm/scorerestriction get |
23 | reyssat | 304 | !if $allow=yes and $wims_user=supervisor |
12384 | bpr | 305 | !if $tv_listname=$empty |
10398 | bpr | 306 | !bound allowtype within all,simulation,none,select default all |
12384 | bpr | 307 | !else |
10398 | bpr | 308 | !bound allowtype within all,simulation,none,select,techvar default all |
23 | reyssat | 309 | !endif |
12384 | bpr | 310 | !if $sharers!=$empty and $allowshare=1 |
16799 | guerimand | 311 | !if $allowtype=techvar |
312 | !readproc adm/vfilter/validtechvar.proc $allowtechvar\ |
||
313 | $sharers |
||
314 | !if $output=1 |
||
315 | setclass=$wims_class,$sharers |
||
316 | !else |
||
317 | error=badallowshare |
||
318 | allowshare=0 |
||
319 | setclass=$wims_class |
||
320 | !endif |
||
16801 | guerimand | 321 | !else |
322 | setclass=$wims_class,$sharers |
||
16799 | guerimand | 323 | !endif |
12384 | bpr | 324 | !else |
325 | setclass=$wims_class |
||
23 | reyssat | 326 | !endif |
12384 | bpr | 327 | !if $allowtype=simulation |
10303 | guerimand | 328 | !for c in $setclass |
12384 | bpr | 329 | !writefile wimshome/log/classes/$c/.E$exam # |
10303 | guerimand | 330 | !next c |
12384 | bpr | 331 | !else |
332 | IPlist=!translate ,;\ |
||
333 | * to $ $ in $_output |
||
334 | IPlist=!trim $IPlist |
||
335 | !if $allowtype=select and $IPlist=$empty and $save!=$empty |
||
336 | allowtype=all |
||
337 | !endif |
||
338 | !if $allowtype=all |
||
339 | allow_parm= |
||
340 | !endif |
||
341 | !if $allowtype=none |
||
342 | allow_parm=none |
||
343 | !endif |
||
344 | !if $allowtype=select |
||
345 | allow_parm=$IPlist |
||
346 | !endif |
||
347 | !if $allowtype=techvar |
||
348 | !readproc adm/vfilter/shexselect.proc E$exam |
||
349 | !endif |
||
350 | !! --- save modification of allow parameters |
||
351 | !if $save!=$empty |
||
352 | !if $allow_parm=$empty |
||
16777 | guerimand | 353 | setclass=!items2words $setclass |
12384 | bpr | 354 | !sh for c in $setclass; do rm -f $wims_home/log/classes/$$c/.E$exam; done |
355 | !else |
||
356 | !for c in $setclass |
||
357 | !writefile wimshome/log/classes/$c/.E$exam $allow_parm |
||
358 | !next c |
||
359 | !endif |
||
360 | wims_class_log=exam $exam allow $allowtype $allowshare by $wims_realuser |
||
361 | !endif |
||
362 | !! --- end of saving |
||
10303 | guerimand | 363 | |
12384 | bpr | 364 | !if $cutt notsametext $cutt_save |
365 | cutt=!text select char 0123456789,.:; in $cutt |
||
366 | cutt=!translate ,; to $ $ in $cutt |
||
367 | cutt=!singlespace $cutt |
||
368 | !! --------------- format verification of cuttime |
||
369 | nbcutt=!wordcnt $cutt |
||
370 | fcutt= |
||
371 | !for k=1 to $nbcutt |
||
372 | tmp=!word $k of $cutt |
||
373 | tmp=!replace internal . by , in $tmp |
||
374 | n=!charcnt $(tmp[1]) |
||
375 | !if $n!=8 |
||
14335 | bpr | 376 | !reset tmp |
12384 | bpr | 377 | !else |
14335 | bpr | 378 | ti=!replace internal : by , in $(tmp[2]) |
379 | !distribute item $ti into h,m |
||
380 | h=$[$h*1] |
||
381 | m=$[$m*1] |
||
382 | !if $h<0 or $h>23 or $m<0 or $m>59 or NaN isin $h$m |
||
383 | !reset tmp |
||
384 | !else |
||
385 | h=!char 2 to 3 of $[100+$h] |
||
386 | m=!char 2 to 3 of $[100+$m] |
||
387 | fcutt=!append word $(tmp[1]).$h:$m to $fcutt |
||
388 | !endif |
||
12384 | bpr | 389 | !endif |
390 | !next k |
||
391 | cutt=$fcutt |
||
392 | cutt=!sort words $cutt |
||
393 | !! --------------- end of format verification |
||
394 | !distribute lines 6\ |
||
23 | reyssat | 395 | $cutt into update_field,update_content |
12384 | bpr | 396 | !read update.exam |
397 | cutt_save=$cutt |
||
398 | !endif |
||
10303 | guerimand | 399 | !endif |
23 | reyssat | 400 | !endif |
401 | |||
11970 | guerimand | 402 | !! --------------- get/save weight parameter |
403 | rec=!record 0 of wimshome/log/classes/$wims_class/exams/.eseverity |
||
404 | !if $save!=$empty |
||
12384 | bpr | 405 | !bound weight between $min_weight and $max_weight default $df_weight |
406 | nb=!linecnt $rec |
||
407 | !if $exam>$nb |
||
14335 | bpr | 408 | !for k=$nb+1 to $exam |
409 | rec=!append line $df_weight to $rec |
||
410 | !next k |
||
12384 | bpr | 411 | !endif |
412 | rec=!replace line number $exam by $weight in $rec |
||
413 | !writefile wimshome/log/classes/$wims_class/exams/.eseverity $rec |
||
11970 | guerimand | 414 | !endif |
415 | s_weight=!line $exam of $rec |
||
416 | !default weight=$s_weight |
||
417 | |||
10303 | guerimand | 418 | !if $allow=$empty or $save!=$empty |
12384 | bpr | 419 | !! --- read saving configuration for allow parameters initial time and after saving |
420 | !readproc adm/vfilter/shexread.proc E$exam |
||
13368 | guerimand | 421 | !read adm/scorerestriction put\ |
11841 | guerimand | 422 | $IPlist |
23 | reyssat | 423 | !endif |
10303 | guerimand | 424 | old_allowtype=$allowtype |
425 | old_allowtechvar=$allowtechvar |
||
426 | !reset allow,save |
||
23 | reyssat | 427 | |
428 | !if $job iswordof student score |
||
12384 | bpr | 429 | !if $wims_user=supervisor |
430 | allowtype=simulation |
||
431 | !else |
||
432 | simutest=!record 0 of wimshome/$wims_sesdir/examsimu.$exam |
||
433 | !if $allowtype!=simulation and yes iswordof $simutest |
||
434 | error=simuchange |
||
435 | !exit |
||
436 | !endif |
||
23 | reyssat | 437 | !endif |
438 | !endif |
||
439 | |||
440 | !if $job!=text |
||
12384 | bpr | 441 | !if $title_save$desc_save=$empty |
442 | rec=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
||
17382 | guerimand | 443 | !distribute lines $rec into bidon,bidon,setup_save,title_save,desc_save,cutt_save,comment_save,formal_hidden_condition_save,mode_save |
12384 | bpr | 444 | !endif |
445 | setup=$setup_save |
||
446 | title=$title_save |
||
447 | desc=$desc_save |
||
448 | cutt=$cutt_save |
||
449 | comment=$comment_save |
||
16006 | guerimand | 450 | !readproc adm/vfilter/convertformat.proc human\ |
451 | $formal_hidden_condition_save |
||
17328 | guerimand | 452 | !if $output_error!=$empty |
453 | error=hiddenbadtechvar |
||
454 | display=1 |
||
17527 | bpr | 455 | !endif |
16006 | guerimand | 456 | hidden_condition=$output_convertformat |
17382 | guerimand | 457 | mode=$mode_save |
23 | reyssat | 458 | !else |
12384 | bpr | 459 | !if $title=$empty |
460 | error=no_title |
||
461 | !exit |
||
462 | !endif |
||
16006 | guerimand | 463 | !if $hidden_condition!=$empty |
17527 | bpr | 464 | !readproc adm/vfilter/convertformat.proc formal\ |
16006 | guerimand | 465 | $hidden_condition |
17527 | bpr | 466 | formal_hidden_condition=$output_convertformat |
467 | !readproc adm/vfilter/convertformat.proc human\ |
||
16195 | guerimand | 468 | $formal_hidden_condition |
17527 | bpr | 469 | hidden_condition=$output_convertformat |
470 | !if $output_error!=$empty |
||
471 | error=badtechvarname $output_error |
||
472 | !endif |
||
16006 | guerimand | 473 | !else |
17527 | bpr | 474 | formal_hidden_condition=$empty |
16006 | guerimand | 475 | !endif |
12384 | bpr | 476 | !ifval $activetest<=0 |
477 | !bound duration between integer $duration_min and $duration_max default $duration_default |
||
478 | !bound tries between integer $tries_min and $tries_max default $tries_default |
||
17553 | bpr | 479 | !bound minscore between integer $minscore_min and $minscore_max default $minscore_default |
17840 | czzmrn | 480 | !if $mode=1 |
481 | setup=$duration $tries $minscore |
||
482 | !else |
||
17553 | bpr | 483 | setup=$duration $tries |
484 | !endif |
||
12384 | bpr | 485 | !else |
486 | rec=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
||
487 | !distribute lines $rec into bidon,bidon,setup_save |
||
488 | setup=$setup_save |
||
489 | !endif |
||
490 | desc=!replace $\ |
||
23 | reyssat | 491 | $ by in $desc |
12384 | bpr | 492 | title=!singlespace $title |
493 | desc=!singlespace $desc |
||
494 | title=!char 1 to $title_limit of $title |
||
495 | desc=!char 1 to $desc_limit of $desc |
||
17430 | guerimand | 496 | !if $activetest=0 |
497 | !bound mode between 0 and 1 default $mode_save |
||
498 | !else |
||
499 | mode=$mode_save |
||
500 | !endif |
||
12384 | bpr | 501 | !if $exam_exist=yes |
502 | !distribute lines 2\ |
||
23 | reyssat | 503 | $expiration into update_field,update_content |
12384 | bpr | 504 | !read update.exam |
505 | !distribute lines 3\ |
||
23 | reyssat | 506 | $setup into update_field,update_content |
12384 | bpr | 507 | !read update.exam |
508 | !distribute lines 4\ |
||
23 | reyssat | 509 | $title into update_field,update_content |
12384 | bpr | 510 | !read update.exam |
511 | !distribute lines 5\ |
||
23 | reyssat | 512 | $desc into update_field,update_content |
12384 | bpr | 513 | !read update.exam |
514 | !distribute lines 6\ |
||
2329 | guerimand | 515 | $cutt into update_field,update_content |
12384 | bpr | 516 | !read update.exam |
517 | !distribute lines 7\ |
||
2329 | guerimand | 518 | $comment into update_field,update_content |
12384 | bpr | 519 | !read update.exam |
16006 | guerimand | 520 | !distribute lines 8\ |
521 | $formal_hidden_condition into update_field,update_content |
||
522 | !read update.exam |
||
17430 | guerimand | 523 | !if $activetest=0 |
524 | !distribute lines 9\ |
||
17382 | guerimand | 525 | $mode into update_field,update_content |
17430 | guerimand | 526 | !read update.exam |
527 | !endif |
||
12384 | bpr | 528 | !else |
529 | !appendfile wimshome/log/classes/$wims_class/exams/.exams :0\ |
||
23 | reyssat | 530 | $expiration\ |
531 | $setup\ |
||
532 | $title\ |
||
533 | $desc\ |
||
2329 | guerimand | 534 | $cutt\ |
16006 | guerimand | 535 | $comment\ |
17382 | guerimand | 536 | $formal_hidden_condition\ |
537 | $mode |
||
12384 | bpr | 538 | exam_exist=yes |
539 | activetest=0 |
||
540 | exam=!recordcnt wimshome/log/classes/$wims_class/exams/.exams |
||
541 | !writefile wimshome/log/classes/$wims_class/exams/.exam$exam |
||
542 | !endif |
||
543 | title_save=$title |
||
544 | desc_save=$desc |
||
545 | setup_save=$setup |
||
546 | cutt_save=$cutt |
||
547 | comment_save=$comment |
||
16006 | guerimand | 548 | formal_hidden_condition_save=$formal_hidden_condition |
17382 | guerimand | 549 | mode_save=$mode |
23 | reyssat | 550 | !endif |
17553 | bpr | 551 | !if $mode=1 |
552 | !distribute words $setup into sdure,stries,sminscore |
||
553 | !else |
||
554 | !distribute words $setup into sdure,stries,sprime |
||
555 | !endif |
||
23 | reyssat | 556 | !default sprime=0 |
17553 | bpr | 557 | !default sminscore=100 |
23 | reyssat | 558 | duration=$sdure |
17553 | bpr | 559 | minscore=$sminscore |
23 | reyssat | 560 | !if $activetest>0 or $wims_user=supervisor |
15841 | bpr | 561 | !! FIXME unuseless if one wants to create an exam ?? |
12384 | bpr | 562 | !read score.proc |
23 | reyssat | 563 | !endif |
564 | |||
17553 | bpr | 565 | !if $job=activate and $[$activetest]=0 or ($exam_mode=1 and $job=text and $[$activetest]=0) |
566 | !if $job=activate and $[$activetest]=0 |
||
567 | !distribute item 1,1 into update_field,update_content |
||
568 | !read update.exam |
||
569 | !endif |
||
17907 | czzmrn | 570 | !if $exam_mode=1 and $exocnt > 1 |
17542 | bpr | 571 | !! fix exercise dependancy in case of course mode to lock exercice order |
572 | !! and protect for adress hack |
||
17430 | guerimand | 573 | dataexam=$empty |
574 | dataexam=!record 1 of wimshome/log/classes/$wims_class/exams/.exam$exam |
||
17907 | czzmrn | 575 | !if $dataexam!=$empty |
576 | !! if you move some other exercise in first position, need to clear |
||
577 | !! dependencies |
||
578 | dtlen=!linecnt $dataexam |
||
579 | !if $dtlen > 3 |
||
580 | dataexam=!replace line number 4 by $empty in $dataexam |
||
581 | !endif |
||
582 | dataexam=:$dataexam |
||
583 | !for k=2 to $exocnt |
||
584 | dt=!record $k of wimshome/log/classes/$wims_class/exams/.exam$exam |
||
585 | dtlen=!linecnt $dt |
||
586 | !if $dtlen < 4 |
||
587 | dt=$dt\ |
||
17433 | guerimand | 588 | \ |
17430 | guerimand | 589 | |
17907 | czzmrn | 590 | !endif |
591 | dt=!replace line number 4 by $[$k-1]:$minscore in $dt |
||
592 | dataexam=!append line :$dt to $dataexam |
||
593 | !next k |
||
594 | !writefile wimshome/log/classes/$wims_class/exams/.exam$exam $dataexam |
||
595 | !endif |
||
17430 | guerimand | 596 | !endif |
17553 | bpr | 597 | !if $job=activate |
598 | activetest=1 |
||
599 | !endif |
||
23 | reyssat | 600 | !endif |
601 | |||
14108 | guerimand | 602 | !if $activetest=0 |
16006 | guerimand | 603 | !readproc vfilter/listvarfilter.proc |
14108 | guerimand | 604 | # delete an item |
605 | !if $job=delete and $delete>0 and $delete<=$exocnt |
||
14109 | guerimand | 606 | !read adm/sheet/sheetexam.shift exam,$exam,,$delete |
14108 | guerimand | 607 | delete= |
608 | exocnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$exam |
||
609 | !endif |
||
23 | reyssat | 610 | |
14109 | guerimand | 611 | # move to specific position |
17553 | bpr | 612 | !if $job=moveto and $movetarget>=1 and $movetarget<=$[$exocnt+1] \ |
613 | and $movesource!=$movetarget and $movesource>=1 and $movesource<=$exocnt |
||
14109 | guerimand | 614 | !read adm/sheet/sheetexam.shift exam,$exam,$movetarget,$movesource |
615 | !endif |
||
23 | reyssat | 616 | !endif |
617 | |||
618 | # modify an exercise |
||
619 | !if $job=exo |
||
12384 | bpr | 620 | !if $activetest>0 |
621 | error=active_exam |
||
622 | job=$empty |
||
623 | !exit |
||
624 | !endif |
||
625 | !bound $exo between integer 1 and $exocnt+1 default $exocnt+1 |
||
10477 | guerimand | 626 | |
12384 | bpr | 627 | ee=!record $exo of wimshome/log/classes/$wims_class/exams/.exam$exam |
628 | !distribute lines $ee into w_,c_,n_,d_,o_,co_ |
||
2731 | guerimand | 629 | !! !if $echoose$ename$eweight!=$empty |
12384 | bpr | 630 | !if $save2!=$empty |
631 | !if $echoose=$empty |
||
632 | !if $c_!=$empty |
||
633 | echoose=$c_ |
||
634 | !else |
||
635 | error=prep_noexercise |
||
636 | !reset save2 |
||
637 | !exit |
||
638 | !endif |
||
2789 | guerimand | 639 | !endif |
12384 | bpr | 640 | !bound eweight between 0,10 default 1 |
641 | ename=!singlespace $ename |
||
642 | ename=!char 1 to $etitle_limit of $ename |
||
643 | !default ename=Ex |
||
644 | edep=!char 1 to 100 of $edep |
||
645 | eopt=!listintersect $eopt and $optionlist |
||
646 | update_content=$eweight\ |
||
23 | reyssat | 647 | $echoose\ |
648 | $ename\ |
||
649 | $edep\ |
||
2329 | guerimand | 650 | $eopt\ |
651 | $ecomment |
||
12384 | bpr | 652 | update_field=0 |
653 | !reset save2 |
||
654 | !read update.exo |
||
655 | !reset job,sasheets |
||
656 | !if $error=$empty |
||
657 | msg_info=addexook |
||
658 | !endif |
||
659 | !changeto var.proc |
||
660 | !else |
||
661 | eweight=$w_ |
||
662 | echoose=$c_ |
||
663 | ename=$n_ |
||
664 | edep=$d_ |
||
665 | eopt=$o_ |
||
666 | ecomment=$co_ |
||
23 | reyssat | 667 | !endif |
668 | !endif |
||
669 | |||
3245 | guerimand | 670 | erasable=no |
23 | reyssat | 671 | !if $[$activetest]=0 |
12384 | bpr | 672 | erasable=yes |
673 | scnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams |
||
674 | !for s=$exam+1 to $scnt |
||
675 | l=!record $s of wimshome/log/classes/$wims_class/exams/.exams |
||
676 | l=!line 1 of $l |
||
677 | !if $l>0 |
||
678 | erasable=no |
||
679 | !endif |
||
680 | !next s |
||
23 | reyssat | 681 | !endif |
682 | |||
3245 | guerimand | 683 | !if $back=1 and $error=$empty |
12384 | bpr | 684 | !restart module=home |
3245 | guerimand | 685 | !endif |
686 | |||
8903 | czzmrn | 687 | !if $job iswordof scorereg renew cpsheet cpexam |
12384 | bpr | 688 | !read $job.proc |
23 | reyssat | 689 | !endif |