--- loncom/homework/radiobuttonresponse.pm 2006/12/07 23:10:42 1.108
+++ loncom/homework/radiobuttonresponse.pm 2006/12/19 11:05:21 1.110
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.108 2006/12/07 23:10:42 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.110 2006/12/19 11:05:21 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -32,8 +32,6 @@ use HTML::Entities();
use Apache::lonlocal;
use Apache::lonnet;
-my $exam_max_bubbles = 10;
-
BEGIN {
&Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse'));
}
@@ -181,7 +179,7 @@ sub end_foilgroup {
$safeeval,'-2');
if ( $style eq 'survey' && $target ne 'analyze') {
if ($target eq 'web' || $target eq 'tex') {
- $result=&displayallfoils($direction);
+ $result=&displayallfoils($direction, $target);
} elsif ( $target eq 'answer' ) {
$result=&displayallanswers();
} elsif ( $target eq 'grade' ) {
@@ -233,7 +231,7 @@ sub getfoilcounts {
}
sub displayallfoils {
- my ($direction)=@_;
+ my ($direction, $target)=@_;
my $result;
&Apache::lonxml::debug("survey style display");
my @names;
@@ -241,6 +239,7 @@ sub displayallfoils {
@names= @{ $Apache::response::foilgroup{'names'} };
}
my $temp=0;
+ my $i =0;
my $id=$Apache::inputtags::response['-1'];
my $part=$Apache::inputtags::part;
my $lastresponse=
@@ -250,19 +249,27 @@ sub displayallfoils {
if (&Apache::response::show_answer() ) {
foreach my $name (@names) {
if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
- if ($direction eq 'horizontal') {
+ if (($direction eq 'horizontal') && ($target ne 'tex')) {
$result.="
";
} else {
- $result.=" ";
+ if ($target eq 'tex') {
+ $result .= '\item \vskip -2mm ';
+ } else {
+ $result.=" ";
+ }
}
if (defined($lastresponse{$name})) {
- $result.='';
+ if ($target eq 'tex') {
+ $result .= '}';
+ } else {
+ $result.='';
+ }
}
$result .= $Apache::response::foilgroup{$name.'.text'};
- if (defined($lastresponse{$name})) {
+ if (defined($lastresponse{$name}) && ($target ne 'tex')) {
$result.='';
}
- if ($direction eq 'horizontal') { $result.=" | "; }
+ if (($direction eq 'horizontal') && ($target ne 'tex')) { $result.=""; }
}
}
} else {
@@ -271,19 +278,32 @@ sub displayallfoils {
if ($direction eq 'horizontal') {
$result.="";
} else {
- $result.=" ";
+ if ($target eq 'tex') {
+ $result .= '\item \vskip -2mm ';
+ } else {
+ $result.=" ";
+ }
+ }
+ if ($target eq 'tex') {
+ $result .= '$\bigcirc$'.$Apache::response::foilgroup{$name.'.text'}.'\\\\'; #' stupid emacs
+ $i++;
+ } else {
+ $result .= ' | "; }
+ if ($target ne 'tex') {
+ if (($direction eq 'horizontal') && ($target ne 'tex')) { $result.=""; }
+ } else {
+ $result.='\vskip 0 mm ';
+ }
}
}
}
- if ($direction eq 'horizontal') { $result.=''; }
+ if (($direction eq 'horizontal') && ($target ne 'tex')) { $result.=''; }
return $result;
}
@@ -492,19 +512,8 @@ sub displayfoils {
$result .= ' />'.$Apache::response::foilgroup{$name.'.text'}."";
} else {
if ($Apache::lonhomework::type eq 'exam') {
-
- # If necessary, start a new group of bubbles
- # in the next row on the scantron sheet:
- #
- if ($i >= $exam_max_bubbles) {
- $i = 0; # Back to A.
- $Apache::lonxml::counter++; # Next row of bubbles...
- $result .= '\item[\textbf{'.$Apache::lonxml::counter.'}.]';
- }
-
$result .= '{\small \textbf{'.$alphabet[$i].'}}$\bigcirc$'.$Apache::response::foilgroup{$name.'.text'}.'\\\\'; #' stupid emacs
$i++;
-
} else {
$result .= '\vspace*{-2 mm}\item '.$Apache::response::foilgroup{$name.'.text'};
}