version 1.86, 2003/10/06 21:57:54
|
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 574 sub show_answer {
|
Line 571 sub show_answer {
|
&& lc($Apache::lonhomework::problemstatus) ne 'no') |
&& lc($Apache::lonhomework::problemstatus) ne 'no') |
|| $status eq "SHOW_ANSWER"); |
|| $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__ |
|
|