--- loncom/cgi/decompress.pl 2006/05/05 21:07:19 1.16 +++ loncom/cgi/decompress.pl 2008/11/28 20:42:20 1.17 @@ -31,6 +31,8 @@ #### use strict; use lib '/home/httpd/lib/perl'; +use Apache::lonnet; +use Apache::lonlocal; use LONCAPA::loncgi; my %location_of; @@ -43,22 +45,28 @@ foreach my $program ('tar','gunzip','bun } } +print("Content-type: text/html\n\n"); + if (!&LONCAPA::loncgi::check_cookie_and_load_env()) { - print("Content-type: text/html\n\n"); - print(<NO COOKIE! -END + &Apache::lonlocal::get_language_handle(); + print(&LONCAPA::loncgi::missing_cookie_msg()); } else { - print "Content-type: text/html\n\n"; + &Apache::lonlocal::get_language_handle(); + my %lt = &Apache::lonlocal::texthash ( + bade => 'Bad Environment!', + outo => 'Output of decompress:', + comp => 'Decompress complete.', + erro => 'An error occurred', + ); my $file=$Apache::lonnet::env{'cgi.file'}; my $dir=$Apache::lonnet::env{'cgi.dir'}; if(! $file || ! $dir) { print(<Bad Enviroment! + $lt{'bade'} END } else { print(<

Output of decompress:

+

$lt{'outo'}

END chdir($dir); my @cmd; @@ -76,7 +84,7 @@ END } elsif ($file =~ m|\.tar$|) { @cmd = ($location_of{'tar'},"-xpvf"); } else { - print("There has been an error in determining the file type of $file, please check name"); + print(''.&Apache::lonlocal::mt('There has been an error in determining the file type of [_1], please check the name',$file).''); } if (@cmd) { undef($!); @@ -84,12 +92,12 @@ END open(OUTPUT,"-|", @cmd, $file); while (my $line = ) { print("$line
"); } close(OUTPUT); - print("

Decompress complete.

"); + print("

$lt{'comp'}

"); if ($! || $@) { - print("

An error occurred

$!

$@

"); + print('

'.$lt{'erro'}.'
'.$!.'
'.$@.'

'); } - print(""); } + print(''); } }