[LON-CAPA-cvs] cvs: loncom /homework radiobuttonresponse.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 05 Aug 2002 15:55:21 -0000
albertel Mon Aug 5 11:55:21 2002 EDT
Modified files:
/loncom/homework radiobuttonresponse.pm
Log:
- show answer after answer date (was reverting to default display)
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.44 loncom/homework/radiobuttonresponse.pm:1.45
--- loncom/homework/radiobuttonresponse.pm:1.44 Mon Aug 5 10:59:24 2002
+++ loncom/homework/radiobuttonresponse.pm Mon Aug 5 11:55:21 2002
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.44 2002/08/05 14:59:24 sakharuk Exp $
+# $Id: radiobuttonresponse.pm,v 1.45 2002/08/05 15:55:21 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -184,13 +184,27 @@
my $part=$Apache::inputtags::part;
my $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
- &Apache::lonhomework::showhash(%lastresponse);
- foreach my $name (@names) {
- if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
- $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
- if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
- $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
- $temp++;
+ if (($Apache::lonhomework::history{"resource.$part.solved"} =~ /^correct/) || ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER')) {
+ foreach my $name (@names) {
+ if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
+ $result.="<br />".$Apache::response::foilgroup{$name.'.value'};
+ if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
+ $result.='<b>';
+ }
+ $result .= $Apache::response::foilgroup{$name.'.text'};
+ if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
+ $result.='</b>';
+ }
+ }
+ }
+ } else {
+ foreach my $name (@names) {
+ if ($Apache::response::foilgroup{$name.'.value'} ne 'unused') {
+ $result.="<br /><input type=\"radio\" name=\"HWVAL$Apache::inputtags::response['-1']\" value=\"$temp\" ";
+ if (defined($lastresponse{$name})) { $result .= 'checked="on"'; }
+ $result .= '>'.$Apache::response::foilgroup{$name.'.text'}."</input>\n";
+ $temp++;
+ }
}
}
return $result;
@@ -242,7 +256,7 @@
my $result;
my @whichfoils=&whichfoils($max,$answer);
- if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ ) {
+ if ($Apache::lonhomework::history{"resource.$Apache::inputtags::part.solved"} =~ /^correct/ || ($Apache::inputtags::status[-1] eq 'SHOW_ANSWER')) {
foreach my $name (@whichfoils) {
if ($target ne 'tex') {
$result.="<br />";
@@ -250,11 +264,14 @@
$result.='\vskip 0 mm ';
}
if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
- $result.='Correct';
+ $result.='Correct:<b>';
} else {
- $result.='Incorrect';
+ $result.='Incorrect:';
+ }
+ $result.=$Apache::response::foilgroup{$name.'.text'}."</input>\n";
+ if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
+ $result.='</b>';
}
- $result.=":".$Apache::response::foilgroup{$name.'.text'}."</input>\n";
}
} else {
my $temp=0;