Diff for /loncom/interface/lonindexer.pm between versions 1.139 and 1.140

version 1.139, 2006/03/02 20:16:10 version 1.140, 2006/03/06 18:23:10
Line 1062  sub display_line { Line 1062  sub display_line {
         }          }
         if ($hash{'display_attrs_7'} == 1) {          if ($hash{'display_attrs_7'} == 1) {
 # Show resource  # Show resource
             my $output='';     my $output=&showpreview($filelink);
             my $embstyle=&Apache::loncommon::fileembstyle($curfext);             $r->print('<td> '.($output eq '' ? '&nbsp;':$output).
     if ($embstyle eq 'ssi') {  
  my $cache=$Apache::lonnet::perlvar{'lonDocRoot'}.$filelink.  
     '.tmp';  
  if ((!$env{'form.updatedisplay'}) &&  
     (-e $cache)) {  
     open(FH,$cache);  
     $output=join("\n",<FH>);  
     close(FH);  
  } else {  
     $output=&Apache::lonnet::ssi_body($filelink);  
     if ($output=~/LONCAPAACCESSCONTROLERRORSCREEN/) {  
  $output='';  
     } else {  
  open(FH,">$cache");  
  print FH $output;  
  close(FH);  
     }  
  }  
  $output='<font size="-2">'.$output.'</font>';  
    } elsif ($embstyle eq 'img') {  
                $output='<img src="'.$filelink.'" />';  
            } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {  
                $output='<img src="http://'.  
  $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.  
                  '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';  
            }  
    $r->print('<td> '.($output eq '' ? '&nbsp;':$output).  
       " </td>\n");        " </td>\n");
         }          }
  $r->print("</tr>\n");   $r->print("</tr>\n");
Line 1182  sub display_line { Line 1155  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",<FH>);
             close(FH);
          } else {
             $output=&Apache::lonnet::ssi_body($filelink);
             if ($output=~/LONCAPAACCESSCONTROLERRORSCREEN/s) {
                $output='';
             } else {
                open(FH,">$cache");
                print FH $output;
                close(FH);
             }
          }
          $output='<font size="-2">'.$output.'</font>';
       } elsif ($embstyle eq 'img') {
          $output='<img src="'.$filelink.'" />';
       } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {
          $output='<img src="http://'.
                    $Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
                    '/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
       }
       return $output;
   }
   
 sub dynmetaprint {  sub dynmetaprint {
     my ($r,$filelink,$item)=@_;      my ($r,$filelink,$item)=@_;
     if ($dynhash{$filelink}->{$item}) {      if ($dynhash{$filelink}->{$item}) {

Removed from v.1.139  
changed lines
  Added in v.1.140


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>