version 1.484, 2004/04/01 15:24:44
|
version 1.485, 2004/04/03 00:13:01
|
Line 1186 sub tokenwrapper {
|
Line 1186 sub tokenwrapper {
|
# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course |
# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course |
# input: action, courseID, current domain, home server for course, intended |
# input: action, courseID, current domain, home server for course, intended |
# path to file, source of file. |
# path to file, source of file. |
# output: ok if successful, diagnostic message otherwise |
# output: url to file (if action was uploaddoc), |
|
# ok if successful, or diagnostic message otherwise (if action was propagate or copy) |
# |
# |
# Allows directory structure to be used within lonUsers/../userfiles/ for a |
# Allows directory structure to be used within lonUsers/../userfiles/ for a |
# course. |
# course. |
Line 1201 sub tokenwrapper {
|
Line 1202 sub tokenwrapper {
|
# and will then be copied to |
# and will then be copied to |
# /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in |
# /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in |
# course's home server. |
# course's home server. |
|
# |
# action = uploaddoc - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# action = uploaddoc - /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# will be retrived from $ENV{form.$source} via DOCS interface to |
# will be retrived from $ENV{form.uploaddoc} (from DOCS interface) to |
# /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# /home/httpd/html/userfiles/$domain/1/2/3/$course/$file |
# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file |
# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file |
# in course's home server. |
# in course's home server. |
Line 1255 sub process_coursefile {
|
Line 1257 sub process_coursefile {
|
} |
} |
} |
} |
} |
} |
unless ( ($fetchresult eq 'ok') || ($fetchresult eq 'no source file') ) { |
unless ( $fetchresult eq 'ok') { |
&logthis('Failed to transfer '.$docudom.'/'.$docuname.'/'.$file. |
&logthis('Failed to transfer '.$docudom.'/'.$docuname.'/'.$file. |
' to host '.$docuhome.': '.$fetchresult); |
' to host '.$docuhome.': '.$fetchresult); |
} |
} |
Line 1280 sub userfileupload {
|
Line 1282 sub userfileupload {
|
# See if there is anything left |
# See if there is anything left |
unless ($fname) { return 'error: no uploaded file'; } |
unless ($fname) { return 'error: no uploaded file'; } |
chop($ENV{'form.'.$formname}); |
chop($ENV{'form.'.$formname}); |
my $url = ''; |
|
# Create the directory if not present |
# Create the directory if not present |
my $docuname=''; |
my $docuname=''; |
my $docudom=''; |
my $docudom=''; |
Line 1290 sub userfileupload {
|
Line 1291 sub userfileupload {
|
$docudom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
$docudom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
$docuhome=$ENV{'course.'.$ENV{'request.course.id'}.'.home'}; |
$docuhome=$ENV{'course.'.$ENV{'request.course.id'}.'.home'}; |
if ($ENV{'form.folder'} =~ m/^default/) { |
if ($ENV{'form.folder'} =~ m/^default/) { |
$url = &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname); |
return &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname); |
} else { |
} else { |
$fname=$ENV{'form.folder'}.'/'.$fname; |
$fname=$ENV{'form.folder'}.'/'.$fname; |
$url = &process_coursefile('uploaddoc',$docuname,$docudom,$docuhome,$fname,$formname); |
return &process_coursefile('uploaddoc',$docuname,$docudom,$docuhome,$fname,$formname); |
} |
} |
} else { |
} else { |
$docuname=$ENV{'user.name'}; |
$docuname=$ENV{'user.name'}; |
$docudom=$ENV{'user.domain'}; |
$docudom=$ENV{'user.domain'}; |
$docuhome=$ENV{'user.home'}; |
$docuhome=$ENV{'user.home'}; |
|
return &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname); |
} |
} |
return |
|
&finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname); |
|
} |
} |
|
|
sub finishuserfileupload { |
sub finishuserfileupload { |