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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 08 Apr 2003 02:47:42 -0000


albertel		Mon Apr  7 22:47:42 2003 EDT

  Modified files:              
    /loncom/homework	hint.pm 
  Log:
  - hide blank hints
  
  
Index: loncom/homework/hint.pm
diff -u loncom/homework/hint.pm:1.39 loncom/homework/hint.pm:1.40
--- loncom/homework/hint.pm:1.39	Mon Apr  7 22:21:13 2003
+++ loncom/homework/hint.pm	Mon Apr  7 22:47:42 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # implements the tags that control the hints
 #
-# $Id: hint.pm,v 1.39 2003/04/08 02:21:13 albertel Exp $
+# $Id: hint.pm,v 1.40 2003/04/08 02:47:42 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,18 +50,10 @@
 	my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries");
 	if ( $hinttries eq '') { $hinttries = 1; }
 	&Apache::lonxml::debug("found :$id:$numtries:$hinttries:");
-	if ($Apache::lonhomework::type ne 'exam') {
-	    if ( $numtries < $hinttries ) {
-		$skiptoend='1';
-	    } else {
-		$result='<table bgcolor="#dddddd"><tr><td>';
-	    }
-	} else {
-	    &Apache::lonxml::startredirection;
-	}
-	if ($skiptoend) {
+	if ( $numtries < $hinttries ) {
 	    &Apache::lonxml::get_all_text("/hintgroup",$parser);
 	}
+	&Apache::lonxml::startredirection;
     } elsif ($target eq 'tex') {
 	$result .= '\keephidden{';
     }
@@ -80,12 +72,11 @@
 	my $hinttries=&Apache::lonnet::EXT("resource.$id.hinttries");
 	if ( $hinttries eq '') { $hinttries = 1; }
 	&Apache::lonxml::debug("found :$id:$numtries:$hinttries:");
-	if ($Apache::lonhomework::type ne 'exam') {
-	    if ( $numtries >= $hinttries ) {
-		$result='</td></tr></table>';
-	    }
-	} else {
-	    &Apache::lonxml::endredirection;
+	my $hinttext=&Apache::lonxml::endredirection;
+	if ($Apache::lonhomework::type ne 'exam' &&
+	    $numtries >= $hinttries && $hinttext !~/^\s*$/) {
+	    $result='<table bgcolor="#dddddd"><tr><td>'.
+		$hinttext.'</td></tr></table>';
 	}
     } elsif ($target eq 'edit') {
 	$result.=&Apache::edit::end_table();