--- loncom/publisher/loncfile.pm 2007/10/18 21:58:21 1.87 +++ loncom/publisher/loncfile.pm 2009/04/04 21:45:57 1.95 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.87 2007/10/18 21:58:21 albertel Exp $ +# $Id: loncfile.pm,v 1.95 2009/04/04 21:45:57 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -109,6 +109,17 @@ sub Debug { } } +sub done { + my ($url)=@_; + my $done=&mt("Done"); + return(<$done + +ENDDONE +} + =pod =item URLToPath($url) @@ -148,7 +159,7 @@ sub URLToPath { my $Url = shift; &Debug($r, "UrlToPath got: $Url"); $Url=~ s/\/+/\//g; - $Url=~ s/^http\:\/\/[^\/]+//; + $Url=~ s/^https?\:\/\/[^\/]+//; $Url=~ s/^\///; $Url=~ s/(\~|priv\/)($match_username)\//\/home\/$2\/public_html\//; &Debug($r, "Returning $Url \n"); @@ -350,13 +361,20 @@ sub cleanDest { my ($newpath)=($dest=~m|(.*)/|); $newpath=&relativeDest($fn,$newpath,$uname); if (! -d "$newpath") { - $request->print("

".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"'.&display($newpath).'"')."

"); + $request->print('

' + .&mt("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested file name." + ,'"'.&display($newpath).'"') + .'

'); $dest=~s|.*/||; } } if ($dest =~ /\.(\d+)\.(\w+)$/){ $request->print('' - .&mt('Bad filename [_1].
(name).(number).(extension) not allowed.
Removing the .number. from requested filename.',&display($dest)) + .&mt('Bad filename [_1]',''.&display($dest).'') + .'
' + .&mt('[_1](name).(number).(extension)[_2] not allowed.','','') + .'
' + .&mt('Removing the [_1].number.[_2] from requested filename.','','') .'
'); $dest =~ s/\.(\d+)(\.\w+)$/$2/; } @@ -435,7 +453,7 @@ Parameters: sub CloseForm2 { my ($request, $user, $fn) = @_; - $request->print('

'.&mt('Done').'

'); + $request->print(&done(&url($fn))); } =pod @@ -570,7 +588,7 @@ sub Delete1 { if( -e $fn) { $request->print(''); + $fn.'" />'); if (-d $fn) { unless (&empty_directory($fn,'Delete1')) { $request->print('

'.&mt('Only empty directories may be deleted.').'

'. @@ -700,9 +718,9 @@ sub NewDir1 { $request->print(''); } else { if ($mode eq 'testbank') { - $request->print(''); + $request->print(''); } elsif ($mode eq 'imsimport') { - $request->print(''); + $request->print(''); } $request->print('

'.&mt('Make new directory').' '. @@ -715,7 +733,7 @@ sub NewDir1 { sub Decompress1 { my ($request, $user, $domain, $fn) = @_; if( -e $fn) { - $request->print(''); + $request->print(''); $request->print('

'.&mt('Decompress').' '.&display($fn).'?

'); &CloseForm1($request, $fn); } else { @@ -1128,8 +1146,8 @@ sub NewDir2 { sub decompress2 { my ($r, $user, $dir, $file) = @_; - &Apache::lonnet::appenv('cgi.file' => $file); - &Apache::lonnet::appenv('cgi.dir' => $dir); + &Apache::lonnet::appenv({'cgi.file' => $file}); + &Apache::lonnet::appenv({'cgi.dir' => $dir}); my $result=&Apache::lonnet::ssi_body('/cgi-bin/decompress.pl'); $r->print($result); &Apache::lonnet::delenv('cgi.file'); @@ -1256,7 +1274,7 @@ sub phasetwo { $r->print('

'.&mt('Return to Directory').'

'); $r->print('

'.$disp_newname.'

'); } else { - $r->print('

'.&mt('Done').'

'); + $r->print(&done(&url($dest))); } } } @@ -1330,10 +1348,9 @@ sub handler { $js = qq| |; @@ -1347,8 +1364,10 @@ function writeDone() { $r->print('

'.&mt('Location').': '.&display($fn).'

'); if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { - $r->print('

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

'); + $r->print('

' + .&mt('Co-Author [_1]:[_2]',$uname,$udom) + .'

' + ); }