--- loncom/xml/londefdef.pm 2002/09/16 17:40:09 1.88 +++ loncom/xml/londefdef.pm 2002/10/07 17:57:37 1.90 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.88 2002/09/16 17:40:09 sakharuk Exp $ +# $Id: londefdef.pm,v 1.90 2002/10/07 17:57:37 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -1549,7 +1549,7 @@ EDITBUTTON my $currentstring = ''; my $width_param = ''; my $height_param = ''; - my $scaling = .3; + my $scaling = .3; if ($target eq 'web') { $currentstring = $token->[4]; @@ -1568,10 +1568,14 @@ EDITBUTTON 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; + if ($TeXwidth ne '') { + if ($TeXwidth=~/(\d+)\s*\%/) { + $width_param = $1*$ENV{'form.textwidth'}/100; + } else { + $width_param = $TeXwidth; + } + } elsif ($TeXheight ne '') { + $width_param = $TeXheight/$height_param*$width_param; } elsif ($width ne '') { $width_param = $width*$scaling; } @@ -1711,15 +1715,23 @@ sub start_embed { } return $currentstring; } - #-- tag - sub start_allow { - my ($target,$token) = @_; - + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= $token->[2]->{'src'}; - + my $src = &Apache::lonxml::get_param('src',$parstack,$safeeval); + if (not -e '/home/httpd/html'.$src) { + #replicates image itself + &Apache::lonnet::repcopy($src); + #replicates eps or ps + my $newsrc = $src; + $newsrc =~ s/(.gif|.jpg)$/.eps/; + if (not-e $newsrc && &Apache::lonnet::repcopy($newsrc) ne 'OK') { + $newsrc =~ s/\.ps$/\.eps/; + &Apache::lonnet::repcopy($newsrc); + } + } return ''; } sub end_allow {