version 1.67, 2003/06/16 17:27:33
|
version 1.70, 2003/07/21 18:35:25
|
Line 62 use strict;
|
Line 62 use strict;
|
use Apache::lonnet(); |
use Apache::lonnet(); |
use Apache::loncommon(); |
use Apache::loncommon(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
use Apache::lonmeta; |
use Apache::File; |
use Apache::File; |
use GDBM_File; |
use GDBM_File; |
|
|
Line 126 sub handler {
|
Line 127 sub handler {
|
my $diropendb = |
my $diropendb = |
"/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_indexer.db"; |
"/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_indexer.db"; |
%hash = (); |
%hash = (); |
my %dbfile; |
{ |
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
my %dbfile; |
while(my($key,$value)=each(%dbfile)) { |
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
$hash{$key}=$value; |
while(my($key,$value)=each(%dbfile)) { |
} |
$hash{$key}=$value; |
untie(%dbfile); |
} |
|
untie(%dbfile); |
|
} |
|
} |
|
{ |
if ($ENV{'form.launch'} eq '1') { |
if ($ENV{'form.launch'} eq '1') { |
&start_fresh_session(); |
&start_fresh_session(); |
} |
} |
Line 315 END
|
Line 319 END
|
|
|
<script type="text/javascript"> |
<script type="text/javascript"> |
$catalogmodefunctions |
$catalogmodefunctions |
function openWindow(url, wdwName, w, h, toolbar,scrollbar) { |
function openWindow(url, wdwName, w, h, toolbar,scrollbar,locationbar) { |
var options = "width=" + w + ",height=" + h + ","; |
var options = "width=" + w + ",height=" + h + ","; |
options += "resizable=yes,scrollbars="+scrollbar+",status=no,"; |
options += "resizable=yes,scrollbars="+scrollbar+",status=no,"; |
options += "menubar=no,toolbar="+toolbar+",location=no,directories=no"; |
options += "menubar=no,toolbar="+toolbar+",location="+locationbar+",directories=no"; |
var newWin = window.open(url, wdwName, options); |
var newWin = window.open(url, wdwName, options); |
newWin.focus(); |
newWin.focus(); |
} |
} |
Line 374 $r->print(&Apache::loncommon::bodytag('B
|
Line 378 $r->print(&Apache::loncommon::bodytag('B
|
|
|
# ---------------------------------- get state of file attributes to be showing |
# ---------------------------------- get state of file attributes to be showing |
if ($ENV{'form.attrs'} ne '') { |
if ($ENV{'form.attrs'} ne '') { |
for (my $i=0; $i<=8; $i++) { |
for (my $i=0; $i<=9; $i++) { |
delete $hash{'display_attrs_'.$i}; |
delete $hash{'display_attrs_'.$i}; |
if ($ENV{'form.attr'.$i} == 1) { |
if ($ENV{'form.attr'.$i} == 1) { |
$attrchk[$i] = 'checked'; |
$attrchk[$i] = 'checked'; |
Line 382 $r->print(&Apache::loncommon::bodytag('B
|
Line 386 $r->print(&Apache::loncommon::bodytag('B
|
} |
} |
} |
} |
} else { |
} else { |
for (my $i=0; $i<=8; $i++) { |
for (my $i=0; $i<=9; $i++) { |
$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; |
$attrchk[$i] = 'checked' if $hash{'display_attrs_'.$i} == 1; |
} |
} |
} |
} |
Line 396 $r->print(&Apache::loncommon::bodytag('B
|
Line 400 $r->print(&Apache::loncommon::bodytag('B
|
<td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td> |
<td><input type="checkbox" name="attr1" value="1" $attrchk[1] /> Size</td> |
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td> |
<td><input type="checkbox" name="attr2" value="1" $attrchk[2] /> Last access</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td> |
<td><input type="checkbox" name="attr3" value="1" $attrchk[3] /> Last modified</td> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> All versions</td></tr><tr> |
<td><input type="checkbox" name="attr8" value="1" $attrchk[8] /> Statistics</td></tr><tr> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td> |
<td><input type="checkbox" name="attr4" value="1" $attrchk[4] /> Author</td> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td> |
<td><input type="checkbox" name="attr5" value="1" $attrchk[5] /> Keywords</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td> |
<td><input type="checkbox" name="attr6" value="1" $attrchk[6] /> Language</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td> |
<td><input type="checkbox" name="attr7" value="1" $attrchk[7] /> Show Resource</td> |
|
<td><input type="checkbox" name="attr9" value="1" $attrchk[9] /> All versions</td> |
<td> </td> |
<td> </td> |
</tr></table> |
</tr></table> |
<input type="hidden" name="dirPointer" value="on" /> |
<input type="hidden" name="dirPointer" value="on" /> |
Line 436 END
|
Line 441 END
|
if ($hash{'display_attrs_6'} == 1); |
if ($hash{'display_attrs_6'} == 1); |
$r->print("<td><b>Resource</b></td>\n") |
$r->print("<td><b>Resource</b></td>\n") |
if ($hash{'display_attrs_7'} == 1); |
if ($hash{'display_attrs_7'} == 1); |
|
$r->print("<td><b>Usage Statistics <br />(Courses/Network Hits)</b></td>\n") |
|
if ($hash{'display_attrs_8'} == 1); |
$r->print('</tr>'); |
$r->print('</tr>'); |
|
|
# ----------------- read in what directories have previously been set to "open" |
# ----------------- read in what directories have previously been set to "open" |
Line 499 END
|
Line 506 END
|
|
|
# --------------------------------------------------- end the output and return |
# --------------------------------------------------- end the output and return |
$r->print('</body></html>'."\n"); |
$r->print('</body></html>'."\n"); |
} else { |
# } else { |
$r->print('<html><head></head><body>Unable to tie hash to db '. |
# $r->print('<html><head></head><body>Unable to tie hash to db '. |
'file</body></html>'); |
# 'file</body></html>'); |
return OK; |
# return OK; |
} |
} |
if(! $c->aborted()) { |
if(! $c->aborted()) { |
|
my %dbfile; |
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) { |
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) { |
while (my($key,$value) = each(%hash)) { |
while (my($key,$value) = each(%hash)) { |
$dbfile{$key}=$value; |
$dbfile{$key}=$value; |
Line 531 sub scanDir {
|
Line 539 sub scanDir {
|
my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); |
my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); |
next if $strip =~ /.*\.meta$/; |
next if $strip =~ /.*\.meta$/; |
my (@fileparts) = split(/\./,$strip); |
my (@fileparts) = split(/\./,$strip); |
if ($hash{'display_attrs_8'} != 1) { |
if ($hash{'display_attrs_9'} != 1) { |
if (scalar(@fileparts) >= 3) { |
if (scalar(@fileparts) >= 3) { |
my $fext = pop @fileparts; |
my $fext = pop @fileparts; |
my $ov = pop @fileparts; |
my $ov = pop @fileparts; |
Line 655 sub display_line {
|
Line 663 sub display_line {
|
my $tabtag='</td>'; |
my $tabtag='</td>'; |
my $i=0; |
my $i=0; |
|
|
while ($i<=7) { |
while ($i<=8) { |
$tabtag=join('',$tabtag,"<td> </td>") |
$tabtag=join('',$tabtag,"<td> </td>") |
if $hash{'display_attrs_'.$i} == 1; |
if $hash{'display_attrs_'.$i} == 1; |
$i++; |
$i++; |
Line 665 sub display_line {
|
Line 673 sub display_line {
|
|
|
# display uplink arrow |
# display uplink arrow |
if ($filecom[1] eq 'viewOneUp') { |
if ($filecom[1] eq 'viewOneUp') { |
$r->print("<tr bgcolor=$fileclr>$extrafield"); |
$r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield"); |
$r->print("<td valign=$valign>\n"); |
$r->print("<td>\n"); |
$r->print ('<form method="post" name="dirpathUP" action="'.$startdir. |
$r->print ('<form method="post" name="dirpathUP" action="'.$startdir. |
'/" '. |
'/" '. |
'onSubmit="return rep_dirpath(\'UP\','. |
'onSubmit="return rep_dirpath(\'UP\','. |
Line 690 sub display_line {
|
Line 698 sub display_line {
|
if ($filecom[1] eq 'domain') { |
if ($filecom[1] eq 'domain') { |
$r->print ('<input type="hidden" name="dirPointer" value="on">'."\n") |
$r->print ('<input type="hidden" name="dirPointer" value="on">'."\n") |
if ($ENV{'form.dirPointer'} eq "on"); |
if ($ENV{'form.dirPointer'} eq "on"); |
$r->print("<tr bgcolor=$fileclr>$extrafield"); |
$r->print("<tr valign='$valign' bgcolor=$fileclr>$extrafield"); |
$r->print("<td valign=$valign>"); |
$r->print("<td>"); |
&begin_form ($r,$filecom[0].'/'); |
&begin_form ($r,$filecom[0].'/'); |
my $anchor = $filecom[0].'/'; |
my $anchor = $filecom[0].'/'; |
$anchor =~ s/\///g; |
$anchor =~ s/\///g; |
Line 715 sub display_line {
|
Line 723 sub display_line {
|
# display user directory |
# display user directory |
} |
} |
if ($filecom[1] eq 'user') { |
if ($filecom[1] eq 'user') { |
$r->print("<tr bgcolor=$fileclr>$extrafield"); |
$r->print("<tr valign=$valign bgcolor=$fileclr>$extrafield"); |
$r->print("<td valign=$valign nowrap>\n"); |
$r->print("<td nowrap>\n"); |
my $curdir = $startdir.$filecom[0].'/'; |
my $curdir = $startdir.$filecom[0].'/'; |
my $anchor = $curdir; |
my $anchor = $curdir; |
$anchor =~ s/\///g; |
$anchor =~ s/\///g; |
Line 759 sub display_line {
|
Line 767 sub display_line {
|
$iconname = $curfext.".gif" unless |
$iconname = $curfext.".gif" unless |
(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn'); |
(!defined($embstyle) || $embstyle eq 'unk' || $embstyle eq 'hdn'); |
# |
# |
$r->print("<tr bgcolor=$fileclr><td nowrap valign='$valign'>"); |
$r->print("<tr valign='$valign' bgcolor=$fileclr><td nowrap>"); |
my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list; |
my $metafile = grep /^\Q$filecom[0]\E\.meta\&/, @list; |
my $title; |
my $title; |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
if ($ENV{'form.catalogmode'} eq 'interactive') { |
Line 773 sub display_line {
|
Line 781 sub display_line {
|
$titleesc,"','",$filelink,"')\">"); |
$titleesc,"','",$filelink,"')\">"); |
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
$r->print("<img src='",$iconpath,"select.gif' border='0' /></a>". |
"\n"); |
"\n"); |
$r->print("</td><td valign='$valign' nowrap>"); |
$r->print("</td><td nowrap>"); |
} |
} |
elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
elsif ($ENV{'form.catalogmode'} eq 'groupimport') { |
$title=$listname; |
$title=$listname; |
Line 792 sub display_line {
|
Line 800 sub display_line {
|
$r->print("<input type='hidden' name='title"."' ". |
$r->print("<input type='hidden' name='title"."' ". |
"value='$titleesc'>\n"); |
"value='$titleesc'>\n"); |
$r->print("</form>\n"); |
$r->print("</form>\n"); |
$r->print("</td><td valign='$valign' nowrap>"); |
$r->print("</td><td nowrap>"); |
$hash{"pre_${fnum}_link"}=$filelink; |
$hash{"pre_${fnum}_link"}=$filelink; |
$hash{"pre_${fnum}_title"}=$titleesc; |
$hash{"pre_${fnum}_title"}=$titleesc; |
$fnum++; |
$fnum++; |
Line 816 sub display_line {
|
Line 824 sub display_line {
|
|
|
$r->print("<img src=$iconpath$iconname border='0' />\n"); |
$r->print("<img src=$iconpath$iconname border='0' />\n"); |
$r->print (" <a href=\"javascript:openWindow('".$filelink. |
$r->print (" <a href=\"javascript:openWindow('".$filelink. |
"', 'metadatafile', '450', '500', 'no', 'yes')\";". |
"', 'previewfile', '450', '500', 'no', 'yes','yes')\";". |
" TARGET=_self>$listname</a> "); |
" TARGET=_self>$listname</a> "); |
|
|
$r->print (" (<a href=\"javascript:openWindow('".$filelink. |
$r->print (" (<a href=\"javascript:openWindow('".$filelink. |
".meta', 'metadatafile', '400', '450', 'no', 'yes')\"; ". |
".meta', 'metadatafile', '400', '450', 'no', 'yes','no')\"; ". |
"TARGET=_self>metadata</a>) ") if ($metafile == 1); |
"TARGET=_self>metadata</a>) ") if ($metafile == 1); |
|
|
$r->print("</td>\n"); |
$r->print("</td>\n"); |
if ($hash{'display_attrs_0'} == 1) { |
if ($hash{'display_attrs_0'} == 1) { |
my $title = &Apache::lonnet::metadata($filelink,'title') |
my $title = &Apache::lonnet::gettitle($filelink,'title') |
if ($metafile == 1); |
if ($metafile == 1); |
$r->print('<td valign=$valign> '.($title eq '' ? ' ' : $title). |
$r->print('<td> '.($title eq '' ? ' ' : $title). |
' </td>'."\n"); |
' </td>'."\n"); |
} |
} |
$r->print('<td align=right valign=$valign> ', |
$r->print('<td align=right> ', |
$filecom[8]," </td>\n") |
$filecom[8]," </td>\n") |
if $hash{'display_attrs_1'} == 1; |
if $hash{'display_attrs_1'} == 1; |
$r->print('<td valign=$valign> '. |
$r->print('<td> '. |
(localtime($filecom[9]))." </td>\n") |
(localtime($filecom[9]))." </td>\n") |
if $hash{'display_attrs_2'} == 1; |
if $hash{'display_attrs_2'} == 1; |
$r->print('<td valign=$valign> '. |
$r->print('<td> '. |
(localtime($filecom[10]))." </td>\n") |
(localtime($filecom[10]))." </td>\n") |
if $hash{'display_attrs_3'} == 1; |
if $hash{'display_attrs_3'} == 1; |
|
|
if ($hash{'display_attrs_4'} == 1) { |
if ($hash{'display_attrs_4'} == 1) { |
my $author = &Apache::lonnet::metadata($filelink,'author') |
my $author = &Apache::lonnet::metadata($filelink,'author') |
if ($metafile == 1); |
if ($metafile == 1); |
$r->print('<td valign=$valign> '.($author eq '' ? ' ' : $author). |
$r->print('<td> '.($author eq '' ? ' ' : $author). |
" </td>\n"); |
" </td>\n"); |
} |
} |
if ($hash{'display_attrs_5'} == 1) { |
if ($hash{'display_attrs_5'} == 1) { |
my $keywords = &Apache::lonnet::metadata($filelink,'keywords') |
my $keywords = &Apache::lonnet::metadata($filelink,'keywords') |
if ($metafile == 1); |
if ($metafile == 1); |
# $keywords = ' ' if (!$keywords); |
# $keywords = ' ' if (!$keywords); |
$r->print('<td valign=$valign> '.($keywords eq '' ? ' ' : $keywords). |
$r->print('<td> '.($keywords eq '' ? ' ' : $keywords). |
" </td>\n"); |
" </td>\n"); |
} |
} |
if ($hash{'display_attrs_6'} == 1) { |
if ($hash{'display_attrs_6'} == 1) { |
my $lang = &Apache::lonnet::metadata($filelink,'language') |
my $lang = &Apache::lonnet::metadata($filelink,'language') |
if ($metafile == 1); |
if ($metafile == 1); |
$lang = &Apache::loncommon::languagedescription($lang); |
$lang = &Apache::loncommon::languagedescription($lang); |
$r->print('<td valign=$valign> '.($lang eq '' ? ' ' : $lang). |
$r->print('<td> '.($lang eq '' ? ' ' : $lang). |
" </td>\n"); |
" </td>\n"); |
} |
} |
if ($hash{'display_attrs_7'} == 1) { |
if ($hash{'display_attrs_7'} == 1) { |
Line 873 sub display_line {
|
Line 881 sub display_line {
|
$Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}. |
$Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}. |
'/cgi-bin/thumbnail.gif?url='.$filelink.'" />'; |
'/cgi-bin/thumbnail.gif?url='.$filelink.'" />'; |
} |
} |
$r->print('<td valign=$valign> '.($output eq '' ? ' ':$output). |
$r->print('<td> '.($output eq '' ? ' ':$output). |
" </td>\n"); |
" </td>\n"); |
} |
} |
|
if ($hash{'display_attrs_8'} == 1) { |
|
my (%stat) = &Apache::lonmeta::dynamicmeta($filelink) if ($metafile == 1); |
|
my $stat = ($stat{'course'} eq '' ? '' : $stat{'course'}). |
|
(($stat{'course'} ne '' || $stat{'count'} ne '') ? '/' : ''). |
|
($stat{'count'} eq '' ? '' : $stat{'count'}); |
|
$r->print('<td align=center> '.($stat eq '' ? ' ' : $stat). |
|
' </td>'."\n"); |
|
} |
|
|
$r->print("</tr>\n"); |
$r->print("</tr>\n"); |
} |
} |
|
|