Subversion Repositories wimsdev

Rev

Rev 10702 | Rev 10820 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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