--- loncom/interface/lonindexer.pm 2001/05/18 21:10:48 1.2
+++ loncom/interface/lonindexer.pm 2001/07/08 18:31:10 1.13
@@ -6,7 +6,15 @@
# 07/20-08/04 H.K. Ng
#
# 05/9-05/19/2001 H. K. Ng
-#
+# 05/21/2001 H. K. Ng
+# 05/23/2001 H. K. Ng
+# 05/31/2001 Scott Harrison
+# 06/01/2001 Scott Harrison
+# 06/02/2001 Scott Harrison
+# 06/15/2001 Scott Harrison
+# 06/26/2001 H. K. Ng
+# 07/08/2001 H. K. Ng
+
package Apache::lonindexer;
use strict;
@@ -15,9 +23,12 @@ use Apache::Constants qw(:common);
use Apache::File;
use GDBM_File;
+my %hash;
my %dirs;
my %language;
-
+my $hidden;
+my $extrafield;
+my $fnum;
sub BEGIN {
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.'/language.tab');
map {
@@ -31,8 +42,8 @@ sub handler {
$r->content_type('text/html');
$r->send_http_header;
return OK if $r->header_only;
-
- my $iconpath= $r->dir_config('lonIconsURL');
+ $fnum=0;
+ my $iconpath= $r->dir_config('lonIconsURL') . "/";
my $domain = $r->dir_config('lonDefDomain');
my $role = $r->dir_config('lonRole');
my $loadlim = $r->dir_config('lonLoadLim');
@@ -41,12 +52,120 @@ sub handler {
my $lonhost = $r->dir_config('lonHostID');
my $tabdir = $r->dir_config('lonTabDir');
+ my $fileclr='#ffffe6';
+# -------------------------------------- see if called from an interactive mode
+ map {
+ my ($name, $value) = split(/=/,$_);
+ $value =~ tr/+/ /;
+ $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
+ if ($name eq 'catalogmode') {
+ $ENV{'form.'.$name}=$value;
+ }
+ } (split(/&/,$ENV{'QUERY_STRING'}));
+
+ $hidden=''; my $closebutton='';
+ my $groupimportbutton='';
+ my $colspan='';
+ if ($ENV{'form.catalogmode'} eq 'interactive') {
+ $extrafield='
'.
+ ' | ';
+ $colspan=" colspan='2' ";
+ $hidden=<
+END
+ $closebutton=<
+END
+ }
+ elsif ($ENV{'form.catalogmode'} eq 'groupimport') {
+ $extrafield=''.
+ ' | ';
+ $colspan=" colspan='2' ";
+ $hidden=<
+END
+ $closebutton=<
+END
+ $groupimportbutton=<
+END
+ }
+
+ my $catalogmodefunctions='';
+ if ($ENV{'form.catalogmode'} eq 'interactive' or
+ $ENV{'form.catalogmode'} eq 'groupimport') {
+ $catalogmodefunctions=<print(<
The LearningOnline Network With CAPA Directory Browser
+
+
ENDHEADER
@@ -62,13 +182,26 @@ ENDHEADER
my $line;
my (@attrchk,@openpath);
my $uri=$r->uri;
- my $iconpath="/res/adm/pages/indexericons/";
- $r->print("The LearningOnline With CAPA Network Directory Browser
\n");
+ $r->print('The LearningOnline With CAPA Network Directory Browser
'."\n");
- for (my $i=0; $i<=5; $i++) {
- $attrchk[$i] = "checked" if $ENV{'form.attr'.$i} == 1;
- }
+ my $diropendb = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db";
+
+ if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) {
+
+ if ($ENV{'form.attrs'} ne "") {
+ for (my $i=0; $i<=5; $i++) {
+ delete $hash{'display_attrs_'.$i};
+ if ($ENV{'form.attr'.$i} == 1) {
+ $attrchk[$i] = "checked";
+ $hash{'display_attrs_'.$i} = 1;
+ }
+ }
+ } else {
+ for (my $i=0; $i<=5; $i++) {
+ $attrchk[$i] = "checked" if $hash{'display_attrs_'.$i} == 1;
+ }
+ }
$r->print(<Display file attributes
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";
-# my $fileclr="#ffffdd";
- $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 ($hash{'display_attrs_0'} == 1);
+ $r->print("Last accessed | \n") if ($hash{'display_attrs_1'} == 1);
+ $r->print("Last modified | \n") if ($hash{'display_attrs_2'} == 1);
+ $r->print("Author(s) | \n") if ($hash{'display_attrs_3'} == 1);
+ $r->print("Keywords | \n") if ($hash{'display_attrs_4'} == 1);
+ $r->print("Language | \n") if ($hash{'display_attrs_5'} == 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';
}
}
+
+ my $bredir = $ENV{'form.dirPointer'};
+ my $toplevel;
+ my $indent = 0;
+ $uri = $uri.'/' if $uri !~ /.*\/$/;
+ if ($bredir ne "on") {
+ $hash{'top.level'} = $uri;
+ $toplevel = $uri;
- sort keys %dirs;
-
- my $toplevel = "/res/";
- my $indent = -1;
+ } else {
+ $toplevel = $hash{'top.level'};
+ }
+ if ($toplevel ne "/res/"){
+ my (@uri_com) = split(/\//,$uri);
+ pop @uri_com;
+ my $upone = join('/',@uri_com);
+ my @list = qw (0);
+ &display_line ($r,'opened',$upone.'&viewOneUp',0,$upone,@list);
+ $indent = 1;
+ }
&scanDir ($r,$toplevel,$indent);
-
+
+ $r->print("");
$r->print(" ");
$r->print(" | ");
$r->print("
|