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