--- loncom/publisher/loncfile.pm 2011/11/02 19:12:40 1.113
+++ loncom/publisher/loncfile.pm 2013/07/03 05:03:19 1.120
@@ -9,7 +9,7 @@
# and displays a page showing the results of the action.
#
#
-# $Id: loncfile.pm,v 1.113 2011/11/02 19:12:40 raeburn Exp $
+# $Id: loncfile.pm,v 1.120 2013/07/03 05:03:19 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("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."
+ .&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("Continue").''
+ .''
+ .'
'.&mt('Cancel').'');
+ $request->print('
'.&mt('Cancel').'');
return;
}
+# Check if there is enough space.
+ my @fileinfo = stat($fn);
+ my ($dir,$fname) = ($fn =~ m{^(.+/)([^/]+)$});
+ my $filesize = $fileinfo[7];
+ $filesize = int($filesize/1000); #expressed in kb
+ my $authorspace = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$domain/$user";
+ my $output = &Apache::loncommon::excess_filesize_authorspace($user,$domain,$authorspace,
+ $fname,$filesize,'copy');
+ if ($output) {
+ $request->print($output.'
'.&mt('Cancel').'');
+ return;
+ }
$request->print(
''
@@ -824,7 +837,7 @@ Parameters:
=item $domain - Name of the domain of the user
-=item $fn - Source file name
+=item $fn - Source filename
=item $newfilename
- Name of the file to be created; no path information
@@ -837,7 +850,7 @@ Side Effects:
=item 2 new forms are displayed. Clicking on the confirmation button
causes the browser to attempt to load the specfied URL, allowing the
proper handler to take care of file creation. There is also a Cancel
-button which returns you to the driectory listing you came from
+button which returns you to the directory listing you came from
=back
@@ -879,7 +892,7 @@ sub NewFile1 {
'
'.&mt('Return to Directory'). + '
'); return; } $r->print('' @@ -1386,11 +1399,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))); } @@ -1441,7 +1462,7 @@ sub handler { # ----------------------------------------------------------- Start page output - my ($uname,$udom) = &Apache::loncacc::constructaccess($fn); + my ($uname,$udom) = &Apache::lonnet::constructaccess($fn); &Debug($r, "loncfile::handler constructaccess uname = $uname domain = $udom"); if (($uname eq '') || ($udom eq '')) { @@ -1479,16 +1500,16 @@ function writeDone() { # 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() @@ -1496,7 +1517,7 @@ function writeDone() { &Apache::loncommon::CSTR_pageheader($trailfile)) ); - $r->print(''.&mt('Location').': '.&display($fn).'
'); if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { $r->print('' @@ -1507,37 +1528,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);