--- loncom/homework/radiobuttonresponse.pm	2001/12/14 23:00:52	1.33
+++ loncom/homework/radiobuttonresponse.pm	2002/01/25 16:11:37	1.37
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.33 2001/12/14 23:00:52 albertel Exp $
+# $Id: radiobuttonresponse.pm,v 1.37 2002/01/25 16:11:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -30,7 +30,7 @@
 package Apache::radiobuttonresponse;
 use strict;
 
-sub BEGIN {
+BEGIN {
   &Apache::lonxml::register('Apache::radiobuttonresponse',('radiobuttonresponse'));
 }
 
@@ -45,12 +45,13 @@ sub start_radiobuttonresponse {
     $result=&Apache::response::meta_package_write('radiobuttonresponse');
   } elsif ($target eq 'edit' ) {
     $result.=&Apache::edit::start_table($token).
-      '<tr><td>'.&Apache::lonxml::description($token)."</td><td>Delete:".
+	'<tr><td>'.&Apache::lonxml::description($token)."</td><td>Delete:".
 	&Apache::edit::deletelist($target,$token)
-	  ."</td><td>&nbsp</td></tr><tr><td colspan=\"3\">\n";
-    $result.=&Apache::edit::text_arg('Max Number Of Foils:','max',$token,'4').
-      "</td></tr>";
-    $result.="<tr><td colspan=\"3\">\n";
+	."</td><td>&nbsp".&Apache::edit::end_row()
+        .&Apache::edit::start_spanning_row();
+
+    $result.=&Apache::edit::text_arg('Max Number Of Shown Foils:','max',$token,'4').
+	&Apache::edit::end_row().&Apache::edit::start_spanning_row()."\n";
   } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
 						 $safeeval,'max');
@@ -153,11 +154,13 @@ sub end_foilgroup {
 sub getfoilcounts {
   my ($parstack,$safeeval)=@_;
   my $max = &Apache::lonxml::get_param('max',$parstack,$safeeval,'-2');
-  my @names = @{ $Apache::response::foilgroup{'names'} };
+  my @names;
   my $truecnt=0;
   my $falsecnt=0;
   my $name;
-
+  if ( $Apache::response::foilgroup{'names'} ) {
+    @names= @{ $Apache::response::foilgroup{'names'} };
+  }
   foreach $name (@names) {
     if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
       $truecnt++;
@@ -195,7 +198,10 @@ sub whichfoils {
   my @truelist;
   my @falselist;
 
-  my @names = @{ $Apache::response::foilgroup{'names'} };
+  my @names;
+  if ( $Apache::response::foilgroup{'names'} ) {
+    @names= @{ $Apache::response::foilgroup{'names'} };
+  }
   foreach my $name (@names) {
     #result.="<br /><b>$name</b> is <i> $Apache::response::foilgroup{$name.'.value'} </i>";
     if ($Apache::response::foilgroup{$name.'.value'} eq 'true') {
@@ -256,7 +262,6 @@ sub displayfoils {
 
 sub displayanswers {
   my ($max,$answer)=@_;
-  my @names = @{ $Apache::response::foilgroup{'names'} };
   my @whichopt = &whichfoils($max,$answer);
   my $result=&Apache::response::answer_header('radiobuttonresponse');
   foreach my $name (@whichopt) {
@@ -275,7 +280,7 @@ sub start_conceptgroup {
   if ($target eq 'edit') {
     $result.=&Apache::edit::tag_start($target,$token);
     $result.=&Apache::edit::text_arg('Concept:','concept',$token,'50').
-      "</td></tr><tr><td colspan=\"3\">\n";
+	&Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {
     my $constructtag=&Apache::edit::get_new_args($token,$parstack,
 						 $safeeval,'concept');
@@ -321,6 +326,7 @@ sub start_foil {
     $result.=&Apache::edit::text_arg('Name:','name',$token);
     $result.=&Apache::edit::select_arg('Correct Option:','value',
 				       ['unused','true','false'],$token);
+    $result.=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
   } elsif ($target eq 'modified') {
      my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
 						  'value','name');