--- loncom/publisher/lonupload.pm 2003/08/04 18:22:55 1.19 +++ 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.19 2003/08/04 18:22:55 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( '
'. - 'File '.$fn.' exists. Overwrite? '. + &mt('File').' '.$fn.' '.&mt('exists. Overwrite?').' '. ''. ''. ''. - '
'); + ''); } else { my $source=$r->dir_config('lonDaemons'). '/tmp/'.$datatoken.'.tmp'; @@ -159,49 +160,50 @@ sub phasetwo { if ($fn=~/\.(\w+)$/ && (&Apache::loncommon::fileembstyle($1) eq 'hdn')) { $r->print( - 'File '.$fn.' could not be copied.
'. + &mt('File').' '.$fn.' '.&mt('could not be copied.').'
'. ''. - 'The extension on this file is reserved internally by LON-CAPA.'. + &mt('The extension on this file is reserved internally by LON-CAPA.'). ''); $r->print('

Back to Directory'); + '">'.&mt('Back to Directory').''); } elsif ($fn=~/\.(\w+)$/ && !defined(&Apache::loncommon::fileembstyle($1))) { $r->print( - 'File '.$fn.' could not be copied.
'. + &mt('File').' '.$fn.' '.&mt('could not be copied.').'
'. ''. - 'The extension on this file is not recognized by LON-CAPA.'. + &mt('The extension on this file is not recognized by LON-CAPA.'). ''); $r->print('

Back to Directory'); + '">'.&mt('Back to Directory').''); } elsif (-d $target) { $r->print( 'File '.$fn.' could not be copied.
'. ''. - 'The target is an existing directory.'. + &mt('The target is an existing directory.'). ''); $r->print('

Back to Directory'); + '">'.&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('

Back to Directory'); + '">'.&mt('Back to Directory').''); } } } else { $r->print( - 'Please use browser "Back" button and pick a filename

'); + ''. +&mt('Please use browser "Back" button and pick a filename').'

'); } } else { $r->print( - 'Please use browser "Back" button and pick a filename

'); + ''.&mt('Please use browser "Back" button and pick a filename').'

'); } } @@ -248,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('LON-CAPA Construction Space'); @@ -256,7 +258,8 @@ sub handler { $r->print(&Apache::loncommon::bodytag('Upload file to Construction Space')); if (($uname ne $ENV{'user.name'}) || ($udom ne $ENV{'user.domain'})) { - $r->print('

Co-Author: '.$uname.' at '.$udom. + $r->print('

'&mt('Co-Author').': '.$uname. +&mt(' at ').$udom. '

'); }