--- loncom/homework/hint.pm	2003/05/09 20:44:54	1.42
+++ loncom/homework/hint.pm	2004/03/04 21:21:55	1.47
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # implements the tags that control the hints
 #
-# $Id: hint.pm,v 1.42 2003/05/09 20:44:54 albertel Exp $
+# $Id: hint.pm,v 1.47 2004/03/04 21:21:55 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,9 +48,15 @@ sub start_hintgroup {
 	my $numtries=$Apache::lonhomework::history{"resource.$id.tries"};
 	if ( $numtries eq '') { $numtries = 0; }
 	my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries");
+	if ($ENV{'request.state'} eq 'construct' &&
+	    defined($Apache::inputtags::params{'hinttries'})) {
+	    $hinttries=$Apache::inputtags::params{'hinttries'};
+	}
+
 	if ( $hinttries eq '') { $hinttries = 1; }
 	&Apache::lonxml::debug("found :$id:$numtries:$hinttries:");
-	if ( $numtries < $hinttries ) {
+	my $gradestatus=$Apache::lonhomework::history{"resource.$id.solved"};
+	if ( $numtries < $hinttries || $gradestatus =~ /^correct/) {
 	    &Apache::lonxml::get_all_text("/hintgroup",$parser);
 	}
 	&Apache::lonxml::startredirection;
@@ -102,7 +108,9 @@ sub start_numericalhint {
 	    $result.=&Apache::edit::text_arg('Format:','format',$token,4).
 		&Apache::loncommon::help_open_topic('Numerical_Response_Format');
 	} elsif ($token->[1] eq 'stringhint') {
-	    $result.=&Apache::edit::select_arg('Type:','type',['cs','ci','mc'],$token);
+	    $result.=&Apache::edit::select_arg('Type:','type',
+			    [['cs','Case Sensitive'],['ci','Case Insensitive'],
+			     ['mc','Case Insensitive, Any Order']],$token);
 	} elsif ($token->[1] eq 'formulahint') {
 	    $result.=&Apache::edit::text_arg('Sample Points:','samples',$token,40);
 	}
@@ -158,7 +166,16 @@ 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.="');";
+	my @answer=&Apache::lonxml::get_param_var('answer',$parstack,$safeeval);
+	&Apache::lonxml::debug('answer is'.join(':',@answer));
+	@{$safeeval->varglob('CAPARESPONSE_CHECK_LIST_answer')}=@answer;
+		
 	$result = &Apache::run::run($expression,$safeeval);
 	&Apache::lonxml::debug("$expression:result:$result:$Apache::lonxml::curdepth");
 	my ($awards) = split /:/ , $result;