Subversion Repositories wimsdev

Rev

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