--- loncom/homework/imageresponse.pm 2008/11/18 19:14:28 1.96 +++ loncom/homework/imageresponse.pm 2009/08/03 10:40:00 1.98 @@ -2,7 +2,7 @@ # The LearningOnline Network with CAPA # image click response style # -# $Id: imageresponse.pm,v 1.96 2008/11/18 19:14:28 jms Exp $ +# $Id: imageresponse.pm,v 1.98 2009/08/03 10:40:00 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -187,7 +187,6 @@ sub end_imageresponse { } &Apache::response::end_response(); - return $result; } @@ -320,7 +319,7 @@ sub displayfoils { my $image=$Apache::response::foilgroup{"$name.image"}; &Apache::lonxml::debug("image is $image"); if ( ($target eq 'web' || $target eq 'answer') - && $image !~ /^http:/ ) { + && $image !~ /^https?\:/ ) { $image=&clean_up_image($image); } push(@images,$image); @@ -386,7 +385,7 @@ sub display_answers { my $image=$Apache::response::foilgroup{"$name.image"}; &Apache::lonxml::debug("image is $image"); if ( ($target eq 'web' || $target eq 'answer') - && $image !~ /^http:/ ) { + && $image !~ /^https?\:/ ) { $image = &clean_up_image($image); } my $token=&prep_image($image,'answeronly',$name); @@ -401,7 +400,7 @@ sub clean_up_image { my ($image)=@_; if ($image =~ /\s*<img\s*/) { ($image) = ($image =~ /src\s*=\s*[\"\']([^\"\']+)[\"\']/i); - if ($image !~ /^http:/) { + if ($image !~ /^https?\:/) { $image=&Apache::lonnet::hreflocation('',$image); } if (!$image) { @@ -716,11 +715,13 @@ sub end_image { my ($commentline, $restofstuff) = split(/\n/, $src); $graphinclude = $src; $graphinclude =~ s/^$commentline//; - } else { + } elsif (!($src =~ /\\/)) { my ($path,$file) = &Apache::londefdef::get_eps_image($src); my ($height_param,$width_param)= &Apache::londefdef::image_size($src,0.3,$parstack,$safeeval); $graphinclude = '\graphicspath{{'.$path.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'}'; + } else { + $graphinclude = $src; # Already fully formed. } $Apache::response::foilgroup{"$name.image"} ='\vskip 0 mm \noindent '.$graphinclude; }