Diff for /loncom/homework/optionresponse.pm between versions 1.6 and 1.8

version 1.6, 2001/05/04 21:19:37 version 1.8, 2001/05/21 19:45:28
Line 13  sub start_optionresponse { Line 13  sub start_optionresponse {
   my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;    my ($target,$token,$parstack,$parser,$safeeval,$style)=@_;
   #when in a radiobutton response use these    #when in a radiobutton response use these
   &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup'));    &Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup'));
     push (@Apache::lonxml::namespace,'optionresponse');
   my $id = &Apache::response::start_response($parstack,$safeeval);    my $id = &Apache::response::start_response($parstack,$safeeval);
   return '';    return '';
 }  }
   
 sub end_optionresponse {  sub end_optionresponse {
   &Apache::response::end_response;    &Apache::response::end_response;
     pop @Apache::lonxml::namespace;
   return '';    return '';
 }  }
   
   sub insert_optionresponse {
     return '
   <optionresponse max="10">
       <foilgroup options=\"\">
       </foilgroup>
   </optionresponse>';
   }
   
 %Apache::response::foilgroup={};  %Apache::response::foilgroup={};
 sub start_foilgroup {  sub start_foilgroup {
   %Apache::response::foilgroup={};    %Apache::response::foilgroup={};
Line 52  sub end_foilgroup { Line 62  sub end_foilgroup {
  my $allresponse;   my $allresponse;
  my $right=0;   my $right=0;
  my $wrong=0;   my $wrong=0;
    my $ignored=0;
  foreach $name (@whichopt) {   foreach $name (@whichopt) {
   my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"};    my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"};
   $allresponse.="$response:";    $allresponse.="$response:";
Line 59  sub end_foilgroup { Line 70  sub end_foilgroup {
     &Apache::lonxml::debug("submitted a $response<br />\n");      &Apache::lonxml::debug("submitted a $response<br />\n");
     my $value=$Apache::response::foilgroup{$name.'.value'};      my $value=$Apache::response::foilgroup{$name.'.value'};
     if ($value eq $response) {$right++;} else {$wrong++;}      if ($value eq $response) {$right++;} else {$wrong++;}
     } else {
       $ignored++;
   }    }
   $temp++;    $temp++;
  }   }
  my $id = $Apache::inputtags::response['-1'];   my $id = $Apache::inputtags::response['-1'];
  $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$allresponse;   $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.submission"}=$allresponse;
  &Apache::lonxml::debug("Got $right right and $wrong wrong");   &Apache::lonxml::debug("Got $right right and $wrong wrong, and $ignored were ignored");
  if ($wrong==0) {   if ($wrong==0 && $ignored==0) {
   $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='EXACT_ANS';    $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='EXACT_ANS';
  } else {   } else {
   $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='INCORRECT';    $Apache::lonhomework::results{"resource.$Apache::inputtags::part.$id.awarddetail"}='INCORRECT';
Line 193  sub end_foil { Line 206  sub end_foil {
   return '';    return '';
 }  }
   
   sub insert_foil {
     return '
   <foil name="" value="">
   </foil>';
   }
 1;  1;
 __END__  __END__
     

Removed from v.1.6  
changed lines
  Added in v.1.8


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