--- loncom/interface/lonindexer.pm 2001/11/29 20:31:45 1.24 +++ loncom/interface/lonindexer.pm 2001/12/04 15:35:39 1.25 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.24 2001/11/29 20:31:45 harris41 Exp $ +# $Id: lonindexer.pm,v 1.25 2001/12/04 15:35:39 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,7 @@ # 8/6,8/7,8/10 Scott Harrison # 8/14 H. K. Ng # 8/28,10/15,11/28,11/29 Scott Harrison +# 11/30 Matthew Hall # ### @@ -478,16 +479,6 @@ sub match_ext { my @fileext; my $dirptr=16384; - my $tabdir = $r->dir_config('lonTabDir'); - my $fn = $tabdir.'/filetypes.tab'; - if (-e $fn) { - my $FH=Apache::File->new($fn); - my @content=<$FH>; - foreach my $line (@content) { - (my $ext,my $foo) = split /\s+/,$line; - push @fileext,$ext; - } - } foreach my $line (@packlist) { chomp $line; $line =~ s/^\/home\/httpd\/html//; @@ -498,9 +489,9 @@ sub match_ext { my $fext = pop(@filecom); my $fnptr = $unpackline[3]&$dirptr; if ($fnptr == 0 and $unpackline[3] ne "") { - foreach my $nextline (@fileext) { - push @trimlist,$line if $nextline eq $fext; - } + my $embstyle = &Apache::lonnet::fileembstyle($fext); + push @trimlist,$line if (defined($embstyle) && + $embstyle ne 'hdn' ); } else { push @trimlist,$line; } @@ -600,7 +591,14 @@ sub display_line { # display file if ($fnptr == 0 and $filecom[3] ne "") { my @file_ext = split (/\./,$listname); - my $curfext = $file_ext[scalar(@file_ext)-1]; + my $curfext = $file_ext[-1]; + # Set the icon for the file + my $iconname = "unknownfiletype.gif"; + my $embstyle = &Apache::lonnet::fileembstyle($curfext); + # The unless conditional that follows is a bit of overkill + $iconname = $curfext.".gif" unless + (!defined($embstyle) || $embstyle eq 'hdn'); + # my $filelink = $startdir.$filecom[0]; $r->print(""); my $metafile = grep /^$filecom[0]\.meta\&/, @list; @@ -654,7 +652,7 @@ sub display_line { ".gif border='0' />\n") if $rem > 0; } - $r->print("\n"); + $r->print("\n"); $r->print (" $listname ");