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

raeburn raeburn at source.lon-capa.org
Sun Nov 10 19:43:39 EST 2024


raeburn		Mon Nov 11 00:43:39 2024 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - Ensure correct name/section in header on last page when printing for other 
    people on RHEL/Oracle/Alma/Rocky/CentOS-Stream 9 for 1-column or landscape 
    2 -column and a4 paper.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.702 loncom/interface/lonprintout.pm:1.703
--- loncom/interface/lonprintout.pm:1.702	Sun Nov 10 20:41:18 2024
+++ loncom/interface/lonprintout.pm	Mon Nov 11 00:43:39 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.702 2024/11/10 20:41:18 raeburn Exp $
+# $Id: lonprintout.pm,v 1.703 2024/11/11 00:43:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1985,7 +1985,8 @@
 }
 
 sub page_format_transformation {
-    my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist,$selectionmade) = @_;
+    my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,
+        $indexlist,$selectionmade,$mostrecent) = @_;
     my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin);
 
     if ($selectionmade eq '4') {
@@ -1999,8 +2000,12 @@
     }
     ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin) = &page_format($papersize,$layout,$numberofcolumns,$topmargin);
 
-
-    my $name = &get_name();
+    my $name;
+    if ($mostrecent ne '') {
+        $name = $mostrecent;
+    } else {
+        $name = &get_name();
+    }
     my $courseidinfo = &get_course();
     my $header_text  = $parmhash{'print_header_format'};
     $header_text     = &format_page_header($textwidth, $header_text, $assignment,
@@ -2768,6 +2773,7 @@
 #   6        Print selected problems from a folder.
 #   7        Print print selected resources from some scope.
 #   8        Print resources for selected students.
+#   9        Print for anonymous CODEs
 #
 #BZ 5209
 #   2        map_incomplete_problems_seq Print incomplete problems from the current
@@ -2860,7 +2866,7 @@
     my $LaTeXwidth=&recalcto_mm($textwidth);
     my @print_array=();
     my @student_names=();
-
+    my $lastprinted;
 
     #  Common settings for the %form hash:
     # In some cases these settings get overridden by specific cases, but the
@@ -3388,6 +3394,9 @@
 #	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname);
 	     &Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,'last student');
 	     $flag_latex_header_remove = 'YES';
+             if ($printed) {
+                 $lastprinted = $fullname;
+             }
 	     if (&Apache::loncommon::connection_aborted($r)) { last; }
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
@@ -3397,6 +3406,7 @@
 	      ($print_type eq 'resources_for_anon')     ||
               ($print_type eq 'select_sequences_problems_for_anon') ||
               ($print_type eq 'select_sequences_resources_for_anon')) {
+         $selectionmade = 9;
 	 my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
 	 my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
 	 my $num_todo=$helper->{'VARS'}->{'NUMBER_TO_PRINT_TOTAL'};
@@ -3510,6 +3520,9 @@
 				       &mt('last assignment').' '.$fullname);
 	     $flag_latex_header_remove = 'YES';
 	     $count++;
+             if ($printed) {
+                 $lastprinted = $fullname;
+             }
 	     if (&Apache::loncommon::connection_aborted($r)) { last; }
 	 }
 	 &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
@@ -3589,13 +3602,18 @@
     # Only post process if that has not been turned off e.g. by a raw latex resource.
 
     if ($do_postprocessing) {
+        my $mostrecent;
+        if ((($selectionmade == 5) || ($selectionmade == 8) || ($selectionmade == 9)) &&
+            (($numberofcolumns == 1) || ($laystyle eq 'album' && $papersize eq 'a4'))) {
+            $mostrecent = $lastprinted;
+        }
 	$result = &page_format_transformation($papersize,
 					      $laystyle,$numberofcolumns,
 					      $print_type,$result,
 					      $helper->{VARS}->{'assignment'},
 					      $helper->{'VARS'}->{'TABLE_CONTENTS'},
 					      $helper->{'VARS'}->{'TABLE_INDEX'},
-					      $selectionmade);
+					      $selectionmade,$mostrecent);
 	$result = &latex_corrections($number_of_columns,$result,$selectionmade,
 				     $helper->{'VARS'}->{'ANSWER_TYPE'});
 	#if ($numberofcolumns == 1) {




More information about the LON-CAPA-cvs mailing list