Rev 17556 | Rev 17907 | Go to most recent revision | 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 |
16006 | guerimand | 237 | !if $exam_hidetechvar!=$empty |
238 | !readproc adm/vfilter/ishiddensheet.proc $exam_hidetechvar |
||
239 | !if $hidden_sheet=1 |
||
240 | activetest=-1 |
||
241 | exocnt=0 |
||
242 | error=exam_hidden |
||
243 | !default expiration=$class_expiration |
||
244 | exam_exist=no |
||
245 | !exit |
||
246 | !endif |
||
247 | !endif |
||
6172 | czzmrn | 248 | !endif |
23 | reyssat | 249 | !else |
12384 | bpr | 250 | exam_exist=no |
251 | activetest=-1 |
||
252 | exocnt=0 |
||
253 | !default expiration=$class_expiration |
||
23 | reyssat | 254 | !endif |
255 | |||
17542 | bpr | 256 | !!----desactivation d'examen soumis à condition : |
257 | !!pas de partage, pas de score élève, |
||
258 | !! certains types de classe (FG). |
||
14033 | bpr | 259 | !!----desactivation possible dans un programme sans cours |
260 | !! tests faits differemment dans adm/class/sheet ... |
||
957 | guerimand | 261 | testsharing=!defof sharable_exam\ |
262 | sharing_exam in wimshome/log/classes/$wims_class/neighbors |
||
263 | testsharing=!lines2items $testsharing |
||
14033 | bpr | 264 | testsharing=!nonempty items $testsharing |
14079 | bpr | 265 | !! test for main class or program in a class group or a portal |
266 | testrecshare=!defof class_recshare in wimshome/log/classes/$wims_class/.def |
||
957 | guerimand | 267 | deactivate=yes |
14079 | bpr | 268 | !if $testsharing!=$empty or main isin $testrecshare or $activetest<1 |
12384 | bpr | 269 | deactivate=sharing |
957 | guerimand | 270 | !else |
14033 | bpr | 271 | !if $class_type!=0 and ($class_type!=1 or $wims_superclass!=$class_parent) \ |
272 | and /0// notin $wims_class// |
||
273 | !if $class_typename=program |
||
274 | test1=!record 0 of wimshome/log/classes/$wims_class/courses |
||
275 | test2=!record 0 of wimshome/log/classes/$wims_class/icourses |
||
276 | !if $test1$test2!=$empty |
||
277 | deactivate=badstructure |
||
278 | !endif |
||
279 | !else |
||
280 | deactivate=badstructure |
||
281 | !endif |
||
12384 | bpr | 282 | !else |
283 | test=!sh cd $wims_home/log/classes/$wims_class/;\ |
||
957 | guerimand | 284 | list=`ls noscore | grep -v supervisor`;\ |
285 | cd noscore;\ |
||
8504 | bpr | 286 | awk 'length($$1)==18{if($$3==$exam){print "no";exit};}' $$list; |
12384 | bpr | 287 | !if no isin $test |
288 | deactivate=score |
||
289 | !endif |
||
957 | guerimand | 290 | !endif |
291 | !endif |
||
292 | !if $job=deactivate |
||
12384 | bpr | 293 | !if yes isin $deactivate |
294 | !distribute item 1,0 into update_field,update_content |
||
295 | !read update.exam |
||
296 | job= |
||
297 | !read var.proc |
||
298 | !else |
||
299 | error=nodeactivate |
||
300 | !endif |
||
957 | guerimand | 301 | !endif |
302 | !! --------------------------- |
||
303 | |||
16006 | guerimand | 304 | |
12999 | obado | 305 | !readproc adm/scorerestriction get |
23 | reyssat | 306 | !if $allow=yes and $wims_user=supervisor |
12384 | bpr | 307 | !if $tv_listname=$empty |
10398 | bpr | 308 | !bound allowtype within all,simulation,none,select default all |
12384 | bpr | 309 | !else |
10398 | bpr | 310 | !bound allowtype within all,simulation,none,select,techvar default all |
23 | reyssat | 311 | !endif |
12384 | bpr | 312 | !if $sharers!=$empty and $allowshare=1 |
16799 | guerimand | 313 | !if $allowtype=techvar |
314 | !readproc adm/vfilter/validtechvar.proc $allowtechvar\ |
||
315 | $sharers |
||
316 | !if $output=1 |
||
317 | setclass=$wims_class,$sharers |
||
318 | !else |
||
319 | error=badallowshare |
||
320 | allowshare=0 |
||
321 | setclass=$wims_class |
||
322 | !endif |
||
16801 | guerimand | 323 | !else |
324 | setclass=$wims_class,$sharers |
||
16799 | guerimand | 325 | !endif |
12384 | bpr | 326 | !else |
327 | setclass=$wims_class |
||
23 | reyssat | 328 | !endif |
12384 | bpr | 329 | !if $allowtype=simulation |
10303 | guerimand | 330 | !for c in $setclass |
12384 | bpr | 331 | !writefile wimshome/log/classes/$c/.E$exam # |
10303 | guerimand | 332 | !next c |
12384 | bpr | 333 | !else |
334 | IPlist=!translate ,;\ |
||
335 | * to $ $ in $_output |
||
336 | IPlist=!trim $IPlist |
||
337 | !if $allowtype=select and $IPlist=$empty and $save!=$empty |
||
338 | allowtype=all |
||
339 | !endif |
||
340 | !if $allowtype=all |
||
341 | allow_parm= |
||
342 | !endif |
||
343 | !if $allowtype=none |
||
344 | allow_parm=none |
||
345 | !endif |
||
346 | !if $allowtype=select |
||
347 | allow_parm=$IPlist |
||
348 | !endif |
||
349 | !if $allowtype=techvar |
||
350 | !readproc adm/vfilter/shexselect.proc E$exam |
||
351 | !endif |
||
352 | !! --- save modification of allow parameters |
||
353 | !if $save!=$empty |
||
354 | !if $allow_parm=$empty |
||
16777 | guerimand | 355 | setclass=!items2words $setclass |
12384 | bpr | 356 | !sh for c in $setclass; do rm -f $wims_home/log/classes/$$c/.E$exam; done |
357 | !else |
||
358 | !for c in $setclass |
||
359 | !writefile wimshome/log/classes/$c/.E$exam $allow_parm |
||
360 | !next c |
||
361 | !endif |
||
362 | wims_class_log=exam $exam allow $allowtype $allowshare by $wims_realuser |
||
363 | !endif |
||
364 | !! --- end of saving |
||
10303 | guerimand | 365 | |
12384 | bpr | 366 | !if $cutt notsametext $cutt_save |
367 | cutt=!text select char 0123456789,.:; in $cutt |
||
368 | cutt=!translate ,; to $ $ in $cutt |
||
369 | cutt=!singlespace $cutt |
||
370 | !! --------------- format verification of cuttime |
||
371 | nbcutt=!wordcnt $cutt |
||
372 | fcutt= |
||
373 | !for k=1 to $nbcutt |
||
374 | tmp=!word $k of $cutt |
||
375 | tmp=!replace internal . by , in $tmp |
||
376 | n=!charcnt $(tmp[1]) |
||
377 | !if $n!=8 |
||
14335 | bpr | 378 | !reset tmp |
12384 | bpr | 379 | !else |
14335 | bpr | 380 | ti=!replace internal : by , in $(tmp[2]) |
381 | !distribute item $ti into h,m |
||
382 | h=$[$h*1] |
||
383 | m=$[$m*1] |
||
384 | !if $h<0 or $h>23 or $m<0 or $m>59 or NaN isin $h$m |
||
385 | !reset tmp |
||
386 | !else |
||
387 | h=!char 2 to 3 of $[100+$h] |
||
388 | m=!char 2 to 3 of $[100+$m] |
||
389 | fcutt=!append word $(tmp[1]).$h:$m to $fcutt |
||
390 | !endif |
||
12384 | bpr | 391 | !endif |
392 | !next k |
||
393 | cutt=$fcutt |
||
394 | cutt=!sort words $cutt |
||
395 | !! --------------- end of format verification |
||
396 | !distribute lines 6\ |
||
23 | reyssat | 397 | $cutt into update_field,update_content |
12384 | bpr | 398 | !read update.exam |
399 | cutt_save=$cutt |
||
400 | !endif |
||
10303 | guerimand | 401 | !endif |
23 | reyssat | 402 | !endif |
403 | |||
11970 | guerimand | 404 | !! --------------- get/save weight parameter |
405 | rec=!record 0 of wimshome/log/classes/$wims_class/exams/.eseverity |
||
406 | !if $save!=$empty |
||
12384 | bpr | 407 | !bound weight between $min_weight and $max_weight default $df_weight |
408 | nb=!linecnt $rec |
||
409 | !if $exam>$nb |
||
14335 | bpr | 410 | !for k=$nb+1 to $exam |
411 | rec=!append line $df_weight to $rec |
||
412 | !next k |
||
12384 | bpr | 413 | !endif |
414 | rec=!replace line number $exam by $weight in $rec |
||
415 | !writefile wimshome/log/classes/$wims_class/exams/.eseverity $rec |
||
11970 | guerimand | 416 | !endif |
417 | s_weight=!line $exam of $rec |
||
418 | !default weight=$s_weight |
||
419 | |||
10303 | guerimand | 420 | !if $allow=$empty or $save!=$empty |
12384 | bpr | 421 | !! --- read saving configuration for allow parameters initial time and after saving |
422 | !readproc adm/vfilter/shexread.proc E$exam |
||
13368 | guerimand | 423 | !read adm/scorerestriction put\ |
11841 | guerimand | 424 | $IPlist |
23 | reyssat | 425 | !endif |
10303 | guerimand | 426 | old_allowtype=$allowtype |
427 | old_allowtechvar=$allowtechvar |
||
428 | !reset allow,save |
||
23 | reyssat | 429 | |
430 | !if $job iswordof student score |
||
12384 | bpr | 431 | !if $wims_user=supervisor |
432 | allowtype=simulation |
||
433 | !else |
||
434 | simutest=!record 0 of wimshome/$wims_sesdir/examsimu.$exam |
||
435 | !if $allowtype!=simulation and yes iswordof $simutest |
||
436 | error=simuchange |
||
437 | !exit |
||
438 | !endif |
||
23 | reyssat | 439 | !endif |
440 | !endif |
||
441 | |||
442 | !if $job!=text |
||
12384 | bpr | 443 | !if $title_save$desc_save=$empty |
444 | rec=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
||
17382 | guerimand | 445 | !distribute lines $rec into bidon,bidon,setup_save,title_save,desc_save,cutt_save,comment_save,formal_hidden_condition_save,mode_save |
12384 | bpr | 446 | !endif |
447 | setup=$setup_save |
||
448 | title=$title_save |
||
449 | desc=$desc_save |
||
450 | cutt=$cutt_save |
||
451 | comment=$comment_save |
||
16006 | guerimand | 452 | !readproc adm/vfilter/convertformat.proc human\ |
453 | $formal_hidden_condition_save |
||
17328 | guerimand | 454 | !if $output_error!=$empty |
455 | error=hiddenbadtechvar |
||
456 | display=1 |
||
17527 | bpr | 457 | !endif |
16006 | guerimand | 458 | hidden_condition=$output_convertformat |
17382 | guerimand | 459 | mode=$mode_save |
23 | reyssat | 460 | !else |
12384 | bpr | 461 | !if $title=$empty |
462 | error=no_title |
||
463 | !exit |
||
464 | !endif |
||
16006 | guerimand | 465 | !if $hidden_condition!=$empty |
17527 | bpr | 466 | !readproc adm/vfilter/convertformat.proc formal\ |
16006 | guerimand | 467 | $hidden_condition |
17527 | bpr | 468 | formal_hidden_condition=$output_convertformat |
469 | !readproc adm/vfilter/convertformat.proc human\ |
||
16195 | guerimand | 470 | $formal_hidden_condition |
17527 | bpr | 471 | hidden_condition=$output_convertformat |
472 | !if $output_error!=$empty |
||
473 | error=badtechvarname $output_error |
||
474 | !endif |
||
16006 | guerimand | 475 | !else |
17527 | bpr | 476 | formal_hidden_condition=$empty |
16006 | guerimand | 477 | !endif |
12384 | bpr | 478 | !ifval $activetest<=0 |
479 | !bound duration between integer $duration_min and $duration_max default $duration_default |
||
480 | !bound tries between integer $tries_min and $tries_max default $tries_default |
||
17553 | bpr | 481 | !bound minscore between integer $minscore_min and $minscore_max default $minscore_default |
17840 | czzmrn | 482 | !if $mode=1 |
483 | setup=$duration $tries $minscore |
||
484 | !else |
||
17553 | bpr | 485 | setup=$duration $tries |
486 | !endif |
||
12384 | bpr | 487 | !else |
488 | rec=!record $exam of wimshome/log/classes/$wims_class/exams/.exams |
||
489 | !distribute lines $rec into bidon,bidon,setup_save |
||
490 | setup=$setup_save |
||
491 | !endif |
||
492 | desc=!replace $\ |
||
23 | reyssat | 493 | $ by in $desc |
12384 | bpr | 494 | title=!singlespace $title |
495 | desc=!singlespace $desc |
||
496 | title=!char 1 to $title_limit of $title |
||
497 | desc=!char 1 to $desc_limit of $desc |
||
17430 | guerimand | 498 | !if $activetest=0 |
499 | !bound mode between 0 and 1 default $mode_save |
||
500 | !else |
||
501 | mode=$mode_save |
||
502 | !endif |
||
12384 | bpr | 503 | !if $exam_exist=yes |
504 | !distribute lines 2\ |
||
23 | reyssat | 505 | $expiration into update_field,update_content |
12384 | bpr | 506 | !read update.exam |
507 | !distribute lines 3\ |
||
23 | reyssat | 508 | $setup into update_field,update_content |
12384 | bpr | 509 | !read update.exam |
510 | !distribute lines 4\ |
||
23 | reyssat | 511 | $title into update_field,update_content |
12384 | bpr | 512 | !read update.exam |
513 | !distribute lines 5\ |
||
23 | reyssat | 514 | $desc into update_field,update_content |
12384 | bpr | 515 | !read update.exam |
516 | !distribute lines 6\ |
||
2329 | guerimand | 517 | $cutt into update_field,update_content |
12384 | bpr | 518 | !read update.exam |
519 | !distribute lines 7\ |
||
2329 | guerimand | 520 | $comment into update_field,update_content |
12384 | bpr | 521 | !read update.exam |
16006 | guerimand | 522 | !distribute lines 8\ |
523 | $formal_hidden_condition into update_field,update_content |
||
524 | !read update.exam |
||
17430 | guerimand | 525 | !if $activetest=0 |
526 | !distribute lines 9\ |
||
17382 | guerimand | 527 | $mode into update_field,update_content |
17430 | guerimand | 528 | !read update.exam |
529 | !endif |
||
12384 | bpr | 530 | !else |
531 | !appendfile wimshome/log/classes/$wims_class/exams/.exams :0\ |
||
23 | reyssat | 532 | $expiration\ |
533 | $setup\ |
||
534 | $title\ |
||
535 | $desc\ |
||
2329 | guerimand | 536 | $cutt\ |
16006 | guerimand | 537 | $comment\ |
17382 | guerimand | 538 | $formal_hidden_condition\ |
539 | $mode |
||
12384 | bpr | 540 | exam_exist=yes |
541 | activetest=0 |
||
542 | exam=!recordcnt wimshome/log/classes/$wims_class/exams/.exams |
||
543 | !writefile wimshome/log/classes/$wims_class/exams/.exam$exam |
||
544 | !endif |
||
545 | title_save=$title |
||
546 | desc_save=$desc |
||
547 | setup_save=$setup |
||
548 | cutt_save=$cutt |
||
549 | comment_save=$comment |
||
16006 | guerimand | 550 | formal_hidden_condition_save=$formal_hidden_condition |
17382 | guerimand | 551 | mode_save=$mode |
23 | reyssat | 552 | !endif |
17553 | bpr | 553 | !if $mode=1 |
554 | !distribute words $setup into sdure,stries,sminscore |
||
555 | !else |
||
556 | !distribute words $setup into sdure,stries,sprime |
||
557 | !endif |
||
23 | reyssat | 558 | !default sprime=0 |
17553 | bpr | 559 | !default sminscore=100 |
23 | reyssat | 560 | duration=$sdure |
17553 | bpr | 561 | minscore=$sminscore |
23 | reyssat | 562 | !if $activetest>0 or $wims_user=supervisor |
15841 | bpr | 563 | !! FIXME unuseless if one wants to create an exam ?? |
12384 | bpr | 564 | !read score.proc |
23 | reyssat | 565 | !endif |
566 | |||
17553 | bpr | 567 | !if $job=activate and $[$activetest]=0 or ($exam_mode=1 and $job=text and $[$activetest]=0) |
568 | !if $job=activate and $[$activetest]=0 |
||
569 | !distribute item 1,1 into update_field,update_content |
||
570 | !read update.exam |
||
571 | !endif |
||
17430 | guerimand | 572 | !if $exam_mode=1 |
17542 | bpr | 573 | !! fix exercise dependancy in case of course mode to lock exercice order |
574 | !! and protect for adress hack |
||
17430 | guerimand | 575 | dataexam=$empty |
576 | dataexam=!record 1 of wimshome/log/classes/$wims_class/exams/.exam$exam |
||
577 | dataexam=:$dataexam |
||
578 | !for k=2 to $exocnt |
||
579 | dt=!record $k of wimshome/log/classes/$wims_class/exams/.exam$exam |
||
580 | dt=$dt\ |
||
17433 | guerimand | 581 | \ |
17430 | guerimand | 582 | |
17553 | bpr | 583 | dt=!replace line number 4 by $[$k-1]:$minscore in $dt |
17430 | guerimand | 584 | dataexam=!append line :$dt to $dataexam |
585 | !next k |
||
586 | !writefile wimshome/log/classes/$wims_class/exams/.exam$exam $dataexam |
||
587 | !endif |
||
17553 | bpr | 588 | !if $job=activate |
589 | activetest=1 |
||
590 | !endif |
||
23 | reyssat | 591 | !endif |
592 | |||
14108 | guerimand | 593 | !if $activetest=0 |
16006 | guerimand | 594 | !readproc vfilter/listvarfilter.proc |
14108 | guerimand | 595 | # delete an item |
596 | !if $job=delete and $delete>0 and $delete<=$exocnt |
||
14109 | guerimand | 597 | !read adm/sheet/sheetexam.shift exam,$exam,,$delete |
14108 | guerimand | 598 | delete= |
599 | exocnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$exam |
||
600 | !endif |
||
23 | reyssat | 601 | |
14109 | guerimand | 602 | # move to specific position |
17553 | bpr | 603 | !if $job=moveto and $movetarget>=1 and $movetarget<=$[$exocnt+1] \ |
604 | and $movesource!=$movetarget and $movesource>=1 and $movesource<=$exocnt |
||
14109 | guerimand | 605 | !read adm/sheet/sheetexam.shift exam,$exam,$movetarget,$movesource |
606 | !endif |
||
23 | reyssat | 607 | !endif |
608 | |||
609 | # modify an exercise |
||
610 | !if $job=exo |
||
12384 | bpr | 611 | !if $activetest>0 |
612 | error=active_exam |
||
613 | job=$empty |
||
614 | !exit |
||
615 | !endif |
||
616 | !bound $exo between integer 1 and $exocnt+1 default $exocnt+1 |
||
10477 | guerimand | 617 | |
12384 | bpr | 618 | ee=!record $exo of wimshome/log/classes/$wims_class/exams/.exam$exam |
619 | !distribute lines $ee into w_,c_,n_,d_,o_,co_ |
||
2731 | guerimand | 620 | !! !if $echoose$ename$eweight!=$empty |
12384 | bpr | 621 | !if $save2!=$empty |
622 | !if $echoose=$empty |
||
623 | !if $c_!=$empty |
||
624 | echoose=$c_ |
||
625 | !else |
||
626 | error=prep_noexercise |
||
627 | !reset save2 |
||
628 | !exit |
||
629 | !endif |
||
2789 | guerimand | 630 | !endif |
12384 | bpr | 631 | !bound eweight between 0,10 default 1 |
632 | ename=!singlespace $ename |
||
633 | ename=!char 1 to $etitle_limit of $ename |
||
634 | !default ename=Ex |
||
635 | edep=!char 1 to 100 of $edep |
||
636 | eopt=!listintersect $eopt and $optionlist |
||
637 | update_content=$eweight\ |
||
23 | reyssat | 638 | $echoose\ |
639 | $ename\ |
||
640 | $edep\ |
||
2329 | guerimand | 641 | $eopt\ |
642 | $ecomment |
||
12384 | bpr | 643 | update_field=0 |
644 | !reset save2 |
||
645 | !read update.exo |
||
646 | !reset job,sasheets |
||
647 | !if $error=$empty |
||
648 | msg_info=addexook |
||
649 | !endif |
||
650 | !changeto var.proc |
||
651 | !else |
||
652 | eweight=$w_ |
||
653 | echoose=$c_ |
||
654 | ename=$n_ |
||
655 | edep=$d_ |
||
656 | eopt=$o_ |
||
657 | ecomment=$co_ |
||
23 | reyssat | 658 | !endif |
659 | !endif |
||
660 | |||
3245 | guerimand | 661 | erasable=no |
23 | reyssat | 662 | !if $[$activetest]=0 |
12384 | bpr | 663 | erasable=yes |
664 | scnt=!recordcnt wimshome/log/classes/$wims_class/exams/.exams |
||
665 | !for s=$exam+1 to $scnt |
||
666 | l=!record $s of wimshome/log/classes/$wims_class/exams/.exams |
||
667 | l=!line 1 of $l |
||
668 | !if $l>0 |
||
669 | erasable=no |
||
670 | !endif |
||
671 | !next s |
||
23 | reyssat | 672 | !endif |
673 | |||
3245 | guerimand | 674 | !if $back=1 and $error=$empty |
12384 | bpr | 675 | !restart module=home |
3245 | guerimand | 676 | !endif |
677 | |||
8903 | czzmrn | 678 | !if $job iswordof scorereg renew cpsheet cpexam |
12384 | bpr | 679 | !read $job.proc |
23 | reyssat | 680 | !endif |