version 1.11, 2001/06/21 20:57:12
|
version 1.13, 2001/07/08 18:31:10
|
Line 12
|
Line 12
|
# 06/01/2001 Scott Harrison |
# 06/01/2001 Scott Harrison |
# 06/02/2001 Scott Harrison |
# 06/02/2001 Scott Harrison |
# 06/15/2001 Scott Harrison |
# 06/15/2001 Scott Harrison |
|
# 06/26/2001 H. K. Ng |
|
# 07/08/2001 H. K. Ng |
|
|
package Apache::lonindexer; |
package Apache::lonindexer; |
|
|
Line 181 ENDHEADER
|
Line 183 ENDHEADER
|
my (@attrchk,@openpath); |
my (@attrchk,@openpath); |
my $uri=$r->uri; |
my $uri=$r->uri; |
|
|
$r->print("<h2><font color=\"\#888888\">The LearningOnline With CAPA Network Directory Browser</font></h2>\n"); |
$r->print('<h2><font color="#888888">The LearningOnline With CAPA Network Directory Browser</font></h2>'."\n"); |
|
|
my $diropendb = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; |
my $diropendb = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; |
|
|
Line 212 ENDHEADER
|
Line 214 ENDHEADER
|
<td><input type=checkbox name=attr4 value="1" $attrchk[4]> Keywords</td> |
<td><input type=checkbox name=attr4 value="1" $attrchk[4]> Keywords</td> |
<td><input type=checkbox name=attr5 value="1" $attrchk[5]> Language</td> |
<td><input type=checkbox name=attr5 value="1" $attrchk[5]> Language</td> |
</tr></table> |
</tr></table> |
|
<input type=hidden name=dirPointer value="on"> |
<input type="submit" name="attrs" value="Review"> |
<input type="submit" name="attrs" value="Review"> |
<input type="submit" name="attrs" value="Refresh"> |
<input type="submit" name="attrs" value="Refresh"> |
$hidden |
$hidden |
Line 255 END
|
Line 258 END
|
$dirs{$uri} = 'open'; |
$dirs{$uri} = 'open'; |
} |
} |
} |
} |
|
|
# my $toplevel = "/res/"; |
my $bredir = $ENV{'form.dirPointer'}; |
my $toplevel = $uri; |
my $toplevel; |
my $indent = 0; |
my $indent = 0; |
&scanDir ($r,$toplevel,$indent); |
$uri = $uri.'/' if $uri !~ /.*\/$/; |
|
if ($bredir ne "on") { |
|
$hash{'top.level'} = $uri; |
|
$toplevel = $uri; |
|
|
|
} 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("<form name='fnum'>"); |
$r->print("<form name='fnum'>"); |
$r->print("<input type='hidden' name='fnum' value='$fnum'></form>"); |
$r->print("<input type='hidden' name='fnum' value='$fnum'></form>"); |
$r->print("</table>"); |
$r->print("</table>"); |
Line 290 sub scanDir {
|
Line 309 sub scanDir {
|
$compuri = join('',$strip,"/"); # domain list has /res/<domain name> |
$compuri = join('',$strip,"/"); # domain list has /res/<domain name> |
$curdir = $compuri; |
$curdir = $compuri; |
} else { |
} 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; |
$curdir = $startdir; |
} |
} |
my $diropen = "closed"; |
my $diropen = "closed"; |
Line 339 sub match_ext {
|
Line 358 sub match_ext {
|
my $dirptr=16384; |
my $dirptr=16384; |
|
|
my $tabdir = $r->dir_config('lonTabDir'); |
my $tabdir = $r->dir_config('lonTabDir'); |
my $fn = $tabdir."/filetypes.tab"; |
my $fn = $tabdir.'/filetypes.tab'; |
if (-e $fn) { |
if (-e $fn) { |
my $FH=Apache::File->new($fn); |
my $FH=Apache::File->new($fn); |
my @content=<$FH>; |
my @content=<$FH>; |
Line 391 sub display_line{
|
Line 410 sub display_line{
|
$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $hash{'display_attrs_'.$i} == 1; |
$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $hash{'display_attrs_'.$i} == 1; |
$i++; |
$i++; |
} |
} |
|
if ($filecom[1] eq "viewOneUp") { |
|
$r->print("<tr>$extrafield"); |
|
$r->print("<td bgcolor=$fileclr valign=bottom>\n"); |
|
$r->print ('<form method="post" name="dirpath" action="'.$startdir. |
|
'" enctype="application/x-www-form-urlencoded">'."\n"); |
|
$r->print ($hidden.'<input type=hidden name=openuri value="'.$startdir.'">'."\n"); |
|
$r->print ('<input src="'.$iconpath.'arrow_up.gif"'); |
|
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
|
$r->print("Up $tabtag</tr></form>\n"); |
|
return OK; |
|
} |
if ($filecom[1] eq "domain") { |
if ($filecom[1] eq "domain") { |
|
$r->print ('<input type=hidden name=dirPointer value="on">'."\n") if ($ENV{'form.dirPointer'} eq "on"); |
$r->print("<tr>$extrafield"); |
$r->print("<tr>$extrafield"); |
$r->print("<td bgcolor=$fileclr valign=bottom>"); |
$r->print("<td bgcolor=$fileclr valign=bottom>"); |
&begin_form ($r,$filecom[0].'/'); |
&begin_form ($r,$filecom[0].'/'); |
my $anchor = $filecom[0].'/'; |
my $anchor = $filecom[0].'/'; |
$anchor =~ s/\///g; |
$anchor =~ s/\///g; |
$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.'server.gif"'); |
$r->print ('<a name="'.$anchor.'">'); |
|
$r->print ('<input src="'.$iconpath.'folder_pointer_'.$diropen.'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
|
$r->print ('<a href="'.$filecom[0].'"><img src="'.$iconpath.'server.gif"'); |
|
$r->print (' border="0"></a>'."\n"); |
$r->print("Domain - $listname $tabtag</tr></form>\n"); |
$r->print("Domain - $listname $tabtag</tr></form>\n"); |
return OK; |
return OK; |
} |
} |
if ($filecom[1] eq "user") { |
if ($filecom[1] eq "user") { |
$r->print("<tr>$extrafield"); |
$r->print("<tr>$extrafield"); |
$r->print("<td bgcolor=$fileclr valign=bottom>\n"); |
$r->print("<td bgcolor=$fileclr valign=bottom nowrap>\n"); |
my $curdir = $startdir.$filecom[0].'/'; |
my $curdir = $startdir.$filecom[0].'/'; |
&begin_form ($r,$curdir); |
|
my $anchor = $curdir; |
my $anchor = $curdir; |
$anchor =~ s/\///g; |
$anchor =~ s/\///g; |
|
&begin_form ($r,$curdir); |
$r->print ('<a name="'.$anchor.'"><img src="'.$iconpath.'whitespace1.gif" border=0>'."\n"); |
$r->print ('<a name="'.$anchor.'"><img src="'.$iconpath.'whitespace1.gif" border=0>'."\n"); |
$r->print ('<input src="'.$iconpath.'folder_pointer_'.$diropen.'.gif"'); |
$r->print ('<input src="'.$iconpath.'folder_pointer_'.$diropen.'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
$r->print ("<img src=",$iconpath,"quill.gif border=0>\n"); |
$r->print ('<a href="'.$curdir.'"><img src='.$iconpath.'quill.gif border=0 name="'.$msg.'" height="22"></a>'); |
$r->print ("$listname $tabtag</tr></form>\n"); |
$r->print ($listname.$tabtag.'</tr></form>'."\n"); |
return OK; |
return OK; |
} |
} |
# display file |
# display file |
Line 449 sub display_line{
|
Line 483 sub display_line{
|
$fnum++; |
$fnum++; |
} |
} |
|
|
if ($indent < 11) { |
if ($indent > 0 and $indent < 11) { |
$r->print("<img src=",$iconpath,"whitespace",$indent,".gif border=0>\n"); |
$r->print("<img src=",$iconpath,"whitespace",$indent,".gif border=0>\n"); |
} elsif ($indent >0) { |
} elsif ($indent >0) { |
my $ten = int($indent/10.); |
my $ten = int($indent/10.); |
Line 463 sub display_line{
|
Line 497 sub display_line{
|
} |
} |
|
|
$r->print("<img src=$iconpath$curfext.gif border=0>\n"); |
$r->print("<img src=$iconpath$curfext.gif border=0>\n"); |
$r->print(" <a href=$filelink target='_blank'>",$listname,"</a>\n"); |
$r->print (" <a href=\"javascript:openWindow('".$filelink."', 'metadatafile', '450', '500', 'no', 'yes')\"; TARGET=_self>$listname</a> "); |
|
|
$r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if ($metafile == 1); |
$r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if ($metafile == 1); |
|
|
Line 510 sub display_line{
|
Line 544 sub display_line{
|
my $rem = $indentm1%10.0; |
my $rem = $indentm1%10.0; |
my $count = 0; |
my $count = 0; |
while ($count < $ten) { |
while ($count < $ten) { |
$r->print("<img src=",$iconpath,"whitespace10.gif border=0>\n"); |
$r->print ("<img src=",$iconpath,"whitespace10.gif border=0>\n"); |
$count++; |
$count++; |
} |
} |
$r->print("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0; |
$r->print ("<img src=",$iconpath,"whitespace",$rem,".gif border=0>\n") if $rem > 0; |
} |
} |
$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.'folder_pointer_'.$diropen.'.gif"'); |
$r->print ('<a name="'.$anchor.'"><input src="'.$iconpath.'folder_pointer_'.$diropen.'.gif"'); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
$r->print (' name="'.$msg.'" height="22" type="image" border="0">'."\n"); |
$r->print("<img src=",$iconpath,"folder_$diropen.gif border=0>\n"); |
$r->print ('<a href="'.$curdir.'"><img src="'.$iconpath.'folder_'.$diropen.'.gif" border=0></a>'."\n"); |
$r->print("$listname $tabtag</tr></form>\n"); |
$r->print ("$listname$tabtag</tr></form>\n"); |
} |
} |
|
|
} |
} |
Line 528 sub begin_form {
|
Line 562 sub begin_form {
|
my ($r,$uri) = @_; |
my ($r,$uri) = @_; |
my $anchor = $uri; |
my $anchor = $uri; |
$anchor =~ s/\///g; |
$anchor =~ s/\///g; |
$r->print ('<form method="post" name="dirpath" action="/res/#'.$anchor.'" enctype="application/x-www-form-urlencoded">'."\n"); |
$r->print ('<form method="post" name="dirpath" action="'.$uri.'#'.$anchor. |
$r->print ("$hidden<input type=hidden name=openuri value=\"$uri\">\n"); |
'" enctype="application/x-www-form-urlencoded">'."\n"); |
|
$r->print ($hidden.'<input type=hidden name=openuri value="'.$uri.'">'."\n"); |
|
$r->print ('<input type=hidden name=dirPointer value="on">'."\n"); |
} |
} |
|
|
1; |
1; |
__END__ |
__END__ |
|
|
|
|
|
|