Rev 14335 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11214 | guerimand | 1 | !if $save!=$empty |
12616 | bpr | 2 | wims_deposit=!word 1 of $wims_deposit |
3 | !if $wims_deposit=$empty |
||
4 | !exit |
||
5 | !endif |
||
6 | !if / isin $wims_deposit or .. isin $wims_deposit |
||
7 | error=bad_filename |
||
8 | !exit |
||
9 | !endif |
||
10 | d=!translate . to $ $ in $wims_deposit |
||
11 | d=!word -1 of $d |
||
12 | !if $d notwordof csv tsv txt |
||
13 | error=bad_filename |
||
14 | !exit |
||
15 | !endif |
||
16 | sdir=$wims_home/$wims_sesdir |
||
17 | t=!exec ftype $sdir/user-deposit |
||
18 | !if $t=$empty |
||
19 | !exit |
||
20 | !endif |
||
21 | !if $t=binary |
||
22 | error=binary_upload |
||
23 | !exit |
||
24 | !endif |
||
25 | !sh grep . $sdir/user-deposit | awk '{print ":"$$0}' | tr ' "' ', ' >$sdir/user_deposit |
||
26 | file=wimshome/$wims_sesdir/user_deposit |
||
27 | nbdata=!recordcnt $file |
||
28 | !! ----- search for keywords in the firstline |
||
29 | keylist=cname,login,regpass,secure,limit |
||
30 | keydon=!record 1 of $file |
||
31 | missingkey=$empty |
||
32 | keyposition=$empty |
||
33 | !for k in $keylist |
||
34 | p=!positionof item $k in $keydon |
||
14335 | bpr | 35 | !if $p=$empty |
36 | missingkey=!append item $k to $missingkey |
||
37 | !endif |
||
38 | keyposition=!append item $p to $keyposition |
||
12616 | bpr | 39 | !next k |
12995 | guerimand | 40 | !if cname isitemof $missingkey or login isitemof $missingkey |
14335 | bpr | 41 | error=missing_key |
42 | !exit |
||
12616 | bpr | 43 | !endif |
44 | !! ----- process for each class |
||
45 | listerror=$empty |
||
46 | !for classk=2 to $nbdata |
||
47 | data=!record $classk of $file |
||
48 | cname=!item $(keyposition[1]) of $data |
||
49 | sup=!item $(keyposition[2]) of $data |
||
12995 | guerimand | 50 | !if $(keyposition[3])!=0 |
51 | pass=!item $(keyposition[3]) of $data |
||
52 | !endif |
||
12616 | bpr | 53 | pass2=$pass |
54 | !reset passs,passs2 |
||
12995 | guerimand | 55 | !if $(keyposition[4])!=0 |
56 | sechost=!item $(keyposition[4]) of $data |
||
57 | !endif |
||
58 | !if $(keyposition[5])!=0 |
||
59 | cadd_limit=!item $(keyposition[5]) of $data |
||
60 | !bound cadd_limit between 0 and $class_limit default $class_limit |
||
61 | !else |
||
62 | cadd_limit=$class_limit |
||
63 | !endif |
||
17099 | guerimand | 64 | !read adm/gateway/mkindex |
12616 | bpr | 65 | !readproc adm/gateway/addclass $sup,$cname |
66 | !if $error!=$empty |
||
11214 | guerimand | 67 | listerror=!append line $classk,$error to $listerror |
12616 | bpr | 68 | !endif |
69 | !reset error |
||
70 | !read adm/gateway/mkindex |
||
71 | !next classk |
||
72 | !if $listerror!=$empty |
||
73 | !! we can made more explicit error message (TODO) |
||
14335 | bpr | 74 | error=baddata |
11214 | guerimand | 75 | !endif |
12616 | bpr | 76 | job=level |
77 | !reset save |
||
78 | !changeto jobs/$job.proc |
||
11214 | guerimand | 79 | !endif |