--- loncom/interface/lonindexer.pm 2006/03/02 20:16:10 1.139 +++ 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.139 2006/03/02 20:16:10 www Exp $ +# $Id: lonindexer.pm,v 1.140 2006/03/06 18:23:10 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1062,35 +1062,8 @@ sub display_line { } 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); - if ($output=~/LONCAPAACCESSCONTROLERRORSCREEN/) { - $output=''; - } else { - 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"); @@ -1182,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}) {