--- loncom/interface/lonindexer.pm 2001/05/21 15:22:48 1.4 +++ loncom/interface/lonindexer.pm 2001/05/29 12:24:17 1.6 @@ -7,6 +7,7 @@ # # 05/9-05/19/2001 H. K. Ng # 05/21/2001 H. K. Ng +# 05/23/2001 H. K. Ng # package Apache::lonindexer; @@ -70,9 +71,23 @@ ENDHEADER $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 $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; + + if (tie(%hash,'GDBM_File',$diropen,&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
@@ -85,25 +100,22 @@ ENDHEADER Keywords Language -  - +  +
END - my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_diropen.db"; - - if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { - my $titleclr="#ddffff"; - $r->print("
\n"); - $r->print("\n"); - $r->print("\n"); - $r->print("\n") if ($ENV{'form.attr0'} == 1); - $r->print("\n") if ($ENV{'form.attr1'} == 1); - $r->print("\n") if ($ENV{'form.attr2'} == 1); - $r->print("\n") if ($ENV{'form.attr3'} == 1); - $r->print("\n") if ($ENV{'form.attr4'} == 1); - $r->print("\n") if ($ENV{'form.attr5'} == 1); - $r->print(""); + my $titleclr="#ddffff"; + $r->print("
NameSize (bytes) Last accessedLast modifiedAuthor(s)KeywordsLanguage
\n"); + $r->print("\n"); + $r->print("\n"); + $r->print("\n") if ($hash{'display_attrs_0'} == 1); + $r->print("\n") if ($hash{'display_attrs_1'} == 1); + $r->print("\n") if ($hash{'display_attrs_2'} == 1); + $r->print("\n") if ($hash{'display_attrs_3'} == 1); + $r->print("\n") if ($hash{'display_attrs_4'} == 1); + $r->print("\n") if ($hash{'display_attrs_5'} == 1); + $r->print(""); map { if ($_ =~ /^diropen_status_/) { @@ -143,6 +155,7 @@ END return OK; } + # --------------------recursive scan of a directory sub scanDir { my ($r,$startdir,$indent)=@_; @@ -153,9 +166,9 @@ sub scanDir { my %dupdirs = %dirs; my @list=&get_list($r,$startdir); foreach my $line (@list) { - my ($strip,$domusr,$foo,$testdir,$foo)=split(/\&/,$line,5); + my ($strip,$dom,$foo,$testdir,$foo)=split(/\&/,$line,5); next if $strip =~ /.*\.meta$/; - if ($domusr eq "domain") { + if ($dom eq "domain") { $compuri = join('',$strip,"/"); # domain list has /res/ $curdir = $compuri; } else { @@ -163,9 +176,12 @@ sub scanDir { $curdir = $startdir; } my $diropen = 0; - if (($dirptr&$testdir) or ($domusr =~ /^(domain|user)$/)) { + if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) { while (my ($key,$val)= each %dupdirs) { - $diropen = 1 if ($key eq $compuri and $val eq "open"); + if ($key eq $compuri and $val eq "open") { + $diropen = 1; + delete $dupdirs{key},$dirs{$key}; + } } } &display_line($r,$diropen,$line,$indent,$curdir,@list); @@ -181,7 +197,7 @@ sub get_list { my $luri = $uri; $luri =~ s/\//_/g; - if ($ENV{'form.dirlistattr'} eq "Refresh") { + if ($ENV{'form.attrs'} eq "Refresh") { map { delete $hash{$_} if ($_ =~ /^dirlist_files_/); } keys %hash; @@ -254,8 +270,9 @@ sub display_line{ my $i=0; while ($i<=5) { - my $key="form.attr".$i; - $tabtag=join('',$tabtag,"") if $ENV{$key} == 1; +# my $key="form.attr".$i; +# $tabtag=join('',$tabtag,"") if $ENV{$key} == 1; + $tabtag=join('',$tabtag,"") if $hash{'display_attrs_'.$i} == 1; $i++; } if ($filecom[1] eq "domain") { @@ -313,21 +330,22 @@ sub display_line{ $r->print (" (metadata) ") if ($metafile == 1); $r=>print("\n"); - $r->print("\n") if $ENV{'form.attr0'} == 1; - $r->print("\n") if $ENV{'form.attr1'} == 1; - $r->print("\n") if $ENV{'form.attr2'} == 1; +# $r->print("\n") if $ENV{'form.attr0'} == 1; + $r->print("\n") if $hash{'display_attrs_0'} == 1; + $r->print("\n") if $hash{'display_attrs_1'} == 1; + $r->print("\n") if $hash{'display_attrs_2'} == 1; - if ($ENV{'form.attr3'} == 1) { + if ($hash{'display_attrs_3'} == 1) { my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1); $author = ' ' if (!$author); $r->print("\n"); } - if ($ENV{'form.attr4'} == 1) { + if ($hash{'display_attrs_4'} == 1) { my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1); $keywords = ' ' if (!$keywords); $r->print("\n"); } - if ($ENV{'form.attr5'} == 1) { + if ($hash{'display_attrs_5'} == 1) { my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1); $lang = $language{$lang}; $lang = ' ' if (!$lang); @@ -376,9 +394,9 @@ sub begin_form { $r->print ("\n"); $r->print ("\n"); - for (my $i=0; $i<=5; $i++) { - $r->print ("\n") if $ENV{'form.attr'.$i} == 1; - } +# for (my $i=0; $i<=5; $i++) { +# $r->print ("\n") if $ENV{'form.attr'.$i} == 1; +# } } 1;
NameSize (bytes) Last accessedLast modifiedAuthor(s)KeywordsLanguage
    ",$filecom[8]," ".(localtime($filecom[9]))." ".(localtime($filecom[10]))." ",$filecom[8]," ",$filecom[8]," ".(localtime($filecom[9]))." ".(localtime($filecom[10]))." ".$author." ".$keywords."