--- loncom/homework/optionresponse.pm 2002/11/11 20:13:47 1.61 +++ loncom/homework/optionresponse.pm 2002/11/11 20:26:59 1.62 @@ -1,7 +1,7 @@ # LearningOnline Network with CAPA # option list style responses # -# $Id: optionresponse.pm,v 1.61 2002/11/11 20:13:47 sakharuk Exp $ +# $Id: optionresponse.pm,v 1.62 2002/11/11 20:26:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -318,22 +318,30 @@ sub displayfoils { my @whichopt = &whichfoils($max,$randomize); my $part=$Apache::inputtags::part; my $id=$Apache::inputtags::response[-1]; + my $break; 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.="
"; + my $text=$Apache::response::foilgroup{$name.'.text'}; + if ($text!~/^\s*$/) { + if ($target eq 'tex') { + $break='\vskip 0 mm '; + } elsif ($target eq 'web') { + $break='
'; + } + } + $result.=$break; + if ($target eq 'web') { + my $value=$Apache::response::foilgroup{$name.'.value'}; + if (!($text=~s||$value|)) { + if ($text=~/^\s*$/) { + $text=$value.$text; + } else { + $text=$value.': '.$text; + } + } + $result.=$text."\n"; } elsif ($target eq 'tex') { - $result.='\vskip 0 mm '; - } - if ($target ne 'tex') { - 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"; @@ -351,6 +359,14 @@ sub displayfoils { my $temp=1; my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"}); foreach $name (@whichopt) { + my $text=$Apache::response::foilgroup{$name.'.text'}; + if ($text!~/^\s*$/) { + if ($target eq 'tex') { + $break='\vskip 0 mm '; + } elsif ($target eq 'web') { + $break='
'; + } + } my $lastopt=$lastresponse{$name}; my $optionlist="\n"; my $option; @@ -369,7 +385,7 @@ sub displayfoils { if (!($text=~s||$optionlist|)) { $text=$optionlist.$text; } - $result.="
".$text."\n"; + $result.=$break.$text."\n"; if ($Apache::lonhomework::type eq 'exam') { $result.=&webbubbles(\@opt,\@alphabet); } @@ -417,13 +433,12 @@ sub displayfoils { $result.=&bubbles(\@alphabet,\@opt); } } - } + } } - } - if ($target ne 'tex') { - return $result."
"; } - else { + if ($target ne 'tex') { + return $result.$break; + } else { return $result; } }