Subversion Repositories wimsdev

Rev

Rev 15850 | Rev 15910 | 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_
39
    !for k_ in $list_val_
40
      active_$k_=$empty
41
    !next k_
42
  !endif
12701 bpr 43
  !distribute item ,,, into reqs,weis
44
  !for e=1 to $ecnt
45
    r=!record $e of wimshome/log/classes/$wims_class/sheets/.sheet$s
15770 guerimand 46
    !distribute lines $r into t_,t_,r_,w_,t_,t_,t_,t_,t_,t_,indiv_
12701 bpr 47
    r_=$[$r_]
48
    w_=$[$w_]
49
    reqs=!append word $r_ to $reqs
50
    weis=!append word $w_ to $weis
15770 guerimand 51
    !if $indivtechvar_!=$empty
52
      !for k_ in $listval_
53
        !if $k_ isitemof $indiv_
54
          active_$k_=!append word 1 to $(active_$k_)
55
        !else
56
          active_$k_=!append word 0 to $(active_$k_)
57
        !endif
58
      !next k_
59
    !endif
12701 bpr 60
  !next e
15848 guerimand 61
  !appendfile wimshome/log/classes/$wims_class/sheets/.require :$reqs
62
  !appendfile wimshome/log/classes/$wims_class/sheets/.weight :$weis
15847 bpr 63
   --- build of require and weight (but with a simple copy of default weight and require
64
  v_=!values 1 for v=1 to $ecnt
65
  v_=!items2words $v_
66
  !appendfile wimshome/log/classes/$wims_class/sheets/.active :$v_
15770 guerimand 67
  !if $indivtechvar_!=$empty
15783 guerimand 68
    t_=!items2words $listval_
15847 bpr 69
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :$indivtechvar_ _EMPTY_ $t_
15770 guerimand 70
    !for k_ in $listval_
15847 bpr 71
      !appendfile wimshome/log/classes/$wims_class/sheets/.active $(active_$k_)
72
      !appendfile wimshome/log/classes/$wims_class/sheets/.require $reqs
73
      !appendfile wimshome/log/classes/$wims_class/sheets/.weight $weis
15770 guerimand 74
    !next k_
15847 bpr 75
  !else
76
    !appendfile wimshome/log/classes/$wims_class/sheets/.vars :
15770 guerimand 77
  !endif
23 reyssat 78
!next s