--- loncom/interface/lonindexer.pm 2001/06/21 20:57:12 1.11 +++ loncom/interface/lonindexer.pm 2001/06/26 21:11:18 1.12 @@ -12,6 +12,7 @@ # 06/01/2001 Scott Harrison # 06/02/2001 Scott Harrison # 06/15/2001 Scott Harrison +# 06/26/2001 H. K. Ng package Apache::lonindexer; @@ -181,7 +182,7 @@ ENDHEADER my (@attrchk,@openpath); my $uri=$r->uri; - $r->print("

The LearningOnline With CAPA Network Directory Browser

\n"); + $r->print('

The LearningOnline With CAPA Network Directory Browser

'."\n"); my $diropendb = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; @@ -255,12 +256,23 @@ END $dirs{$uri} = 'open'; } } - -# my $toplevel = "/res/"; - my $toplevel = $uri; + + my $bredir = $ENV{'form.dirPointer'}; + my $toplevel; + $uri = $uri.'/' if $uri !~ /.*\/$/; + if ($uri eq "/res/" or $bredir ne "on") { + $hash{'top.level'} = $uri; + $toplevel = $uri; + } elsif ($bredir eq "on") { + if ($hash{'top.level'} eq "/res/") { + $toplevel = "/res/"; + } else { + $toplevel = $uri; + } + } my $indent = 0; &scanDir ($r,$toplevel,$indent); - + $r->print("
"); $r->print("
"); $r->print(""); @@ -290,7 +302,7 @@ sub scanDir { $compuri = join('',$strip,"/"); # domain list has /res/ $curdir = $compuri; } else { - $compuri = join('',$startdir,$strip,"/"); # user, dir & file having name only, i.e., w/o path + $compuri = join('',$startdir,$strip,"/"); # user, dir & file have name only, i.e., w/o path $curdir = $startdir; } my $diropen = "closed"; @@ -339,7 +351,7 @@ sub match_ext { my $dirptr=16384; my $tabdir = $r->dir_config('lonTabDir'); - my $fn = $tabdir."/filetypes.tab"; + my $fn = $tabdir.'/filetypes.tab'; if (-e $fn) { my $FH=Apache::File->new($fn); my @content=<$FH>; @@ -412,8 +424,7 @@ sub display_line{ $r->print (''."\n"); $r->print ('print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); - $r->print ("\n"); - $r->print ("$listname $tabtag\n"); + $r->print (''.$listname.$tabtag.''."\n"); return OK; } # display file @@ -449,7 +460,7 @@ sub display_line{ $fnum++; } - if ($indent < 11) { + if ($indent > 0 and $indent < 11) { $r->print("\n"); } elsif ($indent >0) { my $ten = int($indent/10.); @@ -463,7 +474,7 @@ sub display_line{ } $r->print("\n"); - $r->print(" ",$listname,"\n"); + $r->print (" $listname "); $r->print (" (metadata) ") if ($metafile == 1); @@ -511,7 +522,7 @@ sub display_line{ my $count = 0; while ($count < $ten) { $r->print("\n"); - $count++; + $count++; } $r->print("\n") if $rem > 0; } @@ -528,8 +539,9 @@ sub begin_form { my ($r,$uri) = @_; my $anchor = $uri; $anchor =~ s/\///g; - $r->print ('
'."\n"); - $r->print ("$hidden\n"); + $r->print (''."\n"); + $r->print ($hidden.''."\n"); + $r->print (''."\n"); }