--- loncom/interface/lonindexer.pm 2001/05/19 14:31:45 1.3
+++ loncom/interface/lonindexer.pm 2001/05/21 15:22:48 1.4
@@ -6,6 +6,7 @@
# 07/20-08/04 H.K. Ng
#
# 05/9-05/19/2001 H. K. Ng
+# 05/21/2001 H. K. Ng
#
package Apache::lonindexer;
@@ -15,6 +16,7 @@ use Apache::Constants qw(:common);
use Apache::File;
use GDBM_File;
+my %hash;
my %dirs;
my %language;
@@ -88,9 +90,9 @@ ENDHEADER
END
- my $diropen = "/home/httpd/perl/tmp/$domain$ENV{'user.name'}_diropen.db";
+ my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_diropen.db";
- if (tie(%dirs,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) {
+ if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) {
my $titleclr="#ddffff";
$r->print("
\n");
$r->print("\n");
@@ -103,26 +105,38 @@ END
$r->print("Language | \n") if ($ENV{'form.attr5'} == 1);
$r->print(" ");
+ map {
+ if ($_ =~ /^diropen_status_/) {
+ my $key = $_;
+ $key =~ s/^diropen_status_//;
+ $dirs{$key} = $hash{$_};
+ }
+ } keys %hash;
+
if ($ENV{'form.openuri'}) { # take care of review and refresh options
my $uri=$ENV{'form.openuri'};
- if (exists($dirs{$uri})) {
- my $cursta = $dirs{$uri};
+ if (exists($hash{'diropen_status_'.$uri})) {
+ my $cursta = $hash{'diropen_status_'.$uri};
$dirs{$uri} = 'open';
- $dirs{$uri} = 'closed' if $cursta eq 'open';
+ $hash{'diropen_status_'.$uri} = 'open';
+ if ($cursta eq 'open') {
+ $dirs{$uri} = 'closed';
+ $hash{'diropen_status_'.$uri} = 'closed';
+ }
} else {
+ $hash{'diropen_status_'.$uri} = 'open';
$dirs{$uri} = 'open';
}
}
- sort keys %dirs;
my $toplevel = "/res/";
- my $indent = -1;
+ my $indent = 0;
&scanDir ($r,$toplevel,$indent);
$r->print(" ");
$r->print(" |
");
$r->print("