--- loncom/homework/convertjme.pl 2005/02/02 20:08:05 1.12 +++ loncom/homework/convertjme.pl 2011/07/04 09:24:54 1.16 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # Dynamically converts JME strings into either a png or ps file. # -# $Id: convertjme.pl,v 1.12 2005/02/02 20:08:05 albertel Exp $ +# $Id: convertjme.pl,v 1.16 2011/07/04 09:24:54 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -34,8 +34,8 @@ use strict; ### For standalone operation, set $loncapa to 0, and comment out both uses my $loncapa=1; use lib '/home/httpd/lib/perl'; -use LONCAPA::loncgi(); - +use LONCAPA::loncgi; +use LONCAPA; use GD; use PostScript::Simple; @@ -66,11 +66,11 @@ sub unescape { my ($id,$width,$ps,$png,@JMEstring); if ($loncapa) { $id=$ENV{'QUERY_STRING'}; - $width = $ENV{'cgi.'.$id.'.WIDTH'}; + $width = $Apache::lonnet::env{'cgi.'.$id.'.WIDTH'}; if (!$width) { $width = 400; } - $png = $ENV{'cgi.'.$id.'.PNG'}; - $ps = $ENV{'cgi.'.$id.'.PS'}; - @JMEstring=&unescape($ENV{'cgi.'.$id.'.JME'}); + $png = $Apache::lonnet::env{'cgi.'.$id.'.PNG'}; + $ps = $Apache::lonnet::env{'cgi.'.$id.'.PS'}; + @JMEstring=&unescape($Apache::lonnet::env{'cgi.'.$id.'.JME'}); } else { @JMEstring = @ARGV; $width = shift @JMEstring; @@ -396,7 +396,7 @@ foreach my $struct (@all_structs) { (shift @formula) =~ /([A-Z][a-z]?)(\d*)/; my $carrige = $x[$i]-stringWidth($1)/2; $carrige = printElement ($1,$2,$carrige,$y[$i]); - my $y = (@formula > 0) ? $y[$i] + fm2cm(800) : $y[$i]; + my $y = (@formula > 0) ? $y[$i] + fm2cm(900) : $y[$i]; $carrige = (@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; foreach (@formula) { @@ -409,7 +409,7 @@ foreach my $struct (@all_structs) { (shift @formula) =~ /([A-Z][a-z]?)(\d*)/; my $carrige = $x[$i]-stringWidth($1)/2; $carrige = printElement ($1,$2,$carrige,$y[$i]); - my $y = (@formula > 0) ? $y[$i] + fm2cm(-800) : $y[$i]; + my $y = (@formula > 0) ? $y[$i] + fm2cm(-900) : $y[$i]; $carrige = (@formula > 0) ? $x[$i]-stringWidth($1)/2 : $carrige; foreach (@formula) { @@ -431,7 +431,7 @@ if ($loncapa) { print "Content-type: image/png\n\n"; print $im->png; } elsif ($ps) { - my $psfile = "/home/httpd/perl/tmp/".$id.'.eps'; + my $psfile = LONCAPA::tempdir().$id.'.eps'; $im->output($psfile); print "Content-type: text/html\n\n"; print (<