--- loncom/publisher/lonpubdir.pm 2001/05/09 16:57:07 1.6
+++ loncom/publisher/lonpubdir.pm 2001/07/12 21:23:12 1.10
@@ -10,7 +10,7 @@
# 03/23 Guy Albertelli
# 03/24,03/29 Gerd Kortemeyer)
#
-# 03/31,04/03,05/09 Gerd Kortemeyer
+# 03/31,04/03,05/09,06/23 Gerd Kortemeyer
package Apache::lonpubdir;
@@ -19,6 +19,7 @@ use Apache::File;
use File::Copy;
use Apache::Constants qw(:common :http :methods);
use Apache::loncacc;
+use Apache::lonnet;
sub handler {
@@ -38,9 +39,10 @@ sub handler {
my $uname;
my $udom;
- unless (($uname,$udom)=
+ ($uname,$udom)=
&Apache::loncacc::constructaccess(
- $fn,$r->dir_config('lonDefDomain'))) {
+ $fn,$r->dir_config('lonDefDomain'));
+ unless (($uname) && ($udom)) {
$r->log_reason($uname.' at '.$udom.
' trying to publish file '.$ENV{'form.filename'}.
' ('.$fn.') - not authorized',
@@ -90,13 +92,15 @@ sub handler {
my $dirptr=16384;
opendir(DIR,$fn);
- while ($filename=readdir(DIR)) {
+ my @files=sort(readdir(DIR));
+ foreach my$filename (@files) {
my ($cdev,$cino,$cmode,$cnlink,
$cuid,$cgid,$crdev,$csize,
$catime,$cmtime,$cctime,
$cblksize,$cblocks)=stat($fn.'/'.$filename);
- $filename=~/\.(\w+)$/;
- if (($1 ne 'meta') && (&Apache::lonnet::fileembstyle($1))) {
+ my $extension='';
+ if ($filename=~/\.(\w+)$/) { $extension=$1; }
+ if (($extension ne 'meta') && (&Apache::lonnet::fileembstyle($extension))) {
my $status='Unpublished';
my $bgcol='#FFBBBB';
if (-e $resdir.'/'.$filename) {
@@ -112,7 +116,8 @@ sub handler {
$bgcol='#FFFFBB';
if
(&Apache::lonnet::fileembstyle(($filename=~/\.(\w+)$/)) eq 'ssi') {
- $status.='
Diffs';
}
}
@@ -131,6 +136,9 @@ sub handler {
'>