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

raeburn raeburn@source.lon-capa.org
Mon, 27 Sep 2010 20:59:41 -0000


raeburn		Mon Sep 27 20:59:41 2010 EDT

  Modified files:              
    /loncom/homework	bridgetask.pm 
  Log:
  - Bug 5921.
    - If gradingkey mismatch is detected, provide information about this to grader.
    - Do not get another submission to grade. 
  
  
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.253 loncom/homework/bridgetask.pm:1.254
--- loncom/homework/bridgetask.pm:1.253	Mon Sep 27 18:45:14 2010
+++ loncom/homework/bridgetask.pm	Mon Sep 27 20:59:41 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.253 2010/09/27 18:45:14 raeburn Exp $
+# $Id: bridgetask.pm,v 1.254 2010/09/27 20:59:41 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -784,6 +784,11 @@
 		    $result.='<b>'.&mt("Stopped grading.").'</b>'.$back;
 		} elsif ($status_code eq 'cancel') {
 		    $result.='<b>'.&mt("Cancelled grading.").'</b>'.$back;
+                } elsif ($status_code eq 'terminated') {
+                    $result.= '<b>'.&mt('Terminated grading').'</b><br />'.
+                              '<span class="LC_error">'.
+                              &mt('Grading for [_1] has not been saved because of a grading key mismatch.',
+                              '<tt>'.$env{'form.terminated'}.'</tt>').'</span><br />'.$back;
 		} elsif ($status_code eq 'never_versioned') {
 		    $result.='<b>'.
 			&mt("Requested user has never accessed the task.").
@@ -1004,6 +1009,8 @@
 		    return (undef,'stop');
 		} elsif ($env{'form.cancel'}) {
 		    return (undef,'cancel');
+                } elsif ($env{'form.terminated'}) {
+                    return (undef, 'terminated');
 		} elsif ($env{'form.next'}) {
 		    return (undef,'select_user');
 		}
@@ -1049,13 +1056,17 @@
 
     if ($env{'form.queuemode'} ne 'selected') {
 	# don't get something new from the queue if they hit the stop button
-    	if (!(($env{'form.cancel'} || $env{'form.stop'}) 
+    	if (!(($env{'form.cancel'} || $env{'form.stop'} || $env{'form.terminated'}) 
 	      && $target eq 'webgrade') 
 	    && !$env{'form.gradingaction'}) {
 	    &Apache::lonxml::debug("Getting anew $queue");
 	    return (&get_from_queue($queue));
 	} else {
-	    return (undef,'stop');
+            if ($env{'form.terminated'}) {
+                return (undef,'terminated');
+            } else {
+                return (undef,'stop');
+            }
 	}
     }
     return (undef,undef)
@@ -1320,9 +1331,9 @@
 		    $Apache::lonhomework::results{"resource.$version.0.solved"};
 	    }
 	    &minimize_storage();
-            my $canstore;
+            my ($canstore,$domain,$name);
             if ($env{'form.gradingkey'}) {
-                my ($symb,$courseid,$domain,$name) =
+                (my $symb,my $courseid,$domain,$name) =
                     &Apache::lonnet::whichuser();
                 my $todo=&unescape($env{'form.gradingkey'});
                 my ($keysymb,$uname,$udom)=&decode_queue_key($todo);
@@ -1363,8 +1374,7 @@
 	        }
             } else {
                 &check_queue_unlock($env{'form.queue'});
-                $result .= '<br /><div class="LC_error">'.
-                           &mt('Information extracted from the current gradingkey was for a different BT or user from those for which grading data are to be stored.').' '.&mt('No grading changes stored.').'</div><br />';
+                $env{'form.terminated'} = $name.':'.$domain;
             }
         }
 	if (exists($Apache::lonhomework::results{'INTERNAL_store'})) {