--- loncom/interface/lonprintout.pm 2006/07/17 23:11:10 1.463
+++ loncom/interface/lonprintout.pm 2006/07/18 18:19:51 1.464
@@ -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.464 2006/07/18 18:19:51 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;
@@ -2979,7 +2979,7 @@ sub render {
my $var = $self->{'variable'};
if (defined $self->{ERROR_MSG}) {
- $result .= '
' . $self->{ERROR_MSG} . '
';
+ $result .= '
' . $self->{ERROR_MSG} . '
';
}
my $format = $helper->{VARS}->{$self->{'formatvar'}};
@@ -2998,78 +2998,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 +3088,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.