version 1.2, 2001/05/18 21:10:48
|
version 1.3, 2001/05/19 14:31:45
|
Line 46 sub handler {
|
Line 46 sub handler {
|
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network With CAPA Directory Browser</title> |
<title>The LearningOnline Network With CAPA Directory Browser</title> |
|
|
<SCRIPT language="javascript"> |
<SCRIPT language="javascript"> |
function openWindow(url, wdwName, w, h, toolbar,scrollbar) { |
function openWindow(url, wdwName, w, h, toolbar,scrollbar) { |
var options = "width=" + w + ",height=" + h + ","; |
var options = "width=" + w + ",height=" + h + ","; |
Line 55 function openWindow(url, wdwName, w, h,
|
Line 56 function openWindow(url, wdwName, w, h,
|
newWin.focus(); |
newWin.focus(); |
} |
} |
</SCRIPT> |
</SCRIPT> |
|
|
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
ENDHEADER |
ENDHEADER |
Line 90 END
|
Line 92 END
|
|
|
if (tie(%dirs,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { |
if (tie(%dirs,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { |
my $titleclr="#ddffff"; |
my $titleclr="#ddffff"; |
# my $fileclr="#ffffdd"; |
|
$r->print("<table border=0><tr><td bgcolor=#eeeeee>\n"); |
$r->print("<table border=0><tr><td bgcolor=#eeeeee>\n"); |
$r->print("<table border=0><tr>\n"); |
$r->print("<table border=0><tr>\n"); |
$r->print("<td bgcolor=$titleclr><b>Name</b></td>\n"); |
$r->print("<td bgcolor=$titleclr><b>Name</b></td>\n"); |
Line 112 END
|
Line 113 END
|
$dirs{$uri} = 'open'; |
$dirs{$uri} = 'open'; |
} |
} |
} |
} |
|
|
sort keys %dirs; |
sort keys %dirs; |
|
|
my $toplevel = "/res/"; |
my $toplevel = "/res/"; |
Line 132 END
|
Line 132 END
|
# --------------------recursive scan of a directory |
# --------------------recursive scan of a directory |
sub scanDir { |
sub scanDir { |
my ($r,$startdir,$indent)=@_; |
my ($r,$startdir,$indent)=@_; |
my $compuri; |
my ($compuri,$curdir); |
|
my $dirptr=16384; |
$indent++; |
$indent++; |
|
|
my %dupdirs = %dirs; |
my %dupdirs = %dirs; |
sort keys %dupdirs; |
|
my @list=&get_list($r,$startdir); |
my @list=&get_list($r,$startdir); |
foreach my $line (@list) { |
foreach my $line (@list) { |
my ($strip,$domusr,$foo,$testdir,$foo)=split(/\&/,$line,5); |
my ($strip,$domusr,$foo,$testdir,$foo)=split(/\&/,$line,5); |
if ($domusr eq "domain") { |
if ($domusr eq "domain") { |
$compuri=join('',$strip,"/"); # domain list has /res/<domain name> |
$compuri = join('',$strip,"/"); # domain list has /res/<domain name> |
|
$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 having name only, i.e., w/o path |
|
$curdir = $startdir; |
} |
} |
my $diropen = 0; |
my $diropen = 0; |
&display_line($r,$diropen,$line,$indent,$strip."/") if $domusr eq "domain"; |
if (($dirptr&$testdir) or ($domusr =~ /^(domain|user)$/)) { |
while (my ($key,$val)= each %dupdirs) { |
while (my ($key,$val)= each %dupdirs) { |
$diropen = 1 if ($key eq $compuri and $val eq "open"); |
$diropen = 1 if ($key eq $compuri and $val eq "open"); |
|
} |
} |
} |
&display_line($r,$diropen,$line,$indent,$startdir) if ($domusr ne "domain"); |
&display_line($r,$diropen,$line,$indent,$curdir); |
&scanDir ($r,$compuri,$indent) if $diropen == 1; |
&scanDir ($r,$compuri,$indent) if $diropen == 1; |
} |
} |
$indent--; |
$indent--; |
Line 253 sub display_line{
|
Line 256 sub display_line{
|
$r->print("<tr>"); |
$r->print("<tr>"); |
$r->print("<td bgcolor=$fileclr valign=bottom>"); |
$r->print("<td bgcolor=$fileclr valign=bottom>"); |
&begin_form ($r,$filecom[0].'/'); |
&begin_form ($r,$filecom[0].'/'); |
$r->print ("<input src=\"$iconpath"); |
my $anchor = $filecom[0].'/'; |
$r->print ("comp.blue.gif\""); |
$anchor =~ s/\///g; |
|
$r->print ("<a name=\"".$anchor."\">\n<input src=\"".$iconpath."comp.blue.gif\""); |
$r->print (" name=\"View $filecom[0]/ resources\" height=\"22\" type=\"image\" border=\"0\">\n"); |
$r->print (" name=\"View $filecom[0]/ resources\" height=\"22\" type=\"image\" border=\"0\">\n"); |
$r->print("Domain - $listname $tabtag</tr></form>\n"); |
$r->print("Domain - $listname $tabtag</tr></form>\n"); |
return OK; |
return OK; |
Line 264 sub display_line{
|
Line 268 sub display_line{
|
$r->print("<td bgcolor=$fileclr valign=bottom>\n"); |
$r->print("<td bgcolor=$fileclr valign=bottom>\n"); |
my $curdir = $startdir.$filecom[0].'/'; |
my $curdir = $startdir.$filecom[0].'/'; |
&begin_form ($r,$curdir); |
&begin_form ($r,$curdir); |
$r->print("<img src=",$iconpath,"white_space_20_22.gif border=0>\n"); |
my $anchor = $curdir; |
|
$anchor =~ s/\///g; |
|
$r->print ("<a name=\"$anchor\">\n<img src=",$iconpath,"white_space_20_22.gif border=0>\n"); |
$r->print ("<input src=\"$iconpath"); |
$r->print ("<input src=\"$iconpath"); |
$r->print ("folder_pointer_closed.gif\"") if $diropen == 0; |
$r->print ("folder_pointer_closed.gif\"") if $diropen == 0; |
$r->print ("folder_pointer_opened.gif\"") if $diropen == 1; |
$r->print ("folder_pointer_opened.gif\"") if $diropen == 1; |
$r->print (" name=\"View $curdir resources\" height=\"22\" type=\"image\" border=\"0\">\n"); |
$r->print (" name=\"View $curdir resources\" 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>\n"); |
$r->print("$listname $tabtag</tr></form>\n"); |
$r->print ("$listname $tabtag</tr></form>\n"); |
return OK; |
return OK; |
} |
} |
# display file |
# display file |
Line 289 sub display_line{
|
Line 295 sub display_line{
|
$r->print(" <a href=$filelink>",$listname,"</a>"); |
$r->print(" <a href=$filelink>",$listname,"</a>"); |
my $metafile = '/home/httpd/html'.$filelink.'.meta'; |
my $metafile = '/home/httpd/html'.$filelink.'.meta'; |
|
|
$r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadata', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if (-e $metafile); |
$r->print (" (<a href=\"javascript:openWindow('".$filelink.".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; TARGET=_self>metadata</a>) ") if (-e $metafile); |
|
|
# $r->print(" (<a href=$filelink.meta target=cat>metadata</a>)") if (-e $metafile); |
# $r->print(" (<a href=$filelink.meta target=cat>metadata</a>)") if (-e $metafile); |
$r=>print("</td>\n"); |
$r=>print("</td>\n"); |
Line 320 sub display_line{
|
Line 326 sub display_line{
|
my @file_ext = split (/\./,$listname); |
my @file_ext = split (/\./,$listname); |
my $curfext = $file_ext[scalar(@file_ext)-1]; |
my $curfext = $file_ext[scalar(@file_ext)-1]; |
my $curdir = $startdir.$filecom[0].'/'; |
my $curdir = $startdir.$filecom[0].'/'; |
|
my $anchor = $curdir; |
|
$anchor =~ s/\///g; |
$r->print("<tr><td bgcolor=$fileclr valign=bottom>"); |
$r->print("<tr><td bgcolor=$fileclr valign=bottom>"); |
&begin_form ($r,$curdir); |
&begin_form ($r,$curdir); |
|
|
Line 329 sub display_line{
|
Line 337 sub display_line{
|
$count++; |
$count++; |
} |
} |
|
|
$r->print ("<input src=\"$iconpath"); |
$r->print ("<a name=\"$anchor\">\n<input src=\"$iconpath"); |
$r->print ("folder_pointer_closed.gif\"") if $diropen == 0; |
$r->print ("folder_pointer_closed.gif\"") if $diropen == 0; |
$r->print ("folder_pointer_opened.gif\"") if $diropen == 1; |
$r->print ("folder_pointer_opened.gif\"") if $diropen == 1; |
$r->print (" name=\"View $curdir resources\" height=\"22\" type=\"image\" border=\"0\">\n"); |
$r->print (" name=\"View $curdir resources\" height=\"22\" type=\"image\" border=\"0\">\n"); |
Line 343 sub display_line{
|
Line 351 sub display_line{
|
#---------------------prints the beginning of a form for directory or file link |
#---------------------prints the beginning of a form for directory or file link |
sub begin_form { |
sub begin_form { |
my ($r,$uri) = @_; |
my ($r,$uri) = @_; |
|
my $anchor = $uri; |
$r->print ("<form method=\"post\" name=\"dirpath\" action=\"/res/\" enctype=\"application/x-www-form-urlencoded\">\n"); |
$anchor =~ s/\///g; |
|
$r->print ("<form method=\"post\" name=\"dirpath\" action=\"/res/\#$anchor\" enctype=\"application/x-www-form-urlencoded\">\n"); |
$r->print ("<input type=hidden name=openuri value=\"$uri\">\n"); |
$r->print ("<input type=hidden name=openuri value=\"$uri\">\n"); |
|
|
for (my $i=0; $i<=5; $i++) { |
for (my $i=0; $i<=5; $i++) { |