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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 26 Apr 2004 19:00:29 -0000


albertel		Mon Apr 26 15:00:29 2004 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - support putting multiple printouts into a single PDF
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.294 loncom/interface/lonprintout.pm:1.295
--- loncom/interface/lonprintout.pm:1.294	Mon Apr 26 14:21:26 2004
+++ loncom/interface/lonprintout.pm	Mon Apr 26 15:00:29 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.294 2004/04/26 18:21:26 albertel Exp $
+# $Id: lonprintout.pm,v 1.295 2004/04/26 19:00:29 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1009,6 +1009,10 @@
 	 my $old_name=$helper->{'VARS'}->{'REUSE_OLD_CODES'};
 	 my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
 	 my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'});
+	 my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'};
+	 if ($number_per_page eq '0' || $number_per_page eq 'all') {
+	     $number_per_page=$num_todo;
+	 }
 	 my $flag_latex_header_remove = 'NO'; 
 	 my %moreenv = ('textwidth' => &get_textwidth($helper,$LaTeXwidth));
 	 my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$num_todo,'inline');
@@ -1029,17 +1033,18 @@
 	     }
 	     @allcodes=keys(%allcodes);
 	 }
-	 my $i=0;
+	 my $count=0;
 	 foreach my $code (sort(@allcodes)) {
+	     my $file_num=int($count/$number_per_page);
 	     $moreenv{'CODE'}=&num_to_letters($code);
 	     my ($output,$fullname)=
 		 &print_resources($r,$helper,'anonymous',$type,\%moreenv,
 				  \@master_seq,$flag_latex_header_remove);
-	     $print_array[$i].=$output;
+	     $print_array[$file_num].=$output;
 	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,
 				       &mt('last assignment').' '.$fullname);
 	     $flag_latex_header_remove = 'YES';
-	     $i++;
+	     $count++;
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
 	 $result .= $print_array[0].'  \end{document}';