--- loncom/homework/radiobuttonresponse.pm 2004/05/27 04:25:13 1.89 +++ loncom/homework/radiobuttonresponse.pm 2004/08/24 23:32:13 1.90 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.89 2004/05/27 04:25:13 albertel Exp $ +# $Id: radiobuttonresponse.pm,v 1.90 2004/08/24 23:32:13 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -181,8 +181,11 @@ sub end_foilgroup { '-2'); my $randomize = &Apache::lonxml::get_param('randomize',$parstack, $safeeval,'-2'); + my $direction = &Apache::lonxml::get_param('direction',$parstack, + $safeeval,'-2'); + &Apache::lonxml::debug("direction is $direction"); if ($target eq 'web' || $target eq 'tex') { - $result=&displayfoils($target,$max,$randomize); + $result=&displayfoils($target,$max,$randomize,$direction); } elsif ($target eq 'answer' ) { $result=&displayanswers($max,$randomize); } elsif ( $target eq 'grade') { @@ -390,7 +393,7 @@ sub whichfoils { } sub displayfoils { - my ($target,$max,$randomize)=@_; + my ($target,$max,$randomize,$direction)=@_; my $result; my ($answer,@whichfoils)=&whichfoils($max,$randomize); @@ -398,7 +401,15 @@ sub displayfoils { my $solved=$Apache::lonhomework::history{"resource.$part.solved"}; if ( ($target ne 'tex') && &Apache::response::show_answer() ) { + if ($direction eq 'horizontal') { + if ($target ne 'tex') { + $result.=''; + } + } foreach my $name (@whichfoils) { + if ($direction eq 'horizontal') { + if ($target ne 'tex') { $result.=''; } + } + } + if ($direction eq 'horizontal') { + if ($target ne 'tex') { + $result.='
'; } + } if ($target ne 'tex') { $result.="
"; } else { @@ -409,14 +420,19 @@ sub displayfoils { } else { $result.='Incorrect:'; } - if ($target ne 'tex') { - $result.=$Apache::response::foilgroup{$name.'.text'}."\n"; - } else { - $result.=$Apache::response::foilgroup{$name.'.text'}; - } + $result.=$Apache::response::foilgroup{$name.'.text'}; + if ($target eq 'web') { $result.="\n"; } if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { if ($target ne 'tex') { $result.='';} else {$result.='}';} } + if ($direction eq 'horizontal') { + if ($target ne 'tex') { $result.='
'; + } } } else { my @alphabet = ('A'..'Z'); @@ -426,9 +442,19 @@ sub displayfoils { my $part=$Apache::inputtags::part; my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"}; my %lastresponse=&Apache::lonnet::str2hash($lastresponse); + if ($target ne 'tex' && $direction eq 'horizontal') { + $result.=""; + } foreach my $name (@whichfoils) { if ($target ne 'tex') { - $result.="
\n"; } else { @@ -439,8 +465,14 @@ sub displayfoils { $result .= '\vspace*{-2 mm}\item '.$Apache::response::foilgroup{$name.'.text'}; } } + if ($target ne 'tex' && $direction eq 'horizontal') { + $result.=""; + } $temp++; } + if ($target ne 'tex' && $direction eq 'horizontal') { + $result.="
"; + } } if ($target ne 'tex') { $result.="
"; } else { $result.='\vskip 0 mm '; } return $result;