Diff for /loncom/homework/response.pm between versions 1.84 and 1.87

version 1.84, 2003/08/20 14:05:40 version 1.87, 2003/10/27 19:27:09
Line 25 Line 25
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 # 11/23,11/24,11/28 Gerd Kortemeyer  
 # Guy Albertelli  
 # 08/04,08/07 Gerd Kortemeyer  
   
 package Apache::response;  package Apache::response;
 use strict;  use strict;
Line 180  sub mandatory_part_meta { Line 177  sub mandatory_part_meta {
 #  #
 }  }
   
   sub meta_part_order {
       if (@Apache::inputtags::partlist) {
    my @parts=@Apache::inputtags::partlist;
    shift(@parts);
    return '<partorder>'.join(',',@parts).'</partorder>';
       } else {
    return '<partorder>0</partorder>';
       }
   }
   
 sub check_for_previous {  sub check_for_previous {
     my ($curresponse,$partid,$id) = @_;      my ($curresponse,$partid,$id) = @_;
     my %previous;      my %previous;
Line 556  sub whichorder { Line 563  sub whichorder {
     return @whichopt;      return @whichopt;
 }  }
   
   sub show_answer {
       my $part   = $Apache::inputtags::part;
       my $award  = $Apache::lonhomework::history{"resource.$part.solved"};
       my $status = $Apache::inputtags::status[-1];
       return  ( ($award =~ /^correct/
          && lc($Apache::lonhomework::problemstatus) ne 'no')
         || $status eq "SHOW_ANSWER");
   }
   
   sub analyze_store_foilgroup {
       my ($shown,$attrs)=@_;
       my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
       foreach my $name (@{ $Apache::response::foilgroup{'names'} }) {
    if (defined($Apache::lonhomework::analyze{"$part_id.foil.value.$name"})) { next; }
    push (@{ $Apache::lonhomework::analyze{"$part_id.foils"} },$name);
    foreach my $attr (@$attrs) {
       $Apache::lonhomework::analyze{"$part_id.foil.".$attr.".$name"} =
    $Apache::response::foilgroup{"$name.".$attr};
    }
       }
       push (@{ $Apache::lonhomework::analyze{"$part_id.shown"} }, @{ $shown });
   }
   
   sub pick_foil_for_concept {
       my ($target,$attrs,$hinthash,$parstack,$safeeval)=@_;
       if (not defined(@{ $Apache::response::conceptgroup{'names'} })) { return; }
       my @names = @{ $Apache::response::conceptgroup{'names'} };
       my $pick=int(&Math::Random::random_uniform() * ($#names+1));
       my $name=$names[$pick];
       push @{ $Apache::response::foilgroup{'names'} }, $name;
       foreach my $attr (@$attrs) {
    $Apache::response::foilgroup{"$name.".$attr} =
       $Apache::response::conceptgroup{"$name.".$attr};
       }
       my $concept = &Apache::lonxml::get_param('concept',$parstack,$safeeval);
       $Apache::response::foilgroup{"$name.concept"} = $concept;
       &Apache::lonxml::debug("Selecting $name in $concept");
       my $part_id="$Apache::inputtags::part.$Apache::inputtags::response[-1]";
       if ($target eq 'analyze') {
    push (@{ $Apache::lonhomework::analyze{"$part_id.concepts"} },
         $concept);
    $Apache::lonhomework::analyze{"$part_id.concept.$concept"}=
       $Apache::response::conceptgroup{'names'};
    foreach my $name (@{ $Apache::response::conceptgroup{'names'} }) {
       push (@{ $Apache::lonhomework::analyze{"$part_id.foils"} },
     $name);
       foreach my $attr (@$attrs) {
    $Apache::lonhomework::analyze{"$part_id.foil.$attr.$name"}=
       $Apache::response::conceptgroup{"$name.$attr"};
       }
    }
       }
       push(@{ $hinthash->{"$part_id.concepts"} },$concept);
       $hinthash->{"$part_id.concept.$concept"}=
    $Apache::response::conceptgroup{'names'};
   
   }
   
   
 1;  1;
 __END__  __END__
     

Removed from v.1.84  
changed lines
  Added in v.1.87


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