--- loncom/homework/optionresponse.pm 2003/07/25 19:29:15 1.81 +++ loncom/homework/optionresponse.pm 2003/10/15 19:40:42 1.90 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # option list style responses # -# $Id: optionresponse.pm,v 1.81 2003/07/25 19:29:15 sakharuk Exp $ +# $Id: optionresponse.pm,v 1.90 2003/10/15 19:40:42 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -302,12 +302,13 @@ sub displayfoils { my $id=$Apache::inputtags::response[-1]; my $break; my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; - my $status=$Apache::inputtags::status[-1]; - if ( - ($target ne 'tex') && - (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) { + if ( ($target ne 'tex') && + &Apache::response::show_answer() ) { + my $temp=1; foreach $name (@whichopt) { my $text=$Apache::response::foilgroup{$name.'.text'}; + my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"}); + my $lastopt=$lastresponse{$name}; if ($text!~/^\s*$/) { if ($target eq 'tex') { $break='\vskip 0 mm '; @@ -328,16 +329,18 @@ sub displayfoils { $result.=$text."\n"; } elsif ($target eq 'tex') { $Apache::response::foilgroup{$name.'.text'}=~s/\\item//; - $result .='\item \textit{'.$Apache::response::foilgroup{$name.'.value'}.'}'. + if ($max>1) {$result .='\item ';} + $result .=' \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); + $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt); } else { $result.=&bubbles(\@alphabet,\@opt); } } + $temp++; } } else { my $temp=1; @@ -374,7 +377,7 @@ sub displayfoils { } $result.=$break.$text."\n"; if ($Apache::lonhomework::type eq 'exam') { - $result.=&webbubbles(\@opt,\@alphabet,$temp); + $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt); } $temp++; } else { @@ -436,8 +439,8 @@ sub displayfoils { sub optionlist_correction { my $texoptionlist = shift; - if ($texoptionlist=~/