Diff for /loncom/homework/optionresponse.pm between versions 1.84 and 1.84.2.2

version 1.84, 2003/08/01 19:04:06 version 1.84.2.2, 2003/10/15 19:51:29
Line 303  sub displayfoils { Line 303  sub displayfoils {
   my $break;    my $break;
   my $solved=$Apache::lonhomework::history{"resource.$part.solved"};    my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
   my $status=$Apache::inputtags::status[-1];    my $status=$Apache::inputtags::status[-1];
   if (    if ( ($target ne 'tex') &&
       ($target ne 'tex') &&         &Apache::response::show_answer() ) {
       (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) {      my $temp=1;
     foreach $name (@whichopt) {      foreach $name (@whichopt) {
  my $text=$Apache::response::foilgroup{$name.'.text'};   my $text=$Apache::response::foilgroup{$name.'.text'};
    my %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
    my $lastopt=$lastresponse{$name};
  if ($text!~/^\s*$/) {   if ($text!~/^\s*$/) {
     if ($target eq 'tex') {      if ($target eq 'tex') {
  $break='\vskip 0 mm ';   $break='\vskip 0 mm ';
Line 334  sub displayfoils { Line 336  sub displayfoils {
       }        }
       if ($Apache::lonhomework::type eq 'exam') {        if ($Apache::lonhomework::type eq 'exam') {
  if ($target ne 'tex') {   if ($target ne 'tex') {
   $result.=&webbubbles(\@opt,\@alphabet);    $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
         } else {          } else {
   $result.=&bubbles(\@alphabet,\@opt);    $result.=&bubbles(\@alphabet,\@opt);
         }          }
       }        }
         $temp++;
     }      }
   } else {    } else {
     my $temp=1;      my $temp=1;
Line 375  sub displayfoils { Line 378  sub displayfoils {
   }    }
   $result.=$break.$text."\n";    $result.=$break.$text."\n";
   if ($Apache::lonhomework::type eq 'exam') {    if ($Apache::lonhomework::type eq 'exam') {
     $result.=&webbubbles(\@opt,\@alphabet,$temp);      $result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt);
   }    }
   $temp++;    $temp++;
       } else {        } else {
Line 456  sub optionlist_correction { Line 459  sub optionlist_correction {
   
 sub webbubbles {  sub webbubbles {
   
     my ($ropt,$ralphabet,$temp)=@_;      my ($ropt,$ralphabet,$temp,$lastopt)=@_;
     my @opt=@$ropt;       my @opt=@$ropt; 
     my @alphabet=@$ralphabet;      my @alphabet=@$ralphabet;
     my $result='';      my $result='';
  my $number_of_bubbles = $#opt + 1;      my $number_of_bubbles = $#opt + 1;
  $result.= '<table border="1"><tr>';      $result.= '<table border="1"><tr>';
  for (my $ind=0;$ind<$number_of_bubbles;$ind++) {      for (my $ind=0;$ind<$number_of_bubbles;$ind++) {
    $result.='<td><input type="radio" name="HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp.   my $checked='';
                     '" value='.$opt[$ind].'>'.$alphabet[$ind].': '.$opt[$ind].'</td>';   if ($lastopt eq $opt[$ind]) {
       $checked=' checked="on" ';
  }   }
  $result.='</tr></table>';   $result.='<td><input type="radio" name="HWVAL_'.
  return $result;      $Apache::inputtags::response['-1'].':'.$temp.
       '" value="'.$opt[$ind].'" '.$checked.' />'.$alphabet[$ind].': '.
       $opt[$ind].'</td>';
       }
       $result.='</tr></table>';
       return $result;
 }  }
   
   

Removed from v.1.84  
changed lines
  Added in v.1.84.2.2


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