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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 16 May 2006 21:21:34 -0000


albertel		Tue May 16 17:21:34 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm lonhomework.pm 
  Log:
  - non proctored access to slots now works with .tas
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.151 loncom/homework/bridgetask.pm:1.152
--- loncom/homework/bridgetask.pm:1.151	Tue May 16 02:43:42 2006
+++ loncom/homework/bridgetask.pm	Tue May 16 17:21:31 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.151 2006/05/16 06:43:42 albertel Exp $
+# $Id: bridgetask.pm,v 1.152 2006/05/16 21:21:31 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -95,7 +95,7 @@
 	my $version=
 	    $Apache::lonhomework::history{'resource.0.version'};
 	$version++;
-	
+	&Apache::lonxml::debug("Making version $version");
 	#clean out all current results
 	foreach my $key (keys(%Apache::lonhomework::history)) {
 	    if ($key=~/^resource\.0\./) {
@@ -108,6 +108,9 @@
 	if (defined($user) && defined($domain)) {
 	    $Apache::lonhomework::results{"resource.$version.0.checkedin"}=
 		$user.':'.$domain;
+	} else {
+	    $Apache::lonhomework::results{"resource.$version.0.checkedin"}=
+		$env{'user.name'}.':'.$env{'user.domain'};
 	}
 	if (defined($slot_name)) {
 	    $Apache::lonhomework::results{"resource.$version.0.checkedin.slot"}=
@@ -454,8 +457,11 @@
 	my ($version,$previous)=&get_version();
 	($status,$accessmsg,my $slot_name,$slot) = 
 	    &Apache::lonhomework::check_slot_access('0','Task');
-	if ($status eq 'CAN_ANSWER' && $version eq '' && $slot_name eq '') {
-	    &create_new_version('Task');
+	if ($status eq 'CAN_ANSWER' && $version eq '') {
+	    &create_new_version('Task',undef,undef,$slot_name);
+	    &add_to_queue('gradingqueue',{'type' => 'Task',
+					  'time' => time,
+					  'slot' => $slot_name});
 	    ($version,$previous)=&get_version();
 	}
 
@@ -528,7 +534,7 @@
 		       && defined($Apache::inputtags::slot_name)) {
 			my $result=
 			    &add_to_queue('gradingqueue',
-					  {'type' => 'task',
+					  {'type' => 'Task',
 					   'time' => time,
 					   'slot' => 
 					       $Apache::inputtags::slot_name});
@@ -916,11 +922,11 @@
 		my $useslots = &Apache::lonnet::EXT("resource.0.useslots");
 		if ($useslots =~ /^\s*no\s*$/i) {
 		    &add_to_queue('gradingqueue',
-				  {'type' => 'task',
+				  {'type' => 'Task',
 				   'time' => time});
 		} elsif (defined($Apache::inputtags::slot_name)) {
 		    &add_to_queue('gradingqueue',
-				  {'type' => 'task',
+				  {'type' => 'Task',
 				   'time' => time,
 				   'slot' => $Apache::inputtags::slot_name});
 		}
@@ -1777,8 +1783,6 @@
 	my $dim=&get_id($parstack,$safeeval);
 	my $instance=&get_instance($dim);
 	my $version=&get_version();
-	    use Data::Dumper;
-	    &Apache::lonxml::debug(Dumper(\%dimension));
 	if ($target eq 'web') {
 	    @Apache::scripttag::parser_env = @_;
 	    $result.=&Apache::scripttag::xmlparse($dimension{'intro'});
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.247 loncom/homework/lonhomework.pm:1.248
--- loncom/homework/lonhomework.pm:1.247	Mon May 15 15:29:17 2006
+++ loncom/homework/lonhomework.pm	Tue May 16 17:21:32 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Homework handler
 #
-# $Id: lonhomework.pm,v 1.247 2006/05/15 19:29:17 albertel Exp $
+# $Id: lonhomework.pm,v 1.248 2006/05/16 21:21:32 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -161,6 +161,8 @@
     my ($slot_name,$slot,$type)=@_;
     my @possible_proctors=split(",",$slot->{'proctor'});
     
+    return 1 if (!@possible_proctors);
+
     my $key;
     if ($type eq 'Task') {
 	my $version=$Apache::lonhomework::history{'resource.0.version'};