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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 13 Jun 2006 21:34:29 -0000


albertel		Tue Jun 13 17:34:29 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - output is in correct order
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.170 loncom/homework/bridgetask.pm:1.171
--- loncom/homework/bridgetask.pm:1.170	Tue Jun 13 16:48:05 2006
+++ loncom/homework/bridgetask.pm	Tue Jun 13 17:34:28 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.170 2006/06/13 20:48:05 albertel Exp $
+# $Id: bridgetask.pm,v 1.171 2006/06/13 21:34:28 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1916,12 +1916,12 @@
 	$previous_dim = $Apache::bridgetask::dimension[-1];
 	push(@{$Apache::bridgetask::dimension{$previous_dim}{'contains'}},
 	     $dim);
-	# FIXME need to add as a 'criteria' for nesting
 	$dimension{$previous_dim}{'criteria.'.$dim}='';
 	$dimension{$previous_dim}{'criteria.'.$dim.'.type'}='dimension';
 	$dimension{$previous_dim}{'criteria.'.$dim.'.mandatory'}=
 	    &Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
 	push(@{$dimension{$previous_dim}{'criterias'}},$dim);
+	$dimension{$dim}{'nested'}=$previous_dim;
     } else {
 	$Apache::bridgetask::top_dimensionlist{$dim}{'manadatory'}=
 	    &Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
@@ -2072,10 +2072,11 @@
 
 		    foreach my $id (@{$dimension{$dim}{$instance.'.criterias'}},
 				    @{$dimension{$dim}{'criterias'}}) {
-			# FIXME need to collect the dimension style criteria 
-			# and output them here.
 			my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
-			next if ($type eq 'dimension');
+			if ($type eq 'dimension') {
+			    $result.=$dimension{$id}{'result'};
+			    next;
+			}
 			my $status= &get_criteria('status', $version,$dim,$id);
 			my $comment=&get_criteria('comment',$version,$dim,$id);
 			my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
@@ -2105,6 +2106,10 @@
 		    }
 		}
 	    }
+	    if (exists($dimension{$dim}{'nested'})) {
+		$dimension{$dim}{'result'}=$result;
+		undef($result);
+	    }
 	} elsif ($target eq 'webgrade') {
 	    # in case of any side effects that we need
 	    @Apache::scripttag::parser_env = @_;
@@ -2115,9 +2120,12 @@
 	    &Apache::scripttag::xmlparse($dimension{$dim}{'questiontext'});
 	    foreach my $id (@{$dimension{$dim}{$instance.'.criterias'}},
 			    @{$dimension{$dim}{'criterias'}} ) {
-		# dimensional 'criteria' don't get assigned grades
 		my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
-		next if ($type eq 'dimension');
+		if ($type eq 'dimension') {
+		    # dimensional 'criteria' don't get assigned grades
+		    $result.=$dimension{$id}{'result'};
+		    next;
+		}
 
 		my $link=&link($id);
 		my $status= &get_criteria('status',$version,$dim,$id);
@@ -2144,6 +2152,10 @@
 		$result.=&grading_history($version,$dim,$id);
 		$last_link=$link;
 	    }
+	    if (exists($dimension{$dim}{'nested'})) {
+		$dimension{$dim}{'result'}=$result;
+		undef($result);
+	    }
 	} elsif ($target eq 'grade' && $env{'form.webgrade'}) {
 	    my $optional_passed=0;
 	    my $mandatory_failed=0;