--- loncom/interface/lonprintout.pm 2010/01/12 10:40:01 1.569 +++ loncom/interface/lonprintout.pm 2010/01/12 11:49:46 1.570 @@ -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 @@ sub get_page_breaks { # 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 @@ sub get_page_breaks { my %possible_resources; +my %extraspace_mm; my @extraspace; my $skips_loaded = 0; @@ -1811,6 +1814,9 @@ sub load_skips { $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 @@ sub get_extra_vspaces { 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 @@ sub get_extra_vspaces { # 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 @@ sub set_form_extraspace { } $env{'form.extraspace'} = $result; + $env{'form.extraspace_units'} = $helper->{'VARS'}->{'EXTRASPACE_UNITS'}; return $result; } @@ -2049,6 +2064,7 @@ ENDPART &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 @@ sub printHelper { &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 @@ sub printHelper { $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 @@ sub printHelper { $start_new_option = "