Diff for /loncom/interface/lonprintout.pm between versions 1.569 and 1.570

version 1.569, 2010/01/12 10:40:01 version 1.570, 2010/01/12 11:49:46
Line 1781  sub get_page_breaks  { Line 1781  sub get_page_breaks  {
 #   This is done as follows:  #   This is done as follows:
 #    POSSIBLE_RESOURCES has the list of possible resources.  #    POSSIBLE_RESOURCES has the list of possible resources.
 #    EXTRASPACE         has the list of extra space values.  #    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  #    The resource is found in the POSSIBLE_RESOURCES to get the index
 #    of the EXTRASPACE value.  #    of the EXTRASPACE value.
Line 1792  sub get_page_breaks  { Line 1794  sub get_page_breaks  {
   
   
 my %possible_resources;  my %possible_resources;
   my %extraspace_mm;
 my @extraspace;  my @extraspace;
 my $skips_loaded       = 0;  my $skips_loaded       = 0;
   
Line 1811  sub load_skips { Line 1814  sub load_skips {
     $possible_resources{$resource} = $i;      $possible_resources{$resource} = $i;
     $i++;      $i++;
  }   }
    foreach my $mm_resource (split(/\|\|\|/, $helper->{'VARS'}->{'EXTRASPACE_UNITS'})) {
       $extraspace_mm{$mm_resource} = 1;
    }
  $skips_loaded = 1;   $skips_loaded = 1;
     }      }
 }  }
Line 1829  sub get_extra_vspaces { Line 1835  sub get_extra_vspaces {
   
     my $result = '';      my $result = '';
     if ($skip ne '') {      if ($skip ne '') {
  $result = '\vskip '.$skip.' mm';   my $units = 'in';
    if (defined($extraspace_mm{$resource})) {
       $units = 'mm';
    }
    $result = '\vskip '.$skip.' '.$units;
     }      }
   
   
     return $result;      return $result;
   
   
Line 1848  sub get_extra_vspaces { Line 1860  sub get_extra_vspaces {
 #  Implicit input:  #  Implicit input:
 #     $helper->{'VARS'}->{'EXTRASPACE'}  - the spaces helper var has the text field  #     $helper->{'VARS'}->{'EXTRASPACE'}  - the spaces helper var has the text field
 #                                          value.  #                                          value.
   #     $helper->{'VARS'}->{'EXTRASPACE_UNITS'} - units for the skips (checkboxes).
 #     $helper->{'VARS'}->{'POSSIBLE_RESOURCES'}  - has the list of resources. |||  #     $helper->{'VARS'}->{'POSSIBLE_RESOURCES'}  - has the list of resources. |||
 #                                          separated of course.  #                                          separated of course.
 #  Implicit outputs:  #  Implicit outputs:
 #     $env{'form.extrapsace'}  #     $env{'form.extraspace'}
   #     $env{'form.extraspace_units'}
 #  #
 sub set_form_extraspace {  sub set_form_extraspace {
     my ($helper) = @_;      my ($helper) = @_;
Line 1870  sub set_form_extraspace { Line 1884  sub set_form_extraspace {
     }      }
   
     $env{'form.extraspace'}  = $result;      $env{'form.extraspace'}  = $result;
       $env{'form.extraspace_units'} = $helper->{'VARS'}->{'EXTRASPACE_UNITS'};
     return $result;      return $result;
           
 }  }
Line 2049  ENDPART Line 2064  ENDPART
     &Apache::loncommon::store_course_settings('print',      &Apache::loncommon::store_course_settings('print',
       {'pagebreaks'    => 'scalar',        {'pagebreaks'    => 'scalar',
        'extraspace'    => 'scalar',         'extraspace'    => 'scalar',
          'extraspace_units' => 'scalar',
        'lastprinttype' => 'scalar'});         'lastprinttype' => 'scalar'});
     my %page_breaks  = &get_page_breaks($helper);      my %page_breaks  = &get_page_breaks($helper);
   
Line 3177  sub printHelper { Line 3193  sub printHelper {
     &Apache::loncommon::restore_course_settings('print',      &Apache::loncommon::restore_course_settings('print',
  {'pagebreaks'  => 'scalar',   {'pagebreaks'  => 'scalar',
  'extraspace'  => 'scalar',   'extraspace'  => 'scalar',
    'extraspace_units' => 'scalar',
          'lastprinttype' => 'scalar'});           'lastprinttype' => 'scalar'});
           
     # This will persistently load in the data we want from the      # This will persistently load in the data we want from the
Line 3187  sub printHelper { Line 3204  sub printHelper {
           
     $helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};      $helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};
     $helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};      $helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};
       $helper->{VARS}->{EXTRASPACE_UNITS} = $env{'form.extraspace_units'};
  } else {   } else {
     my $state = $env{"form.CURRENT_STATE"};      my $state = $env{"form.CURRENT_STATE"};
     if ($state eq "START") {      if ($state eq "START") {
  $helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};   $helper->{VARS}->{FINISHPAGE} = $env{'form.pagebreaks'};
  $helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};   $helper->{VARS}->{EXTRASPACE} = $env{'form.extraspace'};
    $helper->{VARS}->{EXTRASPACE_UNITS} = $env{'form.extraspace_units'};
   
     }      }
  }   }
   
Line 3311  sub printHelper { Line 3331  sub printHelper {
  $start_new_option =    $start_new_option = 
     "<option text='".&mt('Start new page<br />before selected').      "<option text='".&mt('Start new page<br />before selected').
     "' variable='FINISHPAGE' />".      "' variable='FINISHPAGE' />".
     "<option text='".&mt('Extra space(mm)<br />before selected').      "<option text='".&mt('Extra space<br />before selected').
     "' variable='EXTRASPACE' type='text' />" .      "' variable='EXTRASPACE' type='text' />" .
     "<option " .      "<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' />"
       ;
       
   
     }      }
   

Removed from v.1.569  
changed lines
  Added in v.1.570


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>