--- loncom/homework/radiobuttonresponse.pm 2010/12/19 04:24:29 1.147
+++ loncom/homework/radiobuttonresponse.pm 2011/08/26 22:40:17 1.150
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.147 2010/12/19 04:24:29 raeburn Exp $
+# $Id: radiobuttonresponse.pm,v 1.150 2011/08/26 22:40:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -336,7 +336,6 @@ sub displayallfoils {
my $i =0;
my $id=$Apache::inputtags::response['-1'];
my $part=$Apache::inputtags::part;
- my $lastresponse;
my ($lastresponse,$newvariation,$showanswer);
if ((($Apache::lonhomework::history{"resource.$part.type"} eq 'randomizetry') ||
($Apache::lonhomework::type eq 'randomizetry')) &&
@@ -556,8 +555,12 @@ sub whichfoils {
$dosplice=0;
} else {
if ($topcount>0 || $bottomcount>0) {
- $answer = int(&Math::Random::random_uniform() * ($#whichfalse+1))
- + $topcount;
+ my $inc = 1;
+ if (($bottomcount > 0) && ($Apache::lonhomework::type ne 'exam')) {
+ $inc = 2;
+ }
+ $answer=int(&Math::Random::random_uniform() * ($#whichfalse+$inc))
+ + $topcount;
}
}
&Apache::lonxml::debug("Answer now wants $answer");
@@ -816,6 +819,9 @@ sub end_foil {
&Apache::lonxml::warning(&mt('Foils without names exist. This can cause problems to malfunction.'));
$name=$Apache::lonxml::curdepth;
}
+ if ($name eq "0") {
+ &Apache::lonxml::error(&mt('Foil name [_1] is not supported. Please choose another name.',''.$name.''));
+ }
if (defined($Apache::response::foilnames{$name})) {
&Apache::lonxml::error(&mt('Foil name [_1] appears more than once. Foil names need to be unique.',''.$name.''));
}