--- loncom/interface/lonprintout.pm 2006/05/24 10:49:04 1.438
+++ loncom/interface/lonprintout.pm 2006/06/26 22:16:06 1.446
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.438 2006/05/24 10:49:04 foxr Exp $
+# $Id: lonprintout.pm,v 1.446 2006/06/26 22:16:06 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,6 +42,8 @@ use Apache::lonratedt;
use POSIX qw(strftime);
use Apache::lonlocal;
use Carp;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
my %perm;
@@ -700,14 +702,15 @@ sub get_name {
if (!defined($udom)) { $udom=$env{'user.domain'}; }
my $plainname=&Apache::loncommon::plainname($uname,$udom);
if ($plainname=~/^\s*$/) { $plainname=$uname.'@'.$udom; }
- $plainname=&Apache::lonxml::latex_special_symbols($plainname,'header');
+ # $plainname=&Apache::lonxml::latex_special_symbols($plainname,'header');
+ $plainname = &escape_LaTeX($plainname);
return $plainname;
}
sub get_course {
my $courseidinfo;
if (defined($env{'request.course.id'})) {
- $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header');
+ $courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header');
}
return $courseidinfo;
}
@@ -1670,14 +1673,12 @@ ENDPART
$selectionmade,
$helper->{'VARS'}->{'ANSWER_TYPE'});
}
- &Apache::lonnet::logthis("Resetting page e.g. height -> $helper->{'VARS'}->{'pagesize.height'}");
- &Apache::lonnet::logthis("Before: $result \n--------------------------\n");
+
$result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
$result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /;
$result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
$result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /;
- &Apache::lonnet::logthis("After: $result \n----------------------------------\n");
#-- writing .tex file in prtspool
my $temp_file;
@@ -1733,7 +1734,7 @@ ENDPART
my $URLback=''; #link to original document
if ($helper->{'VARS'}->{'construction'} ne '1') {
#prints published resource
- $URLback=&Apache::lonnet::escape('/adm/flip?postdata=return:');
+ $URLback=&escape('/adm/flip?postdata=return:');
} else {
#prints resource from the construction space
$URLback='/'.$helper->{'VARS'}->{'filename'};
@@ -1802,6 +1803,12 @@ sub print_resources {
$namepostfix="\\\\Name: ";
$fullname = "CODE - ".$moreenv->{'CODE'};
}
+ # Fullname may have special latex characters that need \ prefixing:
+ #
+# &Apache::lonnet::logthis("Prior to latex escape: $fullname");
+# $fullname = &escape_LaTeX($fullname);
+# &Apache::lonnet::logthis("After escape $fullname");
+
my $i = 0;
#goes through all resources, checks if they are available for
#current student, and produces output
@@ -1810,6 +1817,16 @@ sub print_resources {
my %page_breaks = &get_page_breaks($helper);
my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'});
my $columns_in_format = $format_array[1];
+ #
+ # end each student with a
+ # Special that allows the post processor to even out the page
+ # counts later. Nasty problem this... it would be really
+ # nice to put the special in as a postscript comment
+ # e.g. \special{ps:\ENDOFSTUDENTSTAMP} unfortunately,
+ # The special gets passed the \ and dvips puts it in the output file
+ # so we will just rely on prntout.pl to strip ENDOFSTUDENTSTAMP from the
+ # postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself.
+ #
foreach my $curresline (@{$master_seq}) {
if (defined $page_breaks{$curresline}) {
@@ -1905,6 +1922,10 @@ sub print_resources {
$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;
}
}
+ #
+ # Close the student bracketing.
+ #
+ $current_output .= "\n\\special{ps:ENDOFSTUDENTSTAMP}\n";
return ($current_output,$fullname, $printed);
}
@@ -2527,7 +2548,7 @@ CHOOSE_FROM_SUBDIR
CHOOSE_FROM_ANY_SEQUENCE
return \$res->is_sequence;
return $urlValue;
- return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },0,0);
+ return \$res->hasResource(\$res,sub { return !\$_[0]->is_sequence() },1,0);