Subversion Repositories wimsdev

Rev

Rev 10820 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10820 Rev 12488
Line 2... Line 2...
2
!if $version_class>=5
2
!if $version_class>=5
3
  !exit
3
  !exit
4
!endif
4
!endif
5
olddon=!record 0 of wimshome/s2/$wims_session/oldtechvar.don
5
olddon=!record 0 of wimshome/s2/$wims_session/oldtechvar.don
6
!if $olddon=$empty or $subjob=$empty
6
!if $olddon=$empty or $subjob=$empty
7
    olddon=!sh cd $wims_home/log/classes/$tv_Sclass/.users/;\
7
  olddon=!sh cd $wims_home/log/classes/$tv_Sclass/.users/;\
8
grep -r user__ * | awk -F= '$$2!=""{print $$0}'
8
grep -r user__ * | awk -F= '$$2!=""{print $$0}'
9
    olddon=!replace internal :!set user__ by , in $olddon
9
  olddon=!replace internal :!set user__ by , in $olddon
10
    olddon=!replace internal = by , in $olddon
10
  olddon=!replace internal = by , in $olddon
11
    !if $olddon=$empty
11
  !if $olddon=$empty
12
        !writefile wimshome/s2/$wims_session/oldtechvar.don EMPTY
12
    !writefile wimshome/s2/$wims_session/oldtechvar.don EMPTY
13
    !else
13
  !else
14
      !writefile wimshome/s2/$wims_session/oldtechvar.don $olddon
14
    !writefile wimshome/s2/$wims_session/oldtechvar.don $olddon
15
    !endif
15
  !endif
16
!endif
16
!endif
17
!if EMPTY=$olddon
17
!if EMPTY=$olddon
18
    !reset olddon
18
  !reset olddon
19
!endif
19
!endif
20
nb=!linecnt $olddon
20
nb=!linecnt $olddon
21
!if $nb<=0
21
!if $nb<=0
22
    error=nooldvar
22
  error=nooldvar
23
    job=listvar
23
  job=listvar
24
    !changeto $job.proc
24
  !changeto $job.proc
25
    !exit
25
  !exit
26
!endif
26
!endif
27
 
27
 
28
listclsuser=$empty
28
listclsuser=$empty
29
nuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
29
nuser=!recordcnt wimshome/log/classes/$wims_class/.userlist
30
!if $nuser>0
30
!if $nuser>0
31
    !for k=1 to $nuser
31
  !for k=1 to $nuser
32
      u=!record $k of wimshome/log/classes/$wims_class/.userlist
32
    u=!record $k of wimshome/log/classes/$wims_class/.userlist
33
      listclsuser=!append item $(u[3]) to $listclsuser
33
    listclsuser=!append item $(u[3]) to $listclsuser
34
    !next k
34
  !next k
35
!endif
35
!endif
36
listlocalname=!item $tv_listlocal of $tv_listname
36
listlocalname=!item $tv_listlocal of $tv_listname
37
 
37
 
38
!! ------ description of used variables :
38
!! ------ description of used variables :
39
!! listforbname1 : contient les noms de variables non chargeables car affectés également à des participants extérieurs à la classe
39
!! listforbname1 : contient les noms de variables non chargeables car affectés également à des participants extérieurs à la classe
Line 43... Line 43...
43
!! listmodify : variable locale modifiable
43
!! listmodify : variable locale modifiable
44
!! listlogin_$name : contient la liste des logins contenant une valeur pour la variable name
44
!! listlogin_$name : contient la liste des logins contenant une valeur pour la variable name
45
!! listval_$name : liste des différentes valeurs trouvées pour la variable name
45
!! listval_$name : liste des différentes valeurs trouvées pour la variable name
46
 
46
 
47
!for k=1 to $nb
47
!for k=1 to $nb
48
    l=!line $k of $olddon
48
  l=!line $k of $olddon
49
    !distribute item $l into varuser,varname,varval
49
  !distribute item $l into varuser,varname,varval
50
    name2=!text select 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in $varname
50
  name2=!text select 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ in $varname
51
    name2=!nospace $name2
51
  name2=!nospace $name2
52
    n=!charcnt $name2
52
  n=!charcnt $name2
53
    !if $n>$MAXcharname or $n<1
53
  !if $n>$MAXcharname or $n<1
54
      listforbname3=!listunion $listforbname3 and $varname
54
    listforbname3=!listunion $listforbname3 and $varname
-
 
55
  !else
-
 
56
    varname=$name2
-
 
57
    !if $varname notitemof $tv_listallname
-
 
58
      # eventualy a new vartech
-
 
59
      listnew=!listunion $listnew and $varname
-
 
60
      # precheck condition of localisation (no participant use it outside class)
-
 
61
      !if $varuser notitemof $listclsuser
-
 
62
        listforbname1=!listunion $listforbname1 and $varname
-
 
63
      !endif
55
    !else
64
    !else
56
      varname=$name2
-
 
57
      !if $varname notitemof $tv_listallname
65
      !if $varname isitemof $listlocalname
58
          # eventualy a new vartech
-
 
59
          listnew=!listunion $listnew and $varname
66
        listmodify=!listunion $listmodify and $varname
60
          # precheck condition of localisation (no participant use it outside class)
-
 
61
          !if $varuser notitemof $listclsuser
-
 
62
            listforbname1=!listunion $listforbname1 and $varname
-
 
63
          !endif
-
 
64
      !else
67
      !else
65
          !if $varname isitemof $listlocalname
-
 
66
            listmodify=!listunion $listmodify and $varname
-
 
67
          !else
-
 
68
            listforbname2=!listunion $listforbname2 and $varname
68
        listforbname2=!listunion $listforbname2 and $varname
69
          !endif
-
 
70
      !endif
69
      !endif
71
    !endif
70
    !endif
-
 
71
  !endif
72
!next k
72
!next k
73
listnew=!listcomplement $listforbname1 in $listnew
73
listnew=!listcomplement $listforbname1 in $listnew
74
!! check list of value for new techvar
74
!! check list of value for new techvar
75
!for k in $listnew
75
!for k in $listnew
76
    newval=!sh grep $k $wims_home/s2/$wims_session/oldtechvar.don
76
  newval=!sh grep $k $wims_home/s2/$wims_session/oldtechvar.don
77
    newval=!column 3 of $newval
77
  newval=!column 3 of $newval
78
    newval=!listuniq $newval
78
  newval=!listuniq $newval
79
    nb=!itemcnt $newval
79
  nb=!itemcnt $newval
80
    !if $nb>$MAXnbvalue
80
  !if $nb>$MAXnbvalue
81
      listnew=!listcomplement $k in $listnew
81
    listnew=!listcomplement $k in $listnew
82
      listforbname3=!listunion $listforbname3 and $k
82
    listforbname3=!listunion $listforbname3 and $k
83
    !endif
83
  !endif
84
!next k
84
!next k
85
!! check list of value for modify techvar
85
!! check list of value for modify techvar
86
!for k in $listmodify
86
!for k in $listmodify
87
    newval=!sh grep $k $wims_home/s2/$wims_session/oldtechvar.don
87
  newval=!sh grep $k $wims_home/s2/$wims_session/oldtechvar.don
88
    newval=!column 3 of $newval
88
  newval=!column 3 of $newval
89
    num=!positionof item $techvar in $tv_listname
89
  num=!positionof item $techvar in $tv_listname
90
    don=!record $num of wimshome/log/classes/$wims_class/.techvar
90
  don=!record $num of wimshome/log/classes/$wims_class/.techvar
91
    oldval=!line 2 of $don
91
  oldval=!line 2 of $don
92
    val=!listuniq $newval,$oldval
92
  val=!listuniq $newval,$oldval
93
    nb=!itemcnt $val
93
  nb=!itemcnt $val
94
    !if $nb>$MAXnbvalue
94
  !if $nb>$MAXnbvalue
95
      listmodify=!listcomplement $k in $listmodify
95
    listmodify=!listcomplement $k in $listmodify
96
      listforbname3=!listunion $listforbname3 and $k
96
    listforbname3=!listunion $listforbname3 and $k
97
    !endif
97
  !endif
98
!next k
98
!next k
99
 
99
 
100
!!debug olddon : $olddon\
100
!!debug olddon : $olddon\
101
!!listforbname1 : $listforbname1\
101
!!listforbname1 : $listforbname1\
102
!!listforbname2 : $listforbname2\
102
!!listforbname2 : $listforbname2\
103
!!listforbname3 : $listforbname3\
103
!!listforbname3 : $listforbname3\
104
!!listnew : $listnew \
104
!!listnew : $listnew \
105
!!listmodify : $listmodify
105
!!listmodify : $listmodify
106
 
106
 
107
!if $listnew$listforbname1$listforbname2$listmodify=$empty
107
!if $listnew$listforbname1$listforbname2$listmodify=$empty
108
    error=nooldvar
108
  error=nooldvar
109
    job=listvar
109
  job=listvar
110
    !changeto $job.proc
110
  !changeto $job.proc
111
    !exit
111
  !exit
112
!endif
112
!endif
113
 
113
 
114
!! --------------------------- le processus make est à reprendre avec les nouvelles variables.
114
!! --------------------------- le processus make est à reprendre avec les nouvelles variables.
115
 
115
 
116
!if $subjob=make
116
!if $subjob=make
117
   nb=!itemcnt $tv_listlocal
117
  nb=!itemcnt $tv_listlocal
118
   !if $nb>=$MAXtechvar
118
  !if $nb>=$MAXtechvar
119
     error=toomanytechvar
119
    error=toomanytechvar
120
     !reset subjob
120
    !reset subjob
121
     !exit
121
    !exit
122
   !endif
122
  !endif
123
   !if $techvar notitemof $listnew
123
  !if $techvar notitemof $listnew
124
     error=oldvar_badvar
124
    error=oldvar_badvar
125
     !reset subjob
125
    !reset subjob
126
     !exit
126
    !exit
127
   !endif
127
  !endif
128
   num=!replace internal / by _ in $wims_class
128
  num=!replace internal / by _ in $wims_class
129
   !increase nb
129
  !increase nb
130
   num=$(num)_$nb
130
  num=$(num)_$nb
131
   liste=!sh grep $techvar $wims_home/s2/$wims_session/oldtechvar.don
131
  liste=!sh grep $techvar $wims_home/s2/$wims_session/oldtechvar.don
132
   !if $liste=$empty
132
  !if $liste=$empty
133
     error=oldvar_nouser
133
    error=oldvar_nouser
134
     !reset subjob
134
    !reset subjob
135
     !exit
135
    !exit
136
   !endif
136
  !endif
137
!! make the new technical variable
137
  !! make the new technical variable
138
   listval=!column 3 of $liste
138
  listval=!column 3 of $liste
139
   listval=!listuniq $listval
139
  listval=!listuniq $listval
140
   nbval=!itemcnt $listval
140
  nbval=!itemcnt $listval
141
   !if $nbval>$MAXnbvalue
141
  !if $nbval>$MAXnbvalue
142
     error=badoldvaluesnb
142
    error=badoldvaluesnb
143
     !reset subjob
143
    !reset subjob
144
     !exit
144
    !exit
145
   !endif
145
  !endif
146
   techvar=!lower $techvar
146
  techvar=!lower $techvar
147
   !fileappend wimshome/log/classes/$wims_class/.techvar :$techvar\
147
  !fileappend wimshome/log/classes/$wims_class/.techvar :$techvar\
148
$listval
148
$listval
149
    !fileappend wimshome/log/classes/$tv_Sclass/.indextechvar :$techvar,$wims_class,$[$nb]
149
  !fileappend wimshome/log/classes/$tv_Sclass/.indextechvar :$techvar,$wims_class,$[$nb]
150
!! put value in participant file.
150
  !! put value in participant file.
151
    nb=!linecnt $liste
151
  nb=!linecnt $liste
152
    !for k=1 to $nb
152
  !for k=1 to $nb
153
      udon=!line $k of $liste
153
    udon=!line $k of $liste
154
      !distribute item $udon into login,bb,val
154
    !distribute item $udon into login,bb,val
155
      !setdef !set user_techvar_$num=$val in wimshome/log/classes/$tv_Sclass/.users/$login
155
    !setdef !set user_techvar_$num=$val in wimshome/log/classes/$tv_Sclass/.users/$login
156
      listlogin=!append item $login to $listlogin
156
    listlogin=!append item $login to $listlogin
157
    !next k
157
  !next k
158
    !restart module=adm/class/techvar
158
  !restart module=adm/class/techvar
159
!endif
159
!endif
160
 
160
 
161
!if $subjob=modify
161
!if $subjob=modify
162
    !if $techvar notitemof $listmodify
162
  !if $techvar notitemof $listmodify
163
      error=oldvar_badvar
163
    error=oldvar_badvar
164
      !reset subjob
164
    !reset subjob
165
      !exit
165
    !exit
166
    !endif
166
  !endif
167
    liste=!sh grep $techvar $wims_home/s2/$wims_session/oldtechvar.don
167
  liste=!sh grep $techvar $wims_home/s2/$wims_session/oldtechvar.don
168
    !if $liste=$empty
168
  !if $liste=$empty
169
       error=oldvar_nouser
169
    error=oldvar_nouser
170
      !reset subjob
170
    !reset subjob
171
      !exit
171
    !exit
172
    !endif
172
  !endif
173
    nb=!linecnt $liste
173
  nb=!linecnt $liste
174
    num0=!positionof item $techvar in $tv_listname
174
  num0=!positionof item $techvar in $tv_listname
175
    num=$(tv_listtechvar[$num0;3])
175
  num=$(tv_listtechvar[$num0;3])
176
    cls=!item $num0 of $tv_listcode
176
  cls=!item $num0 of $tv_listcode
-
 
177
  !for k=1 to $nb
-
 
178
    udon=!line $k of $liste
-
 
179
    !distribute item $udon into login,bb,val
-
 
180
    !setdef !set user_techvar_$(cls)=$val in wimshome/log/classes/$tv_Sclass/.users/$login
-
 
181
    listlogin=!append item $login to $listlogin
-
 
182
  !next k
-
 
183
  !! modify list of values (if necessary) of technical variable
-
 
184
  listval=!column 3 of $liste
-
 
185
  listval=!listuniq $listval
-
 
186
  don=!record $num of wimshome/log/classes/$wims_class/.techvar
-
 
187
  oldval=!line 2 of $don
-
 
188
  new=!listcomplement $oldval in $listval
-
 
189
  !if $new!=$empty
-
 
190
    nb=!recordcnt wimshome/log/classes/$wims_class/.techvar
-
 
191
    output=$empty
177
    !for k=1 to $nb
192
    !for k=1 to $nb
178
      udon=!line $k of $liste
193
      tmp=!record $k of wimshome/log/classes/$wims_class/.techvar
179
      !distribute item $udon into login,bb,val
194
      !if $k=$num
180
      !setdef !set user_techvar_$(cls)=$val in wimshome/log/classes/$tv_Sclass/.users/$login
195
        tmp=!replace line number 2 by $oldval,$new in $tmp
-
 
196
      !endif
181
      listlogin=!append item $login to $listlogin
197
      output=!append line :$tmp to $output
182
    !next k
198
    !next k
183
!! modify list of values (if necessary) of technical variable
-
 
184
    listval=!column 3 of $liste
-
 
185
    listval=!listuniq $listval
-
 
186
    don=!record $num of wimshome/log/classes/$wims_class/.techvar
-
 
187
    oldval=!line 2 of $don
-
 
188
    new=!listcomplement $oldval in $listval
-
 
189
    !if $new!=$empty
-
 
190
      nb=!recordcnt wimshome/log/classes/$wims_class/.techvar
-
 
191
      output=$empty
-
 
192
      !for k=1 to $nb
-
 
193
          tmp=!record $k of wimshome/log/classes/$wims_class/.techvar
-
 
194
          !if $k=$num
-
 
195
            tmp=!replace line number 2 by $oldval,$new in $tmp
-
 
196
          !endif
-
 
197
          output=!append line :$tmp to $output
-
 
198
      !next k
-
 
199
        !filewrite wimshome/log/classes/$wims_class/.techvar $output
199
    !filewrite wimshome/log/classes/$wims_class/.techvar $output
200
    !endif
200
  !endif
201
    !restart module=adm/class/techvar&job=userlist
201
  !restart module=adm/class/techvar&job=userlist
202
!endif
202
!endif