Diff for /loncom/homework/matchresponse.pm between versions 1.80 and 1.81

version 1.80, 2010/04/27 14:11:17 version 1.81, 2010/12/19 00:54:20
Line 252  sub start_foilgroup { Line 252  sub start_foilgroup {
     my $result;      my $result;
     %Apache::response::foilgroup=();      %Apache::response::foilgroup=();
     $Apache::matchresponse::conceptgroup=0;      $Apache::matchresponse::conceptgroup=0;
     &Apache::response::pushrandomnumber();      &Apache::response::pushrandomnumber(undef,$target);
     if ($target eq 'edit') {      if ($target eq 'edit') {
  $result.=&Apache::edit::start_table($token)   $result.=&Apache::edit::start_table($token)
     .'<tr><td>'.&mt('Collection Of Foils').'</td>'      .'<tr><td>'.&mt('Collection Of Foils').'</td>'
Line 354  sub grade_response { Line 354  sub grade_response {
     if (!&Apache::response::submitted()) { return; }      if (!&Apache::response::submitted()) { return; }
     my %responsehash;      my %responsehash;
     my %grade;      my %grade;
       my %answerhash;
     my ($temp,$right,$wrong,$ignored)=(1,0,0,0);      my ($temp,$right,$wrong,$ignored)=(1,0,0,0);
     my %letter_name_map;      my %letter_name_map;
     if (defined(%{ $Apache::response::itemgroup{'letter_name_map'} })) {      if (defined(%{ $Apache::response::itemgroup{'letter_name_map'} })) {
Line 366  sub grade_response { Line 367  sub grade_response {
  push(@items,$response);   push(@items,$response);
  my $responsename = $letter_name_map{$response};   my $responsename = $letter_name_map{$response};
  my $value=$Apache::response::foilgroup{$name.'.value'};   my $value=$Apache::response::foilgroup{$name.'.value'};
           if ($Apache::lonhomework::type eq 'randomizetry') {
               $answerhash{$name} = $value;
           }
  if ( $response =~ /[^\s]/) {   if ( $response =~ /[^\s]/) {
     $responsehash{$name}=$responsename;      $responsehash{$name}=$responsename;
     &Apache::lonxml::debug("submitted a $response($responsename) for $value<br />\n");      &Apache::lonxml::debug("submitted a $response($responsename) for $value<br />\n");
Line 392  sub grade_response { Line 396  sub grade_response {
  $itemstr;   $itemstr;
     $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=      $Apache::lonhomework::results{"resource.$part.$id.submissiongrading"}=
  $gradestr;   $gradestr;
       if ($Apache::lonhomework::type eq 'randomizetry') {
           $Apache::lonhomework::results{"resource.$part.$id.foilorder"} = &Apache::lonnet::array2str(@whichfoils);
       }
     if (($Apache::lonhomework::type eq 'survey') ||      if (($Apache::lonhomework::type eq 'survey') ||
         ($Apache::lonhomework::type eq 'surveycred') ||          ($Apache::lonhomework::type eq 'surveycred') ||
         ($Apache::lonhomework::type eq 'anonsurvey') ||          ($Apache::lonhomework::type eq 'anonsurvey') ||
Line 512  sub displayfoils { Line 519  sub displayfoils {
  my $temp=1;   my $temp=1;
  my $id=$Apache::inputtags::response[-1];   my $id=$Apache::inputtags::response[-1];
  my $part=$Apache::inputtags::part;   my $part=$Apache::inputtags::part;
         my $lastresponse;          my ($lastresponse,$newvariation);
         unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) && (defined($env{'form.grade_symb'}))) {          if ((($Apache::lonhomework::history{"resource.$part.type"} eq 'randomizetry') ||
               ($Apache::lonhomework::type eq 'randomizetry')) &&
               ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) {
               if ($env{'form.'.$part.'.rndseed'} ne
                   $Apache::lonhomework::history{"resource.$part.rndseed"}) {
                   $newvariation = 1;
               }
           }
           unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred') && (defined($env{'form.grade_symb'}))) || $newvariation) {
     $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};      $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
         }          }
  my %lastresponse=&Apache::lonnet::str2hash($lastresponse);       my %lastresponse=&Apache::lonnet::str2hash($lastresponse);    
Line 542  sub displayfoils { Line 557  sub displayfoils {
     foreach $option (@used_letters) {      foreach $option (@used_letters) {
  if ($option eq $last_letter) {   if ($option eq $last_letter) {
     if ($target ne 'tex') {      if ($target ne 'tex') {
                         $optionlist.="<option selected=\"on\">$option</option>\n";                          $optionlist.="<option selected=\"selected\">$option</option>\n";
                     } elsif ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'                      } elsif ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
                              && $Apache::inputtags::status['-1'] eq 'CAN_ANSWER'                               && $Apache::inputtags::status['-1'] eq 'CAN_ANSWER'
                              && $Apache::lonhomework::type ne 'exam') {                               && $Apache::lonhomework::type ne 'exam') {
Line 652  sub displayfoils { Line 667  sub displayfoils {
  }   }
     }      }
     if ($target eq 'web') {      if ($target eq 'web') {
           my $questiontype;
           if ($Apache::lonhomework::type eq 'randomizetry') {
               $questiontype = $Apache::lonhomework::type;
           }
  &Apache::response::setup_prior_tries_hash(\&format_prior_answer,   &Apache::response::setup_prior_tries_hash(\&format_prior_answer,
   [\@whichfoils,    [\@whichfoils,
    'submissiongrading',     'submissiongrading',
    'submissionitems']);     'submissionitems'],
                                                     $questiontype);
     }      }
     if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}      if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}
     return $result;      return $result;

Removed from v.1.80  
changed lines
  Added in v.1.81


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