Subversion Repositories wimsdev

Rev

Rev 3261 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3261 obado 1
 
2
!if $wims_class=$empty or $wims_user!=supervisor
3
 error=unauthorized
4
 !exit
5
!endif
6
 
7
t=!exec ftype $wims_home/$wims_sesdir/user-deposit
8
!if $t=$empty
9
 error=empty
10
 !exit
11
!endif
12
!if $t=binary
13
 error=binary
14
 !exit
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
24
 error=empty
25
 !exit
26
!endif
27
 
28
loglist=
29
!for i=1 to $n
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
49
 !endif
50
!next i
51
 
52
!if $gotlogin=$empty
53
 error=no_login
54
 !exit
55
!endif
56
 
57
remark=
58
!if sheet isin $types or exam isin $types or average isin $types
59
 remark=$remark noauto
60
!endif
61
 
62
prop=no
63
!if noauto iswordof $remark or manual isin $types
64
 remark=$remark noprop
65
!else
66
 !if firstname isitemof $types and lastname isitemof $types
67
  prop=yes
68
  !read adm/class/userremain.proc
69
 !endif
70
!endif
71
 
72
!if manual isin $types
73
 manual=yes
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
85
  !reset up_firstname,up_lastname,up_email,up_password,up_comments,up_regnum
86
  !distribute items $(dep_$l) into $types
87
  exist=!defof user_exists in wimshome/log/classes/$wims_class/.users/$l
88
  !if $exist=yes
89
   !if $prop=yes
90
    !read adm/class/adduser $l
91
   !endif
92
  !else
93
   exist2=!defof user_exists in wimshome/log/classes/$wims_class/.users/.$l
94
   !if $exist2=yes
95
    erased=!append item $i 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
110
     !endif
111
    !endif
112
   !endif
113
  !endif
114
!next l
115
missing=!listcomplement $added in $missing
116
 
117
!if $change!=$empty
118
 !read adm/class/mkuserlist
10132 bpr 119
 !read adm/class/stat
3261 obado 120
 wims_class_log=spreadsheet userinfo
121
!endif
122
 
123
!if $manual=yes
124
 fn=wimshome/log/classes/$wims_class/.grades
125
 fu=wimshome/log/classes/$wims_class/.userlist
126
 l=!record 1 of $fn
127
 t=!line 2 of $l
128
 n=!itemcnt $t
129
 n=$[$n-2]
130
 !if $n<1
131
  error=no_manual
132
  !exit
133
 !endif
134
 otypes=nn
135
 !for i=1 to $n
136
  otypes=$otypes,o_$i
137
 !next i
138
 first=$l
139
 cnt=!recordcnt $fn
140
 !for u=2 to $cnt
141
  l=!record $u of $fn
142
  uu=!item 1 of $l
143
  orig_$uu=!item 2 to -1 of $l
144
 !next u
145
 !writefile $fn :$first
146
 cnt=!recordcnt $fu
147
 !for i=1 to $cnt
148
  l_=!record $i of $fu
149
  u=!item 3 of $l_
150
  !distribute items $(dep_$u) into $types
151
  !distribute items $(orig_$u) into $otypes
152
  t_=!defof user_firstname user_lastname in wimshome/log/classes/$wims_class/.users/$u
153
  !for i=1 to $n
154
   l_=$[$(up_manual$i)]
155
   !if NaN isin $l_ or Inf isin $l_ or $l_<0 or $l_>100000 or $(up_manual$i)=$empty
156
    l_=
157
   !endif
158
   !default l_=$(o_$i)
159
   t_=!append item $l_ to $t_
160
  !next i
161
  !appendfile $fn :$u,$t_
162
 !next u
163
 wims_class_log=spreadsheet grades
164
!endif
165