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