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