--- loncom/homework/optionresponse.pm	2005/06/07 01:33:19	1.126
+++ loncom/homework/optionresponse.pm	2005/12/06 10:03:57	1.130
@@ -1,7 +1,7 @@
 # LearningOnline Network with CAPA
 # option list style responses
 #
-# $Id: optionresponse.pm,v 1.126 2005/06/07 01:33:19 albertel Exp $
+# $Id: optionresponse.pm,v 1.130 2005/12/06 10:03:57 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -295,17 +295,34 @@ sub whichfoils {
 }
 
 sub displayanswers {
-  my ($max,$randomize,@opt)=@_;
-  if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
-  my @names = @{ $Apache::response::foilgroup{'names'} };
-  my @whichopt = &whichfoils($max,$randomize);
-  my $result=&Apache::response::answer_header('optionresponse');
-  foreach my $name (@whichopt) {
-    $result.=&Apache::response::answer_part('optionresponse',
-		     $Apache::response::foilgroup{$name.'.value'})
-  }
-  $result.=&Apache::response::answer_footer('optionresponse');
-  return $result;
+    my ($max,$randomize,@opt)=@_;
+    if (!defined(@{ $Apache::response::foilgroup{'names'} })) {return;}
+    my @names = @{ $Apache::response::foilgroup{'names'} };
+    my @whichopt = &whichfoils($max,$randomize);
+    my $result;
+    if ($Apache::lonhomework::type eq 'exam') {
+	my $i = 0;
+	my %opt = map { ($_,$i++) } @opt;
+	
+	$i = 0;
+	my @alphabet = ('A'..'Z');
+	foreach my $name (@whichopt) {
+	    $result.=&Apache::response::answer_header('optionresponse',$i++);
+	    $result.=&Apache::response::answer_part('optionresponse',
+						    $alphabet[$opt{$Apache::response::foilgroup{$name.'.value'}}]);
+	    $result.=&Apache::response::answer_part('optionresponse',
+						    $Apache::response::foilgroup{$name.'.value'});
+	    $result.=&Apache::response::answer_footer('optionresponse');
+	}
+    } else {
+	$result=&Apache::response::answer_header('optionresponse');
+	foreach my $name (@whichopt) {
+	    $result.=&Apache::response::answer_part('optionresponse',
+						    $Apache::response::foilgroup{$name.'.value'});
+	}
+	$result.=&Apache::response::answer_footer('optionresponse');
+    }
+    return $result;
 }
 
 sub check_for_invalid {
@@ -360,7 +377,7 @@ sub displayfoils {
 		if ($text=~/^\s*$/) {
 		    $text=$value.$text;
 		} else {
-		    $text=$value.': '.$text;
+		    $text='<b>'.$value.':</b> '.$text;
 		}
 	    } else {
 		$text='&#149;'.$text;
@@ -632,8 +649,8 @@ sub end_foil {
     if ($value ne 'unused') {
       my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval);
       &Apache::lonxml::debug("Got a name of :$name:");
-      if (!$name) {
-	  &Apache::lonxml::error("Foils without names exist. This can cause problems to malfunction.");
+      if ($name eq "") {
+	  &Apache::lonxml::warning("Foils without names exist. This can cause problems to malfunction.");
 	  $name=$Apache::lonxml::curdepth;
       }
       &Apache::lonxml::debug("Using a name of :$name:");