--- loncom/interface/lonindexer.pm 2001/05/19 14:31:45 1.3
+++ loncom/interface/lonindexer.pm 2001/05/21 18:11:31 1.5
@@ -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,41 +90,53 @@ ENDHEADER
END
- my $diropen = "/home/httpd/perl/tmp/$domain$ENV{'user.name'}_diropen.db";
-
- if (tie(%dirs,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) {
- my $titleclr="#ddffff";
- $r->print("
\n");
- $r->print("\n");
- $r->print("Name | \n");
- $r->print("Size (bytes) | \n") if ($ENV{'form.attr0'} == 1);
- $r->print("Last accessed | \n") if ($ENV{'form.attr1'} == 1);
- $r->print("Last modified | \n") if ($ENV{'form.attr2'} == 1);
- $r->print("Author(s) | \n") if ($ENV{'form.attr3'} == 1);
- $r->print("Keywords | \n") if ($ENV{'form.attr4'} == 1);
- $r->print("Language | \n") if ($ENV{'form.attr5'} == 1);
- $r->print(" ");
+ my $titleclr="#ddffff";
+ $r->print("\n");
+ $r->print("\n");
+ $r->print("Name | \n");
+ $r->print("Size (bytes) | \n") if ($ENV{'form.attr0'} == 1);
+ $r->print("Last accessed | \n") if ($ENV{'form.attr1'} == 1);
+ $r->print("Last modified | \n") if ($ENV{'form.attr2'} == 1);
+ $r->print("Author(s) | \n") if ($ENV{'form.attr3'} == 1);
+ $r->print("Keywords | \n") if ($ENV{'form.attr4'} == 1);
+ $r->print("Language | \n") if ($ENV{'form.attr5'} == 1);
+ $r->print(" ");
+
+ my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
+
+ if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) {
+ 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("
|