--- loncom/homework/radiobuttonresponse.pm 2011/08/26 22:40:17 1.150 +++ loncom/homework/radiobuttonresponse.pm 2011/09/16 22:23:54 1.152 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.150 2011/08/26 22:40:17 raeburn Exp $ +# $Id: radiobuttonresponse.pm,v 1.152 2011/09/16 22:23:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,14 +138,10 @@ sub end_radiobuttonresponse { %Apache::response::foilgroup=(); sub start_foilgroup { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; - my $result; %Apache::response::foilgroup=(); $Apache::radiobuttonresponse::conceptgroup=0; &Apache::response::pushrandomnumber(undef,$target); - if ($target eq 'tex' && $Apache::lonhomework::type eq 'exam') { - $result.='\item[\textbf{'.$Apache::lonxml::counter.'}.]'; - } - return $result; + return; } sub storesurvey { @@ -222,15 +218,10 @@ sub end_foilgroup { my $result; my $bubble_lines; - my $bubbles_per_line; my $answer_count; my $id = $Apache::inputtags::response['-1']; my $part = $Apache::inputtags::part; - $bubbles_per_line = - &Apache::response::get_response_param($Apache::inputtags::part."_$id", - 'numbubbles', - $default_bubbles_per_line); - + my $bubbles_per_line = &getbubblesnum($part,$id); if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { @@ -260,7 +251,7 @@ sub end_foilgroup { $answer_count = scalar(@shown); if ($target eq 'web' || $target eq 'tex') { - $result=&displayfoils($target, + $result=&displayfoils($target, $answer, \@shown, $direction, $bubbles_per_line); @@ -295,6 +286,20 @@ sub end_foilgroup { return $result; } +sub getbubblesnum { + my ($part,$id) = @_; + my $bubbles_per_line; + my $default_numbubbles = $default_bubbles_per_line; + if (($env{'form.bubbles_per_row'} =~ /^\d+$/) && + ($env{'form.bubbles_per_row'} > 0)) { + $default_numbubbles = $env{'form.bubbles_per_row'}; + } + $bubbles_per_line = + &Apache::response::get_response_param($part."_$id",'numbubbles', + $default_numbubbles); + return $bubbles_per_line; +} + sub getfoilcounts { my @names; my $truecnt=0; @@ -648,6 +653,30 @@ sub displayfoils { if ($target ne 'tex' && $direction eq 'horizontal') { $result.="