--- loncom/publisher/loncfile.pm 2004/09/10 20:05:03 1.63 +++ loncom/publisher/loncfile.pm 2005/03/10 03:50:49 1.65 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.63 2004/09/10 20:05:03 albertel Exp $ +# $Id: loncfile.pm,v 1.65 2005/03/10 03:50:49 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -289,7 +289,7 @@ sub checksuffix { } sub cleanDest { - my ($request,$dest,$subdir,$fn)=@_; + my ($request,$dest,$subdir,$fn,$uname)=@_; #remove bad characters my $foundbad=0; if ($subdir && $dest =~/\./) { @@ -302,8 +302,9 @@ sub cleanDest { } if ($dest=~m|/|) { my ($newpath)=($dest=~m|(.*)/|); - if (! -d "$fn/$newpath") { - $request->print("

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

"); + $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.','"'.$newpath.'"')."

"); $dest=~s|.*/||; } } @@ -767,7 +768,7 @@ sub phaseone { my $doingdir=0; if ($ENV{'form.action'} eq 'newdir') { $doingdir=1; } - my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir,$fn); + my $newfilename=&cleanDest($r,$ENV{'form.newfilename'},$doingdir,$fn,$uname); $newfilename=&relativeDest($fn,$newfilename,$uname); $r->print('
'. ''. @@ -801,8 +802,10 @@ sub phaseone { $ENV{'form.action'} eq 'newsequencefile' || $ENV{'form.action'} eq 'newrightsfile' || $ENV{'form.action'} eq 'newstyfile' || + $ENV{'form.action'} eq 'newlibraryfile' || $ENV{'form.action'} eq 'Select Action') { - if ($newfilename) { + my $empty=&mt('Type Name Here'); + if (($newfilename!~/\/$/) && ($newfilename!~/$empty$/)) { &NewFile1($r, $uname, $udom, $fn, $newfilename); } else { $r->print('

'.&mt('No new filename specified.').'

'); @@ -1285,6 +1288,7 @@ function writeDone() { $ENV{'form.action'} eq 'newsequencefile' || $ENV{'form.action'} eq 'newrightsfile' || $ENV{'form.action'} eq 'newstyfile' || + $ENV{'form.action'} eq 'newlibraryfile' || $ENV{'form.action'} eq 'Select Action' ) { $r->print('

'.&mt('New Resource').'

'); } else {