--- loncom/publisher/lonupload.pm 2001/12/17 00:57:59 1.10 +++ loncom/publisher/lonupload.pm 2003/02/03 18:03:53 1.15 @@ -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.15 2003/02/03 18:03:53 harris41 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,7 +44,6 @@ # # 04/05,04/09,05/25,06/23,06/24,08/22 Gerd Kortemeyer # 11/29 Matthew Hall -# 12/16 Scott Harrison # ### @@ -52,9 +52,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 +107,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 +191,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: '.$!);