Subversion Repositories wimsdev

Rev

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