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

foxr foxr at source.lon-capa.org
Mon Jun 11 07:07:34 EDT 2012


foxr		Mon Jun 11 11:07:34 2012 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  BZ 6499 - In printouts that may span sequendes ensure the assignment changes
  as the sequence/map changes.
  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.618 loncom/interface/lonprintout.pm:1.619
--- loncom/interface/lonprintout.pm:1.618	Thu Jun  7 10:27:26 2012
+++ loncom/interface/lonprintout.pm	Mon Jun 11 11:07:33 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.618 2012/06/07 10:27:26 foxr Exp $
+# $Id: lonprintout.pm,v 1.619 2012/06/11 11:07:33 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3018,7 +3018,6 @@
 							  $assignment, 
 							  $courseidinfo, 
 							  $name);
-
 		    if ($numberofcolumns eq '1') {
 			$result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{'.$header_text.'}} \vskip 5 mm ';
 		    } else {
@@ -3530,6 +3529,8 @@
     my $fullname = &get_name($username,$userdomain);
     my $namepostfix = "\\\\";	# Both anon and not anon should get the same vspace.
 
+
+
     #
     # Figure out if we need to filter the output by
     # the incomplete problems for that person
@@ -3568,6 +3569,10 @@
     #
 
     my $syllabus_first = 0;
+    my $current_assignment = "";
+    my $assignment;
+    my $courseidinfo = &get_course();
+
     foreach my $curresline (@{$master_seq})  {
 	if (defined $page_breaks{$curresline}) {
 	    if($i != 0) {
@@ -3576,9 +3581,12 @@
 	}
 	$current_output .= &get_extra_vspaces($helper, $curresline);
 	$i++;
+	my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
+
+	# See if we need to emit a new header:
+
 	if ( !($type eq 'problems' && 
 	       ($curresline!~ m/$LONCAPA::assess_page_re/)) ) {
-	    my ($map,$id,$res_url) = &Apache::lonnet::decode_symb($curresline);
 	    if ($print_incomplete && !&incomplete($username, $userdomain, $res_url)) {
 		next;
 	    }
@@ -3682,6 +3690,19 @@
 	    }
 	    $remove_latex_header = 'YES';
 	}
+	$assignment = &Apache::lonxml::latex_special_symbols(
+	    &Apache::lonnet::gettitle($map), 'header');
+	if (($assignment ne $current_assignment) && ($assignment ne "")) {
+	    my $header_line = &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
+						  $assignment, $courseidinfo, 
+						  $fullname, $usersection);
+	    my $header_start = ($columns_in_format == 1) ? '\lhead'
+		: '\fancyhead[LO]';
+	    $header_line = $header_start.'{'.$header_line.'}';
+	    $current_output = $current_output . $header_line;
+	    $current_assignment = $assignment;
+	}
+
 	if (&Apache::loncommon::connection_aborted($r)) { last; }
     }
     # If we are printing incomplete it's possible we don't have
@@ -3702,24 +3723,32 @@
     if ($syllabus_first) {
         $current_output =~ s/\\\\ Last updated:/Last updated:/
     }
-    my $courseidinfo = &get_course();
-    my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
-    my $header_line =
-	&format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
-			    $currentassignment, $courseidinfo, $fullname, $usersection);
-    my $header_start = ($columns_in_format == 1) ? '\lhead'
-	                                         : '\fancyhead[LO]';
-    $header_line = $header_start.'{'.$header_line.'}';
+    if (0) {
+	my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
+	my $header_line =
+	    &format_page_header($LaTeXwidth, $parmhash{'print_header_format'},
+				$currentassignment, $courseidinfo, $fullname, $usersection);
+	my $header_start = ($columns_in_format == 1) ? '\lhead'
+	    : '\fancyhead[LO]';
+	$header_line = $header_start.'{'.$header_line.'}';
+    }
     if ($current_output=~/\\documentclass/) {
-	$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$header_line$namepostfix}\\vskip 5 mm /;
+#	$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$header_line$namepostfix}\\vskip 5 mm /;
+	$current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent$namepostfix}\\vskip 5 mm /;
+
     } else {
 	my $blankpages = 
 	    '\clearpage\strut\clearpage'x$helper->{'VARS'}->{'EMPTY_PAGES'};
-	    
+	
+#	$current_output = '\strut\vspace*{-6 mm}\\newline'.
+#	    &copyright_line().' \newpage '.$blankpages.$end_of_student.
+#	    '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'.
+#	    $header_line.$namepostfix. '} \vskip 5 mm '.$current_output;
 	$current_output = '\strut\vspace*{-6 mm}\\newline'.
 	    &copyright_line().' \newpage '.$blankpages.$end_of_student.
-	    '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'.
-	    $header_line.$namepostfix.'} \vskip 5 mm '.$current_output;
+	    '\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent'
+	    .$namepostfix. '} \vskip 5 mm '.$current_output;
+
     }
     #
     #  Close the student bracketing.




More information about the LON-CAPA-cvs mailing list