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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 09 Jun 2006 23:09:02 -0000


albertel		Fri Jun  9 19:09:02 2006 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - prevent grading of non-checkedout non-versioned tasks
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.163 loncom/homework/bridgetask.pm:1.164
--- loncom/homework/bridgetask.pm:1.163	Fri Jun  9 18:31:36 2006
+++ loncom/homework/bridgetask.pm	Fri Jun  9 19:09:01 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.163 2006/06/09 22:31:36 albertel Exp $
+# $Id: bridgetask.pm,v 1.164 2006/06/09 23:09:01 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -614,6 +614,10 @@
 		    $result.='<b>'.&mt("Stopped grading.").'</b>'.$back;
 		} elsif ($status_code eq 'cancel') {
 		    $result.='<b>'.&mt("Cancelled grading.").'</b>'.$back;
+		} elsif ($status_code eq 'never_versioned') {
+		    $result.='<b>'.
+			&mt("Requested user has never accessed the task.").
+			'</b>'.$back;
 		} elsif ($status_code eq 'lock_failed') {
 		    $result.='<b>'.&mt("Failed to lock the requested record.")
 			.'</b>'.$back;
@@ -726,8 +730,10 @@
 	if (!$queue) {
 	    $env{'form.queue'} = $queue = 'none';
 	    #not queued so doing either a re or pre grade
-	    #FIXME don't allow pregrade
-	    &Apache::lonxml::debug("not in queue no lock");
+	    my %status = &Apache::lonnet::restore($symb,$cid,$udom,$uname);
+	    if ($status{'resource.0.version'} < 1) {
+		return (undef,'never_versioned');
+	    }
 	    return ($gradingkey);
 	}