--- loncom/interface/lonprintout.pm 2006/01/26 23:15:54 1.416 +++ loncom/interface/lonprintout.pm 2006/01/27 00:06:52 1.417 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.416 2006/01/26 23:15:54 foxr Exp $ +# $Id: lonprintout.pm,v 1.417 2006/01/27 00:06:52 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -687,7 +687,7 @@ sub page_format_transformation { my $topmargintoinsert = ''; if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';} my $fancypagestatement=''; -# &Apache::lonnet::logthis("1: columns = $numberofcolumns"); + &Apache::lonnet::logthis("1: columns = $numberofcolumns"); if ($numberofcolumns eq '2') { $fancypagestatement="\\fancyhead{}\\fancyhead[LO]{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}"; } else { @@ -907,7 +907,10 @@ sub unsupported { } else { $result.=$currentURL; } - $result.= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill} \end{document}'; + # TODO: /2 used to be /$number_of_columns which we don'thave + # access to and therefore now causes latex to fail. + # need to figure out exactly what we should divide by. + $result.= '\vskip 0.5mm\noindent\makebox[\textwidth/2][b]{\hrulefill} \end{document}'; return $result; } @@ -964,12 +967,12 @@ sub recently_generated { # A reference to a page break hash. # # -#use Data::Dumper; -#sub dump_helper_vars { -# my ($helper) = @_; -# my $helpervars = Dumper($helper->{'VARS'}); -# &Apache::lonnet::logthis("Dump of helper vars:\n $helpervars"); -#} +use Data::Dumper; +sub dump_helper_vars { + my ($helper) = @_; + my $helpervars = Dumper($helper->{'VARS'}); + &Apache::lonnet::logthis("Dump of helper vars:\n $helpervars"); +} sub get_page_breaks { my ($helper) = @_; @@ -1037,6 +1040,7 @@ ENDPART my %page_breaks = &get_page_breaks($helper); my $format_from_helper = $helper->{'VARS'}->{'FORMAT'}; + &dump_helper_vars($helper); my ($result,$selectionmade) = ('',''); my $number_of_columns = 1; #used only for pages to determine the width of the cell my @temporary_array=split /\|/,$format_from_helper; @@ -1329,8 +1333,8 @@ ENDPART my $courseidinfo = &get_course(); if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } $prevassignment=$assignment; -# &Apache::lonnet::logthis("2: Number of columns: $number_of_columns"); - if ($number_of_columns eq '1') { + &Apache::lonnet::logthis("2: Number of columns: $numberofcolumns"); + if ($numberofcolumns eq '1') { $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; } else { $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; @@ -1745,6 +1749,8 @@ sub print_resources { &Apache::lonxml::init_counter(); &Apache::lonxml::store_counter(); my %page_breaks = &get_page_breaks($helper); + my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'}); + my $columns_in_format = $format_array[1]; foreach my $curresline (@{$master_seq}) { if (defined $page_breaks{$curresline}) { @@ -1824,8 +1830,8 @@ sub print_resources { if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); if ($current_output=~/\\documentclass/) { -# &Apache::lonnet::logthis("3: Number of columns = $number_of_columns"); - if ($number_of_columns == 1) { + &Apache::lonnet::logthis("3: Number of columns = $columns_in_format"); + if ($columns_in_format == 1) { $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; } else { $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; @@ -1834,8 +1840,8 @@ sub print_resources { } else { my $blankpages = ''; for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';} -# &Apache::lonnet::logthis("4: Number of columns = $number_of_columns"); - if ($number_of_columns == 1) { + &Apache::lonnet::logthis("4: Number of columns = $columns_in_format"); + if ($columns_in_format == 1) { $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output; } else { $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output;