--- loncom/publisher/loncfile.pm 2009/05/26 16:29:56 1.99 +++ loncom/publisher/loncfile.pm 2009/08/28 14:32:26 1.100.2.2 @@ -9,7 +9,7 @@ # and displays a page showing the results of the action. # # -# $Id: loncfile.pm,v 1.99 2009/05/26 16:29:56 bisitz Exp $ +# $Id: loncfile.pm,v 1.100.2.2 2009/08/28 14:32:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -361,25 +361,28 @@ 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).'"')
+ ,''.&display($newpath).'')
.' '
.&mt('Bad filename [_1]',''.&display($dest).'')
.'
'
.&mt('[_1](name).(number).(extension)[_2] not allowed.','','')
.'
'
.&mt('Removing the [_1].number.[_2] from requested filename.','','')
- .'');
+ .'
".&mt('Invalid characters in requested name have been removed.')."
"); + $request->print('' + .&mt('Invalid characters in requested name have been removed.') + .'
' + ); } return $dest; } @@ -514,10 +517,10 @@ sub Rename1 { if (-d $fn) { $newfilename=~/\.(\w+)$/; if (&Apache::loncommon::fileembstyle($1) eq 'ssi') { - $request->print(''.
+ &mt('Cannot change MIME type of a directory.').
''.
- '
'.&mt('Cancel').'');
+ '
'.&mt('Cancel').'
'
+ .&mt('Cannot rename or move non-obsolete published file.')
+ .'
'
+ .''.&mt('Cancel').'
'.$action.' '.&display($fn). - '
' + .&mt($action.' [_1] to [_2]?' + ,&display($fn),&display($newfilename)) + .'
' + ); &CloseForm1($request, $fn); } else { - $request->print(''.&mt('No new filename specified.').'
'); + $request->print(''.&mt('No new filename specified.').'
'); return; } } else { - $request->print(''.&mt('No such file').': '.&display($fn).'
'); + $request->print('' + .&mt('No such file: [_1]' + ,''.&display($fn).'') + .'
' + ); return; } @@ -591,22 +604,38 @@ sub Delete1 { $fn.'" />'); if (-d $fn) { unless (&empty_directory($fn,'Delete1')) { - $request->print(''
+ .''
+ .&mt('Only empty directories may be deleted.')
+ .'
'
+ .&mt('You must delete the contents of the directory first.')
+ .'
'
+ .&mt('Cannot delete non-obsolete published file.')
+ .'
'
+ .''.&mt('Cancel').'
'.&mt('Delete').' '.&display($fn).'?
'); + $request->print('' + .&mt('Delete [_1]?' + ,''.&display($fn).'') + .'
' + ); &CloseForm1($request, $fn); } else { - $request->print(''.&mt('No such file').': '.&display($fn).'
'); + $request->print('' + .&mt('No such file: [_1]' + ,''.&display($fn).'') + .'
' + ); } } @@ -660,13 +689,21 @@ sub Copy1 { $request->print(''.&mt('Copy').' '.&display($fn).'
to '.
- &display($newfilename).'?
' + .&mt('Copy [_1] to [_2]?' + ,''.&display($fn).'' + ,''.&display($newfilename).'') + .'
' + ); &CloseForm1($request, $fn); } else { - $request->print(''.&mt('No such file').': '.&display($fn).'
'); + $request->print('' + .&mt('No such file: [_1]' + ,''.&display($fn).'') + .'
' + ); } } @@ -722,9 +759,13 @@ sub NewDir1 { } elsif ($mode eq 'imsimport') { $request->print(''); } - $request->print(''.&mt('Make new directory').' '. - &display($newfilename).'?
'); + $request->print('' + .'' + .&mt('Make new directory [_1]?' + ,''.&display($newfilename).'') + .'
' + ); &CloseForm1($request, $fn); } } @@ -734,10 +775,18 @@ sub Decompress1 { my ($request, $user, $domain, $fn) = @_; if( -e $fn) { $request->print(''); - $request->print(''.&mt('Decompress').' '.&display($fn).'?
'); + $request->print('' + .&mt('Decompress [_1]?' + ,''.&display($fn).'') + .'
' + ); &CloseForm1($request, $fn); } else { - $request->print(''.&mt('No such file').': '.&display($fn).'
'); + $request->print('' + .&mt('No such file: [_1]' + ,''.&display($fn).'') + .'
' + ); } } @@ -806,7 +855,8 @@ sub NewFile1 { $extension = $1; } - my @okexts = qw(xml html xhtml htm xhtm problem page sequence rights sty library js css txt); + my @okexts = qw(xml html xhtml htm xhtm problem page sequence rights sty task library js css txt); + if (($extension eq '') || (!grep(/^\Q$extension\E/,@okexts))) { my $validexts = '.'.join(', .',@okexts); $request->print(''. @@ -905,7 +955,10 @@ sub phaseone { if($newfilename) { &Copy1($r, $uname, $udom, $fn, $newfilename); } else { - $r->print('
'.&mt('No new filename specified.').'
'); + $r->print('' + .&mt('No new filename specified.') + .'
' + ); } } elsif ($env{'form.action'} eq 'newdir') { my $mode = ''; @@ -927,7 +980,10 @@ sub phaseone { if (($newfilename!~/\/$/) && ($newfilename!~/$empty$/)) { &NewFile1($r, $uname, $udom, $fn, $newfilename); } else { - $r->print(''.&mt('No new filename specified.').'
'); + $r->print('' + .&mt('No new filename specified.') + .'
' + ); } } } @@ -1014,7 +1070,11 @@ sub Rename2 { unlink $tmp2; } } else { - $request->print("".&mt('No such file').": ".&display($oldfile).'
'); + $request->print('' + .&mt('No such file: [_1]' + ,''.&display($oldfile).'') + .'
' + ); return 0; } return 1; @@ -1062,7 +1122,7 @@ sub Delete2 { return 0; } } else { - $request->print(''.&mt('No such file').'.
'); + $request->print(''.&mt('No such file').'
'); return 0; } } @@ -1073,7 +1133,7 @@ sub Delete2 { return 0; } } else { - $request->print(''.&mt('No such file').'.
'); + $request->print(''.&mt('No such file').'
'); return 0; } } @@ -1132,7 +1192,7 @@ sub Copy2 { return 1; } } else { - $request->print(''.&mt('No such file').'
'); + $request->print(''.&mt('No such file').'
'); return 0; } return 1; @@ -1286,7 +1346,7 @@ sub phasetwo { } $dest = $env{'form.newfilename'}; } else { - $r->print(''.&mt('No New filename specified').'
'); + $r->print(''.&mt('No New filename specified').'
'); return; } @@ -1387,26 +1447,10 @@ function writeDone() { $loaditem{'onload'} = "writeDone()"; } - # Breadcrumbs - &Apache::lonhtmlcommon::clear_breadcrumbs(); - &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'Construction Space', - 'href' => '', # FIXME Add link to /priv/[user] - }); - &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'File Operation', - 'title' => 'Construction Space File Operation', - 'href' => '', - }); - $r->print(&Apache::loncommon::start_page('Construction Space File Operation', $js, - {'add_entries' => \%loaditem,}) - .&Apache::lonhtmlcommon::breadcrumbs() - .&Apache::loncommon::head_subbox( - &Apache::loncommon::CSTR_pageheader()) - ); - + {'add_entries' => \%loaditem,})); + $r->print(''.&mt('Unknown Action').' '.$env{'form.action'}.'
'. - &Apache::loncommon::end_page()); + $r->print('' + .&mt('Unknown Action').' '.$env{'form.action'} + .'
' + .&Apache::loncommon::end_page() + ); return OK; } if ($env{'form.phase'} eq 'two') {