Subversion Repositories wimsdev

Rev

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