--- loncom/publisher/lonpubdir.pm 2011/10/25 22:04:20 1.132
+++ loncom/publisher/lonpubdir.pm 2013/07/27 21:38:54 1.148
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
-# Construction Space Directory Lister
+# Authoring Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.132 2011/10/25 22:04:20 www Exp $
+# $Id: lonpubdir.pm,v 1.148 2013/07/27 21:38:54 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,7 +33,6 @@ use strict;
use Apache::File;
use File::Copy;
use Apache::Constants qw(:common :http :methods);
-use Apache::loncacc;
use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::londiff();
@@ -52,7 +51,7 @@ sub handler {
my $uname;
my $udom;
- ($uname,$udom)=&Apache::loncacc::constructaccess($r->uri);
+ ($uname,$udom)=&Apache::lonnet::constructaccess($r->uri);
unless (($uname) && ($udom)) {
return HTTP_NOT_ACCEPTABLE;
}
@@ -98,6 +97,7 @@ sub handler {
opendir(DIR,$fn);
my @files=sort {uc($a) cmp uc($b)} (readdir(DIR));
foreach my $filename (@files) {
+ next if ($filename eq '.DS_Store');
my ($cdev,$cino,$cmode,$cnlink,
$cuid,$cgid,$crdev,$csize,
$catime,$cmtime,$cctime,
@@ -144,20 +144,28 @@ sub startpage {
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({
- 'text' => 'Construction Space',
- 'href' => &Apache::loncommon::authorspace(),
+ 'text' => 'Authoring Space',
+ 'href' => &Apache::loncommon::authorspace($formaction),
});
# breadcrumbs (and tools) will be created
# in start_page->bodytag->innerregister
$env{'request.noversionuri'}=$formaction;
- $r->print(&Apache::loncommon::start_page('Construction Space',undef));
+ $r->print(&Apache::loncommon::start_page('Authoring Space',undef));
+
+ my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
+ my $current_disk_usage = &Apache::lonnet::diskusage($udom,$uname,"$londocroot/priv/$udom/$uname");
+ my $disk_quota = &Apache::loncommon::get_user_quota($uname,$udom,'author'); #expressed in Mb
+ $disk_quota = 1000 * $disk_quota; # convert from Mb to kb
$r->print(&Apache::loncommon::head_subbox(
- &Apache::loncommon::CSTR_pageheader(1)));
+ '
'
+ .&Apache::lonhtmlcommon::display_usage($current_disk_usage,$disk_quota)
+ .'
'
+ .&Apache::loncommon::CSTR_pageheader()));
my $esc_thisdisfn = &Apache::loncommon::escape_single($thisdisfn);
- my $doctitle = 'LON-CAPA '.&mt('Construction Space');
+ my $doctitle = 'LON-CAPA '.&mt('Authoring Space');
my $newname = &mt('New Name');
my $pubdirscript=(<
@@ -437,28 +445,34 @@ sub getSourceRightString {
}
#
# Put out a directory table row:
-# putdirectory(r, base, here, dirname, modtime)
-# r - Apache request object.
-# reqfile - File in request.
-# here - Where we are in directory tree.
-# dirname - Name of directory special file.
-# modtime - Encoded modification time.
-#
+# putdirectory(r, base, here, dirname, modtime, targetdir, bombs, numdir)
+# r - Apache request object.
+# reqfile - File in request.
+# here - Where we are in directory tree.
+# dirname - Name of directory special file.
+# modtime - Encoded modification time.
+# targetdir - Publication target directory.
+# bombs - Reference to hash of URLs with runtime error messages.
+# numdir - Reference to scalar used to track number of sub-directories
+# in directory (used in form name for each "actions" dropdown).
+#
sub putdirectory {
- my ($r, $reqfile, $here, $dirname, $modtime, $resdir, $bombs, $numdir) = @_;
+ my ($r, $reqfile, $here, $dirname, $modtime, $targetdir, $bombs, $numdir) = @_;
# construct the display filename: the directory name unless ..:
-
+
+ my $actionitem;
+
my $disfilename = $dirname;
- if ($dirname eq '..') {
- $disfilename = ''.&mt('Parent Directory').'';
- }
# Don't display directory itself, and there is no way up from root directory
- unless ( (($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) {
- my $kaputt=0;
- foreach (keys %{$bombs}) {
- if ($_=~m:^\Q$resdir\E/\Q$disfilename\E/:) { $kaputt=1; last; }
- }
+ unless ((($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) {
+ my $kaputt=0;
+ if (ref($bombs) eq 'HASH') {
+ foreach my $key (keys(%{$bombs})) {
+ my $currentdir = &Apache::lonnet::declutter("$targetdir/$disfilename");
+ if (($key) =~ m{^\Q$currentdir\E/}) { $kaputt=1; last; }
+ }
+ }
#
# Get the metadata from that directory's default.meta to display titles
#
@@ -467,10 +481,9 @@ sub putdirectory {
&Apache::lonpublisher::metaeval(
&Apache::lonnet::getfile($r->dir_config('lonDocRoot').$here.'/'.$dirname.'/default.meta')
);
-#
- my $actionitem = '';
- if ($here eq '..') {
+ if ($dirname eq '..') {
$actionitem = &mt('Go to ...');
+ $disfilename = ''.&mt('Parent Directory').'';
} else {
$actionitem =
'