--- loncom/publisher/loncfile.pm 2009/05/28 17:08:38 1.101
+++ loncom/publisher/loncfile.pm 2013/06/04 22:20:16 1.119
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.101 2009/05/28 17:08:38 bisitz Exp $
+# $Id: loncfile.pm,v 1.119 2013/06/04 22:20:16 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,7 +37,7 @@
=head1 NAME
-Apache::loncfile - Construction space file management.
+Apache::loncfile - Authoring space file management.
=head1 SYNOPSIS
@@ -68,7 +68,6 @@ use File::Basename;
use File::Copy;
use HTML::Entities();
use Apache::Constants qw(:common :http :methods);
-use Apache::loncacc;
use Apache::lonnet;
use Apache::loncommon();
use Apache::lonlocal;
@@ -102,7 +101,7 @@ my $r; # Needs to be global for some
=cut
sub Debug {
- # Put out the indicated message butonly if DEBUG is true.
+ # Put out the indicated message but only if DEBUG is true.
if ($DEBUG) {
my ($r,$message) = @_;
$r->log_reason($message);
@@ -110,14 +109,15 @@ sub Debug {
}
sub done {
- my ($url)=@_;
- my $done=&mt("Done");
- return(< '
+ .&Apache::lonhtmlcommon::confirm_success(&mt("Done"))
+ .' '.&mt('Error: destination for operation is an existing directory.').' '
- .&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("You have requested to create file in directory [_1] which doesn't exist. The requested directory path has been removed from the requested filename."
+ ,&display($newpath))
.' '
- .&mt('Bad filename [_1]',''.&display($dest).'')
+ .&mt('Bad filename [_1]',&display($dest))
.' '
- .&mt($action.' [_1] to [_2]?'
- ,&display($fn),&display($newfilename))
+ .&mt($action.' [_1] to [_2]?',
+ &display($fn),
+ &display($newfilename))
.' '
- .&mt('No such file: [_1]'
- ,''.&display($fn).'')
+ .&mt('No such file: [_1]',
+ &display($fn))
.' '
- .&mt('Delete [_1]?'
- ,''.&display($fn).'')
+ .&mt('Delete [_1]?',
+ &display($fn))
.' '
- .&mt('No such file: [_1]'
- ,''.&display($fn).'')
+ .&mt('No such file: [_1]',
+ &display($fn))
.' '
- .&mt('Copy [_1] to [_2]?'
- ,''.&display($fn).''
- ,''.&display($newfilename).'')
- .' '
+ .&mt('Copy [_1] to [_2]?',
+ &display($fn),
+ &display($newfilename))
+ .' '
- .&mt('No such file: [_1]'
- ,''.&display($fn).'')
+ .&mt('No such file: [_1]',
+ &display($fn))
.' '
- .&mt('Make new directory [_1]?'
- ,''.&display($newfilename).'')
+ .&mt('Make new directory [_1]?',
+ &display($newfilename))
.' '
- .&mt('Decompress [_1]?'
- ,''.&display($fn).'')
+ .&mt('Decompress [_1]?',
+ &display($fn))
.' '
- .&mt('No such file: [_1]'
- ,''.&display($fn).'')
+ .&mt('No such file: [_1]',
+ &display($fn))
.' '.
@@ -866,7 +880,7 @@ sub NewFile1 {
'
'.&mt("Continue").''
+ .''
+ .'
'
.&mt('[_1](name).(number).(extension)[_2] not allowed.','','')
.'
'
@@ -384,24 +390,31 @@ sub cleanDest {
.'
'.&mt('Cancel').'');
return;
}
- $request->print(''
- .'
'.&mt('Return to Directory'). + '
'); + return; + } $r->print('' + $request->print( + '' + .&mt('No such file: [_1]', + &display($oldfile)) + .'
' ); return 0; } @@ -1357,11 +1387,19 @@ sub phasetwo { $dest = $newdir."/"; } if ( ($env{'form.action'} eq 'newdir') && ($env{'form.phase'} eq 'two') && ( ($env{'form.callingmode'} eq 'testbank') || ($env{'form.callingmode'} eq 'imsimport') ) ) { - $r->print(''
+ .&Apache::lonhtmlcommon::confirm_success(&mt('Done'))
+ .'
'.&mt('Continue').''
+ .'
'.&Apache::lonhtmlcommon::confirm_success(&mt('Done')).'
' + .&Apache::lonhtmlcommon::actionbox( + [''.&mt('Return to Directory').'', + ''.$disp_newname.''])); } else { $r->print(&done(&url($dest))); } @@ -1411,14 +1449,11 @@ sub handler { } # ----------------------------------------------------------- Start page output - my $uname; - my $udom; - ($uname,$udom)= - &Apache::loncacc::constructaccess($fn,$r->dir_config('lonDefDomain')); + my ($uname,$udom) = &Apache::lonnet::constructaccess($fn); &Debug($r, "loncfile::handler constructaccess uname = $uname domain = $udom"); - unless (($uname) && ($udom)) { + if (($uname eq '') || ($udom eq '')) { $r->log_reason($uname.' at '.$udom. ' trying to manipulate file '.$env{'form.filename'}. ' ('.$fn.') - not authorized', @@ -1445,31 +1480,35 @@ function writeDone() { |; $loaditem{'onload'} = "writeDone()"; } + + my $londocroot = $r->dir_config('lonDocRoot'); + my $trailfile = $fn; + $trailfile =~ s{^/(priv/)}{$londocroot/$1}; # Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb({ - 'text' => 'Construction Space', - 'href' => &Apache::loncommon::authorspace(), + 'text' => 'Authoring Space', + 'href' => &Apache::loncommon::authorspace($fn), }); &Apache::lonhtmlcommon::add_breadcrumb({ 'text' => 'File Operation', - 'title' => 'Construction Space File Operation', + 'title' => 'Authoring Space File Operation', 'href' => '', }); - $r->print(&Apache::loncommon::start_page('Construction Space File Operation', + $r->print(&Apache::loncommon::start_page('Authoring Space File Operation', $js, {'add_entries' => \%loaditem,}) .&Apache::lonhtmlcommon::breadcrumbs() .&Apache::loncommon::head_subbox( - &Apache::loncommon::CSTR_pageheader()) + &Apache::loncommon::CSTR_pageheader($trailfile)) ); - $r->print(''.&mt('Location').': '.&display($fn).'
'); if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { - $r->print('' + $r->print('
' .&mt('Co-Author [_1]',$uname.':'.$udom) .'
' ); @@ -1477,37 +1516,35 @@ function writeDone() { &Debug($r, "loncfile::handler Form action is $env{'form.action'} "); - if ($env{'form.action'} eq 'delete') { - $r->print('' - .&mt('Unknown Action').' '.$env{'form.action'} + .&mt('Unknown Action: [_1]',$env{'form.action'}) .'
' .&Apache::loncommon::end_page() ); - return OK; + return OK; } + if ($env{'form.phase'} eq 'two') { &Debug($r, "loncfile::handler entering phase2"); &phasetwo($r,$fn,$uname,$udom);