Diff for /loncom/xml/londefdef.pm between versions 1.68 and 1.69

version 1.68, 2002/07/03 15:37:10 version 1.69, 2002/07/11 14:40:14
Line 1 Line 1
   
 # The LearningOnline Network with CAPA  # The LearningOnline Network with CAPA
 # Tags Default Definition Module   # Tags Default Definition Module 
 #  #
Line 1286  EDITBUTTON Line 1285  EDITBUTTON
     $Apache::londefdef::table[-1]{'vvinc'} = '|';      $Apache::londefdef::table[-1]{'vvinc'} = '|';
  } else {   } else {
     $Apache::londefdef::table[-1]{'hinc'} = '';       $Apache::londefdef::table[-1]{'hinc'} = ''; 
     $Apache::londefdef::table[-1]{'vinc'} = '';       $Apache::londefdef::table[-1]{'vinc'} = '&'; 
     $Apache::londefdef::table[-1]{'vvinc'} = '';      $Apache::londefdef::table[-1]{'vvinc'} = '';
  }   }
     }       } 
Line 1336  EDITBUTTON Line 1335  EDITBUTTON
  if ($alignchar ne '') {   if ($alignchar ne '') {
     push @ {$Apache::londefdef::table[-1]{'rows'} }, $alignchar;      push @ {$Apache::londefdef::table[-1]{'rows'} }, $alignchar;
  } else {   } else {
     push @ {$Apache::londefdef::table[-1]{'rows'} }, 'c';      push @ {$Apache::londefdef::table[-1]{'rows'} }, 'l';
  }   }
  push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'});   push ( @{ $Apache::londefdef::table[-1]{'rowdata'} }, $Apache::londefdef::table[-1]{'hinc'});
  $Apache::londefdef::table[-1]{'counter_columns'} = -1;   $Apache::londefdef::table[-1]{'counter_columns'} = -1;
Line 1421  EDITBUTTON Line 1420  EDITBUTTON
                                         $token->[2]->{'src'};                                          $token->[2]->{'src'};
             my $currentstring = '';              my $currentstring = '';
     my $width_param = '';      my $width_param = '';
       my $height_param = '';
       my $scaling = .3;
   
     if ($target eq 'web') {      if ($target eq 'web') {
               $currentstring = $token->[4];                     $currentstring = $token->[4];     
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
       my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval);   
               my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval);   
       my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval);  
       if ($TeXwidth ne '') {   
   $width_param = $TeXwidth;   
       } elsif ($TeXheight ne '') {   
   $width_param = $TeXheight;   
       } else {  
   if ($width ne '') {  
       $width_param = $width*.3;  
       if ($width_param <= 900) {  
   $width_param = '[width='.$width_param.'mm]';  
       } else {  
   $width_param = '[width= \textwidth]';  
       }  
   }  
       }  
       my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval);        my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval);
       $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);        $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src);
                 if ($src=~m/\.(gif|GIF)$/) {
     my $gif_file = Apache::File->new($src);
     binmode ($gif_file);
                     my ($buff,$imagesize);
     read ($gif_file,$buff,6);
                     read ($gif_file,$imagesize,4);
                     my ($xlsb,$xmsb,$ylsb,$ymsb) = split(//,$imagesize);
                     my $image_width=ord($xlsb)+ord($xmsb)*256;
                     my $image_height=ord($ylsb)+ord($ymsb)*256;
     $width_param = $image_width * $scaling; #default value of the picture's width
     $height_param = $image_height * $scaling; #default value of the picture's height
          }
       my $epssrc = $src;        my $epssrc = $src;
       $epssrc =~ s/(\.gif|\.jpg|\.GIF|\.JPG)$/\.eps/;        $epssrc =~ s/(\.gif|\.jpg)$/\.eps/i;
       if (not -e $epssrc) {        if (not -e $epssrc) {
   my $localfile = $epssrc;    my $localfile = $epssrc;
   $localfile =~ s/.*(\/res)/$1/;    $localfile =~ s/.*(\/res)/$1/;
Line 1470  EDITBUTTON Line 1466  EDITBUTTON
   } else {    } else {
       $localfile = $src;        $localfile = $src;
       $localfile =~ s/.*(\/res)/$1/;        $localfile =~ s/.*(\/res)/$1/;
       my $as = &Apache::lonnet::getfile($src);        my $as = &Apache::lonnet::getfile($src);      
         
   }    }
       }        }
       my $file;        my $file;
Line 1482  EDITBUTTON Line 1477  EDITBUTTON
       }        }
       my $newsrc = $src;        my $newsrc = $src;
       $newsrc =~ s/(\.gif|\.jpg)$/\.eps/i;        $newsrc =~ s/(\.gif|\.jpg)$/\.eps/i;
   $file=~s/(\.gif|\.jpg)$/\.eps/i;        $file=~s/(\.gif|\.jpg)$/\.eps/i;
                 #do we have any specified size of the picture?
         my $TeXwidth = &Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval); 
                 my $TeXheight = &Apache::lonxml::get_param('TeXheight',$parstack,$safeeval); 
         my $width = &Apache::lonxml::get_param('width',$parstack,$safeeval);
         if ($TeXwidth ne '') { 
     $width_param = $TeXwidth; 
         } elsif ($TeXheight ne '') { 
     $width_param = $TeXheight/$height_param*$width_param;
         } elsif ($width ne '') {
     $width_param = $width*$scaling;      
         }
                 #where can we find the picture?
       if (-e $newsrc) {        if (-e $newsrc) {
   if ($path) {    if ($path) {
       $currentstring .= '\noindent\graphicspath{{'.$path.'}}\fbox{\includegraphics'.$width_param.'{'.$file.'}}';        $currentstring .= '\noindent\graphicspath{{'.$path.'}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} ';
   }    }
       } else {        } else {
   my $temp_file;    my $temp_file;
   my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";    my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat";
   $temp_file = Apache::File->new('>>'.$filename);     $temp_file = Apache::File->new('>>'.$filename); 
   print $temp_file "$src\n";    print $temp_file "$src\n";
   $currentstring .= '\graphicspath{{/home/httpd/prtspool/}}\fbox{\includegraphics'.$width_param.'{'.$file.'}}';    $currentstring .= '\graphicspath{{/home/httpd/prtspool/}}\fbox{\includegraphics[width='.$width_param.' mm]{'.$file.'}} ';
       }        }
     }      }
     return $currentstring;      return $currentstring;

Removed from v.1.68  
changed lines
  Added in v.1.69


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