version 1.153.6.5, 2012/01/24 12:05:12
|
version 1.153.6.6, 2012/01/25 11:37:32
|
Line 571 sub displayallfoils{
|
Line 571 sub displayallfoils{
|
return $result; |
return $result; |
} |
} |
|
|
|
|
|
|
sub whichfoils { |
sub whichfoils { |
my ( $max, $randomize ) = @_; |
my ( $max, $randomize ) = @_; |
|
|
Line 787 sub whichfoils {
|
Line 789 sub whichfoils {
|
&Apache::lonxml::debug("Answer is $answer"); |
&Apache::lonxml::debug("Answer is $answer"); |
return ( $answer, @whichfalse ); |
return ( $answer, @whichfalse ); |
} |
} |
|
|
|
## |
|
# Return a list of foil texts given foil names. |
|
# |
|
# @param $whichfoils - Reference to a list of foil names. |
|
# |
|
# @return array |
|
# @retval foil texts |
|
# |
|
sub get_foil_texts { |
|
my ($whichfoils) = @_; |
|
my @foil_texts; |
|
|
|
foreach my $name (@{$whichfoils}) { |
|
push(@foil_texts, $Apache::response::foilgroup{$name . '.text'}); |
|
} |
|
return @foil_texts; |
|
} |
|
|
## |
## |
# Generate the HTML for a single html foil. |
# Generate the HTML for a single html foil. |
# @param $part - The part for which the response is being generated. |
# @param $part - The part for which the response is being generated. |
Line 984 sub display_latex_exam {
|
Line 1005 sub display_latex_exam {
|
my $line = 0; |
my $line = 0; |
my $i = 0; |
my $i = 0; |
|
|
&Apache::lonnet::logthis("LaTeX exam: $direction $vbegin $vend"); |
|
|
|
if ($direction eq 'horizontal') { |
if ($direction eq 'horizontal') { |
|
|
# Marshall the display text for each foil and turn things over to |
# Marshall the display text for each foil and turn things over to |
# Apache::response::make_horizontal_bubbles: |
# Apache::response::make_horizontal_bubbles: |
|
|
my @foil_texts; |
my @foil_texts = &get_foil_texts($whichfoils); |
foreach my $name (@{$whichfoils}) { |
|
push(@foil_texts, $Apache::response::foilgroup{$name . '.text'}); |
|
} |
|
$result .= &Apache::caparesponse::make_horizontal_latex_bubbles( |
$result .= &Apache::caparesponse::make_horizontal_latex_bubbles( |
$whichfoils, \@foil_texts, '$\bigcirc$'); |
$whichfoils, \@foil_texts, '$\bigcirc$'); |
|
|
Line 1077 sub display_latex {
|
Line 1094 sub display_latex {
|
my ($whichfoils, $direction, $vbegin, $vend) = @_; |
my ($whichfoils, $direction, $vbegin, $vend) = @_; |
my $result; |
my $result; |
|
|
$result .= $vbegin; |
# how we render depends on the direction. |
foreach my $name (@{$whichfoils}) { |
# Vertical is some kind of list environment determined by vbegin/vend. |
$result .= '\vspace*{-2 mm}\item ' |
# Horizontal is a table that is generated by |
. $Apache::response::foilgroup{ $name . '.text' }; |
# Apache::caparesponse::make_horizontal_latex_bubbles with an empty string |
} |
# for the actual bubble text. |
|
|
$result .= $vend; |
if ($direction eq 'horizontal') { |
|
my @foil_texts = &get_foil_texts($whichfoils); |
|
$result .= &Apache::caparesponse::make_horizontal_latex_bubbles( |
|
$whichfoils, \@foil_texts, ''); |
|
} else { |
|
$result .= $vbegin; |
|
foreach my $name (@{$whichfoils}) { |
|
$result .= '\vspace*{-2 mm}\item ' |
|
. $Apache::response::foilgroup{ $name . '.text' }; |
|
} |
|
|
|
$result .= $vend; |
|
} |
return $result; |
return $result; |
} |
} |
|
|