Rev 5052 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | |
2 | !if $wims_class=$empty or $wims_user!=supervisor |
||
12555 | bpr | 3 | error=unauthorized |
4 | !exit |
||
20 | reyssat | 5 | !endif |
6 | |||
7 | t=!exec ftype $wims_home/$wims_sesdir/user-deposit |
||
8 | !if $t=$empty |
||
12555 | bpr | 9 | error=empty |
10 | !exit |
||
20 | reyssat | 11 | !endif |
12 | !if $t=binary |
||
12555 | bpr | 13 | error=binary |
14 | !exit |
||
20 | reyssat | 15 | !endif |
16 | |||
17 | !sh cd $wims_home/$wims_sesdir\ |
||
18 | grep . user-deposit | awk '{print ":"$$0}' | tr ' "' ', ' >user_deposit\ |
||
19 | rm -f user-deposit >/dev/null |
||
20 | |||
21 | file=$wims_sesdir/user_deposit |
||
22 | n=!recordcnt wimshome/$file |
||
23 | !if $n<=0 |
||
12555 | bpr | 24 | error=empty |
25 | !exit |
||
20 | reyssat | 26 | !endif |
27 | |||
28 | loglist= |
||
29 | !for i=1 to $n |
||
12555 | bpr | 30 | l=!record $i of wimshome/$file |
31 | !if $gotlogin!=$empty |
||
32 | ltest=!item $gotlogin of $l |
||
33 | ll=!wordcnt $ltest |
||
34 | !if $ll=1 and # notin $ltest |
||
35 | dep_$ltest=$l |
||
36 | loglist=!append item $ltest to $loglist |
||
37 | !endif |
||
38 | !else |
||
39 | !if $i>3 |
||
40 | error=no_login |
||
41 | !exit |
||
42 | !endif |
||
43 | !if login isitemof $l |
||
44 | l=!lower $l |
||
45 | types=!nospace $l |
||
46 | gotlogin=!positionof item login in $l |
||
47 | gotlogin=!item 1 of $gotlogin |
||
48 | !endif |
||
20 | reyssat | 49 | !endif |
50 | !next i |
||
51 | |||
52 | !if $gotlogin=$empty |
||
12555 | bpr | 53 | error=no_login |
54 | !exit |
||
20 | reyssat | 55 | !endif |
56 | |||
57 | remark= |
||
58 | !if sheet isin $types or exam isin $types or average isin $types |
||
12555 | bpr | 59 | remark=$remark noauto |
20 | reyssat | 60 | !endif |
61 | |||
62 | prop=no |
||
63 | !if noauto iswordof $remark or manual isin $types |
||
12555 | bpr | 64 | remark=$remark noprop |
20 | reyssat | 65 | !else |
12555 | bpr | 66 | !if firstname isitemof $types and lastname isitemof $types |
67 | prop=yes |
||
68 | !read adm/class/userremain.proc |
||
69 | !endif |
||
20 | reyssat | 70 | !endif |
71 | |||
72 | !if manual isin $types |
||
12555 | bpr | 73 | manual=yes |
20 | reyssat | 74 | !endif |
75 | |||
76 | replacelist=$types |
||
77 | types=!replace , by ,up_ in up_$types |
||
78 | gotcnt=!itemcnt $loglist |
||
79 | propcnt=0 |
||
80 | gradecnt=0 |
||
81 | !reset missing erased bad added change |
||
82 | processed=yes |
||
83 | |||
84 | !for l in $loglist |
||
5052 | bpr | 85 | !reset up_firstname,up_lastname,up_email,up_password,up_comments,up_regnum,up_photourl,up_participate,up_external_auth |
20 | reyssat | 86 | !distribute items $(dep_$l) into $types |
87 | exist=!defof user_exists in wimshome/log/classes/$wims_class/.users/$l |
||
88 | !if $exist=yes |
||
12555 | bpr | 89 | !if $prop=yes |
90 | !read adm/class/adduser $l |
||
91 | !endif |
||
20 | reyssat | 92 | !else |
12555 | bpr | 93 | exist2=!defof user_exists in wimshome/log/classes/$wims_class/.users/.$l |
94 | !if $exist2=yes |
||
95 | erased=!append item $l to $erased |
||
96 | !else |
||
97 | missing=!append item $l to $missing |
||
98 | !if $up_firstname!=$empty and $up_lastname!=$empty and $up_password!=$empty |
||
99 | !if $prop=yes |
||
100 | !if $userremain>0 |
||
101 | !read adm/class/adduser $l |
||
102 | !if $l notwordof $bad |
||
103 | added=!append item $l to $added |
||
104 | !else |
||
105 | userremain=$[$userremain-1] |
||
106 | !endif |
||
107 | !else |
||
108 | remark=$remark full |
||
109 | !endif |
||
20 | reyssat | 110 | !endif |
12555 | bpr | 111 | !endif |
20 | reyssat | 112 | !endif |
113 | !endif |
||
114 | !next l |
||
115 | missing=!listcomplement $added in $missing |
||
116 | |||
117 | !if $change!=$empty |
||
12555 | bpr | 118 | !read adm/class/mkuserlist |
119 | wims_class_log=spreadsheet userinfo |
||
20 | reyssat | 120 | !endif |
121 | |||
122 | !if $manual=yes |
||
12555 | bpr | 123 | fn=wimshome/log/classes/$wims_class/.grades |
124 | fu=wimshome/log/classes/$wims_class/.userlist |
||
125 | l=!record 1 of $fn |
||
126 | t=!line 2 of $l |
||
127 | n=!itemcnt $t |
||
128 | n=$[$n-2] |
||
129 | !if $n<1 |
||
130 | error=no_manual |
||
131 | !exit |
||
132 | !endif |
||
133 | otypes=nn |
||
20 | reyssat | 134 | !for i=1 to $n |
12555 | bpr | 135 | otypes=$otypes,o_$i |
20 | reyssat | 136 | !next i |
12555 | bpr | 137 | first=$l |
138 | cnt=!recordcnt $fn |
||
139 | !for u=2 to $cnt |
||
140 | l=!record $u of $fn |
||
141 | uu=!item 1 of $l |
||
142 | orig_$uu=!item 2 to -1 of $l |
||
143 | !next u |
||
144 | !writefile $fn :$first |
||
145 | cnt=!recordcnt $fu |
||
146 | !for i=1 to $cnt |
||
147 | l_=!record $i of $fu |
||
148 | u=!item 3 of $l_ |
||
149 | !distribute items $(dep_$u) into $types |
||
150 | !distribute items $(orig_$u) into $otypes |
||
151 | t_=!defof user_firstname user_lastname in wimshome/log/classes/$wims_class/.users/$u |
||
152 | !for i=1 to $n |
||
153 | l_=$[$(up_manual$i)] |
||
154 | !if NaN isin $l_ or Inf isin $l_ or $l_<0 or $l_>100000 or $(up_manual$i)=$empty |
||
155 | l_= |
||
156 | !endif |
||
157 | !default l_=$(o_$i) |
||
158 | t_=!append item $l_ to $t_ |
||
159 | !next i |
||
160 | !appendfile $fn :$u,$t_ |
||
161 | !next u |
||
162 | wims_class_log=spreadsheet grades |
||
20 | reyssat | 163 | !endif |