Diff for /loncom/homework/caparesponse/caparesponse.pm between versions 1.213 and 1.216

version 1.213, 2007/04/26 23:15:43 version 1.216, 2007/06/06 17:03:54
Line 392  sub setup_capa_args { Line 392  sub setup_capa_args {
 sub setup_capa_response {  sub setup_capa_response {
     my ($args_ref,$response) = @_;         my ($args_ref,$response) = @_;   
   
     use Data::Dumper;  
     &Apache::lonxml::debug("response dump is ".&Dumper($response));  
       
     if (ref($response)) {      if (ref($response)) {
  $$args_ref{'response'}=dclone($response);   $$args_ref{'response'}=dclone($response);
     } else {      } else {
Line 824  sub check_for_answer_errors { Line 821  sub check_for_answer_errors {
  } (sort(keys(%counts))));   } (sort(keys(%counts))));
  &Apache::lonxml::error(&mt("All answers must have the same number of components. Varying numbers of answers were seen. ").$counts);   &Apache::lonxml::error(&mt("All answers must have the same number of components. Varying numbers of answers were seen. ").$counts);
     }      }
     use Data::Dumper;  
     &Apache::lonxml::debug("count dump is ".&Dumper(\%counts));  
     my $expected_number_of_inputs = (keys(%counts))[0];      my $expected_number_of_inputs = (keys(%counts))[0];
     if ( $expected_number_of_inputs != scalar(@Apache::inputtags::inputlist)) {      if ( $expected_number_of_inputs > 0 
    && $expected_number_of_inputs != scalar(@Apache::inputtags::inputlist)) {
  &Apache::lonxml::error(&mt("Expected [_1] input fields, but there were only [_2] seen.",    &Apache::lonxml::error(&mt("Expected [_1] input fields, but there were only [_2] seen.", 
    $expected_number_of_inputs,     $expected_number_of_inputs,
    scalar(@Apache::inputtags::inputlist)));     scalar(@Apache::inputtags::inputlist)));
Line 863  sub get_table_sizes { Line 859  sub get_table_sizes {
     my $bubbles_per_line=int($textwidth/$cell_width);      my $bubbles_per_line=int($textwidth/$cell_width);
     if ($bubbles_per_line > $number_of_bubbles) {      if ($bubbles_per_line > $number_of_bubbles) {
  $bubbles_per_line=$number_of_bubbles;   $bubbles_per_line=$number_of_bubbles;
     }elsif (($bubbles_per_line > $number_of_bubbles/2) && ($number_of_bubbles % 2==0)) {$bubbles_per_line=$number_of_bubbles/2;}      } elsif (($bubbles_per_line > $number_of_bubbles/2) 
        && ($number_of_bubbles % 2==0)) {
    $bubbles_per_line=$number_of_bubbles/2;
       }
       if ($bubbles_per_line < 1) {
    $bubbles_per_line=1;
       }
     my $number_of_tables = int($number_of_bubbles/$bubbles_per_line);      my $number_of_tables = int($number_of_bubbles/$bubbles_per_line);
     my @table_range = ();      my @table_range = ();
     for (my $i=0;$i<$number_of_tables;$i++) {push @table_range,$bubbles_per_line;}      for (my $i=0;$i<$number_of_tables;$i++) {push @table_range,$bubbles_per_line;}
Line 898  sub format_number { Line 900  sub format_number {
   
 sub make_numerical_bubbles {  sub make_numerical_bubbles {
     my ($part,$id,$target,$parstack,$safeeval) =@_;      my ($part,$id,$target,$parstack,$safeeval) =@_;
   
       if (!%answer) {
    &Apache::lonxml::error(&mt("No answers defined for response [_1] in part [_2] to make bubbles for.",$id,$part));
    return ([],[],undef);
       }
           
     my $number_of_bubbles =       my $number_of_bubbles = 
  &Apache::response::get_response_param($part.'_'.$id,'numbubbles',8);   &Apache::response::get_response_param($part.'_'.$id,'numbubbles',8);

Removed from v.1.213  
changed lines
  Added in v.1.216


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