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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 10 Jan 2005 11:46:03 -0000


foxr		Mon Jan 10 06:46:03 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  put sym names into hash in printing page breaks (Bug 2968)
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.350 loncom/interface/lonprintout.pm:1.351
--- loncom/interface/lonprintout.pm:1.350	Wed Jan  5 07:07:27 2005
+++ loncom/interface/lonprintout.pm	Mon Jan 10 06:46:03 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.350 2005/01/05 12:07:27 foxr Exp $
+# $Id: lonprintout.pm,v 1.351 2005/01/10 11:46:03 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1014,8 +1014,10 @@
 	my $flag_latex_header_remove = 'NO';
 	my $flag_page_in_sequence = 'NO';
 	my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
-	my @page_breaks = split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'};
-	my $page_index = 0;
+	my %page_breaks;
+	foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
+	    $page_breaks{$break} = 1;
+	}
 	my $prevassignment='';
 	&Apache::lonnet::delenv('form.counter');
 	&Apache::lonxml::init_counter();
@@ -1024,8 +1026,7 @@
 	    # Note due to document structure, not allowed to put \newpage
 	    # prior to the first resource
 
-	    if (($master_seq[$i] eq $page_breaks[$page_index])) {
-		$page_index++;
+	    if (defined $page_breaks{$master_seq[$i]}) {
 		if($i != 0) {
 		    $result.="\\newpage\n";
 		}
@@ -1425,23 +1426,20 @@
 	$namepostfix="\\\\Name: ";
 	$fullname = "CODE - ".$moreenv->{'CODE'};
     }
-    my @page_breaks = split /\|\|\|/,$helper->{'VARS'}->{'FINISHPAGE'};
-    my $page_index  = 0;
+    my %page_breaks;
+    foreach my $break (split /\|\|\|/,$helper->{'VARS'}->{'FINISHPAGE'}) {
+	$page_breaks{$break} = 1;
+    }
     my $i           = 0;
     #goes through all resources, checks if they are available for 
     #current student, and produces output   
     &Apache::lonnet::delenv('form.counter');
     &Apache::lonxml::init_counter();
     foreach my $curresline (@{$master_seq})  {
-	if ($curresline eq $page_breaks[$page_index]) {
-	    #
-	    #  Due to document structure, we cannot put a 
-	    #  page break prior to the first document
-	    #
+	if (defined $page_breaks{$curresline}) {
 	    if($i != 0) {
 		$current_output.= "\\newpage\n";
 	    }
-	    $page_index++;
 	}
 	$i++;
 	if ( !($type eq 'problems' &&