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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 09 May 2003 20:44:54 -0000


albertel		Fri May  9 16:44:54 2003 EDT

  Modified files:              
    /loncom/homework	hint.pm 
  Log:
  - <radiobuttonhint> supports multiple foils/concepts in single hint condition
  
  
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.41 loncom/homework/hint.pm:1.42
--- loncom/homework/hint.pm:1.41	Fri Apr 18 03:53:15 2003
+++ loncom/homework/hint.pm	Fri May  9 16:44:54 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # implements the tags that control the hints
 #
-# $Id: hint.pm,v 1.41 2003/04/18 07:53:15 albertel Exp $
+# $Id: hint.pm,v 1.42 2003/05/09 20:44:54 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -348,13 +348,25 @@
 	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;
+		    }
 		}
 	    }
 	}