[LON-CAPA-cvs] cvs: loncom /homework radiobuttonresponse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 25 Feb 2004 00:41:47 -0000


albertel		Tue Feb 24 19:41:47 2004 EDT

  Modified files:              
    /loncom/homework	radiobuttonresponse.pm 
  Log:
  - BUG#2754, surveys rendered incorrectly in answer mode
  
  
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.80 loncom/homework/radiobuttonresponse.pm:1.81
--- loncom/homework/radiobuttonresponse.pm:1.80	Wed Jan 14 17:08:22 2004
+++ loncom/homework/radiobuttonresponse.pm	Tue Feb 24 19:41:47 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.80 2004/01/14 22:08:22 www Exp $
+# $Id: radiobuttonresponse.pm,v 1.81 2004/02/25 00:41:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -160,11 +160,13 @@
       $target eq 'tex' || $target eq 'analyze') {
     my $style = $Apache::lonhomework::type;
     if ( $style eq 'survey'  && $target ne 'analyze') {
-      if ($target eq 'web' || $target eq 'answer' || $target eq 'tex') {
-	$result=&displayallfoils();
-      } elsif ( $target eq 'grade' ) {
-	$result=&storesurvey();
-      }
+	if ($target eq 'web' || $target eq 'tex') {
+	    $result=&displayallfoils();
+	} elsif ( $target eq 'answer' ) {
+	    $result=&displayallanswers();
+	} elsif ( $target eq 'grade' ) {
+	    $result=&storesurvey();
+	}
     } else {
       my $name;
       my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
@@ -431,6 +433,18 @@
   }
   if ($target ne 'tex') { $result.="<br />"; } else { $result.='\vskip 0 mm '; }
   return $result;
+}
+
+sub displayallanswers {
+    my @names = @{ $Apache::response::foilgroup{'names'} };
+  
+    my $result=&Apache::response::answer_header('radiobuttonresponse');
+    foreach my $name (@names) {
+	$result.=&Apache::response::answer_part('radiobuttonresponse',
+				$Apache::response::foilgroup{$name.'.value'});
+    }
+    $result.=&Apache::response::answer_footer('radiobuttonresponse');
+    return $result;
 }
 
 sub displayanswers {