--- loncom/homework/bridgetask.pm	2006/11/07 19:43:37	1.194
+++ loncom/homework/bridgetask.pm	2006/11/07 21:31:22	1.196
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.194 2006/11/07 19:43:37 albertel Exp $
+# $Id: bridgetask.pm,v 1.196 2006/11/07 21:31:22 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2097,8 +2097,10 @@ sub start_Dimension {
 	    &Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
 	push(@{$dimension{$previous_dim}{'criterias'}},$dim);
 	$dimension{$dim}{'nested'}=$previous_dim;
+	$dimension{$dim}{'depth'} = 1 + $dimension{$previous_dim}{'depth'};
 	&Apache::lonxml::debug("adding $dim as criteria to $previous_dim");
     } else {
+	$dimension{$top}{'depth'}=0;
 	$dimension{$top}{'criteria.'.$dim.'.type'}='dimension';
 	$dimension{$top}{'criteria.'.$dim.'.mandatory'}=
 	    &Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
@@ -2227,11 +2229,14 @@ sub end_Dimension {
 		    $mandatory='Optional';
 		}
 		my $dim_info="<div class='LC_$dim_status LC_question_grade'>\n";
+		my $question = ('sub' x $dimension{$dim}{'depth'}).'question';
+		my $ucquestion = $question;
+		$ucquestion =~ s/^(.)/uc($1)/e;
 		if ($dim_status eq 'pass') {
-		    $dim_info.='<h3>Question : you passed this '.$mandatory.' question</h3>';
+		    $dim_info.='<h3>'.$ucquestion.' : you passed this '.$mandatory.' '.$question.'</h3>';
 		}
 		if ($dim_status eq 'fail') {
-		    $dim_info.='<h3>Question : you did not pass this '.$mandatory.' question</h3>';
+		    $dim_info.='<h3>'.$ucquestion.' : you did not pass this '.$mandatory.' '.$question.'</h3>';
 		}
 		my $man_count=0;
 		my $man_passed=0;
@@ -2284,7 +2289,7 @@ sub end_Dimension {
 	$result.=
 	    &nested_parse(\$dimension{$dim}{'questiontext'},[@_],
 			  {'set_dim_id'          => undef,
-			   'delayed_dim_results' => 0});
+			   'delayed_dim_results' => 1});
 	foreach my $id (@{$dimension{$dim}{$instance.'.criterias'}},
 			@{$dimension{$dim}{'criterias'}} ) {
 	    my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
@@ -2518,7 +2523,13 @@ sub start_Criteria {
 	my $dim = &get_dim_id();
 	my $id=&get_id($parstack,$safeeval);
 	if ($target eq 'web' || $target eq 'webgrade') {
-	    $result .= &internal_location($id);
+	    if ($target eq 'webgrade' && $dim ne 'top') {
+		&Apache::lonxml::debug(" for $dim $id stashing results into $dim ");
+		$dimension{$dim}{'result'} .= &internal_location($id);
+	    } else {
+		&Apache::lonxml::debug(" not stashing $dim $id");
+		$result .= &internal_location($id);
+	    }
 	}
 	&Apache::lonxml::debug("Criteria $id with $dim");
 	if (&Apache::londefdef::is_inside_of($tagstack,'Instance')) {