Subversion Repositories wimsdev

Rev

Rev 16195 | Rev 16728 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
23 reyssat 1
# Variable calculations should be done in this file.
2
# It is read and interpreted by wims for all valid calls to the module.
2368 bpr 3
!read adm/class/classlang names.phtml
13046 bpr 4
!! number of lines in a record of a sheet
15763 guerimand 5
!set sheetrecordlimit=11
13046 bpr 6
 
10339 bpr 7
!if $job!=$empty and $job notwordof text modify
12701 bpr 8
  job1=$job
9
  !!for the icon and the title
10339 bpr 10
  !if $job=getsource
11
    job1=sheetsource
12
  !endif
13
  !if $job=prep_putsource
14
    job1=putsource
15
  !endif
10512 bpr 16
  !default name_$(job1)=$(wims_name_$job1)
17
  wims_ariane=!append line sheetadmin,1,cmd=resume to $wims_ariane
18
  !if $(name_$(job1))!=$empty or
19
    wims_ariane=!append line "$(name_$(job1))",8, to $wims_ariane
20
  !endif
10339 bpr 21
!else
22
  !set wims_ariane=!append line sheetadmin,8 to $wims_ariane
23
!endif
24
!set wims_ariane_self=no
25
 
9670 guerimand 26
scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
27
!if $sheet>$scnt
12312 bpr 28
  wims_infoshow=yes
29
  !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat
9670 guerimand 30
!endif
9655 guerimand 31
!if $cmd=resume
12312 bpr 32
  !bound infoshow within yes,no default $wims_infoshow
33
  wims_infoshow=$infoshow
34
  !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat
9655 guerimand 35
!endif
36
 
11965 guerimand 37
tmp=!defof MAX_SHEETS\
11967 guerimand 38
MAX_REQUIRE\
39
DF_SEVERITY\
40
MIN_WEIGHT\
41
MAX_WEIGHT in wimshome/public_html/bases/sys/define.conf
42
!distribute line $tmp into max_sheets,require_limit,df_severity,min_weight,max_weight
23 reyssat 43
title_limit=80
44
desc_limit=4000
45
etitle_limit=100
46
edesc_limit=400
12316 bpr 47
 
8255 bpr 48
require_limit=$[$require_limit/10]
10305 guerimand 49
wims_prefix=class user tmp n sharing sharable techvar
23 reyssat 50
srcname=wimshome/$wims_sesdir/home_sheet.src
51
wims_helper=chapter=3
52
 
1533 guerimand 53
!readproc tabletheme
23 reyssat 54
!if $wims_user!=supervisor
12312 bpr 55
  error=not_supervisor
56
  !exit
23 reyssat 57
!endif
1980 guerimand 58
!if $job=chseries
12312 bpr 59
  !changeto chseries.proc
1980 guerimand 60
!endif
11633 bpr 61
!readproc adm/levelname.phtml
1980 guerimand 62
!readproc adm/search_engine/names.$lang
63
!readproc adm/search_engine/mklist_form.proc
23 reyssat 64
 
65
today=!char 1 to 8 of $wims_now
66
thisyear=!char 1 to 4 of $today
67
 
7290 bpr 68
!if $class_expiration=$empty
12312 bpr 69
  !defread wimshome/log/classes/$wims_class/.def
70
  !if $wims_superclass!=$empty
71
    class_expiration=!defof class_expiration in wimshome/log/classes/$wims_superclass/.def
72
  !endif
23 reyssat 73
!endif
1533 guerimand 74
 
23 reyssat 75
!if $class_expiration=$empty
12312 bpr 76
  error=bad_class
77
  !exit
23 reyssat 78
!endif
79
 
80
sharers=
81
sharing1=!defof sharable_sheet in wimshome/log/classes/$wims_class/neighbors
82
!for c in $sharing1
12312 bpr 83
  d=!defof sharing_sheet in wimshome/log/classes/$c/neighbors
84
  !if $d issametext $wims_class
85
    sharers=!append item $c to $sharers
86
  !endif
23 reyssat 87
!next c
11967 guerimand 88
 
12089 guerimand 89
!if $save!=$empty
12312 bpr 90
  jquery_defined=!defof jquery_defined in themes/$wims_theme/header.phtml
91
  !if $jquery_defined=yes
11800 guerimand 92
    expmon=!char 5 to 6 of $expdate
93
    expday=!char 7 to 8 of $expdate
94
    expyear=!char 1 to 4 of $expdate
14366 guerimand 95
  !else
96
    expmon=!char 2,3 of $[abs(floor($monthexpdate))+100]
97
    expday=!char 2,3 of $[abs(floor($dayexpdate))+100]
98
    expyear=!char -4 to -1 of $[abs(floor($yearexpdate))+100000]
99
    expdate=$(expyear)$(expmonth)$(expday)
12312 bpr 100
  !endif
101
  !if $expday>=1 and $expday<=31 and $expmon>=1 and $expmon<=12 \
14335 bpr 102
      and $expyear>=$thisyear and $expyear<=$thisyear+1 \
103
      and $expyear$expmon$expday>$today \
104
      and $expyear$expmon$expday<=$class_expiration \
105
      and N notin $expmon$expday$expyear
12312 bpr 106
    expiration=$expyear$expmon$expday
107
    expdate=$expiration
108
  !else
109
    !if $expyear$expmon$expday>$class_expiration
110
      !readproc adm/date.phtml $class_expiration
111
      error=toolate
112
    !else
113
      expiration=$class_expiration
114
      expdate=$expiration
115
    !endif
116
  !endif
23 reyssat 117
!endif
12089 guerimand 118
 
8255 bpr 119
!if $sheet>$max_sheets
12312 bpr 120
  error=bad_maxsheet
121
  !exit
3062 bpr 122
!endif
123
 
124
!if $sheet<1
12312 bpr 125
  error=bad_sheet
126
  !exit
23 reyssat 127
!endif
128
# menu preparation
129
!if $job!=$empty and $job iswordof \
14335 bpr 130
    prep_activate prep_erase prep_expire prep_putsource prep_modify
12312 bpr 131
  data=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets
15763 guerimand 132
  !distribute lines $data into active,expire,title,desc,bla,comment,attribut,exodescshow,formal_hidden_condition,indivtechvar
12387 bpr 133
  !if $modif!=$empty
134
    exo=!record $modif of wimshome/log/classes/$wims_class/sheets/.sheet$sheet
135
    !distribute lines $exo into D_,p_
136
    !read getparm $p_ exotrymax
137
  !endif
12312 bpr 138
  error=$job
7801 bpr 139
  !if $expire < $today
140
    test_expire=$expire,$today
141
  !endif
15859 guerimand 142
  !if $indivtechvar!=$empty and ($job=prep_modify or $job=prep_activate)
15763 guerimand 143
    !readproc adm/vfilter/listvarfilter.proc
144
    nb=!positionof item $indivtechvar in $tv_listcode
145
    !if $nb!=$empty
146
      don=!line $nb of $tv_listtechvar
147
      !distribute item $don into name,classid,number
148
      don=!record $number of wimshome/log/classes/$classid/.techvar
149
      listval=!line 2 of $don
15910 guerimand 150
      nbtechvalue=!itemcnt $listval
15763 guerimand 151
    !else
152
      !reset indivtechvar
153
    !endif
154
  !endif
15859 guerimand 155
  !if $job=prep_activate
156
     !read adm/sheet/checkdepindiv
157
     !if $sheet isitemof $sheet_dependancy and $sheet isitemof $sheet_indivtechvar
158
        error=depindiv
159
        !reset job
160
     !endif
161
  !endif
12312 bpr 162
  !exit
23 reyssat 163
!endif
164
scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
165
!if $job=erase and $sheet<=$scnt and $sheet>=1
12312 bpr 166
  test=
167
  !for s=$sheet to $scnt
168
    l=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets
169
    l=!line 1 of $l
170
    !if $l>0
171
     test=notclean
172
    !endif
173
  !next s
174
  !if $test=$empty
175
    update_field=0
176
    !read proc/update.docindex
177
    !read update.sheet
23 reyssat 178
  !endif
12312 bpr 179
  !restart module=home
23 reyssat 180
!endif
181
 
9679 guerimand 182
!if $job=duplicate
12312 bpr 183
  !changeto $job.proc
9679 guerimand 184
!endif
185
 
23 reyssat 186
!if $job=expire
12312 bpr 187
  !distribute item 1,2 into update_field,update_content
188
  !read update.sheet
189
  job=
23 reyssat 190
!endif
191
 
192
!if $job=hide
12312 bpr 193
  !distribute item 1,3 into update_field,update_content
194
  !read update.sheet
195
  job=
23 reyssat 196
!endif
197
 
8093 bpr 198
!if $job=reactivate
12312 bpr 199
  !distribute item 1,1 into update_field,update_content
200
  !read update.sheet
201
  job=
23 reyssat 202
!endif
203
 
204
!if $job=deactivate
12312 bpr 205
  !read var.proc.deactivate
23 reyssat 206
!else
12312 bpr 207
  confirmed=!replace word share by $ in $confirmed
208
  confirmed=!singlespace $confirmed
23 reyssat 209
!endif
210
 
211
activetest=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets
212
a_=!line 1 of $activetest
213
a_=!trim $a_
214
expp=!line 2 of $activetest
215
!default expiration=$expp
7801 bpr 216
 
217
!if $expiration>$class_expiration or $test_expire!=$empty
12312 bpr 218
  expiration=$class_expiration
23 reyssat 219
!endif
7801 bpr 220
 
23 reyssat 221
ecnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet
15767 guerimand 222
wims_listexo=!values v for v=1 to $ecnt
223
!setdef wims_listexo=$wims_listexo in wimshome/sessions/$wims_session/var.stat
1513 guerimand 224
activetest=!replace line number 3 by $ecnt in $activetest
23 reyssat 225
 
226
!if $job=putsource and $a_=0
12312 bpr 227
  source=!trim $source
228
  !writefile $srcname $source
229
  putcnt=!recordcnt $srcname
230
  !for i=1 to $putcnt
231
    s_=!record $i of $srcname
232
    n_=!linecnt $s_
233
    bad_source=$i
13046 bpr 234
    !if $n_>=5 and $n_<=$sheetrecordlimit
12312 bpr 235
      !distribute lines $s_ into di,pa,re,we,ti,de
236
      !for k in re,we,di,pa,ti,de
237
        $k=!trim $($k)
238
        w$k=!wordcnt $($k)
239
      !next k
240
      !if NaN isin $[$re]$[$we] or $[$wre*$wwe*$wdi]!=1 or $wpa>1 or $ti=$empty or\
14335 bpr 241
          .. isin $di or $re<0 or $we<0 or ($re>0 and $we=0)
12312 bpr 242
         error=bad_source
243
        !exit
244
      !endif
245
      ti=!char 1 to $etitle_limit of $ti
246
      de=!char 1 to $edesc_limit of $de
247
      source_$i=$s_
248
      last=$i
249
    !else
13046 bpr 250
      # last record may be empty
12312 bpr 251
      !if $i!=$putcnt
252
        error=bad_source
253
        !exit
254
      !endif
255
    !endif
256
  !next i
257
  !for i=1 to $last
258
    !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$sheet :$(source_$i)
259
  !next i
23 reyssat 260
!endif
261
 
262
!if $activetest!=$empty
12312 bpr 263
  sheet_exist=yes
264
  !default expiration=!line 2 of $activetest
265
  activetest=!line 1 of $activetest
266
  exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet
23 reyssat 267
!else
12312 bpr 268
  sheet_exist=no
269
  activetest=-1
270
  exocnt=0
271
  !default expiration=$class_expiration
23 reyssat 272
!endif
273
 
274
!if $job=getsource and $sheet_exist=yes
13640 obado 275
  !writefile $srcname
12312 bpr 276
  !for i=1 to $exocnt
277
    l=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$sheet
13640 obado 278
    # replace eventual html entities so it will not insert \n in textarea
279
    l=!replace internal &#13;&#10; by $ $ in $l
12312 bpr 280
    !appendfile $srcname $$:$l
281
  !next i
13640 obado 282
  !appendfile $srcname
12312 bpr 283
  !exit
23 reyssat 284
!endif
285
 
10062 guerimand 286
!readproc adm/vfilter/listvarfilter.proc
23 reyssat 287
!if $allow=yes
12312 bpr 288
  !if $tv_listname=$empty
289
    !bound allowtype within all,none,select default all
290
  !else
291
    !bound allowtype within all,none,select,techvar default all
292
  !endif
12994 guerimand 293
  !read adm/scorerestriction get
12312 bpr 294
  IPlist=$_output
295
  IPlist=!translate ,;\
23 reyssat 296
* to $    $ in $IPlist
12312 bpr 297
  IPlist=!trim $IPlist
298
  !if $allowtype=select and $IPlist=$empty and $save!=$empty
299
    allowtype=all
300
  !endif
301
  !if $allowtype=all
302
    allow_parm=
303
  !endif
304
  !if $allowtype=none
305
    allow_parm=none
306
  !endif
307
  !if $allowtype=select
308
    allow_parm=$IPlist
309
  !endif
10305 guerimand 310
 
12312 bpr 311
  !if $allowtype=techvar
312
    !readproc adm/vfilter/shexselect.proc $sheet
313
  !endif
10305 guerimand 314
!endif
11810 guerimand 315
 
11967 guerimand 316
!! --------------- get/save severity parameters
317
rec=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
318
!if $save!=$empty
12312 bpr 319
  !distribute word $df_severity into t1,t2,t3
320
  !bound weight between $min_weight and $max_weight default $t1
321
  !bound formulaA between integer 0 and 6 default $t2
322
  !bound formulaB between integer 0 and 2 default $t3
323
  nb=!linecnt $rec
13059 guerimand 324
  !! define maxscore default =10 (not general variable maybe we should ?)
325
  !if $nb=0
13060 bpr 326
    rec=10
13059 guerimand 327
  !endif
12312 bpr 328
  new=$weight $formulaA $formulaB
13058 guerimand 329
  !if $sheet>$nb-1
12312 bpr 330
    !for k=$nb+1 to $sheet+1
14335 bpr 331
      rec=!append line $df_severity to $rec
13058 guerimand 332
    !next k
12312 bpr 333
  !endif
334
  rec=!replace line number $[$sheet+1] by $new in $rec
335
  !writefile wimshome/log/classes/$wims_class/sheets/.severity $rec
11967 guerimand 336
!endif
337
rec=!line $[$sheet+1] of $rec
338
!distribute word $rec into s_weight,s_formulaA,s_formulaB
339
!default weight=$s_weight
340
!default formulaA=$s_formulaA
341
!default formulaB=$s_formulaB
342
 
10062 guerimand 343
!! ---- save modification of allow parameters
10305 guerimand 344
!if $save!=$empty
10062 guerimand 345
  !if $sharers!=$empty and $allowshare=1
12312 bpr 346
    setclass=!items2words $wims_class,$sharers
347
    setclass=!words2items $setclass
10062 guerimand 348
  !else
12312 bpr 349
    setclass=$wims_class
10062 guerimand 350
  !endif
351
  !if $allow_parm=$empty
12312 bpr 352
    !sh for c in $setclass; do rm -f $wims_home/log/classes/$$c/.$sheet; done
10062 guerimand 353
  !else
12312 bpr 354
    !for c in $setclass
355
      !writefile wimshome/log/classes/$c/.$sheet $allow_parm
356
    !next c
10062 guerimand 357
  !endif
358
  wims_class_log=sheet $sheet allow $allowtype $allowshare by $wims_realuser
10305 guerimand 359
!endif
10062 guerimand 360
!! ---- end of saving
23 reyssat 361
 
10062 guerimand 362
!if $allow=$empty or $save!=$empty
363
!! --- read saving configuration for allow parameters initial time and after saving
12312 bpr 364
  !readproc adm/vfilter/shexread.proc $sheet
11810 guerimand 365
!! to distribute IPlist content into variable
12312 bpr 366
  !read adm/scorerestriction put\
11810 guerimand 367
$IPlist
10062 guerimand 368
!endif
10244 guerimand 369
old_allowtype=$allowtype
370
old_allowtechvar=$allowtechvar
10062 guerimand 371
!reset allow,save
372
!! --- end of reading
23 reyssat 373
 
374
expmon=!char 5,6 of $expiration
375
expday=!char 7,8 of $expiration
376
expyear=!char 1,2,3,4 of $expiration
377
 
378
!if $job!=text
13640 obado 379
  # remove \n from textareas
12312 bpr 380
  mod_desc=!replace internal $\
13640 obado 381
$ by $ $ in $mod_desc
12312 bpr 382
  mod_comment=!replace internal $\
13640 obado 383
$ by $ $ in $mod_comment
12312 bpr 384
  !if $title_save$desc_save=$empty
385
    rec=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets
13831 bpr 386
    !distribute lines $rec into bidon,bidon,title_save,desc_save,prpage_save,\
15763 guerimand 387
      comment_save,attribut_save,exodescshow_save,formal_hidden_condition_save,\
388
      indivtechvar_save
15860 guerimand 389
      !bound indivtechvar_save within $empty,$tv_listlocalcode default $empty
12312 bpr 390
  !endif
391
  title=$title_save
392
  desc=$desc_save
393
  prpage=$prpage_save
394
  comment=$comment_save
13825 bpr 395
  exodescshow=$exodescshow_save
14441 guerimand 396
  !readproc adm/vfilter/convertformat.proc human\
397
$formal_hidden_condition_save
398
  hidden_condition=$output_convertformat
15763 guerimand 399
  indivtechvar=$indivtechvar_save
23 reyssat 400
!else
12312 bpr 401
  !if $title=$empty
402
    error=no_title
403
    !exit
404
  !endif
12801 obado 405
  title=!singlespace $title
406
  title=!char 1 to $title_limit of $title
407
  title=!replace internal : by &#58; in $title
408
 
12312 bpr 409
  desc=!replace internal $\
13640 obado 410
$ by $ $ in $desc
12801 obado 411
  desc=!singlespace $desc
412
  desc=!char 1 to $desc_limit of $desc
413
  desc=!replace internal : by &#58; in $desc
414
 
12312 bpr 415
  comment=!replace internal $\
13640 obado 416
$ by $ $ in $comment
12312 bpr 417
  comment=!singlespace $comment
12801 obado 418
 
12312 bpr 419
  prpage=!word 1 of $prpage
420
  prpage=!char 1 to 100 of $prpage
421
  !if .. isin $prpage or / notin $prpage
422
    prpage=
23 reyssat 423
  !endif
12312 bpr 424
  !if $prpage!=$empty
425
    test=!defof titb in wimshome/log/classes/$wims_class/doc/$prpage.def
426
    !if $test=$empty
427
      prpage=
428
    !endif
429
  !endif
14441 guerimand 430
  !if $hidden_condition!=$empty
431
    !readproc adm/vfilter/convertformat.proc formal\
432
$hidden_condition
433
    formal_hidden_condition=$output_convertformat
16195 guerimand 434
    !if $output_error!=$empty
435
      error=badtechvarname $output_error
436
    !endif
437
    !readproc adm/vfilter/convertformat.proc human\
438
$formal_hidden_condition
439
    hidden_condition=$output_convertformat
14441 guerimand 440
  !else
441
    formal_hidden_condition=$empty
442
  !endif
15763 guerimand 443
  !! indivtechvar is not modifiable when sheet is activated.
444
  !if $activetest>0
445
    rec=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets
446
    indivtechvar=!item 10 of $rec
447
  !endif
15860 guerimand 448
  !bound indivtechvar within $empty,$tv_listlocalcode default $empty
12312 bpr 449
  !if $sheet_exist=yes
450
    !distribute lines 2\
23 reyssat 451
$expiration into update_field,update_content
12312 bpr 452
    !read update.sheet
12801 obado 453
 
12312 bpr 454
    !distribute lines 3\
23 reyssat 455
$title into update_field,update_content
12312 bpr 456
    !read update.sheet
12801 obado 457
 
12312 bpr 458
    !distribute lines 4\
23 reyssat 459
$desc into update_field,update_content
12312 bpr 460
    !read update.sheet
12801 obado 461
 
12312 bpr 462
    !distribute lines 5\
23 reyssat 463
$prpage into update_field,update_content
12312 bpr 464
    !read update.sheet
12801 obado 465
 
12312 bpr 466
    !distribute lines 6\
1969 guerimand 467
$comment into update_field,update_content
12312 bpr 468
    !read update.sheet
13825 bpr 469
 
470
    !distribute lines 7\
471
$attribut into update_field,update_content
472
    !read update.sheet
14646 bpr 473
 
13825 bpr 474
    !distribute lines 8\
475
$exodescshow into update_field,update_content
476
    !read update.sheet
14646 bpr 477
 
14441 guerimand 478
    !distribute lines 9\
479
$formal_hidden_condition into update_field,update_content
480
    !read update.sheet
481
 
15763 guerimand 482
    !if $activetest=0
483
      !distribute lines 10\
484
$indivtechvar into update_field,update_content
485
    !read update.sheet
486
 
487
    !endif
488
 
12312 bpr 489
  !else
490
    !appendfile wimshome/log/classes/$wims_class/sheets/.sheets :0\
23 reyssat 491
$expiration\
492
$title\
493
$desc\
1969 guerimand 494
$prpage\
13825 bpr 495
$comment\
496
$attribut\
14441 guerimand 497
$exodescshow\
15763 guerimand 498
$formal_hidden_condition\
15859 guerimand 499
$empty
500
    indivtechvar=$empty
12312 bpr 501
    sheet_exist=yes
502
    activetest=0
503
    sheet=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
504
    !writefile wimshome/log/classes/$wims_class/sheets/.sheet$sheet
14242 obado 505
    message=$name_createok
12312 bpr 506
  !endif
507
  title_save=$title
508
  desc_save=$desc
509
  prpage_save=$prpage
510
  comment_save=$comment
13825 bpr 511
  attribut_save=$attribut
512
  exodescshow_save=$exodescshow
14441 guerimand 513
  formal_hidden_condition_save=$formal_hidden_condition
15763 guerimand 514
  indivtechvar_save=$indivtechvar
23 reyssat 515
!endif
516
 
517
!if $job=activate and $[$activetest]=0
15859 guerimand 518
  !read adm/sheet/checkdepindiv
519
  !if $sheet isitemof $sheet_dependancy and $sheet isitemof $sheet_indivtechvar
520
    error=depindiv
521
    !reset job
522
    !exit
523
  !endif
15857 guerimand 524
  !read adm/sheet/writeweights
12312 bpr 525
  !if $test_expire!=$empty
526
    !distribute items 2,$expiration into update_field,update_content
7801 bpr 527
    !read update.sheet
528
    !reset test_expire
12312 bpr 529
  !endif
530
  !distribute item 1,1 into update_field,update_content
531
  !read update.sheet
532
  activetest=1
533
  wims_class_log=activate sheet $sheet by $wims_realuser
23 reyssat 534
!endif
535
 
13208 obado 536
!! only delete or move items when sheet has not been activated
537
!if $activetest=0
538
  # delete an item
539
  !if $job=delete and $delete>0 and $delete<=$exocnt
14105 guerimand 540
    !read adm/sheet/sheetexam.shift sheet,$sheet,,$delete
13208 obado 541
    delete=
542
    exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet
543
  !endif
23 reyssat 544
 
14104 guerimand 545
  # move to specific position
14113 guerimand 546
  !if $job=moveto and $movetarget>=1 and $movetarget<=$[$exocnt+1] and $movesource!=$movetarget and $movesource>=1 and $movesource<=$exocnt
14105 guerimand 547
    !read adm/sheet/sheetexam.shift sheet,$sheet,$movetarget,$movesource
14104 guerimand 548
  !endif
549
 
15763 guerimand 550
  # change individualisation of sheet with a technical variable
15860 guerimand 551
  !if $job=indiv and $indivtechvar!=0 and $indivtechvar!=$empty
15763 guerimand 552
    !read indiv.proc
553
  !endif
16022 bpr 554
 
13432 bpr 555
!endif
556
 
23 reyssat 557
# modify an item
558
!if $job=modify and $modif>0 and $modif<=$exocnt
12312 bpr 559
  !if $activetest=0
560
    exo=!record $modif of wimshome/log/classes/$wims_class/sheets/.sheet$sheet
561
    !distribute lines $exo into D_,p_
13315 bpr 562
    ####
12312 bpr 563
    iniparm=$p_
12387 bpr 564
    !read getparm $iniparm exo random qnum exotrymax
12312 bpr 565
    exocnt_=!itemcnt $get_exo
13315 bpr 566
    #### common with addmodule
12387 bpr 567
    iniparm2=!replace internal & by $\
568
$ in $iniparm
569
    iniparm2_cnt=!linecnt $iniparm2
570
    new_iniparm=
571
    equal==
12312 bpr 572
    !if $get_random=0
573
      !for i=1 to $get_qnum
16037 bpr 574
        update_order=!append item $(update_ex$i) to $update_order
12312 bpr 575
      !next
576
      get_exo=$(get_exo[$update_order])
577
      !for v in $get_exo
13760 bpr 578
        new_iniparm=!append line exo=$v to $new_iniparm
12312 bpr 579
      !next
580
      !for u=1 to $iniparm2_cnt
581
        l=!line $u of $iniparm2
582
        !if exo$equal notin $l
13760 bpr 583
          new_iniparm=!append line $l to $new_iniparm
12312 bpr 584
        !endif
585
      !next
13760 bpr 586
      new_iniparm=!replace internal $\
587
$ by & in $new_iniparm
12312 bpr 588
      new_iniparm=!nospace $new_iniparm
589
      p_=$new_iniparm
7354 bpr 590
    !endif
12387 bpr 591
    !if $get_exotrymax!=$mod_exotrymax
592
      tmp=!nospace $mod_exotrymax
593
      !if exotrymax isin $p_
13315 bpr 594
        !if $tmp!=$empty
595
          p_=!replace internal exotrymax=$get_exotrymax by exotrymax=$tmp in $p_
596
        !else
597
          p_=!replace internal exotrymax=$get_exotrymax by in $p_
598
        !endif
12400 bpr 599
      !else
12387 bpr 600
        !if $tmp!=$empty
12400 bpr 601
          p_=$p_&exotrymax=$tmp
12387 bpr 602
          !reset mod_exotrymax
603
        !endif
604
      !endif
605
      p_=!nospace $p_
12400 bpr 606
      p_=!replace internal && by & in $p_
12387 bpr 607
      !reset tmp
608
    !endif
609
 
13315 bpr 610
    #####
15910 guerimand 611
    mod_indiv=!listintersection $mod_indiv and $listval
612
    !bound mod_weight between $min_weight and $max_weight default 1
12312 bpr 613
    !bound mod_require between 0 and $[10*$require_limit] default 0
15910 guerimand 614
    !if $mod_indiv!=$empty
16022 bpr 615
      nbvalue=!itemcnt $listval
15910 guerimand 616
      !distribute item $max_weight,$[10*$require_limit],$min_weight,0 into limitM_weight,limitM_require,limitm_weight,limitm_require
617
      !for type in weight,require
618
        tmp=$(mod_$type)
619
        !for k=1 to $nbvalue
620
          !bound $type$k between $(limitm_$type) and $(limitM_$type) default $tmp
621
          !if $($type$k)!=$tmp
622
            mod_$type=$(mod_$type);$(listval[$k]),$($type$k)
623
          !endif
624
        !next k
16022 bpr 625
      !next type
15910 guerimand 626
    !endif
12312 bpr 627
    mod_title=!singlespace $mod_title
628
    mod_desc=!singlespace $mod_desc
629
    mod_comment=!singlespace $mod_comment
630
    mod_title=!char 1 to $etitle_limit of $mod_title
631
    mod_desc=!char 1 to $edesc_limit of $mod_desc
632
    mod_comment=!char 1 to $edesc_limit of $mod_comment
4528 bpr 633
  !endif
12312 bpr 634
  !if $mod_feedback notsametext $empty
14646 bpr 635
    !reset mod_feedback_tmp
636
    tmpcnt=!itemcnt $(mod_feedback[;1])
637
    !for t_=1 to $tmpcnt
638
      mod_feedback_=$(mod_feedback[$t_;])
639
      mod_feedback_lim=$(mod_feedback_[2])
640
      mod_feedback_lim2=$(mod_feedback_[3])
641
      !bound mod_feedback_lim between 0 and 11 default 10
642
      !bound mod_feedback_lim2 between 0  and $mod_feedback_lim default 0
643
      mod_feedback_=!nospace $(mod_feedback_[1])
644
      mod_feedback_test=!replace = by _ in $mod_feedback_
645
      !if cmd_new notin $mod_feedback_test
646
        mod_feedback_=!nospace $mod_feedback_&cmd=new
647
      !endif
648
      !if adm/doc isin $mod_feedback_ and job_read notin $mod_feedback_test
649
        mod_feedback_=$mod_feedback_&job=read
650
      !endif
651
      mod_feedback_tmp=!append line $mod_feedback_,$mod_feedback_lim,$mod_feedback_lim2 to $mod_feedback_tmp
652
    !next
653
    mod_feedback=!lines2rows $mod_feedback_tmp
4528 bpr 654
  !endif
7290 bpr 655
 
12312 bpr 656
  exo=$modif
657
  !if $activetest=0
658
    update_content=$D_\
23 reyssat 659
$p_\
660
$mod_require\
661
$mod_weight\
662
$mod_title\
663
$mod_desc\
1969 guerimand 664
$mod_dep\
4528 bpr 665
$mod_comment\
12316 bpr 666
$mod_feedback\
15763 guerimand 667
$mod_attribut\
668
$mod_indiv
12312 bpr 669
    update_field=0
670
    !read adm/class/update.exo
4864 bpr 671
 !else
12312 bpr 672
    !distribute lines 5\
7290 bpr 673
$mod_title into update_field,update_content
12312 bpr 674
    !read adm/class/update.exo
675
    !distribute lines 6\
7290 bpr 676
$mod_desc into update_field,update_content
12312 bpr 677
    !read adm/class/update.exo
678
    !distribute lines 8\
7290 bpr 679
$mod_comment into update_field,update_content
12312 bpr 680
    !read adm/class/update.exo
681
    !distribute lines 9\
7290 bpr 682
$mod_feedback into update_field,update_content
12312 bpr 683
    !read adm/class/update.exo
12316 bpr 684
    !distribute lines 10\
685
$mod_attribut into update_field,update_content
686
    !read adm/class/update.exo
12312 bpr 687
  !endif
7290 bpr 688
 
12316 bpr 689
  !distribute items $ into mod_title,mod_desc,mod_weight,mod_require,mod_dep,\
15763 guerimand 690
    mod_comment,mod_feedback,mod_attribut,mod_indiv
23 reyssat 691
!endif
692
 
693
!if $[$activetest]=0
12312 bpr 694
  erasable=yes
695
  scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
696
  !for s=$sheet+1 to $scnt
697
    l=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets
698
    l=!line 1 of $l
699
    !if $l>0
700
      erasable=no
701
    !endif
702
  !next s
23 reyssat 703
!endif
704
 
3245 guerimand 705
!if $back=1 and $error=$empty
12312 bpr 706
  !restart module=home
7020 bpr 707
!endif