[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm
foxr
foxr@source.lon-capa.org
Tue, 12 Jan 2010 11:49:46 -0000
foxr Tue Jan 12 11:49:46 2010 EDT
Modified files:
/loncom/interface lonprintout.pm
Log:
Add settable units to \vskip (BZ 6109).
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.569 loncom/interface/lonprintout.pm:1.570
--- loncom/interface/lonprintout.pm:1.569 Tue Jan 12 10:40:01 2010
+++ loncom/interface/lonprintout.pm Tue Jan 12 11:49:46 2010
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.569 2010/01/12 10:40:01 foxr Exp $
+# $Id: lonprintout.pm,v 1.570 2010/01/12 11:49:46 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1781,6 +1781,8 @@
# This is done as follows:
# POSSIBLE_RESOURCES has the list of possible resources.
# EXTRASPACE has the list of extra space values.
+# EXTRASPACE_UNITS is the set of resources for which the units are
+# mm. All others are 'in'.
#
# The resource is found in the POSSIBLE_RESOURCES to get the index
# of the EXTRASPACE value.
@@ -1792,6 +1794,7 @@
my %possible_resources;
+my %extraspace_mm;
my @extraspace;
my $skips_loaded = 0;
@@ -1811,6 +1814,9 @@
$possible_resources{$resource} = $i;
$i++;
}
+ foreach my $mm_resource (split(/\|\|\|/, $helper->{'VARS'}->{'EXTRASPACE_UNITS'})) {
+ $extraspace_mm{$mm_resource} = 1;
+ }
$skips_loaded = 1;
}
}
@@ -1829,8 +1835,14 @@
my $result = '';
if ($skip ne '') {
- $result = '\vskip '.$skip.' mm';
+ my $units = 'in';
+ if (defined($extraspace_mm{$resource})) {
+ $units = 'mm';
+ }
+ $result = '\vskip '.$skip.' '.$units;
}
+
+
return $result;
@@ -1848,10 +1860,12 @@
# Implicit input:
# $helper->{'VARS'}->{'EXTRASPACE'} - the spaces helper var has the text field
# value.
+# $helper->{'VARS'}->{'EXTRASPACE_UNITS'} - units for the skips (checkboxes).
# $helper->{'VARS'}->{'POSSIBLE_RESOURCES'} - has the list of resources. |||
# separated of course.
# Implicit outputs:
-# $env{'form.extrapsace'}
+# $env{'form.extraspace'}
+# $env{'form.extraspace_units'}
#
sub set_form_extraspace {
my ($helper) = @_;
@@ -1870,6 +1884,7 @@
}
$env{'form.extraspace'} = $result;
+ $env{'form.extraspace_units'} = $helper->{'VARS'}->{'EXTRASPACE_UNITS'};
return $result;
}
@@ -2049,6 +2064,7 @@
&Apache::loncommon::store_course_settings('print',
{'pagebreaks' => 'scalar',
'extraspace' => 'scalar',
+ 'extraspace_units' => 'scalar',
'lastprinttype' => 'scalar'});
my %page_breaks = &get_page_breaks($helper);
@@ -3177,6 +3193,7 @@
&Apache::loncommon::restore_course_settings('print',
{'pagebreaks' => 'scalar',
'extraspace' => 'scalar',
+ 'extraspace_units' => 'scalar',
'lastprinttype' => 'scalar'});
# This will persistently load in the data we want from the
@@ -3187,11 +3204,14 @@
$helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};
$helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};
+ $helper->{VARS}->{EXTRASPACE_UNITS} = $env{'form.extraspace_units'};
} else {
my $state = $env{"form.CURRENT_STATE"};
if ($state eq "START") {
$helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};
$helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};
+ $helper->{VARS}->{EXTRASPACE_UNITS} = $env{'form.extraspace_units'};
+
}
}
@@ -3311,10 +3331,14 @@
$start_new_option =
"<option text='".&mt('Start new page<br />before selected').
"' variable='FINISHPAGE' />".
- "<option text='".&mt('Extra space(mm)<br />before selected').
+ "<option text='".&mt('Extra space<br />before selected').
"' variable='EXTRASPACE' type='text' />" .
"<option " .
- "' variable='POSSIBLE_RESOURCES' type='hidden' />";
+ "' variable='POSSIBLE_RESOURCES' type='hidden' />".
+ "<option text='".&mt('Space units<br />check for mm').
+ "' variable='EXTRASPACE_UNITS' type='checkbox' />"
+ ;
+
}