--- loncom/interface/lonprintout.pm 2004/05/06 06:45:13 1.300 +++ loncom/interface/lonprintout.pm 2004/05/27 17:30:48 1.304 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.300 2004/05/06 06:45:13 albertel Exp $ +# $Id: lonprintout.pm,v 1.304 2004/05/27 17:30:48 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -421,13 +421,13 @@ sub page_format { } elsif($papersize eq '6') { if ($layout eq 'book') { if ($numberofcolumns == 1) { - $textwidth = '18 cm'; - $textheight = '28 cm'; + $textwidth = '176 mm'; + $textheight = '254 mm'; $oddoffset = '-0.57 in'; $evenoffset = '-0.57 in'; } elsif ($numberofcolumns == 2) { - $textwidth = '96 mm'; - $textheight = '2 cm'; + $textwidth = '91 mm'; + $textheight = '254 mm'; $oddoffset = '-0.57 in'; $evenoffset = '-0.57 in'; } @@ -676,9 +676,7 @@ sub get_textwidth { sub unsupported { my $currentURL=shift; my $result.='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}Printout of this type of document is currently not supported: '; - if ($currentURL=~/\/(aboutme|syllabus|bulletinboard)$/) { - $result.='\textbf{'.$1.'}'; - } elsif ($currentURL=~/\/ext\//) { + if ($currentURL=~/\/ext\//) { $result.=' \strut \\\\ THIS IS EXTERNAL RESOURCE WITH URL \strut \\\\ '.$currentURL.' '; } else { $result.=$currentURL; @@ -754,7 +752,6 @@ ENDPART } $selectionmade = 1; if ($currentURL=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) { - &Apache::lonnet::logthis("II AMAM IN A WRONG PLACE"); my $rndseed=time; my $texversion=''; if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') { @@ -877,7 +874,7 @@ ENDPART } if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} $result .= '\end{document}'; - } elsif ($currentURL=~/\/(smppg|syllabus)$/) { + } elsif ($currentURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { my %form; $form{'grade_target'}='tex'; $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); @@ -886,7 +883,6 @@ ENDPART my $texversion=&Apache::lonnet::ssi($currentURL,%form); $result .= $texversion; } else { - &Apache::lonnet::logthis("IIII AMAM IN A WRONG PLACE"); $result.=&unsupported($currentURL); } } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or @@ -975,6 +971,20 @@ ENDPART } $result .= $texversion; $flag_latex_header_remove = 'YES'; + } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + my %form; + $form{'grade_target'}='tex'; + $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth); + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; + if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;} + my $texversion=&Apache::lonnet::ssi($urlp,%form); + if ($flag_latex_header_remove ne 'NO') { + $texversion = &latex_header_footer_remove($texversion); + } else { + $texversion =~ s/\\end{document}/\\vskip 0\.5mm\\noindent\\makebox\[\\textwidth\/\$number_of_columns\]\[b\]\{\\hrulefill\}/; + } + $result .= $texversion; + $flag_latex_header_remove = 'YES'; } else { $texversion=&unsupported($urlp); if ($flag_latex_header_remove ne 'NO') { @@ -1093,7 +1103,7 @@ ENDPART if ($urlp =~ m|/home/([^/]+)/public_html|) { $urlp =~ s|/home/([^/]*)/public_html|/~$1|; } else { - $urlp =~ s|^/home/httpd/html||; + $urlp =~ s|^$Apache::lonnet::perlvar{'lonDocRoot'}||; } my $texversion=&Apache::lonnet::ssi($urlp,%form); if(($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || @@ -1221,6 +1231,7 @@ ENDPART &Apache::lonnet::appenv('cgi.'.$identifier.'.file' => $filename, 'cgi.'.$identifier.'.layout' => $laystyle, 'cgi.'.$identifier.'.numcol' => $numberofcolumns, + 'cgi.'.$identifier.'.paper' => $papersize, 'cgi.'.$identifier.'.selection' => $selectionmade, 'cgi.'.$identifier.'tableofcontents' => $helper->{'VARS'}->{'TABLE_CONTENTS'}, 'cgi.'.$identifier.'tableofindex' => $helper->{'VARS'}->{'TABLE_INDEX'}, @@ -1484,7 +1495,7 @@ sub printHelper { # "Delete everything after the last slash." $subdir =~ s|/[^/]+$||; if (not $helper->{VARS}->{'construction'}) { - $subdir='/home/httpd/html/res/'.$subdir; + $subdir=$Apache::lonnet::perlvar{'lonDocRoot'}.'/res/'.$subdir; } # "Remove all duplicate slashes." $subdir =~ s|/+|/|g; @@ -1683,7 +1694,7 @@ CHOOSE_ANON2 } # FIXME: That RE should come from a library somewhere. - if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $ENV{'request.role.adv'} and $subdir ne '/home/httpd/html/res/') { + if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $ENV{'request.role.adv'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') { push @{$printChoices}, ["".&mt('Problems')." ".&mt('from current subdirectory')." $subdir", 'problems_from_directory', 'CHOOSE_FROM_SUBDIR']; my $f = '$filename'; @@ -1956,9 +1967,12 @@ STATEHTML $result .= "\n"; $result .= "