--- loncom/interface/lonprintout.pm 2006/07/17 23:11:10 1.463
+++ 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.463 2006/07/17 23:11:10 foxr Exp $
+# $Id: lonprintout.pm,v 1.466 2006/07/20 03:47:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1759,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;
@@ -2064,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'});
@@ -2241,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'} &&
@@ -2253,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 $format = $helper->{VARS}->{$self->{'formatvar'}};
@@ -2998,78 +3004,63 @@ sub render {
}
-
- my ($width_and_units,
- $height_and_units,
- $margin_and_units) =
- &Apache::lonprintout::page_format($papersize, $laystyle, $cols);
-
-
- my ($width, $wunits) = split(/ /, $width_and_units);
- my ($height, $hunits) = split(/ /, $height_and_units);
- my ($margin, $munits) = split(/ /, $margin_and_units);
-
-
-
- # This code is a bit ugly and not very scalable with additional units.
- # but I'm not sure my poor perlmanship knows a better way yet RF
-
- my ($wuoptions, $huoptions, $muoptions);
+ my %size;
+ ($size{'width_and_units'},
+ $size{'height_and_units'},
+ $size{'margin_and_units'})=
+ &Apache::lonprintout::page_format($papersize, $laystyle, $cols);
- if ($wunits eq 'cm') {
- $wuoptions = '';
- } else {
- $wuoptions = '';
- }
- if ($hunits eq 'cm') {
- $huoptions = '';
- } else {
- $huoptions = '';
- }
- if ($munits eq 'cm') {
- $muoptions = '';
- } else {
- $muoptions = '';
+ 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 @@ -3103,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.