--- loncom/homework/bridgetask.pm	2006/11/13 21:23:19	1.202
+++ loncom/homework/bridgetask.pm	2006/11/14 22:55:19	1.206
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.202 2006/11/13 21:23:19 albertel Exp $
+# $Id: bridgetask.pm,v 1.206 2006/11/14 22:55:19 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2104,8 +2104,10 @@ sub start_Dimension {
     }
     push(@Apache::bridgetask::dimension,$dim);
     &Apache::lonxml::startredirection();
-    &enable_dimension_parsing($dim);
-    return &internal_location($dim);
+    if (!&skip_dimension_parsing($dim)) {
+	&enable_dimension_parsing($dim);
+    }
+#    return &internal_location($dim);
 }
 
 sub start_QuestionText {
@@ -2193,7 +2195,6 @@ sub end_Dimension {
     my $instance=&get_instance($dim);
     my $version=&get_version();
     if ($target eq 'web') {
-	$result .= "\n".'<div class="LC_question">'."\n";
 	$result .= &nested_parse(\$dimension{$dim}{'intro'},[@_]);
 	my @instances = $instance;
 	if (&Apache::response::showallfoils()) {
@@ -2230,7 +2231,7 @@ sub end_Dimension {
 		my $question = ('sub' x $dimension{$dim}{'depth'}).'question';
 		$question =~ s/^(.)/uc($1)/e;
 		if ($dim_status eq 'pass') {
-		    $dim_info.='<h3>'.$question.' : you passed the above'.$mandatory.' question</h3>';
+		    $dim_info.='<h3>'.$question.' : you passed the above '.$mandatory.' question</h3>';
 		}
 		if ($dim_status eq 'fail') {
 		    $dim_info.='<h3>'.$question.' : you did not pass the above '.$mandatory.' question</h3>';
@@ -2247,13 +2248,20 @@ sub end_Dimension {
 				@{$dimension{$dim}{'criterias'}}) {
 		    my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
 		    if ($type eq 'dimension') {
-			$result.=$dimension{$id}{'result'};
-			next;
+			if (defined($dimension{$id}{'result'})) {
+			    $result.=$dimension{$id}{'result'};
+			    next;
+			} else {
+			    $dim_info .=
+				&nested_parse(\$dimension{$dim}{'criteria.'.$id},
+					      [@_],{'set_dim_id' => $id});
+			}
+		    } else {
+			my $criteria =
+			    &nested_parse(\$dimension{$dim}{'criteria.'.$id},
+					  [@_]);
+			$dim_info .= &layout_web_Criteria($dim,$id,$criteria);
 		    }
-		    my $criteria = 
-			&nested_parse(\$dimension{$dim}{'criteria.'.$id},
-				      [@_]);
-		    $dim_info .= &layout_web_Criteria($dim,$id,$criteria);
 		}
 		# puts the results at the end of the dimension
 		$result .= $dim_info;
@@ -2263,7 +2271,10 @@ sub end_Dimension {
 		# $result=~s/\Q$internal_location\E/$dim_info/;
 	    }
 	}
-	$result .= "\n</div>\n";
+	if ($result !~ /^\s*$/s) {
+	    $result = "\n".'<div class="LC_question">'.
+		"\n".$result."\n</div>\n";
+	}
     } elsif ($target eq 'webgrade') {
 	# in case of any side effects that we need
 	&nested_parse(\$dimension{$dim}{'intro'},[@_]);
@@ -2600,7 +2611,7 @@ sub start_Criteria {
 		$dimension{$dim}{'result'} .= &internal_location($id);
 	    } else {
 		&Apache::lonxml::debug(" not stashing $dim $id");
-		$result .= &internal_location($id);
+		#$result .= &internal_location($id);
 	    }
 	}
 	&Apache::lonxml::debug("Criteria $id with $dim");
@@ -2638,7 +2649,8 @@ sub layout_web_Criteria {
     $status_display=~s/^([a-z])/uc($1)/e;
     my $criteria_info.=
 	'<div class="LC_'.$status.' LC_criteria">'."\n\t".'<h4>'
-	.$mandatory.' Criteria</h4>'."\n\t".'<p class="LC_criteria_text>'."\n";
+	.$mandatory.' Criteria</h4>'."\n\t".'<p class="LC_criteria_text">'
+	."\n";
     $criteria =~ s/^\s*//s;
     $criteria =~ s/\s*$//s;
     $criteria_info.= $criteria;