version 1.11, 2001/06/21 20:57:12
|
version 1.12, 2001/06/26 21:11:18
|
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 |
|
|
package Apache::lonindexer; |
package Apache::lonindexer; |
|
|
Line 181 ENDHEADER
|
Line 182 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 255 END
|
Line 256 END
|
$dirs{$uri} = 'open'; |
$dirs{$uri} = 'open'; |
} |
} |
} |
} |
|
|
# my $toplevel = "/res/"; |
my $bredir = $ENV{'form.dirPointer'}; |
my $toplevel = $uri; |
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; |
my $indent = 0; |
&scanDir ($r,$toplevel,$indent); |
&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 302 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 351 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 412 sub display_line{
|
Line 424 sub display_line{
|
$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 ('<img src='.$iconpath.'quill.gif border=0>'.$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 460 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 474 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 511 sub display_line{
|
Line 522 sub display_line{
|
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; |
} |
} |
Line 528 sub begin_form {
|
Line 539 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.'" enctype="application/x-www-form-urlencoded">'."\n"); |
$r->print ("$hidden<input type=hidden name=openuri value=\"$uri\">\n"); |
$r->print ($hidden.'<input type=hidden name=openuri value="'.$uri.'">'."\n"); |
|
$r->print ('<input type=hidden name=dirPointer value="on">'."\n"); |
|
|
} |
} |
|
|