--- loncom/interface/lonindexer.pm 2001/06/15 19:05:26 1.10 +++ loncom/interface/lonindexer.pm 2001/06/21 20:57:12 1.11 @@ -50,7 +50,6 @@ sub handler { my $lonhost = $r->dir_config('lonHostID'); my $tabdir = $r->dir_config('lonTabDir'); -# my $iconpath='/res/adm/pages/indexericons/'; my $fileclr='#ffffe6'; # -------------------------------------- see if called from an interactive mode map { @@ -184,9 +183,9 @@ ENDHEADER $r->print("

The LearningOnline With CAPA Network Directory Browser

\n"); - my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; + my $diropendb = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; - if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { + if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) { if ($ENV{'form.attrs'} ne "") { for (my $i=0; $i<=5; $i++) { @@ -257,7 +256,8 @@ END } } - my $toplevel = "/res/"; +# my $toplevel = "/res/"; + my $toplevel = $uri; my $indent = 0; &scanDir ($r,$toplevel,$indent); @@ -293,17 +293,17 @@ sub scanDir { $compuri = join('',$startdir,$strip,"/"); # user, dir & file having name only, i.e., w/o path $curdir = $startdir; } - my $diropen = 0; + my $diropen = "closed"; if (($dirptr&$testdir) or ($dom =~ /^(domain|user)$/)) { while (my ($key,$val)= each %dupdirs) { if ($key eq $compuri and $val eq "open") { - $diropen = 1; + $diropen = "opened"; delete $dupdirs{key},$dirs{$key}; } } } &display_line($r,$diropen,$line,$indent,$curdir,@list); - &scanDir ($r,$compuri,$indent) if $diropen == 1; + &scanDir ($r,$compuri,$indent) if $diropen eq "opened"; } $indent--; } @@ -376,21 +376,18 @@ sub display_line{ my $dirptr=16384; my $fileclr="#ffffe6"; my $iconpath= $r->dir_config('lonIconsURL') . "/"; -# my $iconpath="/res/adm/pages/indexericons/"; my @filecom = split (/\&/,$line); my @pathcom = split (/\//,$filecom[0]); my $listname = $pathcom[scalar(@pathcom)-1]; my $fnptr = $filecom[3]&$dirptr; my $msg = 'View '.$filecom[0].' resources'; - $msg = 'Close '.$filecom[0].' directory' if $diropen == 1; + $msg = 'Close '.$filecom[0].' directory' if $diropen eq "opened"; my $tabtag=""; my $i=0; while ($i<=5) { -# my $key="form.attr".$i; -# $tabtag=join('',$tabtag," ") if $ENV{$key} == 1; $tabtag=join('',$tabtag," ") if $hash{'display_attrs_'.$i} == 1; $i++; } @@ -400,8 +397,8 @@ sub display_line{ &begin_form ($r,$filecom[0].'/'); my $anchor = $filecom[0].'/'; $anchor =~ s/\///g; - $r->print ("\nprint (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n"); + $r->print ('print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); $r->print("Domain - $listname $tabtag\n"); return OK; } @@ -412,12 +409,9 @@ sub display_line{ &begin_form ($r,$curdir); my $anchor = $curdir; $anchor =~ s/\///g; -# $r->print ("\n\n"); - $r->print ("\n\n"); - $r->print ("print ("folder_pointer_closed.gif\"") if $diropen == 0; - $r->print ("folder_pointer_opened.gif\"") if $diropen == 1; - $r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n"); + $r->print (''."\n"); + $r->print ('print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); $r->print ("\n"); $r->print ("$listname $tabtag\n"); return OK; @@ -457,7 +451,7 @@ sub display_line{ if ($indent < 11) { $r->print("\n"); - } else { + } elsif ($indent >0) { my $ten = int($indent/10.); my $rem = $indent%10.0; my $count = 0; @@ -474,10 +468,12 @@ sub display_line{ $r->print (" (metadata) ") if ($metafile == 1); $r->print("\n"); -# $r->print(" ",$filecom[8]," \n") if $ENV{'form.attr0'} == 1; - $r->print(" ",$filecom[8]," \n") if $hash{'display_attrs_0'} == 1; - $r->print(" ".(localtime($filecom[9]))." \n") if $hash{'display_attrs_1'} == 1; - $r->print(" ".(localtime($filecom[10]))." \n") if $hash{'display_attrs_2'} == 1; + $r->print(" ",$filecom[8]," \n") + if $hash{'display_attrs_0'} == 1; + $r->print(" ".(localtime($filecom[9]))." \n") + if $hash{'display_attrs_1'} == 1; + $r->print(" ".(localtime($filecom[10]))." \n") + if $hash{'display_attrs_2'} == 1; if ($hash{'display_attrs_3'} == 1) { my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1); @@ -507,7 +503,7 @@ sub display_line{ $r->print("$extrafield"); &begin_form ($r,$curdir); my $indentm1 = $indent-1; - if ($indentm1 < 11) { + if ($indentm1 < 11 and $indentm1 > 0) { $r->print("\n"); } else { my $ten = int($indentm1/10.); @@ -519,12 +515,9 @@ sub display_line{ } $r->print("\n") if $rem > 0; } - $r->print ("\nprint ("folder_pointer_closed.gif\"") if $diropen == 0; - $r->print ("folder_pointer_opened.gif\"") if $diropen == 1; - $r->print (" name=\"$msg\" height=\"22\" type=\"image\" border=\"0\">\n"); - $r->print("\n") if $diropen == 0; - $r->print("\n") if $diropen == 1; + $r->print ('print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); + $r->print("\n"); $r->print("$listname $tabtag\n"); } @@ -535,13 +528,13 @@ sub begin_form { my ($r,$uri) = @_; my $anchor = $uri; $anchor =~ s/\///g; - $r->print ("
\n"); + $r->print (''."\n"); $r->print ("$hidden\n"); -# for (my $i=0; $i<=5; $i++) { -# $r->print ("\n") if $ENV{'form.attr'.$i} == 1; -# } } 1; __END__ + + +