--- loncom/publisher/lonupload.pm 2003/08/04 17:45:06 1.18
+++ loncom/publisher/lonupload.pm 2003/09/22 15:39:53 1.20
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# Handler to upload files into construction space
#
-# $Id: lonupload.pm,v 1.18 2003/08/04 17:45:06 www Exp $
+# $Id: lonupload.pm,v 1.20 2003/09/22 15:39:53 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,6 +40,7 @@ use Apache::loncommon();
use Apache::Log();
use Apache::lonnet;
use HTML::Entities();
+use Apache::lonlocal;
my $DEBUG=0;
@@ -98,32 +99,32 @@ sub phaseone {
''.
''.
''.
- 'Store uploaded file as '.
+ &mt('Store uploaded file as ').
'
'.
- '');
+ '');
# Check for bad extension and warn user
if ($fn=~/\.(\w+)$/ &&
(&Apache::loncommon::fileembstyle($1) eq 'hdn')) {
$r->print(
''.
- 'The extension on this file, "'.$1.
- '", is reserved internally by LON-CAPA.
'.
- 'Please change the extension.'.
+ &mt('The extension on this file,').' "'.$1.
+ '"'.&mt(', is reserved internally by LON-CAPA.').'
'.
+ &mt('Please change the extension.').
'');
} elsif($fn=~/\.(\w+)$/ &&
!defined(&Apache::loncommon::fileembstyle($1))) {
$r->print(
''.
- 'The extension on this file, "'.$1.
- '", is not recognized by LON-CAPA.
'.
- 'Please change the extension.'.
+ &mt('The extension on this file,').' "'.$1.
+ '"'.&mt(', is not recognized by LON-CAPA.').'
'.
+ &mt('Please change the extension.').
'');
}
} else {
- $r->print('Illegal filename.');
+ $r->print(''.&mt('Illegal filename.').'');
}
} else {
- $r->print('No upload file specified.');
+ $r->print(''.&mt('No upload file specified.').'');
}
}
@@ -147,11 +148,11 @@ sub phasetwo {
if ((-e $target) && ($ENV{'form.override'} ne 'Yes')) {
$r->print(
'
'.&mt('Back to Directory').'');
} elsif ($fn=~/\.(\w+)$/ &&
!defined(&Apache::loncommon::fileembstyle($1))) {
$r->print(
+ &mt('File').' '.$fn.' '.&mt('could not be copied.').'
'.
+ ''.
+ &mt('The extension on this file is not recognized by LON-CAPA.').
+ '');
+ $r->print('
'.&mt('Back to Directory').'');
+ } elsif (-d $target) {
+ $r->print(
'File '.$fn.' could not be copied.
'.
''.
- 'The extension on this file is not recognized by LON-CAPA.'.
+ &mt('The target is an existing directory.').
'');
+ $r->print('
'.&mt('Back to Directory').''); } elsif (copy($source,$target)) { chmod(0660, $target); # Set permissions to rw-rw---. - $r->print('File copied.'); + $r->print(&mt('File copied.')); $r->print('
View file'); + '">'.&mt('View file').''); $r->print('
Back to Directory'); + '">'.&mt('Back to Directory').''); } else { $r->print('Failed to copy: '.$!); + $r->print('
'.&mt('Back to Directory').''); } } } else { $r->print( - 'Please pick a filename
'); - &phaseone($r,$fn,$uname,$udom); + ''. +&mt('Please use browser "Back" button and pick a filename').'
'); } } else { $r->print( - 'Please pick a filename
'); - &phaseone($r,$fn,$uname,$udom); + ''.&mt('Please use browser "Back" button and pick a filename').'
'); } } @@ -236,7 +250,7 @@ sub handler { # ----------------------------------------------------------- Start page output - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $r->print('