[LON-CAPA-cvs] cvs: loncom /lonnet/perl lonnet.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Sat, 03 Apr 2004 00:13:02 -0000
raeburn Fri Apr 2 19:13:02 2004 EDT
Modified files:
/loncom/lonnet/perl lonnet.pm
Log:
Changes from 1.484 to 1.485:
Correction to returns from lonnet::userfileupload.
The following explanation of previous changes to lonnet::userfileupload and lonnet::process_coursefile should have appeared with the commit for lonnet 1.481. Anyway here they are now for future reference:
Previously undescrined changes from 1.480 to 1.481
lonnet::userfileupload() modified to use lonnet::process_coursefile() for cases where a file is being uploaded into a course via DOCS into a folder that is not at the top level in /userfiles (i.e., the corresponding sequence name is not default.sequence or default_UNIXTIME.sequence). This type of folder is created when an IMS package has been imported into a course. In such cases a call is made to lonnet::process_coursefile() with 'uploaddoc' as the first parameter passed to the routine.
lonnet::process_coursefile() - used to upload files into subdirectories within /userfiles - modified to support additional 'uploaddoc' case, where uploads are from DOCS. In this case the file itself comes from ENV{'form.uploaddoc'} rather than from a location in perl/tmp.
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.484 loncom/lonnet/perl/lonnet.pm:1.485
--- loncom/lonnet/perl/lonnet.pm:1.484 Thu Apr 1 10:24:44 2004
+++ loncom/lonnet/perl/lonnet.pm Fri Apr 2 19:13:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.484 2004/04/01 15:24:44 albertel Exp $
+# $Id: lonnet.pm,v 1.485 2004/04/03 00:13:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1186,7 +1186,8 @@
# --------- File operations in /home/httpd/html/userfiles/$domain/1/2/3/$course
# input: action, courseID, current domain, home server for course, intended
# 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
# course.
@@ -1201,8 +1202,9 @@
# and will then be copied to
# /home/httpd/lonUsers/$domain/1/2/3/$course/userfiles/$file in
# course's home server.
+#
# 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
# and will then be copied to /home/httpd/lonUsers/1/2/3/$course/userfiles/$file
# in course's home server.
@@ -1255,7 +1257,7 @@
}
}
}
- unless ( ($fetchresult eq 'ok') || ($fetchresult eq 'no source file') ) {
+ unless ( $fetchresult eq 'ok') {
&logthis('Failed to transfer '.$docudom.'/'.$docuname.'/'.$file.
' to host '.$docuhome.': '.$fetchresult);
}
@@ -1280,7 +1282,6 @@
# See if there is anything left
unless ($fname) { return 'error: no uploaded file'; }
chop($ENV{'form.'.$formname});
- my $url = '';
# Create the directory if not present
my $docuname='';
my $docudom='';
@@ -1290,18 +1291,17 @@
$docudom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
$docuhome=$ENV{'course.'.$ENV{'request.course.id'}.'.home'};
if ($ENV{'form.folder'} =~ m/^default/) {
- $url = &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname);
+ return &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname);
} else {
$fname=$ENV{'form.folder'}.'/'.$fname;
- $url = &process_coursefile('uploaddoc',$docuname,$docudom,$docuhome,$fname,$formname);
+ return &process_coursefile('uploaddoc',$docuname,$docudom,$docuhome,$fname,$formname);
}
} else {
$docuname=$ENV{'user.name'};
$docudom=$ENV{'user.domain'};
$docuhome=$ENV{'user.home'};
+ return &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname);
}
- return
- &finishuserfileupload($docuname,$docudom,$docuhome,$formname,$fname);
}
sub finishuserfileupload {