--- loncom/interface/lonprintout.pm 2024/11/10 20:41:18 1.702 +++ loncom/interface/lonprintout.pm 2024/11/11 00:43:39 1.703 @@ -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 get_course { } 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 @@ sub page_format_transformation { } ($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 @@ sub print_construction_sequence { # 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 @@ ENDPART 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 @@ ENDPART # &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 @@ ENDPART ($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 @@ ENDPART &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 @@ ENDPART # 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) {