Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
15847 bpr 1
!! this file generate :
2
!! .require require points of each exercise in a sheet
3
!! .weight weight of each exercise in a sheet
4
!! .active indicate hide/show of each exercise of the sheet
15849 bpr 5
!! .vars indicate if a technical variable is used to make indivual sheets
15770 guerimand 6
!!
15847 bpr 7
!! the three first files have the same format :
8
!! - each record is a sheet
15849 bpr 9
!! - first line of each record is the default line,
10
!!  the others correspond to the different technical value if it exists (defined in .vars) ;
11
!! - each word of the line correspond to the parameters for an exercise of the sheet
15847 bpr 12
!!
13
!! each record of .vars file is a sheet ; first line is technical variable name followed
14
!! by the list of values
23 reyssat 15
 
15850 bpr 16
!! remark: when activating/desactivating a single sheet, the script
15849 bpr 17
!! rebuilds all the files for all the sheets (maybe we could only work on the modified sheet)
15847 bpr 18
 
15783 guerimand 19
!readproc adm/vfilter/listvarfilter.proc
23 reyssat 20
scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
15847 bpr 21
!sh cd $wims_home/log/classes/$wims_class/sheets;\
15848 guerimand 22
 rm -f .require .weight .vars .active;\
23
 touch .require .weight .vars .active;
15847 bpr 24
 
23 reyssat 25
!for s=1 to $scnt
12701 bpr 26
  ecnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$s
15770 guerimand 27
  !reset indivtechvar_
28
  indivtechvar_=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets
29
  indivtechvar_=!line 10 of $indivtechvar_
15783 guerimand 30
  !if $indivtechvar_ notitemof $tv_listcode
31
    !reset indivtechvar_
32
  !endif
15770 guerimand 33
  !if $indivtechvar_!=$empty
34
    p=!positionof item $indivtechvar_ in $tv_listcode
35
    p=!line $p of $tv_listtechvar
36
    !distribute item $p into n_,cls_,num_
37
    tmp_=!record $num_ of wimshome/log/classes/$cls_/.techvar
38
    listval_=!line 2 of $tmp_
15910 guerimand 39
    !for k_ in $listval_
40
      !distribute item ,, into active_$(k_),require_$(k_),weight_$(k_)
15770 guerimand 41
    !next k_
42
  !endif
15910 guerimand 43
  !distribute item , into requires_,weights_
12701 bpr 44
  !for e=1 to $ecnt
45
    r=!record $e of wimshome/log/classes/$wims_class/sheets/.sheet$s
15910 guerimand 46
    !distribute lines $r into t_,t_,require,weight,t_,t_,t_,t_,t_,t_,indiv_
47
    !for j_ in require,weight
48
      $(j_)d_=!row 1 of $($j_)
49
      $(j_)s_=!append word $($(j_)d_) to $($(j_)s_)
50
      tmp_=!row 2 to -1 of $($(j_))
51
      $(j_)1_=!column 1 of $tmp_
52
      $(j_)2_=!column 2 of $tmp_
53
    !next j_
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
15910 guerimand 61
        !for j_ in require,weight
62
          p_=!positionof item $k_ in $($(j_)1_)
63
          !if $p_!=$empty
64
            $(j_)_$k_=!append word $($(j_)2_[$p_]) to $($(j_)_$k_)
65
          !else
66
            $(j_)_$k_=!append word $($(j_)d_) to $($(j_)_$k_)
67
          !endif
68
        !next j_
15770 guerimand 69
      !next k_
70
    !endif
12701 bpr 71
  !next e
15910 guerimand 72
  !appendfile wimshome/log/classes/$wims_class/sheets/.require :$requires_
73
  !appendfile wimshome/log/classes/$wims_class/sheets/.weight :$weights_
15847 bpr 74
  v_=!values 1 for v=1 to $ecnt
75
  v_=!items2words $v_
76
  !appendfile wimshome/log/classes/$wims_class/sheets/.active :$v_
15770 guerimand 77
  !if $indivtechvar_!=$empty
15783 guerimand 78
    t_=!items2words $listval_
15847 bpr 79
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :$indivtechvar_ _EMPTY_ $t_
15770 guerimand 80
    !for k_ in $listval_
15847 bpr 81
      !appendfile wimshome/log/classes/$wims_class/sheets/.active $(active_$k_)
15910 guerimand 82
      !appendfile wimshome/log/classes/$wims_class/sheets/.require $(require_$k_)
83
      !appendfile wimshome/log/classes/$wims_class/sheets/.weight $(weight_$k_)
15770 guerimand 84
    !next k_
15847 bpr 85
  !else
86
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :
15770 guerimand 87
  !endif
23 reyssat 88
!next s