--- loncom/homework/drawimage.pm 2003/11/15 06:33:39 1.1 +++ loncom/homework/drawimage.pm 2006/05/30 12:45:36 1.9 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # programatic image drawing # -# $Id: drawimage.pm,v 1.1 2003/11/15 06:33:39 albertel Exp $ +# $Id: drawimage.pm,v 1.9 2006/05/30 12:45:36 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -29,46 +29,81 @@ package Apache::drawimage; use strict; use Apache::loncommon; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; + my %args; my $cgi_id; +my @cgi_ids; BEGIN { &Apache::lonxml::register('Apache::drawimage',('drawimage')); } sub start_drawimage { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; - &Apache::lonxml::register('Apache::drawimage',('line','rectangle','arc','fill')); + &Apache::lonxml::register('Apache::drawimage',('text','line','rectangle','arc','fill','polygon','image')); if ($target eq 'web' || $target eq 'tex') { - $cgi_id=&Apache::loncommon::get_cgi_id(); - %args=(); + my $new_id=&Apache::loncommon::get_cgi_id(); + if ($cgi_id) { push(@cgi_ids,$cgi_id); } else { undef(%args); } + $cgi_id=$new_id; } + return ''; } sub end_drawimage { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result; if ($target eq 'web' || $target eq 'tex') { - if ($target eq 'web') { - my $width = - &Apache::lonxml::get_param('width',$parstack,$safeeval); - my $height = - &Apache::lonxml::get_param('height',$parstack,$safeeval); - my $bgcolor = - &Apache::lonxml::get_param('bgcolor',$parstack,$safeeval); - if (!$width) { $width=300; } - if (!$height) { $height=300; } - $result.="