--- loncom/homework/imageresponse.pm 2004/02/23 23:55:40 1.49 +++ loncom/homework/imageresponse.pm 2004/03/15 22:09:52 1.52 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # image click response style # -# $Id: imageresponse.pm,v 1.49 2004/02/23 23:55:40 albertel Exp $ +# $Id: imageresponse.pm,v 1.52 2004/03/15 22:09:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,10 +31,11 @@ package Apache::imageresponse; use strict; -use Image::Magick; -use Apache::randomlylabel; -use Apache::londefdef; +use Image::Magick(); +use Apache::randomlylabel(); +use Apache::londefdef(); use Apache::Constants qw(:common :http); +use Apache::lonlocal; BEGIN { &Apache::lonxml::register('Apache::imageresponse',('imageresponse')); @@ -49,6 +50,7 @@ sub start_imageresponse { 'polygon','conceptgroup')); push (@Apache::lonxml::namespace,'imageresponse'); my $id = &Apache::response::start_response($parstack,$safeeval); + undef(%Apache::response::foilnames); if ($target eq 'meta') { $result=&Apache::response::meta_package_write('imageresponse'); } elsif ($target eq 'analyze') { @@ -65,6 +67,7 @@ sub end_imageresponse { &Apache::lonxml::deregister('Apache::imageresponse',('foilgroup','foil','text','image','rectangle','conceptgroup')); my $result; if ($target eq 'edit') { $result=&Apache::edit::end_table(); } + undef(%Apache::response::foilnames); return $result; } @@ -215,7 +218,7 @@ sub displayfoils { sub clean_up_image { my ($image)=@_; if ($image =~ /\s*[_1] appears more than once. Foil names need to be unique.",$name)); + } + $Apache::response::foilnames{$name}++; if ( $Apache::imageresponse::conceptgroup && !&Apache::response::showallfoils()) { push(@{ $Apache::response::conceptgroup{'names'} }, $name);