--- loncom/publisher/loncfile.pm 2009/01/15 18:31:19 1.92 +++ 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.92 2009/01/15 18:31:19 bisitz Exp $ +# $Id: loncfile.pm,v 1.96 2009/04/13 21:29:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -361,16 +361,20 @@ sub cleanDest { my ($newpath)=($dest=~m|(.*)/|); $newpath=&relativeDest($fn,$newpath,$uname); if (! -d "$newpath") { - $request->print("
"
+ $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).'"')
- ."
'.&mt('Make new directory').' '. @@ -729,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 { @@ -779,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) + .'
' + ); }