--- loncom/homework/optionresponse.pm 2002/10/28 23:31:48 1.57
+++ loncom/homework/optionresponse.pm 2002/11/10 15:51:31 1.59
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.57 2002/10/28 23:31:48 albertel Exp $
+# $Id: optionresponse.pm,v 1.59 2002/11/10 15:51:31 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -318,7 +318,8 @@ sub displayfoils {
my @whichopt = &whichfoils($max,$randomize);
my $part=$Apache::inputtags::part;
my $id=$Apache::inputtags::response[-1];
- if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/) || ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER')) {
+ if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/) || ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER')) {
+ my $temp=1; ####
foreach $name (@whichopt) {
if ($target eq 'web') {
$result.="
";
@@ -326,13 +327,25 @@ sub displayfoils {
$result.='\vskip 0 mm ';
}
if ($target ne 'tex') {
- $result .=$Apache::response::foilgroup{$name.'.value'}.
- ":".$Apache::response::foilgroup{$name.'.text'}."\n";
+ my $text=$Apache::response::foilgroup{$name.'.text'};
+ my $value=$Apache::response::foilgroup{$name.'.value'};
+ if (!($text=~s||$value|)) {
+ $text=$value.': '.$text;
+ }
+ $result.=$text."\n";
} else {
$Apache::response::foilgroup{$name.'.text'}=~s/\\item//;
$result .='\item \textit{'.$Apache::response::foilgroup{$name.'.value'}.'}'.
":".$Apache::response::foilgroup{$name.'.text'}."\n";
}
+ if ($Apache::lonhomework::type eq 'exam') {
+ if ($target ne 'tex') {
+ $result.=&webbubbles(\@opt,\@alphabet);
+ } else {
+ $result.=&bubbles(\@alphabet,\@opt);
+ }
+ }
+ $temp++;
}
} else {
my $temp=1;
@@ -349,16 +362,16 @@ sub displayfoils {
}
}
if ($target ne 'tex') {
- $result.="
\n".$Apache::response::foilgroup{$name.'.text'}."\n";
+ $optionlist='\n";
+ my $text=$Apache::response::foilgroup{$name.'.text'};
+ if (!($text=~s||$optionlist|)) {
+ $text=$optionlist.$text;
+ }
+ $result.="
".$text."\n";
if ($Apache::lonhomework::type eq 'exam') {
- my $number_of_bubbles = $#opt + 1;
- $result.= '
';
- for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
- $result.=''.$alphabet[$ind].': '.$opt[$ind].' | ';
- }
- $result.='
';
+ $result.=&webbubbles(\@opt,\@alphabet);
}
$temp++;
} else {
@@ -425,6 +438,22 @@ sub optionlist_correction {
}
+sub webbubbles {
+
+ my ($ropt,$ralphabet)=@_;
+ my @opt=@$ropt;
+ my @alphabet=@$ralphabet;
+ my $result='';
+ my $number_of_bubbles = $#opt + 1;
+ $result.= '';
+ for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
+ $result.=''.$alphabet[$ind].': '.$opt[$ind].' | ';
+ }
+ $result.='
';
+ return $result;
+}
+
+
sub bubbles {
my ($ralphabit,$ropt) = @_;