--- loncom/homework/hint.pm	2003/04/08 02:47:42	1.40
+++ loncom/homework/hint.pm	2003/06/20 04:16:00	1.43
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # implements the tags that control the hints
 #
-# $Id: hint.pm,v 1.40 2003/04/08 02:47:42 albertel Exp $
+# $Id: hint.pm,v 1.43 2003/06/20 04:16:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,7 +74,7 @@ sub end_hintgroup {
 	&Apache::lonxml::debug("found :$id:$numtries:$hinttries:");
 	my $hinttext=&Apache::lonxml::endredirection;
 	if ($Apache::lonhomework::type ne 'exam' &&
-	    $numtries >= $hinttries && $hinttext !~/^\s*$/) {
+	    $numtries >= $hinttries && $hinttext =~/\S/) {
 	    $result='<table bgcolor="#dddddd"><tr><td>'.
 		$hinttext.'</td></tr></table>';
 	}
@@ -158,6 +158,11 @@ sub end_numericalhint {
 	    $expression.= ';my $'. #'
 		$key.'="'.$Apache::inputtags::params{$key}.'"';
 	}
+	if ($$tagstack[-1] eq 'formulahint') {
+	    $expression.=';my $type="fml";';
+	} elsif ($$tagstack[-1] eq 'numericalhint') {
+	    $expression.=';my $type="float";';
+	}
 	$expression.="');";
 	$result = &Apache::run::run($expression,$safeeval);
 	&Apache::lonxml::debug("$expression:result:$result:$Apache::lonxml::curdepth");
@@ -348,13 +353,25 @@ sub end_radiobuttonhint {
 	my $response = $Apache::lonhomework::history{
 			    "resource.$part_id.submission"};
 	($response)=&Apache::lonnet::str2hash($response);
-	if ($answer[0] eq 'foil' && $response eq $answer[1]) {
-	    push (@Apache::hint::which,$name);
+	&Apache::lonxml::debug("response is $response");
+	
+	if ($answer[0] eq 'foil') {
+	    shift(@answer);
+	    foreach my $answer (@answer) {
+		if ($response eq $answer) {
+		    push (@Apache::hint::which,$name);
+		    last;
+		}
+	    }
 	} elsif ($answer[0] eq 'concept') {
-	    if (ref($Apache::hint::radiobutton{"$part_id.concept.".$answer[1]})) {
-		my @names=@{ $Apache::hint::radiobutton{"$part_id.concept.".$answer[1]} };
-		if (grep(/^\Q$response\E$/,@names)) {
-		    push(@Apache::hint::which,$name);
+	    shift(@answer);
+	    foreach my $answer (@answer) {
+		if (ref($Apache::hint::radiobutton{"$part_id.concept.".$answer})) {
+		    my @names=@{ $Apache::hint::radiobutton{"$part_id.concept.".$answer} };
+		    if (grep(/^\Q$response\E$/,@names)) {
+			push(@Apache::hint::which,$name);
+			last;
+		    }
 		}
 	    }
 	}