Diff for /loncom/homework/radiobuttonresponse.pm between versions 1.153.6.5 and 1.153.6.7

version 1.153.6.5, 2012/01/24 12:05:12 version 1.153.6.7, 2012/01/25 12:00:33
Line 449  sub displayallfoils{ Line 449  sub displayallfoils{
         $lastresponse =          $lastresponse =
           $Apache::lonhomework::history{"resource.$part.$id.submission"};            $Apache::lonhomework::history{"resource.$part.$id.submission"};
     }      }
     if ( $direction eq 'horizontal' ) { $result .= '<table><tr>'; }      if ( $direction eq 'horizontal' && $target ne 'tex') { 
    $result .= '<table><tr>'; 
       }
     my %lastresponse = &Apache::lonnet::str2hash($lastresponse);      my %lastresponse = &Apache::lonnet::str2hash($lastresponse);
     if ($showanswer) {      if ($showanswer) {
         foreach my $name (@names) {          foreach my $name (@names) {
Line 488  sub displayallfoils{ Line 490  sub displayallfoils{
         foreach my $name (@names) {          foreach my $name (@names) {
             if ( $Apache::response::foilgroup{ $name . '.value' } ne 'unused' )              if ( $Apache::response::foilgroup{ $name . '.value' } ne 'unused' )
             {              {
                 if ( $direction eq 'horizontal' ) {                  if ( $direction eq 'horizontal' && $target ne 'tex' ) {
                     $result .= "<td>";                      $result .= "<td>";
                 }                  }
                 else {                  else {
Line 571  sub displayallfoils{ Line 573  sub displayallfoils{
     return $result;      return $result;
 }  }
   
   
   
 sub whichfoils {  sub whichfoils {
     my ( $max, $randomize ) = @_;      my ( $max, $randomize ) = @_;
   
Line 787  sub whichfoils { Line 791  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 1007  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 1096  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;
 }  }
   

Removed from v.1.153.6.5  
changed lines
  Added in v.1.153.6.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>