--- loncom/homework/rankresponse.pm 2004/10/21 06:35:57 1.40 +++ loncom/homework/rankresponse.pm 2005/01/31 22:00:40 1.44 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # rank style response # -# $Id: rankresponse.pm,v 1.40 2004/10/21 06:35:57 albertel Exp $ +# $Id: rankresponse.pm,v 1.44 2005/01/31 22:00:40 albertel Exp $ # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). @@ -113,6 +113,9 @@ sub end_foilgroup { my @shown = &whichfoils($max,$randomize); &Apache::response::analyze_store_foilgroup(\@shown, ['text','value','location']); + my $part_id= + "$Apache::inputtags::part.$Apache::inputtags::response[-1]"; + $Apache::lonhomework::analyze{"$part_id.tol"}=$tol; } &Apache::lonxml::increment_counter(&getfoilcounts($max)); } elsif ($target eq 'edit') { @@ -192,7 +195,7 @@ sub check_response_order { sub grade_response { my ($max,$randomize,$tol)=@_; my (@whichfoils)=&whichfoils($max,$randomize); - if (!defined($ENV{'form.submitted'})) { return; } + if (!&Apache::response::submitted()) { return; } my %responsehash; my %grade; my ($temp,$right,$wrong,$ignored)=(1,0,0,0); @@ -416,10 +419,16 @@ sub end_foil { if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex' || $target eq 'analyze') { my $value = &Apache::lonxml::get_param('value',$parstack,$safeeval); + if ($target eq 'tex' && $Apache::lonhomework::type eq 'exam') { + $text='\vskip 5mm $\triangleright$ '.$text; + } if ($value ne 'unused') { my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval); &Apache::lonxml::debug("Got a name of :$name:"); - if (!$name) { $name=$Apache::lonxml::curdepth; } + if (!$name) { + &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction."); + $name=$Apache::lonxml::curdepth; + } &Apache::lonxml::debug("Using a name of :$name:"); if (defined($Apache::response::foilnames{$name})) { &Apache::lonxml::error(&mt("Foil name [_1] appears more than once. Foil names need to be unique.",$name)); @@ -431,24 +440,12 @@ sub end_foil { && !&Apache::response::showallfoils() ) { push @{ $Apache::response::conceptgroup{'names'} }, $name; $Apache::response::conceptgroup{"$name.value"} = $value; - if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { - $Apache::response::conceptgroup{"$name.text"} = ' $\triangleright$ '.$text; - } else { - $Apache::response::conceptgroup{"$name.text"} = $text; - } + $Apache::response::conceptgroup{"$name.text"} = $text; $Apache::response::conceptgroup{"$name.location"} = $location; } else { push @{ $Apache::response::foilgroup{'names'} }, $name; $Apache::response::foilgroup{"$name.value"} = $value; - if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { - $Apache::response::foilgroup{"$name.text"} = '\vskip 5 mm $\triangleright$ '.$text; - } else { - if ($target eq 'tex' and $Apache::lonhomework::type eq 'exam') { - $Apache::response::foilgroup{"$name.text"} = ' $\triangleright$ '.$text; - } else { - $Apache::response::foilgroup{"$name.text"} = $text; - } - } + $Apache::response::foilgroup{"$name.text"} = $text; $Apache::response::foilgroup{"$name.location"} = $location; } }