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