[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface loncommon.pm lonprintout.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 24 Sep 2004 20:32:02 -0000


albertel		Fri Sep 24 16:32:02 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm lonprintout.pm 
    /loncom/homework	grades.pm 
  Log:
  - when someone hits stop on the browser we need to stopp processing scantron records, and creating printouts, otherwise havoc ensues.
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.212 loncom/interface/loncommon.pm:1.213
--- loncom/interface/loncommon.pm:1.212	Wed Sep 15 02:11:40 2004
+++ loncom/interface/loncommon.pm	Fri Sep 24 16:32:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.212 2004/09/15 06:11:40 albertel Exp $
+# $Id: loncommon.pm,v 1.213 2004/09/24 20:32:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3699,6 +3699,14 @@
     return $iconname;
 } 
 
+sub connection_aborted {
+    my ($r)=@_;
+    $r->print(" ");$r->rflush();
+    my $c = $r->connection;
+    &Apache::lonnet::logthis("checking :".$c->aborted());
+    return $c->aborted();
+}
+
 =pod
 
 =back
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.330 loncom/interface/lonprintout.pm:1.331
--- loncom/interface/lonprintout.pm:1.330	Mon Sep 20 11:57:11 2004
+++ loncom/interface/lonprintout.pm	Fri Sep 24 16:32:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.330 2004/09/20 15:57:11 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.331 2004/09/24 20:32:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1043,6 +1043,7 @@
 		$result .= $texversion;
 		$flag_latex_header_remove = 'YES';   
 	    }	    
+	    if (&Apache::loncommon::connection_aborted($r)) { last; }
 	}
 	&Apache::lonnet::delenv('form.counter');
 	if ($flag_page_in_sequence eq 'YES') {$result =~ s/\\usepackage{calc}/\\usepackage{calc}\\usepackage{longtable}/;}	
@@ -1086,6 +1087,7 @@
 	     $student_names[$i].=$person.':'.$fullname.'_END_';
 	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
 	     $flag_latex_header_remove = 'YES';
+	     if (&Apache::loncommon::connection_aborted($r)) { last; }
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
 	 $result .= $print_array[0].'  \end{document}';
@@ -1135,6 +1137,7 @@
 				       &mt('last assignment').' '.$fullname);
 	     $flag_latex_header_remove = 'YES';
 	     $count++;
+	     if (&Apache::loncommon::connection_aborted($r)) { last; }
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
 	 $result .= $print_array[0].'  \end{document}';
@@ -1402,6 +1405,7 @@
 	    }
 	    $remove_latex_header = 'YES';
 	}
+	if (&Apache::loncommon::connection_aborted($r)) { last; }
     }
     my $courseidinfo = &get_course();
     if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.212 loncom/homework/grades.pm:1.213
--- loncom/homework/grades.pm:1.212	Thu Sep 16 13:47:23 2004
+++ loncom/homework/grades.pm	Fri Sep 24 16:32:02 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.212 2004/09/16 17:47:23 albertel Exp $
+# $Id: grades.pm,v 1.213 2004/09/24 20:32:02 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4647,9 +4647,10 @@
 		$form{'CODE'}=$scan_record->{'scantron.CODE'};
 	    }
 	    my $result=&Apache::lonnet::ssi($resource->src(),%form);
-
+	    if (&Apache::loncommon::connection_aborted($r)) { last; }
 	}
 	$completedstudents{$uname}={'line'=>$line};
+	if (&Apache::loncommon::connection_aborted($r)) { last; }
     } continue {
 	&Apache::lonnet::delenv('form.counter');
 	&Apache::lonnet::delenv('scantron\.');