--- loncom/interface/lonindexer.pm 2005/04/07 06:56:23 1.133 +++ loncom/interface/lonindexer.pm 2006/03/06 18:23:10 1.140 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Directory Indexer # -# $Id: lonindexer.pm,v 1.133 2005/04/07 06:56:23 albertel Exp $ +# $Id: lonindexer.pm,v 1.140 2006/03/06 18:23:10 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -347,7 +347,7 @@ END } # ---------------------------------------------------------------- Print Header - my $html='';#&Apache::lonxml::xmlbegin(); + my $html=&Apache::lonxml::xmlbegin(); $r->print(< @@ -829,7 +829,7 @@ sub display_line { $r->print ('print (' name="'.$msg.'" height="22" type="image" border="0" />'. "\n"); - $r->print(&mt("Up")." $tabtag\n"); + $r->print(&mt("Up")."$tabtag\n"); return OK; } # Do we have permission to look at this? @@ -863,7 +863,7 @@ sub display_line { $r->print("(".$Apache::lonnet::domaindescription{$listname}. ")"); } - $r->print (" $tabtag\n"); + $r->print ("$tabtag\n"); return OK; # display user directory @@ -928,8 +928,7 @@ sub display_line { $r->print("checked"); } $r->print(" />\n"); - $r->print("\n"); - $r->print(""); + $r->print(""); $hash{"pre_${fnum}_link"}=$filelink; $fnum++; } @@ -970,10 +969,6 @@ sub display_line { } # Filetype icons $r->print("\n"); -# Close form to open/close sequence - if ($filelink=~/\.(page|sequence)$/) { - $r->print(''); - } my $quotable_filelink = &Apache::loncommon::escape_single($filelink); @@ -984,6 +979,10 @@ sub display_line { $r->print (" (metadata) "); +# Close form to open/close sequence + if ($filelink=~/\.(page|sequence)$/) { + $r->print(''); + } $r->print("\n"); if ($hash{'display_attrs_0'} == 1) { my $title = &Apache::lonnet::gettitle($filelink,'title'); @@ -1058,35 +1057,13 @@ sub display_line { &dynmetaprint($r,$filelink,'comefrom_list'); &dynmetaprint($r,$filelink,'sequsage_list'); &dynmetaprint($r,$filelink,'dependencies'); + &dynmetaprint($r,$filelink,'course_list'); $r->print(''); } if ($hash{'display_attrs_7'} == 1) { # Show resource - my $output=''; - my $embstyle=&Apache::loncommon::fileembstyle($curfext); - if ($embstyle eq 'ssi') { - my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink. - '.tmp'; - if ((!$env{'form.updatedisplay'}) && - (-e $cache)) { - open(FH,$cache); - $output=join("\n",); - close(FH); - } else { - $output=&Apache::lonnet::ssi_body($filelink); - open(FH,">$cache"); - print FH $output; - close(FH); - } - $output=''.$output.''; - } elsif ($embstyle eq 'img') { - $output=''; - } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) { - $output=''; - } - $r->print(' '.($output eq '' ? ' ':$output). + my $output=&showpreview($filelink); + $r->print(' '.($output eq '' ? ' ':$output). " \n"); } $r->print("\n"); @@ -1178,6 +1155,40 @@ sub display_line { } +sub showpreview { + my ($filelink)=@_; + my ($curfext)=($filelink=~/\.(\w+)$/); + my $output=''; + my $embstyle=&Apache::loncommon::fileembstyle($curfext); + if ($embstyle eq 'ssi') { + my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink. + '.tmp'; + if ((!$env{'form.updatedisplay'}) && + (-e $cache)) { + open(FH,$cache); + $output=join("\n",); + close(FH); + } else { + $output=&Apache::lonnet::ssi_body($filelink); + if ($output=~/LONCAPAACCESSCONTROLERRORSCREEN/s) { + $output=''; + } else { + open(FH,">$cache"); + print FH $output; + close(FH); + } + } + $output=''.$output.''; + } elsif ($embstyle eq 'img') { + $output=''; + } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) { + $output=''; + } + return $output; +} + sub dynmetaprint { my ($r,$filelink,$item)=@_; if ($dynhash{$filelink}->{$item}) { @@ -1238,6 +1249,7 @@ sub cleanup { if (tied(%hash)){ &Apache::lonnet::logthis('Cleanup indexer: hash'); } + return OK; }