Subversion Repositories wimsdev

Rev

Rev 15910 | 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
16090 guerimand 21
!if $max_sheets!=$empty
22
  scnt=$[min($scnt,$max_sheets)]
23
!endif
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_
15910 guerimand 42
    !for k_ in $listval_
43
      !distribute item ,, into active_$(k_),require_$(k_),weight_$(k_)
15770 guerimand 44
    !next k_
45
  !endif
15910 guerimand 46
  !distribute item , into requires_,weights_
12701 bpr 47
  !for e=1 to $ecnt
48
    r=!record $e of wimshome/log/classes/$wims_class/sheets/.sheet$s
15910 guerimand 49
    !distribute lines $r into t_,t_,require,weight,t_,t_,t_,t_,t_,t_,indiv_
50
    !for j_ in require,weight
51
      $(j_)d_=!row 1 of $($j_)
52
      $(j_)s_=!append word $($(j_)d_) to $($(j_)s_)
53
      tmp_=!row 2 to -1 of $($(j_))
54
      $(j_)1_=!column 1 of $tmp_
55
      $(j_)2_=!column 2 of $tmp_
56
    !next j_
15770 guerimand 57
    !if $indivtechvar_!=$empty
58
      !for k_ in $listval_
59
        !if $k_ isitemof $indiv_
60
          active_$k_=!append word 1 to $(active_$k_)
61
        !else
62
          active_$k_=!append word 0 to $(active_$k_)
63
        !endif
15910 guerimand 64
        !for j_ in require,weight
65
          p_=!positionof item $k_ in $($(j_)1_)
66
          !if $p_!=$empty
67
            $(j_)_$k_=!append word $($(j_)2_[$p_]) to $($(j_)_$k_)
68
          !else
69
            $(j_)_$k_=!append word $($(j_)d_) to $($(j_)_$k_)
70
          !endif
71
        !next j_
15770 guerimand 72
      !next k_
73
    !endif
12701 bpr 74
  !next e
15910 guerimand 75
  !appendfile wimshome/log/classes/$wims_class/sheets/.require :$requires_
76
  !appendfile wimshome/log/classes/$wims_class/sheets/.weight :$weights_
15847 bpr 77
  v_=!values 1 for v=1 to $ecnt
78
  v_=!items2words $v_
79
  !appendfile wimshome/log/classes/$wims_class/sheets/.active :$v_
15770 guerimand 80
  !if $indivtechvar_!=$empty
15783 guerimand 81
    t_=!items2words $listval_
15847 bpr 82
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :$indivtechvar_ _EMPTY_ $t_
15770 guerimand 83
    !for k_ in $listval_
15847 bpr 84
      !appendfile wimshome/log/classes/$wims_class/sheets/.active $(active_$k_)
15910 guerimand 85
      !appendfile wimshome/log/classes/$wims_class/sheets/.require $(require_$k_)
86
      !appendfile wimshome/log/classes/$wims_class/sheets/.weight $(weight_$k_)
15770 guerimand 87
    !next k_
15847 bpr 88
  !else
89
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :
15770 guerimand 90
  !endif
23 reyssat 91
!next s