Diff for /loncom/homework/optionresponse.pm between versions 1.129 and 1.130

version 1.129, 2005/06/22 12:03:23 version 1.130, 2005/12/06 10:03:57
Line 295  sub whichfoils { Line 295  sub whichfoils {
 }  }
   
 sub displayanswers {  sub displayanswers {
   my ($max,$randomize,@opt)=@_;      my ($max,$randomize,@opt)=@_;
   if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}      if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
   my @names = @{ $Apache::response::foilgroup{'names'} };      my @names = @{ $Apache::response::foilgroup{'names'} };
   my @whichopt = &whichfoils($max,$randomize);      my @whichopt = &whichfoils($max,$randomize);
   my $result=&Apache::response::answer_header('optionresponse');      my $result;
   foreach my $name (@whichopt) {      if ($Apache::lonhomework::type eq 'exam') {
     $result.=&Apache::response::answer_part('optionresponse',   my $i = 0;
      $Apache::response::foilgroup{$name.'.value'})   my %opt = map { ($_,$i++) } @opt;
   }  
   $result.=&Apache::response::answer_footer('optionresponse');   $i = 0;
   return $result;   my @alphabet = ('A'..'Z');
    foreach my $name (@whichopt) {
       $result.=&Apache::response::answer_header('optionresponse',$i++);
       $result.=&Apache::response::answer_part('optionresponse',
       $alphabet[$opt{$Apache::response::foilgroup{$name.'.value'}}]);
       $result.=&Apache::response::answer_part('optionresponse',
       $Apache::response::foilgroup{$name.'.value'});
       $result.=&Apache::response::answer_footer('optionresponse');
    }
       } else {
    $result=&Apache::response::answer_header('optionresponse');
    foreach my $name (@whichopt) {
       $result.=&Apache::response::answer_part('optionresponse',
       $Apache::response::foilgroup{$name.'.value'});
    }
    $result.=&Apache::response::answer_footer('optionresponse');
       }
       return $result;
 }  }
   
 sub check_for_invalid {  sub check_for_invalid {

Removed from v.1.129  
changed lines
  Added in v.1.130


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