version 1.5, 2001/05/21 18:11:31
|
version 1.6, 2001/05/29 12:24:17
|
Line 7
|
Line 7
|
# |
# |
# 05/9-05/19/2001 H. K. Ng |
# 05/9-05/19/2001 H. K. Ng |
# 05/21/2001 H. K. Ng |
# 05/21/2001 H. K. Ng |
|
# 05/23/2001 H. K. Ng |
# |
# |
package Apache::lonindexer; |
package Apache::lonindexer; |
|
|
Line 70 ENDHEADER
|
Line 71 ENDHEADER
|
|
|
$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"); |
|
|
for (my $i=0; $i<=5; $i++) { |
my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; |
$attrchk[$i] = "checked" if $ENV{'form.attr'.$i} == 1; |
|
} |
if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { |
|
|
|
if ($ENV{'form.attrs'} ne "") { |
|
for (my $i=0; $i<=5; $i++) { |
|
delete $hash{'display_attrs_'.$i}; |
|
if ($ENV{'form.attr'.$i} == 1) { |
|
$attrchk[$i] = "checked"; |
|
$hash{'display_attrs_'.$i} = 1; |
|
} |
|
} |
|
} else { |
|
for (my $i=0; $i<=5; $i++) { |
|
$attrchk[$i] = "checked" if $hash{'display_attrs_'.$i} == 1; |
|
} |
|
} |
$r->print(<<END); |
$r->print(<<END); |
<b><font color="#666666">Display file attributes</font></b><br> |
<b><font color="#666666">Display file attributes</font></b><br> |
<form method="post" name="fileattr" action="$uri" enctype="application/x-www-form-urlencoded"> |
<form method="post" name="fileattr" action="$uri" enctype="application/x-www-form-urlencoded"> |
Line 85 ENDHEADER
|
Line 100 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="submit" name="dirlistattr" value="Review"> |
<input type="submit" name="attrs" value="Review"> |
<input type="submit" name="dirlistattr" value="Refresh"> |
<input type="submit" name="attrs" value="Refresh"> |
</form> |
</form> |
END |
END |
|
|
Line 94 END
|
Line 109 END
|
$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"); |
$r->print("<td bgcolor=$titleclr align=right><b>Size (bytes) </b></td>\n") if ($ENV{'form.attr0'} == 1); |
$r->print("<td bgcolor=$titleclr align=right><b>Size (bytes) </b></td>\n") if ($hash{'display_attrs_0'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Last accessed</b></td>\n") if ($ENV{'form.attr1'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Last accessed</b></td>\n") if ($hash{'display_attrs_1'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Last modified</b></td>\n") if ($ENV{'form.attr2'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Last modified</b></td>\n") if ($hash{'display_attrs_2'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Author(s)</b></td>\n") if ($ENV{'form.attr3'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Author(s)</b></td>\n") if ($hash{'display_attrs_3'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Keywords</b></td>\n") if ($ENV{'form.attr4'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Keywords</b></td>\n") if ($hash{'display_attrs_4'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Language</b></td>\n") if ($ENV{'form.attr5'} == 1); |
$r->print("<td bgcolor=$titleclr><b>Language</b></td>\n") if ($hash{'display_attrs_5'} == 1); |
$r->print("</tr>"); |
$r->print("</tr>"); |
|
|
my $diropen = "/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; |
|
|
|
if (tie(%hash,'GDBM_File',$diropen,&GDBM_WRCREAT,0640)) { |
|
map { |
map { |
if ($_ =~ /^diropen_status_/) { |
if ($_ =~ /^diropen_status_/) { |
my $key = $_; |
my $key = $_; |
Line 143 END
|
Line 155 END
|
return OK; |
return OK; |
} |
} |
|
|
|
|
# --------------------recursive scan of a directory |
# --------------------recursive scan of a directory |
sub scanDir { |
sub scanDir { |
my ($r,$startdir,$indent)=@_; |
my ($r,$startdir,$indent)=@_; |
Line 184 sub get_list {
|
Line 197 sub get_list {
|
my $luri = $uri; |
my $luri = $uri; |
$luri =~ s/\//_/g; |
$luri =~ s/\//_/g; |
|
|
if ($ENV{'form.dirlistattr'} eq "Refresh") { |
if ($ENV{'form.attrs'} eq "Refresh") { |
map { |
map { |
delete $hash{$_} if ($_ =~ /^dirlist_files_/); |
delete $hash{$_} if ($_ =~ /^dirlist_files_/); |
} keys %hash; |
} keys %hash; |
Line 257 sub display_line{
|
Line 270 sub display_line{
|
my $i=0; |
my $i=0; |
|
|
while ($i<=5) { |
while ($i<=5) { |
my $key="form.attr".$i; |
# my $key="form.attr".$i; |
$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $ENV{$key} == 1; |
# $tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $ENV{$key} == 1; |
|
$tabtag=join('',$tabtag,"<td bgcolor=",$fileclr,"> </td>") if $hash{'display_attrs_'.$i} == 1; |
$i++; |
$i++; |
} |
} |
if ($filecom[1] eq "domain") { |
if ($filecom[1] eq "domain") { |
Line 316 sub display_line{
|
Line 330 sub display_line{
|
$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); |
|
|
$r=>print("</td>\n"); |
$r=>print("</td>\n"); |
$r->print("<td bgcolor=$fileclr align=right valign=bottom> ",$filecom[8]," </td>\n") if $ENV{'form.attr0'} == 1; |
# $r->print("<td bgcolor=$fileclr align=right valign=bottom> ",$filecom[8]," </td>\n") if $ENV{'form.attr0'} == 1; |
$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[9]))." </td>\n") if $ENV{'form.attr1'} == 1; |
$r->print("<td bgcolor=$fileclr align=right valign=bottom> ",$filecom[8]," </td>\n") if $hash{'display_attrs_0'} == 1; |
$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[10]))." </td>\n") if $ENV{'form.attr2'} == 1; |
$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[9]))." </td>\n") if $hash{'display_attrs_1'} == 1; |
|
$r->print("<td bgcolor=$fileclr valign=bottom> ".(localtime($filecom[10]))." </td>\n") if $hash{'display_attrs_2'} == 1; |
|
|
if ($ENV{'form.attr3'} == 1) { |
if ($hash{'display_attrs_3'} == 1) { |
my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1); |
my $author = &Apache::lonnet::metadata($filelink,'author') if ($metafile == 1); |
$author = ' ' if (!$author); |
$author = ' ' if (!$author); |
$r->print("<td bgcolor=$fileclr valign=bottom> ".$author." </td>\n"); |
$r->print("<td bgcolor=$fileclr valign=bottom> ".$author." </td>\n"); |
} |
} |
if ($ENV{'form.attr4'} == 1) { |
if ($hash{'display_attrs_4'} == 1) { |
my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1); |
my $keywords = &Apache::lonnet::metadata($filelink,'keywords') if ($metafile == 1); |
$keywords = ' ' if (!$keywords); |
$keywords = ' ' if (!$keywords); |
$r->print("<td bgcolor=$fileclr valign=bottom> ".$keywords." </td>\n"); |
$r->print("<td bgcolor=$fileclr valign=bottom> ".$keywords." </td>\n"); |
} |
} |
if ($ENV{'form.attr5'} == 1) { |
if ($hash{'display_attrs_5'} == 1) { |
my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1); |
my $lang = &Apache::lonnet::metadata($filelink,'language') if ($metafile == 1); |
$lang = $language{$lang}; |
$lang = $language{$lang}; |
$lang = ' ' if (!$lang); |
$lang = ' ' if (!$lang); |
Line 379 sub begin_form {
|
Line 394 sub begin_form {
|
$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=\"/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++) { |
$r->print ("<input type=hidden name=attr$i value=\"1\">\n") if $ENV{'form.attr'.$i} == 1; |
# $r->print ("<input type=hidden name=attr$i value=\"1\">\n") if $ENV{'form.attr'.$i} == 1; |
} |
# } |
} |
} |
|
|
1; |
1; |