--- loncom/publisher/lonupload.pm 2001/12/17 00:57:59 1.10 +++ loncom/publisher/lonupload.pm 2002/09/10 02:31:26 1.14 @@ -1,7 +1,8 @@ + # The LearningOnline Network with CAPA # Handler to upload files into construction space # -# $Id: lonupload.pm,v 1.10 2001/12/17 00:57:59 harris41 Exp $ +# $Id: lonupload.pm,v 1.14 2002/09/10 02:31:26 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,9 +53,30 @@ package Apache::lonupload; use strict; use Apache::File; use File::Copy; +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(); + +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. + + if ($DEBUG) { + $log->debug($message); + } +} sub upfile_store { my $r=shift; @@ -86,6 +108,10 @@ sub phaseone { $fn=~s/^\///; $fn=~s/(\/)+/\//g; +# Fn is the full path to the destination filename. +# + + &Debug($r, "Filename for upload: $fn"); if (($fn) && ($fn!~/\/$/)) { $r->print( '
'); } else { @@ -156,8 +192,9 @@ sub phasetwo { 'The extension on this file is not recognized by LON-CAPA.'. ''); } elsif (copy($source,$target)) { + chmod(0660, $target); # Set permissions to rw-rw---. $r->print('File copied.'); - $r->print('View file'); } else { $r->print('Failed to copy: '.$!);