--- loncom/homework/radiobuttonresponse.pm 2006/12/19 11:05:21 1.110 +++ loncom/homework/radiobuttonresponse.pm 2007/03/27 19:20:49 1.113 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # mutliple choice style responses # -# $Id: radiobuttonresponse.pm,v 1.110 2006/12/19 11:05:21 foxr Exp $ +# $Id: radiobuttonresponse.pm,v 1.113 2007/03/27 19:20:49 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') { @@ -206,6 +212,7 @@ sub end_foilgroup { ('true','false')); } } + $Apache::lonxml::post_evaluate=0; } &Apache::response::poprandomnumber(); &Apache::lonxml::increment_counter(); @@ -230,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; @@ -289,7 +310,11 @@ sub displayallfoils { $i++; } else { $result .= '