--- loncom/homework/bridgetask.pm	2006/06/20 03:38:58	1.175
+++ loncom/homework/bridgetask.pm	2006/06/28 21:46:53	1.180
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.175 2006/06/20 03:38:58 albertel Exp $
+# $Id: bridgetask.pm,v 1.180 2006/06/28 21:46:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -50,7 +50,7 @@ my %dimension;
 sub initialize_bridgetask {
     # id of current Dimension, 0 means that no dimension is current 
     # (inside <Task> only)
-    %Apache::bridgetask::dimension=();
+    @Apache::bridgetask::dimension=();
     # list of all Dimension ids seen
     %Apache::bridgetask::top_dimensionlist=();
     # list of all current Instance ids
@@ -83,12 +83,7 @@ sub proctor_check_auth {
 		}
 	    }
 	    if ($authenticated) {
-		my $useslots = &Apache::lonnet::EXT("resource.0.useslots");
-		if ( $useslots eq 'map_map') {
-		    &checkin_resource($user,$domain,$slot_name);
-		} else {
-		    &create_new_version($type,$user,$domain,$slot_name);
-		}
+		&check_in($type,$user,$domain,$slot_name);
 		return 1;
 	    }
 	}
@@ -149,7 +144,7 @@ sub create_new_version {
 	#setup new version and who did it
        	$Apache::lonhomework::results{'resource.0.version'}=$version;
 	$id = "$version.0";
-	if (!defined($user) || defined($domain)) {
+	if (!defined($user) || !defined($domain)) {
 	    $user = $env{'user.name'};
 	    $domain = $env{'user.domain'};
 	}
@@ -377,6 +372,8 @@ sub nested_parse {
     @Apache::scripttag::parser_env = @old_env;
     if ($args->{'delayed_dim_results'}) {
 	my $dim = &get_dim_id();
+	&Apache::lonxml::debug(" tossing out $result ");
+	&Apache::lonxml::debug(" usining out $dim 's  ". $dimension{$dim}{'result'});
 	return $dimension{$dim}{'result'};
     }
     return $result;
@@ -535,8 +532,8 @@ sub start_Task {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
 
     my ($status,$accessmsg,$slot);
+    &Apache::structuretags::init_problem_globals('Task');
     if ($target ne 'webgrade') {
-	&Apache::structuretags::init_problem_globals('Task');
 	&Apache::structuretags::initialize_storage();
 	&Apache::lonhomework::showhash(%Apache::lonhomework::history);
 	if ($env{'request.state'} eq 'construct') {
@@ -599,7 +596,7 @@ sub start_Task {
 	($status,$accessmsg,my $slot_name,$slot) = 
 	    &Apache::lonhomework::check_slot_access('0','Task');
 	if ($status eq 'CAN_ANSWER' && $version eq '') {
-	    # CAN_ANSWR mode, and no current version, unproctored access
+	    # CAN_ANSWER mode, and no current version, unproctored access
 	    # thus self-checkedin
 	    &check_in('Task',undef,undef,$slot_name);
 	    &add_to_queue('gradingqueue',{'type' => 'Task',
@@ -1226,6 +1223,7 @@ DONEBUTTON
 	$result.=&Apache::response::meta_stores_write('status','string',
 						      'Bridge Task Status');
     }
+    &Apache::structuretags::reset_problem_globals('Task');
     undef($Apache::lonhomework::parsing_a_task);
     return $result;
 }
@@ -2225,8 +2223,8 @@ sub get_criteria {
 	    &nested_parse(\$dimension{$dim}{$instance.'.text'},[@_]);
 	    $result.=
 		&nested_parse(\$dimension{$dim}{'questiontext'},[@_],
-			      {'set_dim_id'        => undef,
-			       'delay_dim_results' => 1});
+			      {'set_dim_id'          => undef,
+			       'delayed_dim_results' => 1});
 	    foreach my $id (@{$dimension{$dim}{$instance.'.criterias'}},
 			    @{$dimension{$dim}{'criterias'}} ) {
 		my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
@@ -2263,7 +2261,7 @@ sub get_criteria {
 		$result.=&grading_history($version,$dim,$id);
 		$last_link=$link;
 	    }
-	    if (&delay_result()) {
+	    if (&nest()) {
 		&Apache::lonxml::debug(" for $dim stashing results into ".$dimension{$dim}{'nested'});
 		$dimension{$dimension{$dim}{'nested'}}{'result'}.=$result;
 		undef($result);