Subversion Repositories wimsdev

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
15836 guerimand 1
!! TODO this script is same as in file module/adm/raw/scripts/writeweights
2
!! it should be move to script/adm/class/sheet/
3
 
15847 bpr 4
!! this file generate :
5
!! .require require points of each exercise in a sheet
6
!! .weight weight of each exercise in a sheet
7
!! .active indicate hide/show of each exercise of the sheet
15849 bpr 8
!! .vars indicate if a technical variable is used to make indivual sheets
15770 guerimand 9
!!
15847 bpr 10
!! the three first files have the same format :
11
!! - each record is a sheet
15849 bpr 12
!! - first line of each record is the default line,
13
!!  the others correspond to the different technical value if it exists (defined in .vars) ;
14
!! - each word of the line correspond to the parameters for an exercise of the sheet
15847 bpr 15
!!
16
!! each record of .vars file is a sheet ; first line is technical variable name followed
17
!! by the list of values
23 reyssat 18
 
15850 bpr 19
!! remark: when activating/desactivating a single sheet, the script
15849 bpr 20
!! rebuilds all the files for all the sheets (maybe we could only work on the modified sheet)
15847 bpr 21
 
15783 guerimand 22
!readproc adm/vfilter/listvarfilter.proc
23 reyssat 23
scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
15847 bpr 24
!sh cd $wims_home/log/classes/$wims_class/sheets;\
15848 guerimand 25
 rm -f .require .weight .vars .active;\
26
 touch .require .weight .vars .active;
15847 bpr 27
 
23 reyssat 28
!for s=1 to $scnt
12701 bpr 29
  ecnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$s
15770 guerimand 30
  !reset indivtechvar_
31
  indivtechvar_=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets
32
  indivtechvar_=!line 10 of $indivtechvar_
15783 guerimand 33
  !if $indivtechvar_ notitemof $tv_listcode
34
    !reset indivtechvar_
35
  !endif
15770 guerimand 36
  !if $indivtechvar_!=$empty
37
    p=!positionof item $indivtechvar_ in $tv_listcode
38
    p=!line $p of $tv_listtechvar
39
    !distribute item $p into n_,cls_,num_
40
    tmp_=!record $num_ of wimshome/log/classes/$cls_/.techvar
41
    listval_=!line 2 of $tmp_
42
    !for k_ in $list_val_
43
      active_$k_=$empty
44
    !next k_
45
  !endif
12701 bpr 46
  !distribute item ,,, into reqs,weis
47
  !for e=1 to $ecnt
48
    r=!record $e of wimshome/log/classes/$wims_class/sheets/.sheet$s
15770 guerimand 49
    !distribute lines $r into t_,t_,r_,w_,t_,t_,t_,t_,t_,t_,indiv_
12701 bpr 50
    r_=$[$r_]
51
    w_=$[$w_]
52
    reqs=!append word $r_ to $reqs
53
    weis=!append word $w_ to $weis
15770 guerimand 54
    !if $indivtechvar_!=$empty
55
      !for k_ in $listval_
56
        !if $k_ isitemof $indiv_
57
          active_$k_=!append word 1 to $(active_$k_)
58
        !else
59
          active_$k_=!append word 0 to $(active_$k_)
60
        !endif
61
      !next k_
62
    !endif
12701 bpr 63
  !next e
15848 guerimand 64
  !appendfile wimshome/log/classes/$wims_class/sheets/.require :$reqs
65
  !appendfile wimshome/log/classes/$wims_class/sheets/.weight :$weis
15847 bpr 66
   --- build of require and weight (but with a simple copy of default weight and require
67
  v_=!values 1 for v=1 to $ecnt
68
  v_=!items2words $v_
69
  !appendfile wimshome/log/classes/$wims_class/sheets/.active :$v_
15770 guerimand 70
  !if $indivtechvar_!=$empty
15783 guerimand 71
    t_=!items2words $listval_
15847 bpr 72
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :$indivtechvar_ _EMPTY_ $t_
15770 guerimand 73
    !for k_ in $listval_
15847 bpr 74
      !appendfile wimshome/log/classes/$wims_class/sheets/.active $(active_$k_)
75
      !appendfile wimshome/log/classes/$wims_class/sheets/.require $reqs
76
      !appendfile wimshome/log/classes/$wims_class/sheets/.weight $weis
15770 guerimand 77
    !next k_
15847 bpr 78
  !else
79
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :
15770 guerimand 80
  !endif
23 reyssat 81
!next s