Diff for /loncom/homework/matchresponse.pm between versions 1.62 and 1.66

version 1.62, 2007/04/05 10:29:58 version 1.66, 2007/10/08 09:22:50
Line 71  sub start_matchresponse { Line 71  sub start_matchresponse {
     } elsif ($target eq 'analyze') {      } elsif ($target eq 'analyze') {
  my $part_id="$Apache::inputtags::part.$id";   my $part_id="$Apache::inputtags::part.$id";
  push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);   push (@{ $Apache::lonhomework::analyze{"parts"} },$part_id);
    push (@{ $Apache::lonhomework::anaylze{"$part_id.bubble_lines"} },
         1);
     }      }
     return $result;      return $result;
 }  }
Line 276  sub end_foilgroup { Line 278  sub end_foilgroup {
  ['text','value','location']);   ['text','value','location']);
     #FIXME need to store options in some way      #FIXME need to store options in some way
  }   }
  &Apache::lonxml::increment_counter(&getfoilcounts($max));   &Apache::lonxml::increment_counter(&getfoilcounts($max), 
      $Apache::inputtags::part);
    if ($target eq 'analyze') {
       &Apache::lonhomework::set_bubble_lines();
    }
   
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result=&Apache::edit::end_table();   $result=&Apache::edit::end_table();
     }      }
Line 415  sub grade_response { Line 422  sub grade_response {
     }      }
 }  }
   
   sub format_prior_answer {
       my ($mode,$answer,$other_data) = @_;
       my %answer      =&Apache::lonnet::str2hash($answer);
       my $foil_order  =$other_data->[0];
       my %grading     =&Apache::lonnet::str2hash($other_data->[1]);
       my @items       =&Apache::lonnet::str2array($other_data->[2]);
       my $output;
       
       foreach my $name (@{ $foil_order }) {
    my $item=shift(@items);
    $output .= '<tr><td>'.$item.'</td></tr>';
       }
       return if (!defined($output));
   
       $output = '<table class="LC_prior_match">'.$output.'</table>';
       return $output;
   }
   
 sub itemdisplay {  sub itemdisplay {
     my ($location)=@_;      my ($location)=@_;
     if ($location eq 'top' &&      if ($location eq 'top' &&
Line 426  sub itemdisplay { Line 451  sub itemdisplay {
     }      }
     return undef;      return undef;
 }  }
   
 sub displayfoils {  sub displayfoils {
     my ($target,$max,$randomize)=@_;      my ($target,$max,$randomize)=@_;
     my ($tabsize, $lefttabsize, $righttabsize);      my ($tabsize, $lefttabsize, $righttabsize);
Line 535  sub displayfoils { Line 561  sub displayfoils {
     $question.='\vskip -1 mm\noindent\begin{list}{}{\setlength{\listparindent}{0mm}\setlength{\leftmargin}{2mm}}'      $question.='\vskip -1 mm\noindent\begin{list}{}{\setlength{\listparindent}{0mm}\setlength{\leftmargin}{2mm}}'
  .'\item \hskip -3mm \textbf{'.$internal_counter.'}';   .'\item \hskip -3mm \textbf{'.$internal_counter.'}';
     if (&itemdisplay('left') || &itemdisplay('right')) {      if (&itemdisplay('left') || &itemdisplay('right')) {
  &Apache::lonnet::logthis("Constraining bubbles to $righttabsize - 10");  
  $question .= &Apache::optionresponse::bubbles(\@used_letters,\@emptyItems, "", $righttabsize);   $question .= &Apache::optionresponse::bubbles(\@used_letters,\@emptyItems, "", $righttabsize);
     }      }
     else {      else {
  &Apache::lonnet::logthis("Not constraining bubbles");  
  $question .= &Apache::optionresponse::bubbles(\@used_letters,\@emptyItems);   $question .= &Apache::optionresponse::bubbles(\@used_letters,\@emptyItems);
     }      }
     $question .= '\end{list} \vskip -8 mm \strut ';      $question .= '\end{list} \vskip -8 mm \strut ';
Line 578  sub displayfoils { Line 602  sub displayfoils {
     $result='\setlength{\tabcolsep}{1 mm}\begin{tabular}{p{'.$lefttabsize.'}p{'.$righttabsize.'}}\begin{minipage}{'.$lefttabsize.'}'.$result.'\end{minipage}&\begin{minipage}{'.$righttabsize.'}'.$question.'\end{minipage}\end{tabular}';      $result='\setlength{\tabcolsep}{1 mm}\begin{tabular}{p{'.$lefttabsize.'}p{'.$righttabsize.'}}\begin{minipage}{'.$lefttabsize.'}'.$result.'\end{minipage}&\begin{minipage}{'.$righttabsize.'}'.$question.'\end{minipage}\end{tabular}';
  }   }
     }      }
       if ($target eq 'web') {
    &Apache::response::setup_prior_tries_hash(\&format_prior_answer,
     [\@whichfoils,
      'submissiongrading',
      'submissionitems']);
       }
     if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}      if ($target ne 'tex') {$result.="<br />";} else {$result.=' \\\\ ';}
     return $result;      return $result;
 }  }

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


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