Rev 11038 | Rev 11061 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11038 | Rev 11060 | ||
---|---|---|---|
Line 4... | Line 4... | ||
4 | # also constructs .userlist_external if needed |
4 | # also constructs .userlist_external if needed |
5 | 5 | ||
6 | uclass=$wims_read_parm |
6 | uclass=$wims_read_parm |
7 | !default uclass=$wims_class |
7 | !default uclass=$wims_class |
8 | 8 | ||
- | 9 | # What's the point of $wims_prefix ? |
|
9 | !if user notwordof $wims_prefix |
10 | !if user notwordof $wims_prefix |
10 | wims_prefix=$wims_prefix user |
11 | wims_prefix=$wims_prefix user |
11 | !endif |
12 | !endif |
12 | 13 | ||
13 | :mkstart |
14 | :mkstart |
14 | supclass=!defof class_superclass in wimshome/log/classes/$uclass/.def |
15 | supclass=!defof class_superclass in wimshome/log/classes/$uclass/.def |
15 | reset class_lvl |
16 | reset class_lvl |
16 | 17 | ||
17 | !if $supclass!=$empty and $supclass!=$uclass |
18 | !if $supclass!=$empty and $supclass!=$uclass |
18 | supertype=!defof class_type in wimshome/log/classes/$supclass/.def |
19 | supertype=!defof class_type in wimshome/log/classes/$supclass/.def |
19 | typename=!defof class_typename in wimshome/log/classes/$uclass/.def |
20 | typename=!defof class_typename in wimshome/log/classes/$uclass/.def |
- | 21 | ||
20 | !if $typename iswordof level program |
22 | !if $typename iswordof level program |
21 | !exit |
23 | !exit |
22 | !endif |
- | |
23 | !if $typename issametext course |
- | |
24 | class_parent=!defof class_parent in wimshome/log/classes/$uclass/.def |
- | |
25 | !if $class_parent!=$empty |
- | |
26 | i=!defof class_ocourses in wimshome/log/classes/$class_parent/.def |
- | |
27 | i=!makelist $wims_superclass/x for x in $i |
- | |
28 | !if $uclass isitemof $i |
- | |
29 | uclass=$class_parent |
- | |
30 | !goto mkstart |
- | |
31 | !endif |
- | |
32 | !endif |
24 | !endif |
- | 25 | ||
33 |
|
26 | !if $typename issametext course |
34 | !else |
- | |
- | 27 | class_parent=!defof class_parent in wimshome/log/classes/$uclass/.def |
|
35 |
|
28 | !if $class_parent!=$empty |
36 |
|
29 | i=!defof class_ocourses in wimshome/log/classes/$class_parent/.def |
37 |
|
30 | i=!makelist $wims_superclass/x for x in $i |
38 | !if |
31 | !if $uclass isitemof $i |
39 |
|
32 | uclass=$class_parent |
40 |
|
33 | !goto mkstart |
41 |
|
34 | !endif |
42 | clist=$supclass,$class_lvl,$uclass |
- | |
43 | !endif |
35 | !endif |
- | 36 | clist=$uclass |
|
44 | !else |
37 | !else |
- | 38 | !if / isin $uclass |
|
- | 39 | class_lvl=!translate internal / to , in $uclass |
|
- | 40 | class_lvl=$(class_lvl[1])/$(class_lvl[2]) |
|
- | 41 | !if $class_lvl=$uclass |
|
- | 42 | class_lvl= |
|
- | 43 | clist=$supclass,$uclass |
|
- | 44 | !else |
|
- | 45 | clist=$supclass,$class_lvl,$uclass |
|
- | 46 | !endif |
|
- | 47 | !else |
|
45 | clist=!listuniq $supclass,$uclass |
48 | clist=!listuniq $supclass,$uclass |
- | 49 | !endif |
|
46 | !endif |
50 | !endif |
47 | !endif |
- | |
48 | !else |
51 | !else |
49 | typename=class |
52 | typename=class |
50 | clist=$uclass |
53 | clist=$uclass |
51 | supclass=$uclass |
54 | supclass=$uclass |
52 | !endif |
55 | !endif |
53 | 56 | ||
54 | mul_userdir=wimshome/log/classes/$supclass/.users |
57 | mul_userdir=wimshome/log/classes/$supclass/.users |
55 | mul_userdir2=$wims_home/log/classes/$supclass/.users |
58 | mul_userdir2=$wims_home/log/classes/$supclass/.users |
56 | 59 | ||
Line 61... | Line 64... | ||
61 | userlist_$start=!sh cd $mul_userdir2; ls 2>/dev/null | head -$pack_size |
64 | userlist_$start=!sh cd $mul_userdir2; ls 2>/dev/null | head -$pack_size |
62 | userlist_$start=!words2items $(userlist_$start) |
65 | userlist_$start=!words2items $(userlist_$start) |
63 | 66 | ||
64 | userlist_lastcnt=!itemcnt $(userlist_$start) |
67 | userlist_lastcnt=!itemcnt $(userlist_$start) |
65 | 68 | ||
66 | !while $userlist_lastcnt> |
69 | !while $userlist_lastcnt>$[$pack_size-1] |
67 | !advance start |
70 | !advance start |
- | 71 | ||
68 | userlist_$start=!sh cd $mul_userdir2; ls 2>/dev/null | tail -n +$ |
72 | userlist_$start=!sh cd $mul_userdir2; ls 2>/dev/null | tail -n +$[$start*$pack_size+1] | head -$pack_size |
69 | userlist_$start=!words2items $(userlist_$start) |
73 | userlist_$start=!words2items $(userlist_$start) |
70 | userlist_lastcnt=!itemcnt $(userlist_$start) |
74 | userlist_lastcnt=!itemcnt $(userlist_$start) |
71 | !endwhile |
75 | !endwhile |
72 | 76 | ||
73 | ## On supprime une eventuelle liste temporaire "userlist*.raw" dans chaque classe |
77 | ## On supprime une eventuelle liste temporaire "userlist*.raw" dans chaque classe |
74 | ## just junk |
78 | ## just junk |
75 | !for c in $clist |
79 | !for c in $clist |
76 | !sh rm -f $wims_home/log/classes/$c/.userlist.raw 2>/dev/null\ |
80 | !sh rm -f $wims_home/log/classes/$c/.userlist.raw 2>/dev/null\ |
77 | rm -f $wims_home/log/classes/$c/.userlist_external.raw 2>/dev/null |
81 | rm -f $wims_home/log/classes/$c/.userlist_external.raw 2>/dev/null |
78 | !next |
82 | !next |
79 | 83 | ||
80 | ## On parcourt nos paquets de $pack_size users |
84 | ## On parcourt nos paquets de $pack_size users |
81 | !for N=0 to $start |
85 | !for N=0 to $start |
82 | !for u in $(userlist_$N) |
86 | !for u in $(userlist_$N) |
83 | !reset user_firstname, user_lastname, user_supervisable,\ |
87 | !reset user_firstname, user_lastname, user_supervisable,\ |
84 |
|
88 | user_class, user_participate, user_exists, user_external_auth |
85 | !readdef $mul_userdir/$u |
89 | !readdef $mul_userdir/$u |
86 | 90 | ||
87 | !!TODO better to make a special list for user_supervisable who participates |
91 | !!TODO better to make a special list for user_supervisable who participates |
88 | !!(suppress to add supervisor who are registered as participant to appear in userlist) |
92 | !!(suppress to add supervisor who are registered as participant to appear in userlist) |
89 | !if $user_exists=yes and $user_supervisable!=yes |
93 | !if $user_exists=yes and $user_supervisable!=yes |
90 | userline=:$user_lastname,$user_firstname,$u |
94 | userline=:$user_lastname,$user_firstname,$u |
91 | !reset userline_external |
95 | !reset userline_external |
92 | !if $user_external_auth!=$empty |
96 | !if $user_external_auth!=$empty |
93 | userline_external=$user_external_auth:$u |
97 | userline_external=$user_external_auth:$u |
94 | !endif |
98 | !endif |
95 | !if $typename=course |
99 | !if $typename=course |
96 | !readdef wimshome/log/classes/$uclass/.users/$u |
100 | !readdef wimshome/log/classes/$uclass/.users/$u |
97 | !if $user_class!=$empty |
101 | !if $user_class!=$empty |
98 | !appendfile wimshome/log/classes/$uclass/.userlist.raw $userline,$user_class |
102 | !appendfile wimshome/log/classes/$uclass/.userlist.raw $userline,$user_class |
- | 103 | !if $userline_external!=$empty |
|
- | 104 | !appendfile wimshome/log/classes/$uclass/.userlist_external.raw $userline_external |
|
- | 105 | !endif |
|
- | 106 | !endif |
|
- | 107 | !else |
|
- | 108 | !if $supclass=$uclass or $uclass isitemof $user_participate |
|
- | 109 | !appendfile wimshome/log/classes/$uclass/.userlist.raw $userline |
|
99 | !if $userline_external!=$empty |
110 | !if $userline_external!=$empty |
100 | !appendfile wimshome/log/classes/$uclass/.userlist_external.raw $userline_external |
111 | !appendfile wimshome/log/classes/$uclass/.userlist_external.raw $userline_external |
- | 112 | !endif |
|
- | 113 | !endif |
|
- | 114 | ### do it for the $supclass ? could be done many times if not in a group ? |
|
- | 115 | !if $supclass!=$uclass |
|
- | 116 | !appendfile wimshome/log/classes/$supclass/.userlist.raw $userline |
|
- | 117 | !if $userline_external!=$empty |
|
- | 118 | !appendfile wimshome/log/classes/$supclass/.userlist_external.raw $userline_external |
|
- | 119 | !endif |
|
- | 120 | !if $class_lvl!=$empty and $class_lvl/ isin $user_participate |
|
- | 121 | ## do it for the intermediaire class ? could be done many times |
|
- | 122 | !appendfile wimshome/log/classes/$class_lvl/.userlist.raw $userline |
|
- | 123 | !if $userline_external!=$empty |
|
- | 124 | !appendfile wimshome/log/classes/$class_lvl/.userlist_external.raw $userline_external |
|
- | 125 | !endif |
|
- | 126 | !endif |
|
- | 127 | !endif |
|
101 | !endif |
128 | !endif |
102 | !endif |
129 | !endif |
103 | !else |
- | |
104 | !if $supclass=$uclass or $uclass isitemof $user_participate |
- | |
105 | !appendfile wimshome/log/classes/$uclass/.userlist.raw $userline |
- | |
106 | !if $userline_external!=$empty |
- | |
107 | !appendfile wimshome/log/classes/$uclass/.userlist_external.raw $userline_external |
- | |
108 | !endif |
- | |
109 | !endif |
- | |
110 | ### do it for the $supclass ? could be done many times |
- | |
111 | !if $supclass!=$uclass |
- | |
112 | !appendfile wimshome/log/classes/$supclass/.userlist.raw $userline |
- | |
113 | !if $userline_external!=$empty |
- | |
114 | !appendfile wimshome/log/classes/$supclass/.userlist_external.raw $userline_external |
- | |
115 | !endif |
- | |
116 | !if $class_lvl!=$empty and $class_lvl/ isin $user_participate |
- | |
117 | ## do it for the intermediaire class ? could be done many times |
- | |
118 | !appendfile wimshome/log/classes/$class_lvl/.userlist.raw $userline |
- | |
119 | !if $userline_external!=$empty |
- | |
120 | !appendfile wimshome/log/classes/$class_lvl/.userlist_external.raw $userline_external |
- | |
121 | !endif |
- | |
122 | !endif |
- | |
123 | !endif |
- | |
124 | !endif |
- | |
125 | !endif |
- | |
126 | !next u |
130 | !next u |
127 | !next N |
131 | !next N |
128 | 132 | ||
129 | basedir=$wims_home/log/classes |
133 | basedir=$wims_home/log/classes |
130 | basedir2=wimshome/log/classes |
134 | basedir2=wimshome/log/classes |
131 | 135 | ||
132 | !for c in $clist |
136 | !for c in $clist |
133 | !sh sort -f $basedir/$c/.userlist.raw >$basedir/$c/.userlist 2>/dev/ |
137 | !sh sort -f $basedir/$c/.userlist.raw >$basedir/$c/.userlist 2>/dev/null |
- | 138 | # \ |
|
134 | rm -f $basedir/$c/.userlist.raw 2>/dev/null\ |
139 | # rm -f $basedir/$c/.userlist.raw 2>/dev/null\ |
135 | sort -f $basedir/$c/.userlist_external.raw > $basedir/$c/.userlist_external 2>/dev/null\ |
140 | # sort -f $basedir/$c/.userlist_external.raw > $basedir/$c/.userlist_external 2>/dev/null\ |
136 | rm -f $basedir/$c/.userlist_external.raw 2>/dev/null |
141 | # rm -f $basedir/$c/.userlist_external.raw 2>/dev/null |
137 | !next |
142 | !next |
138 | ## Now the files .userlist and .userlist_external are created in the classes of $clist, |
143 | ## Now the files .userlist and .userlist_external are created in the classes of $clist, |
139 | ## so in the sup classes of $uclass. Do we need to do that (it is done many times for |
144 | ## so in the sup classes of $uclass. Do we need to do that (it is done many times for |
140 | ## the portal ... |
145 | ## the portal ... |
141 | 146 | ||
Line 159... | Line 164... | ||
159 | !set nextuser=!rows2lines $nextuser |
164 | !set nextuser=!rows2lines $nextuser |
160 | !set nextuser=!replace internal , by : in $nextuser |
165 | !set nextuser=!replace internal , by : in $nextuser |
161 | !writefile $basedir2/$c/.usernextlist.raw $nextuser |
166 | !writefile $basedir2/$c/.usernextlist.raw $nextuser |
162 | !writefile $basedir2/$c/.userprevlist.raw $prevuser |
167 | !writefile $basedir2/$c/.userprevlist.raw $prevuser |
163 | !sh mv $basedir/$c/.usernextlist.raw $basedir/$c/.usernextlist\ |
168 | !sh mv $basedir/$c/.usernextlist.raw $basedir/$c/.usernextlist\ |
164 | mv $basedir/$c/.userprevlist.raw $basedir/$c/.userprevlist |
169 | mv $basedir/$c/.userprevlist.raw $basedir/$c/.userprevlist |
165 | !next c |
170 | !next c |
166 | 171 | ||
167 | !exit |
172 | !exit |
168 | !read adm/class/stat |
173 | !read adm/class/stat |