--- loncom/homework/drawimage.pm	2004/09/09 07:24:56	1.7
+++ loncom/homework/drawimage.pm	2024/04/05 02:31:23	1.11
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # programatic image drawing
 #
-# $Id: drawimage.pm,v 1.7 2004/09/09 07:24:56 albertel Exp $
+# $Id: drawimage.pm,v 1.11 2024/04/05 02:31:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -29,6 +29,9 @@
 package Apache::drawimage;
 use strict;
 use Apache::loncommon;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+ 
 
 my %args;
 my $cgi_id;
@@ -61,7 +64,7 @@ sub end_drawimage {
                            src='/adm/randomlabel.png?token=$cgi_id' />\n";
 	$args{"cgi.$cgi_id.SIZE"}=join(':',($width,$height));
 	$args{"cgi.$cgi_id.BGCOLOR"}=join(':',($bgcolor));
-	&Apache::lonnet::appenv(%args);
+	&Apache::lonnet::appenv(\%args);
 	if (@cgi_ids) {
 	    $cgi_id=pop(@cgi_ids);
 	} else {
@@ -95,11 +98,12 @@ sub end_text {
         my $font  = &Apache::lonxml::get_param('font',$parstack,$safeeval);
         my $color = &Apache::lonxml::get_param('color',$parstack,$safeeval);
         my $direction = &Apache::lonxml::get_param('direction',$parstack,$safeeval);
+        my $rotation = &Apache::lonxml::get_param('rotation',$parstack,$safeeval);
 	my $text  = &Apache::lonxml::endredirection();
-        $text = &Apache::lonnet::escape($text);
+        $text = &escape($text);
         $args{"cgi.$cgi_id.OBJTYPE"}.='LABEL:';
 	my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
-	$args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$text,$font,$color,$direction));
+	$args{"cgi.$cgi_id.OBJ$i"}=join(':',($x,$y,$text,$font,$color,$direction,$rotation));
     }
     return $result;
 }
@@ -262,7 +266,6 @@ sub end_image {
     my $result;
     if ($target eq 'web' || $target eq 'tex') {
 	my $bgimg=&Apache::lonxml::endredirection();
-	&Apache::lonnet::logthis("image $bgimg");
 	my $x = &Apache::lonxml::get_param('x',$parstack,$safeeval);
         my $y = &Apache::lonxml::get_param('y',$parstack,$safeeval);
 	my $clipx = &Apache::lonxml::get_param('clipx',$parstack,$safeeval);
@@ -278,11 +281,10 @@ sub end_image {
 	my $transparent = 
 	    &Apache::lonxml::get_param('transparent',$parstack,$safeeval);
 	$bgimg=&Apache::imageresponse::clean_up_image($bgimg);
-	&Apache::lonnet::logthis("image af clean $bgimg");
 	my $i=$args{"cgi.$cgi_id.OBJCOUNT"}++;
 	$args{"cgi.$cgi_id.OBJTYPE"}.='IMAGE:';
 	$args{"cgi.$cgi_id.OBJ$i"} = 
-	    join(':',($x,$y,&Apache::lonnet::escape($bgimg),$transparent,
+	    join(':',($x,$y,&escape($bgimg),$transparent,
 		      $clipx,$clipy,$scaledwidth,$scaledheight,$clipwidth,$clipheight));
     }
     return $result;