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

version 1.84.2.2, 2003/10/15 19:51:29 version 1.85, 2003/09/09 13:36:11
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 ( ($target ne 'tex') &&    if (
        &Apache::response::show_answer() ) {        ($target ne 'tex') &&
     my $temp=1;        (($solved =~ /^correct/) || ($status eq 'SHOW_ANSWER')) ) {
     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 336  sub displayfoils { Line 334  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,$temp,$lastopt);    $result.=&webbubbles(\@opt,\@alphabet);
         } else {          } else {
   $result.=&bubbles(\@alphabet,\@opt);    $result.=&bubbles(\@alphabet,\@opt);
         }          }
       }        }
       $temp++;  
     }      }
   } else {    } else {
     my $temp=1;      my $temp=1;
Line 378  sub displayfoils { Line 375  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,$lastopt);      $result.=&webbubbles(\@opt,\@alphabet,$temp);
   }    }
   $temp++;    $temp++;
       } else {        } else {
Line 441  sub optionlist_correction { Line 438  sub optionlist_correction {
   
     my $texoptionlist = shift;      my $texoptionlist = shift;
     if ($texoptionlist=~/<option selected/ or $texoptionlist=~/<option>[^<]+<\/option>/) {      if ($texoptionlist=~/<option selected/ or $texoptionlist=~/<option>[^<]+<\/option>/) {
  $texoptionlist =~ s/<option><\/option>/\\item \[\] Choose from: /;   $texoptionlist =~ s/<option><\/option>/\\item \[\] Choices: /;
  $texoptionlist =~ s/<option>/\{\\bf /g;   $texoptionlist =~ s/<option>/\{\\bf /g;
  $texoptionlist =~ s/<option selected="on">/\{\\bf /g;   $texoptionlist =~ s/<option selected="on">/\{\\bf /g;
  $texoptionlist =~ s/<\/option>/\},/g;   $texoptionlist =~ s/<\/option>/\},/g;
Line 459  sub optionlist_correction { Line 456  sub optionlist_correction {
   
 sub webbubbles {  sub webbubbles {
   
     my ($ropt,$ralphabet,$temp,$lastopt)=@_;      my ($ropt,$ralphabet,$temp)=@_;
     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++) {
  my $checked='';     $result.='<td><input type="radio" name="HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp.
  if ($lastopt eq $opt[$ind]) {                      '" value='.$opt[$ind].'>'.$alphabet[$ind].': '.$opt[$ind].'</td>';
     $checked=' checked="on" ';  
  }   }
  $result.='<td><input type="radio" name="HWVAL_'.   $result.='</tr></table>';
     $Apache::inputtags::response['-1'].':'.$temp.   return $result;
     '" value="'.$opt[$ind].'" '.$checked.' />'.$alphabet[$ind].': '.  
     $opt[$ind].'</td>';  
     }  
     $result.='</tr></table>';  
     return $result;  
 }  }
   
   

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


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