Diff for /loncom/homework/optionresponse.pm between versions 1.72 and 1.75

version 1.72, 2003/04/02 18:07:10 version 1.75, 2003/04/21 22:09:47
Line 185  sub end_foilgroup { Line 185  sub end_foilgroup {
  my $wrong=0;   my $wrong=0;
  my $ignored=0;   my $ignored=0;
  foreach $name (@whichopt) {   foreach $name (@whichopt) {
   my $response = $ENV{'form.HWVAL_'.$Apache::inputtags::response['-1'].":$temp"};    my $response=&Apache::response::getresponse($temp);
     if ($ENV{'form.submitted'} eq 'scantron') {
         $response = $opt[$response];
     }
   $responsehash{$name}=$response;    $responsehash{$name}=$response;
   if ( $response =~ /[^\s]/) {    if ( $response =~ /[^\s]/) {
     my $value=$Apache::response::foilgroup{$name.'.value'};      my $value=$Apache::response::foilgroup{$name.'.value'};
Line 207  sub end_foilgroup { Line 210  sub end_foilgroup {
  my %previous=&Apache::response::check_for_previous($responsestr,   my %previous=&Apache::response::check_for_previous($responsestr,
    $part,$id);     $part,$id);
  &Apache::lonxml::debug("Got $right right and $wrong wrong, and $ignored were ignored");   &Apache::lonxml::debug("Got $right right and $wrong wrong, and $ignored were ignored");
  my $ad;  
  if ($wrong==0 && $ignored==0) {  
   $ad='EXACT_ANS';  
  } elsif ($wrong==0 && $right==0) {  
   #nothing submitted  
  } else {  
   if ($ignored==0) {  
     $ad='INCORRECT';  
   } else {  
     $ad='MISSING_ANSWER';  
   }  
  }  
  $Apache::lonhomework::results{"resource.$part.$id.submission"}=   $Apache::lonhomework::results{"resource.$part.$id.submission"}=
   $responsestr;      $responsestr;
  $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;   $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=$gradestr;
  $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=  
   $ad;   if (!$Apache::lonhomework::scantronmode) {
  &Apache::response::handle_previous(\%previous,$ad);      my $ad;
       if ($wrong==0 && $ignored==0) {
    $ad='EXACT_ANS';
       } elsif ($wrong==0 && $right==0) {
    #nothing submitted
       } else {
    if ($ignored==0) {
       $ad='INCORRECT';
    } else {
       $ad='MISSING_ANSWER';
    }
       }
       $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
       &Apache::response::handle_previous(\%previous,$ad);
    } else {
       my $ad;
       if ($wrong==0 && $right==0) {
    #nothing submitted
       } else {
    $ad='ASSIGNED_SCORE';
       }
       $Apache::lonhomework::results{"resource.$part.$id.awarddetail"}=$ad;
       $Apache::lonhomework::results{"resource.$part.$id.awarded"}=
    $right/(scalar(@whichopt));
    }
       }        }
     }      }
       &Apache::lonxml::increment_counter(&getfoilcounts($max));
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
     $result.=&Apache::edit::end_table();      $result.=&Apache::edit::end_table();
   }      }
   if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {$result .= '\end{enumerate}';}    if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
         $result .= '\end{enumerate}';
     }
   return $result;    return $result;
 }  }
   
Line 393  sub displayfoils { Line 411  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);      $result.=&webbubbles(\@opt,\@alphabet,$temp);
   }    }
   $temp++;    $temp++;
       } else {        } else {
Line 468  sub optionlist_correction { Line 486  sub optionlist_correction {
   
 sub webbubbles {  sub webbubbles {
   
     my ($ropt,$ralphabet)=@_;      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++) {
    $result.='<td><input type="radio" name="HWVAL'.$Apache::inputtags::response['-1'].     $result.='<td><input type="radio" name="HWVAL_'.$Apache::inputtags::response['-1'].':'.$temp.
                     '" value='.$opt[$ind].'>'.$alphabet[$ind].': '.$opt[$ind].'</td>';                      '" value='.$opt[$ind].'>'.$alphabet[$ind].': '.$opt[$ind].'</td>';
  }   }
  $result.='</tr></table>';   $result.='</tr></table>';
Line 505  sub bubbles { Line 523  sub bubbles {
  }   }
   
     }      }
     &Apache::lonxml::increment_counter();  
     return $result;      return $result;
 }  }
   

Removed from v.1.72  
changed lines
  Added in v.1.75


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