--- loncom/publisher/lonupload.pm 2004/12/07 22:11:02 1.28
+++ loncom/publisher/lonupload.pm 2007/05/02 01:34:23 1.35
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Handler to upload files into construction space
#
-# $Id: lonupload.pm,v 1.28 2004/12/07 22:11:02 raeburn Exp $
+# $Id: lonupload.pm,v 1.35 2007/05/02 01:34:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,42 +37,36 @@ use File::Basename;
use Apache::Constants qw(:common :http :methods);
use Apache::loncacc;
use Apache::loncommon();
-use Apache::Log();
use Apache::lonnet;
use HTML::Entities();
use Apache::lonlocal;
+use Apache::lonnet;
+use LONCAPA();
my $DEBUG=0;
sub Debug {
-
- # Marshall the parameters.
-
- my $r = shift;
- my $log = $r->log;
- my $message = shift;
-
- # Put out the indicated message butonly if DEBUG is false.
-
+ # Put out the indicated message but only if DEBUG is true.
if ($DEBUG) {
- $log->debug($message);
+ my ($r,$message) = @_;
+ $r->log_reason($message);
}
}
sub upfile_store {
my $r=shift;
- my $fname=$ENV{'form.upfile.filename'};
+ my $fname=$env{'form.upfile.filename'};
$fname=~s/\W//g;
- chomp($ENV{'form.upfile'});
+ chomp($env{'form.upfile'});
- my $datatoken=$ENV{'user.name'}.'_'.$ENV{'user.domain'}.
+ my $datatoken=$env{'user.name'}.'_'.$env{'user.domain'}.
'_upload_'.$fname.'_'.time.'_'.$$;
{
my $fh=Apache::File->new('>'.$r->dir_config('lonDaemons').
'/tmp/'.$datatoken.'.tmp');
- print $fh $ENV{'form.upfile'};
+ print $fh $env{'form.upfile'};
}
return $datatoken;
}
@@ -86,12 +80,12 @@ sub phaseone {
} elsif ($mode eq 'imsimport') {
$action = '/adm/imsimport';
}
- $ENV{'form.upfile.filename'}=~s/\\/\//g;
- $ENV{'form.upfile.filename'}=~s/^.*\/([^\/]+)$/$1/;
- if ($ENV{'form.upfile.filename'}) {
+ $env{'form.upfile.filename'}=~s/\\/\//g;
+ $env{'form.upfile.filename'}=~s/^.*\/([^\/]+)$/$1/;
+ if ($env{'form.upfile.filename'}) {
$fn=~s/\/[^\/]+$//;
$fn=~s/([^\/])$/$1\//;
- $fn.=$ENV{'form.upfile.filename'};
+ $fn.=$env{'form.upfile.filename'};
$fn=~s/^\///;
$fn=~s/(\/)+/\//g;
@@ -105,44 +99,38 @@ sub phaseone {
''.
''.&mt('Store uploaded file as ').
- "/priv/$uname/".
+ '" />'.&mt('Save uploaded file as ').
+ "/priv/$uname/".
'
');
- $r->print('
'.&mt('Please indicate the type of file you are uploading. The possible types of file are as follows:').'
-