--- loncom/interface/lonprintout.pm 2006/07/17 10:17:40 1.460
+++ loncom/interface/lonprintout.pm 2006/07/20 03:47:09 1.466
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.460 2006/07/17 10:17:40 foxr Exp $
+# $Id: lonprintout.pm,v 1.466 2006/07/20 03:47:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -627,7 +627,7 @@ my %page_formats=
'2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm']
},
'album' => {
- '1' => [ '8.8 in', '6.8 in','-40 pt in', '-60 pt','1 cm'],
+ '1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.83 in','1 cm'],
'2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in']
},
},
@@ -683,12 +683,12 @@ my %page_formats=
},
'a4' => {
'book' => {
- '1' => ['176 mm','272 mm','-40 pt in','-60 pt','-0.5 in'],
- '2' => [ '91 mm','272 mm','-40 pt in','-60 pt','-0.5 in']
+ '1' => ['17.6 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in'],
+ '2' => [ '9.1 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in']
},
'album' => {
- '1' => ['8.5 in','7.7 in','-40 pt in','-60 pt','0 in'],
- '2' => ['3.9 in','7.7 in','-40 pt in','-60 pt','0 in']
+ '1' => ['8.5 in','7.7 in','-0.55 in','-0.83 in','0 in'],
+ '2' => ['3.9 in','7.7 in','-0.55 in','-0.83 in','0 in']
},
},
'a5' => {
@@ -1082,11 +1082,9 @@ sub print_construction_sequence {
#
my @order = @Apache::lonratedt::order;
my @resources = @Apache::lonratedt::resources;
- &Apache::lonnet::logthis("mapread for $currentURL returned: $errtext");
for (my $member=0;$member<=$#order;$member++) {
$resources[$order[$member]]=~/^([^:]*):([^:]*):/;
my $urlp=$2;
- &Apache::lonnet::logthis("Processing $urlp from sequence ($member)");
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
my $texversion='';
if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
@@ -1133,7 +1131,6 @@ sub print_construction_sequence {
$result.=$texversion;
} elsif ($urlp=~/\.(sequence|page)$/) {
- &Apache::lonnet::logthis("elsif just strutting stuff");
# header:
@@ -1337,15 +1334,11 @@ ENDPART
&& $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {
#printing content of sequence from the construction space
$currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
- &Apache::lonnet::logthis("Sequence from constrution space. ouptput is:");
- &Apache::lonnet::logthis($result);
$result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
$result .= &print_construction_sequence($currentURL, $helper, %form,
$LaTeXwidth);
- &Apache::lonnet::logthis("Back from construction space print");
$result .= '\end{document}';
if (!($result =~ /\\begin\{document\}/)) {
- &Apache::lonnet::logthis("inserting header");
$result = &print_latex_header() . $result;
}
# End construction space sequence.
@@ -1766,12 +1759,12 @@ ENDPART
$selectionmade,
$helper->{'VARS'}->{'ANSWER_TYPE'});
}
- if ($numberofcolumns == 1) {
+ #if ($numberofcolumns == 1) {
$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'} /;
- }
+ #}
#-- writing .tex file in prtspool
my $temp_file;
@@ -2071,7 +2064,7 @@ sub init_perm {
$perm{'pav'}=&Apache::lonnet::allowed('pav',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
}
- $perm{'pfo'}=&Apache::lonnet::allowed('pav',$env{'request.course.id'});
+ $perm{'pfo'}=&Apache::lonnet::allowed('pfo',$env{'request.course.id'});
if (!$perm{'pfo'}) {
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
@@ -2248,10 +2241,15 @@ sub printHelper {
$helper->declareVar('SEQUENCE');
+ # If we're in a sequence...
+ my $start_new_option;
+ if ($perm{'pav'}) {
+ $start_new_option =
+ "before selected').
+ "' variable='FINISHPAGE' />";
+ }
- # If we're in a sequence...
- my $startnew=&mt('Start new page
before selected');
if (($helper->{'VARS'}->{'construction'} ne '1') &&
$helper->{VARS}->{'postdata'} &&
@@ -2260,6 +2258,7 @@ sub printHelper {
push @{$printChoices}, [&mt('Selected Problems in folder [_1]',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
push @{$printChoices}, [&mt('Selected Resources in folder [_1]',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+
my $helperFragment = <
' . $self->{ERROR_MSG} . '
';
+ $result .= '
' . $self->{ERROR_MSG} . '
';
}
- my $width = 18;
my $format = $helper->{VARS}->{$self->{'formatvar'}};
- if (substr($format, 2, 1) ne '1') {
- $width = 9;
+
+ # Use format to get sensible defaults for the margins:
+
+
+ my ($laystyle, $cols, $papersize) = split(/\|/, $format);
+ ($papersize) = split(/ /, $papersize);
+
+
+ if ($laystyle eq 'L') {
+ $laystyle = 'album';
+ } else {
+ $laystyle = 'book';
+ }
+
+
+ my %size;
+ ($size{'width_and_units'},
+ $size{'height_and_units'},
+ $size{'margin_and_units'})=
+ &Apache::lonprintout::page_format($papersize, $laystyle, $cols);
+
+ foreach my $dimension ('width','height','margin') {
+ ($size{$dimension},$size{$dimension.'_unit'}) =
+ split(/ +/, $size{$dimension.'_and_units'},2);
+
+ foreach my $unit ('cm','in') {
+ $size{$dimension.'_options'} .= '
How should each column be formatted?
Width: | -+ | ||
Height: | -+ | ||
Left margin: | -+ |
Hint: Some instructors like to leave scratch space for the student by -making the width much smaller than the width of the page.
+ ELEMENTHTML @@ -3044,9 +3073,6 @@ sub preprocess { my $helper = Apache::lonhelper::getHelper(); my $format = $helper->{VARS}->{$self->{'formatvar'}}; -# if (substr($format, 2, 1) ne '1') { -# $helper->changeState($self->{NEXTSTATE}); -# } return 1; } @@ -3068,13 +3094,13 @@ sub postprocess { # /^-?[0-9]+(\.[0-9]*)?$/ -> optional minus, at least on digit, followed # by an optional period, followed by digits, ending the string - if ($width !~ /^-?[0-9]+(\.[0-9]*)?$/) { + if ($width !~ /^-?[0-9]*(\.[0-9]*)?$/) { $error .= "Invalid width; please type only a number.