version 1.32, 2002/06/20 17:50:24
|
version 1.33, 2002/06/21 19:52:13
|
Line 110 ENDPART
|
Line 110 ENDPART
|
|
|
my $choice = $ENV{'form.choice'}; |
my $choice = $ENV{'form.choice'}; |
my $layout = $ENV{'form.layout'}; |
my $layout = $ENV{'form.layout'}; |
my $subdirtoprint = $ENV{'form.subdirect'}; |
|
my $laystyle = 'book'; |
my $laystyle = 'book'; |
my $result = ''; |
my $result = ''; |
my %mystyle; |
|
my $filename; |
|
|
|
if ($choice eq 'Standard LaTeX output for current document') { |
if ($choice eq 'Standard LaTeX output for current document') { |
my %moreenv; |
my %moreenv; |
my $currequest=$ENV{'request.filename'}; |
|
$moreenv{'form.grade_target'}='tex'; |
$moreenv{'form.grade_target'}='tex'; |
$moreenv{'request.filename'}=$ENV{'form.url'}; |
$moreenv{'request.filename'}=$ENV{'form.url'}; |
&Apache::lonnet::appenv(%moreenv); |
&Apache::lonnet::appenv(%moreenv); |
my $texversion=&Apache::lonnet::ssi($ENV{'form.url'}); |
my $texversion=&Apache::lonnet::ssi($ENV{'form.url'}); |
&Apache::lonnet::delenv('form.grade_target'); |
&Apache::lonnet::delenv('form.grade_target'); |
%moreenv = (); |
|
$moreenv{'request.filename'}=$currequest; |
|
&Apache::lonnet::appenv(%moreenv); |
|
$result .= $texversion; |
$result .= $texversion; |
$result = &additional_cleanup($result); |
$result = &additional_cleanup($result); |
|
if ($ENV{'form.url'}=~m/\.page\s*$/) {$result = &page_cleanup($result);} |
} elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') { |
} elsif ($choice eq 'Standard LaTeX output for the primary sequence' or $choice eq 'Standard LaTeX output for whole primary sequence') { |
#-- where is the primary sequence containing file? |
#-- where is the primary sequence containing file? |
my %moreenv; |
my %moreenv; |
Line 236 ENDPART
|
Line 230 ENDPART
|
|
|
|
|
} |
} |
#-- corrections for page layout |
|
$result =~ s/&\s*REMOVE\\\\/\\\\/g; |
|
$_ = $result; |
|
m/\\end{document}(\d*)$/; |
|
my $insert = '{'; |
|
for (my $id=1;$id<=$1;$id++) { $insert .='l'; } |
|
$insert .= '}'; |
|
$result =~ s/(\\begin{tabular})INSERT/$1$insert/g; |
|
#-- corrections for the different page formats |
#-- corrections for the different page formats |
if ($layout eq 'CBI') { |
if ($layout eq 'CBI') { |
$result =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{-40pt}\\setlength{\\evensidemargin}{-60pt}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{4\.4in}\\setlength{\\textheight}{6\.8in}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt} \\begin{document}/; |
$result =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{-40pt}\\setlength{\\evensidemargin}{-60pt}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{4\.4in}\\setlength{\\textheight}{6\.8in}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt} \\begin{document}/; |
Line 277 ENDPART
|
Line 263 ENDPART
|
$result =~ s/\b_+\b/\\makebox\[1 cm\]\[b\]{\\hrulefill}/g; |
$result =~ s/\b_+\b/\\makebox\[1 cm\]\[b\]{\\hrulefill}/g; |
#-- writing .tex file in prtspool |
#-- writing .tex file in prtspool |
my $temp_file; |
my $temp_file; |
$filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout_".time."_".rand(10000000).".tex"; |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
unless ($temp_file = Apache::File->new('>'.$filename)) { |
$r->log_error("Couldn't open $filename for output $!"); |
$r->log_error("Couldn't open $filename for output $!"); |
return SERVER_ERROR; |
return SERVER_ERROR; |
Line 302 sub additional_cleanup {
|
Line 288 sub additional_cleanup {
|
} |
} |
return $result; |
return $result; |
} |
} |
|
sub page_cleanup { |
|
my $result = shift; |
|
$_ = $result; |
|
m/\\end{document}(\d*)$/; |
|
my $insert = '{'; |
|
for (my $id=1;$id<=$1;$id++) { $insert .='l'; } |
|
$insert .= '}'; |
|
$result =~ s/(\\begin{tabular})INSERT/$1$insert/g; |
|
$result =~ s/&\s*REMOVE\\\\/\\end{tabular}\\\\\\begin{tabular}$insert/g; |
|
return $result; |
|
} |
|
|
sub content_map { |
sub content_map { |
#-- find a list of files to print |
#-- find a list of files to print |