Diff for /loncom/homework/optionresponse.pm between versions 1.62 and 1.67

version 1.62, 2002/11/11 20:26:59 version 1.67, 2003/01/19 08:10:22
Line 248  sub whichfoils { Line 248  sub whichfoils {
   my ($max,$randomize)=@_;    my ($max,$randomize)=@_;
   $max = &getfoilcounts($max);    $max = &getfoilcounts($max);
   &Apache::lonxml::debug("randomize $randomize");    &Apache::lonxml::debug("randomize $randomize");
     if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names = @{ $Apache::response::foilgroup{'names'} };
   my @whichopt =();    my @whichopt =();
   my (%top,@toplist,%bottom,@bottomlist);    my (%top,@toplist,%bottom,@bottomlist);
Line 294  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;}
   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=&Apache::response::answer_header('optionresponse');
Line 307  sub displayanswers { Line 309  sub displayanswers {
   
 sub displayfoils {  sub displayfoils {
   my ($target,$max,$randomize,@opt)=@_;    my ($target,$max,$randomize,@opt)=@_;
     if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
   my @names = @{ $Apache::response::foilgroup{'names'} };    my @names = @{ $Apache::response::foilgroup{'names'} };
   my @truelist;    my @truelist;
   my @falselist;    my @falselist;
Line 319  sub displayfoils { Line 322  sub displayfoils {
   my $part=$Apache::inputtags::part;    my $part=$Apache::inputtags::part;
   my $id=$Apache::inputtags::response[-1];    my $id=$Apache::inputtags::response[-1];
   my $break;    my $break;
   if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/)  || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {        my $solved=$Apache::lonhomework::history{"resource.$part.solved"};
     my $temp=1; ####    my $status=$Apache::inputtags::status[-1];
     if (
         ($target ne 'tex') &&
         (($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'};
  if ($text!~/^\s*$/) {   if ($text!~/^\s*$/) {
Line 353  sub displayfoils { Line 359  sub displayfoils {
   $result.=&bubbles(\@alphabet,\@opt);    $result.=&bubbles(\@alphabet,\@opt);
         }          }
       }        }
     $temp++;  
     }      }
   } else {    } else {
     my $temp=1;      my $temp=1;
Line 400  sub displayfoils { Line 405  sub displayfoils {
         }          }
         if ($Apache::response::foilgroup{$name.'.text'}=~/<drawoptionlist\s*\/>/) {          if ($Apache::response::foilgroup{$name.'.text'}=~/<drawoptionlist\s*\/>/) {
           $Apache::response::foilgroup{$name.'.text'}=~s|<drawoptionlist\s*/>| \\makebox\[0\.3in\]\[b\]\{\\hrulefill\} |;            $Apache::response::foilgroup{$name.'.text'}=~s|<drawoptionlist\s*/>| \\makebox\[0\.3in\]\[b\]\{\\hrulefill\} |;
           $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};  
         }          }
    $result.= $texoptionlist.$Apache::response::foilgroup{$name.'.text'};
       } else {        } else {
   if ($Apache::lonhomework::type eq 'exam') {    if ($Apache::lonhomework::type eq 'exam') {
       $result.= $texoptionlist.'\vspace*{-2 mm}\item[\textbf{'.$Apache::lonxml::counter.'}.]'.$Apache::response::foilgroup{$name.'.text'};        $result.= $texoptionlist.'\vspace*{-2 mm}\item[\textbf{'.$Apache::lonxml::counter.'}.]'.$Apache::response::foilgroup{$name.'.text'};
Line 411  sub displayfoils { Line 416  sub displayfoils {
       }        }
       if ($Apache::lonhomework::type eq 'exam') {        if ($Apache::lonhomework::type eq 'exam') {
   $result.=&bubbles(\@alphabet,\@opt);    $result.=&bubbles(\@alphabet,\@opt);
     $result.='\vskip 2 mm ';
       }        }
       $displayoptionintex=1;        $displayoptionintex=1;
   } else {    } else {
Line 431  sub displayfoils { Line 437  sub displayfoils {
       }        }
       if ($Apache::lonhomework::type eq 'exam') {        if ($Apache::lonhomework::type eq 'exam') {
   $result.=&bubbles(\@alphabet,\@opt);    $result.=&bubbles(\@alphabet,\@opt);
     $result.='\vskip 2 mm ';
       }        }
   }    }
       }        }
Line 455  sub optionlist_correction { Line 462  sub optionlist_correction {
     $texoptionlist =~ s/>/\$>\$/g;      $texoptionlist =~ s/>/\$>\$/g;
     $texoptionlist =~ s/</\$<\$/g;      $texoptionlist =~ s/</\$<\$/g;
     $texoptionlist =~ s/=/\$=\$/g;      $texoptionlist =~ s/=/\$=\$/g;
       $texoptionlist =~ s/\^(\d+)/<m>\$$1\$<\/m>/g;
     return $texoptionlist;      return $texoptionlist;
 }  }
   

Removed from v.1.62  
changed lines
  Added in v.1.67


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