--- loncom/publisher/loncfile.pm 2007/07/23 23:53:31 1.85
+++ loncom/publisher/loncfile.pm 2009/04/13 21:29:26 1.96
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.85 2007/07/23 23:53:31 albertel Exp $
+# $Id: loncfile.pm,v 1.96 2009/04/13 21:29:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -109,6 +109,17 @@ sub Debug {
}
}
+sub done {
+ my ($url)=@_;
+ my $done=&mt("Done");
+ return(< ".&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.','"'.$newpath.'"')." '
+ .&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).'"')
+ .' '.$action.' '.&display($fn).
- '
(name).(number).(extension) not allowed.
Removing the .number. from requested filename.',$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/;
}
@@ -434,7 +453,7 @@ Parameters:
sub CloseForm2 {
my ($request, $user, $fn) = @_;
- $request->print(''.&mt('Done').'
');
+ $request->print(&done(&url($fn)));
}
=pod
@@ -527,7 +546,7 @@ sub Rename1 {
$request->print('
to '.&display($newfilename).'?
'.&mt('No new filename specified.').'
'); @@ -569,7 +588,7 @@ sub Delete1 { if( -e $fn) { $request->print(''); + $fn.'" />'); if (-d $fn) { unless (&empty_directory($fn,'Delete1')) { $request->print(''.&mt('Make new directory').' '. @@ -714,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 { @@ -764,23 +783,10 @@ button which returns you to the driector sub NewFile1 { my ($request, $user, $domain, $fn, $newfilename) = @_; + return if (&filename_check($newfilename) ne 'ok'); if ($env{'form.action'} =~ /new(.+)file/) { my $extension=$1; - - ##Informs User (name).(number).(extension) not allowed - if($newfilename =~ /\.(\d+)\.(\w+)$/){ - $r->print(''.$newfilename. - ' - '.&mt('Bad Filename').''. + &mt('Invalid filename: ').&display($newfilename).'
'.
+ &mt('The name of the new file needs to end with an appropriate file extension to indicate the type of file to create.').'
'.
+ &mt('The following are valid extensions: [_1].',$validexts).
+ '
'. + '
'. + ''); + return; + } + $request->print(''.&mt('Make new file').' '.&display($newfilename).'?
'); $request->print(''); + $request->print(''); $request->print(''); } + return; +} + +sub filename_check { + my ($newfilename) = @_; + ##Informs User (name).(number).(extension) not allowed + if($newfilename =~ /\.(\d+)\.(\w+)$/){ + $r->print(''.$newfilename. + ' - '.&mt('Bad Filename').'' + .&mt('Co-Author [_1]:[_2]',$uname,$udom) + .'
' + ); } @@ -1370,6 +1421,7 @@ function writeDone() { $env{'form.action'} eq 'newsequencefile' || $env{'form.action'} eq 'newrightsfile' || $env{'form.action'} eq 'newstyfile' || + $env{'form.action'} eq 'newtaskfile' || $env{'form.action'} eq 'newlibraryfile' || $env{'form.action'} eq 'Select Action' ) { $r->print('