--- loncom/homework/radiobuttonresponse.pm 2007/02/22 01:25:31 1.111 +++ loncom/homework/radiobuttonresponse.pm 2007/03/01 02:31:20 1.112 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.111 2007/02/22 01:25:31 albertel Exp $ +# $Id: radiobuttonresponse.pm,v 1.112 2007/03/01 02:31:20 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -180,6 +180,9 @@ sub end_foilgroup { if ( $style eq 'survey' && $target ne 'analyze') { if ($target eq 'web' || $target eq 'tex') { $result=&displayallfoils($direction, $target); + if ($target eq 'web') { + &setup_prior_tries_hash(); + } } elsif ( $target eq 'answer' ) { $result=&displayallanswers(); } elsif ( $target eq 'grade' ) { @@ -193,6 +196,9 @@ sub end_foilgroup { $safeeval,'-2'); if ($target eq 'web' || $target eq 'tex') { $result=&displayfoils($target,$max,$randomize,$direction); + if ($target eq 'web') { + &setup_prior_tries_hash(); + } } elsif ($target eq 'answer' ) { $result=&displayanswers($max,$randomize); } elsif ( $target eq 'grade') { @@ -231,6 +237,20 @@ sub getfoilcounts { return ($truecnt,$falsecnt); } +sub setup_prior_tries_hash { + my $part=$Apache::inputtags::part; + my $id=$Apache::inputtags::response[-1]; + foreach my $i (1..$Apache::lonhomework::history{'version'}) { + my $key = "$i:resource.$part.$id.submission"; + next if (!exists($Apache::lonhomework::history{"$key"})); + my %response = + &Apache::lonnet::str2hash($Apache::lonhomework::history{$key}); + my ($name) = keys(%response); + $Apache::inputtags::submission_display{$key} = + $Apache::response::foilgroup{$name.'.text'} + } +} + sub displayallfoils { my ($direction, $target)=@_; my $result;