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