Diff for /loncom/homework/radiobuttonresponse.pm between versions 1.42 and 1.45

version 1.42, 2002/07/17 18:06:18 version 1.45, 2002/08/05 15:55:21
Line 74  sub end_radiobuttonresponse { Line 74  sub end_radiobuttonresponse {
   return $result;    return $result;
 }  }
   
 %Apache::response::foilgroup={};  %Apache::response::foilgroup=();
 sub start_foilgroup {  sub start_foilgroup {
   %Apache::response::foilgroup={};    %Apache::response::foilgroup=();
   $Apache::radiobuttonresponse::conceptgroup=0;    $Apache::radiobuttonresponse::conceptgroup=0;
   &Apache::response::setrandomnumber();    &Apache::response::setrandomnumber();
   return '';    return '';
Line 184  sub displayallfoils { Line 184  sub displayallfoils {
   my $part=$Apache::inputtags::part;    my $part=$Apache::inputtags::part;
   my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};    my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
   my %lastresponse=&Apache::lonnet::str2hash($lastresponse);    my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
   &Apache::lonhomework::showhash(%lastresponse);    if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/)  || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {
   foreach my $name (@names) {      foreach my $name (@names) {
     if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {        if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
       $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";   $result.="<br />".$Apache::response::foilgroup{$name.'.value'};
       if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }   if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
       $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";    $result.='<b>';
       $temp++;   }
    $result .= $Apache::response::foilgroup{$name.'.text'};
    if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
     $result.='</b>';
    }
         }
       }
     } else {
       foreach my $name (@names) {
         if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
    $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
    if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
    $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
    $temp++;
         }
     }      }
   }    }
   return $result;    return $result;
Line 242  sub displayfoils { Line 256  sub displayfoils {
   my $result;    my $result;
   
   my @whichfoils=&whichfoils($max,$answer);    my @whichfoils=&whichfoils($max,$answer);
   if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ ) {    if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ || ($Apache::inputtags::status[-1] eq  'SHOW_ANSWER')) {
     foreach my $name (@whichfoils) {      foreach my $name (@whichfoils) {
       if ($target ne 'tex') {        if ($target ne 'tex') {
   $result.="<br />";    $result.="<br />";
         } else {
     $result.='\vskip 0 mm ';
       }        }
       if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {         if ($Apache::response::foilgroup{$name.'.value'} eq 'true') { 
  $result.='Correct';   $result.='Correct:<b>';
       } else {        } else {
  $result.='Incorrect';   $result.='Incorrect:';
         }
         $result.=$Apache::response::foilgroup{$name.'.text'}."</input>\n";
         if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
    $result.='</b>';
       }        }
       $result.=":".$Apache::response::foilgroup{$name.'.text'}."</input>\n";  
     }      }
   } else {    } else {
     my $temp=0;      my $temp=0;
Line 266  sub displayfoils { Line 285  sub displayfoils {
   if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }    if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
   $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";    $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
       } else {        } else {
   $result .= $Apache::response::foilgroup{$name.'.text'};    $result .= '\item '.$Apache::response::foilgroup{$name.'.text'};
       }        }
       $temp++;        $temp++;
     }      }
   }    }
   if ($target ne 'tex') { $result.="<br />"; }    if ($target ne 'tex') { $result.="<br />"; } else { $result.='\vskip 0 mm '; }
   return $result;    return $result;
 }  }
   
Line 290  sub displayanswers { Line 309  sub displayanswers {
 sub start_conceptgroup {  sub start_conceptgroup {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
   $Apache::radiobuttonresponse::conceptgroup=1;    $Apache::radiobuttonresponse::conceptgroup=1;
   %Apache::response::conceptgroup={};    %Apache::response::conceptgroup=();
   my $result;    my $result;
   if ($target eq 'edit') {    if ($target eq 'edit') {
     $result.=&Apache::edit::tag_start($target,$token);      $result.=&Apache::edit::tag_start($target,$token);
Line 336  sub start_foil { Line 355  sub start_foil {
   my $result='';    my $result='';
   if ($target eq 'web' || $target eq 'tex') {    if ($target eq 'web' || $target eq 'tex') {
     &Apache::lonxml::startredirection;      &Apache::lonxml::startredirection;
     if ($target eq 'tex') {  
  $result .= '\item ';  
     }  
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result=&Apache::edit::tag_start($target,$token);      $result=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::text_arg('Name:','name',$token);      $result.=&Apache::edit::text_arg('Name:','name',$token);

Removed from v.1.42  
changed lines
  Added in v.1.45


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