--- loncom/homework/imageresponse.pm 2004/02/23 23:55:40 1.49
+++ loncom/homework/imageresponse.pm 2004/07/02 08:11:10 1.54
@@ -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.54 2004/07/02 08:11:10 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;
}
@@ -72,7 +75,7 @@ sub end_imageresponse {
sub start_foilgroup {
%Apache::response::foilgroup=();
$Apache::imageresponse::conceptgroup=0;
- &Apache::response::setrandomnumber();
+ &Apache::response::pushrandomnumber();
return '';
}
@@ -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);
@@ -544,6 +552,7 @@ sub end_rectangle {
$target eq 'analyze') {
my $name = $Apache::imageresponse::curname;
my $area = &Apache::lonxml::endredirection;
+ $area=~s/\s//g;
&Apache::lonxml::debug("out is $area for $name");
if ( $Apache::imageresponse::conceptgroup
&& !&Apache::response::showallfoils()) {