--- loncom/publisher/lonpubdir.pm 2004/01/29 00:44:43 1.59
+++ loncom/publisher/lonpubdir.pm 2006/04/06 20:52:50 1.89
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construction Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.59 2004/01/29 00:44:43 www Exp $
+# $Id: lonpubdir.pm,v 1.89 2006/04/06 20:52:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -38,6 +38,8 @@ use Apache::loncommon();
use Apache::lonhtmlcommon();
use Apache::lonlocal;
use Apache::lonmsg;
+use Apache::lonmenu;
+use Apache::lonnet;
sub handler {
@@ -59,7 +61,7 @@ sub handler {
$fn,$r->dir_config('lonDefDomain'));
unless (($uname) && ($udom)) {
$r->log_reason($uname.' at '.$udom.
- ' trying to list directory '.$ENV{'form.filename'}.
+ ' trying to list directory '.$env{'form.filename'}.
' ('.$fn.') - not authorized',
$r->filename);
return HTTP_NOT_ACCEPTABLE;
@@ -70,7 +72,7 @@ sub handler {
$fn=~s/\/$//;
unless ($fn) {
- $r->log_reason($ENV{'user.name'}.' at '.$ENV{'user.domain'}.
+ $r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
' trying to list empty directory', $r->filename);
return HTTP_NOT_FOUND;
}
@@ -89,14 +91,27 @@ sub handler {
my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
&startpage($r, $uname, $udom, $thisdisfn); # Put out the start of page.
+ if ($env{'environment.remote'} eq 'off') {
+ &dircontrols($r,$uname,$udom,$thisdisfn); # Put out actions for directory,
+ # browse/upload + new file page.
+ } else {
+ &pubbuttons($r,$uname,$thisdisfn);
+ }
+ &resourceactions($r,$uname,$udom,$thisdisfn); #Put out form used for printing/deletion etc.
+
+ my $numdir = 0;
+ my $numres = 0;
# Start off the directory table.
-
- $r->print('
'.
- ' | '.&mt('Actions').' | '.&mt('Name').' | '.
- &mt('Title').' | '.
- ''.&mt('Status').' | '.&mt('Last Modified').
- ' |
');
+ $r->print('Directory Contents:
');
+ $r->print(''.
+ ''.&mt('Type').' | '.
+ ''.&mt('Actions').' | '.
+ ''.&mt('Name').' | '.
+ ''.&mt('Title').' | '.
+ ''.&mt('Status').' | '.
+ ''.&mt('Last Modified').
+ ' |
'."\n");
my $filename;
my $dirptr=16384; # Mask indicating a directory in stat.cmode.
@@ -112,17 +127,17 @@ sub handler {
my $extension='';
if ($filename=~/\.(\w+)$/) { $extension=$1; }
if ($cmode&$dirptr) {
- putdirectory($r, $thisdisfn, $linkdir, $filename, $cmtime,$targetdir,\%bombs);
+ putdirectory($r, $thisdisfn, $linkdir, $filename, $cmtime,$targetdir,\%bombs,\$numdir);
} elsif (&Apache::loncommon::fileembstyle($extension) ne 'hdn') {
- putresource($r, $uname, $filename, $thisdisfn, $resdir,
- $targetdir, $linkdir, $cmtime,\%bombs);
+ putresource($r, $udom, $uname, $filename, $thisdisfn, $resdir,
+ $targetdir, $linkdir, $cmtime,\%bombs,\$numres);
} else {
# "hidden" extension and not a directory, so hide it away.
}
}
closedir(DIR);
- $r->print('