Diff for /loncom/interface/lonprintout.pm between versions 1.462 and 1.463

version 1.462, 2006/07/17 13:54:36 version 1.463, 2006/07/17 23:11:10
Line 627  my %page_formats= Line 627  my %page_formats=
      '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm']       '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm']
  },   },
  'album' => {   'album' => {
      '1' => [ '8.8 in', '6.8 in','-40 pt in',  '-60 pt','1 cm'],       '1' => [ '8.8 in', '6.8 in','-0.55 in',  '-0.83 in','1 cm'],
      '2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in']       '2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in']
  },   },
      },       },
Line 683  my %page_formats= Line 683  my %page_formats=
      },       },
      'a4' => {       'a4' => {
  'book' => {   'book' => {
      '1' => ['176 mm','272 mm','-40 pt in','-60 pt','-0.5 in'],       '1' => ['17.6 cm','27.2 cm','-0.55  in','-0.83 in','-0.5 in'],
      '2' => [ '91 mm','272 mm','-40 pt in','-60 pt','-0.5 in']       '2' => [ '9.1 cm','27.2 cm','-0.55  in','-0.83 in','-0.5 in']
  },   },
  'album' => {   'album' => {
      '1' => ['8.5 in','7.7 in','-40 pt in','-60 pt','0 in'],       '1' => ['8.5 in','7.7 in','-0.55 in','-0.83 in','0 in'],
      '2' => ['3.9 in','7.7 in','-40 pt in','-60 pt','0 in']       '2' => ['3.9 in','7.7 in','-0.55 in','-0.83 in','0 in']
  },   },
      },       },
      'a5' => {       'a5' => {
Line 1082  sub print_construction_sequence { Line 1082  sub print_construction_sequence {
     #      #
     my @order    = @Apache::lonratedt::order;      my @order    = @Apache::lonratedt::order;
     my @resources = @Apache::lonratedt::resources;       my @resources = @Apache::lonratedt::resources; 
     &Apache::lonnet::logthis("mapread for $currentURL returned: $errtext");  
     for (my $member=0;$member<=$#order;$member++) {      for (my $member=0;$member<=$#order;$member++) {
  $resources[$order[$member]]=~/^([^:]*):([^:]*):/;   $resources[$order[$member]]=~/^([^:]*):([^:]*):/;
  my $urlp=$2;   my $urlp=$2;
  &Apache::lonnet::logthis("Processing $urlp from sequence ($member)");  
  if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {   if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) {
     my $texversion='';      my $texversion='';
     if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {      if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') {
Line 1133  sub print_construction_sequence { Line 1131  sub print_construction_sequence {
     $result.=$texversion;      $result.=$texversion;
   
  } elsif ($urlp=~/\.(sequence|page)$/) {   } elsif ($urlp=~/\.(sequence|page)$/) {
     &Apache::lonnet::logthis("elsif just strutting stuff");  
           
     # header:      # header:
   
Line 1337  ENDPART Line 1334  ENDPART
  && $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {   && $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') {
             #printing content of sequence from the construction space              #printing content of sequence from the construction space
     $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;      $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|;
     &Apache::lonnet::logthis("Sequence from constrution space. ouptput is:");  
     &Apache::lonnet::logthis($result);  
     $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});      $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
     $result .= &print_construction_sequence($currentURL, $helper, %form,      $result .= &print_construction_sequence($currentURL, $helper, %form,
     $LaTeXwidth);      $LaTeXwidth);
     &Apache::lonnet::logthis("Back from construction space print");  
     $result .= '\end{document}';        $result .= '\end{document}';  
     if (!($result =~ /\\begin\{document\}/)) {      if (!($result =~ /\\begin\{document\}/)) {
  &Apache::lonnet::logthis("inserting header");  
  $result = &print_latex_header() . $result;   $result = &print_latex_header() . $result;
     }      }
     # End construction space sequence.      # End construction space sequence.
Line 2973  sub new { Line 2966  sub new {
     # $helper->{VARS} to figure out whether the columns are one or two      # $helper->{VARS} to figure out whether the columns are one or two
     $self->{'formatvar'} = shift;      $self->{'formatvar'} = shift;
   
     # The state to transition to after selection, or after discovering  
     # the cols are not set to 1  
     $self->{NEXTSTATE} = shift;      $self->{NEXTSTATE} = shift;
     bless($self);      bless($self);
     return $self;      return $self;
Line 2990  sub render { Line 2982  sub render {
         $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />';          $result .= '<br /><font color="#FF0000">' . $self->{ERROR_MSG} . '</font><br />';
     }      }
   
     my $width = 18;  
     my $format = $helper->{VARS}->{$self->{'formatvar'}};      my $format = $helper->{VARS}->{$self->{'formatvar'}};
     if (substr($format, 2, 1) ne '1') {  
  $width = 9;      # Use format to get sensible defaults for the margins:
   
   
       my ($laystyle, $cols, $papersize) = split(/\|/, $format);
       ($papersize)                      = split(/ /, $papersize);
   
   
       if ($laystyle eq 'L') {
    $laystyle = 'album';
       } else {
    $laystyle = 'book';
       }
   
   
   
       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);
       
       if ($wunits eq 'cm') {
    $wuoptions = '<option>cm</option><option>in</option>';
       } else {
    $wuoptions = '<option>in</option><option>cm</option>';
       }
       if ($hunits eq 'cm') {
    $huoptions =  '<option>cm</option><option>in</option>';
       } else {
    $huoptions = '<option>in</option><option>cm</option>';
       }
       if ($munits eq 'cm') {
    $muoptions = '<option>cm</option><option>in</option>';
       } else {
    $muoptions = '<option>in</option><option>cm</option>';
     }      }
   
     $result .= <<ELEMENTHTML;      $result .= <<ELEMENTHTML;
   
   
   
 <p>How should the column be formatted?</p>  <p>How should the column be formatted?</p>
   
 <table cellpadding='3'>  <table cellpadding='3'>
   <tr>    <tr>
     <td align='right'><b>Width</b>:</td>      <td align='right'><b>Width</b>:</td>
     <td align='left'><input type='text' name='$var.width' value='$width' size='4'></td>      <td align='left'><input type='text' name='$var.width' value="$width" size='4'></td>
     <td align='left'>      <td align='left'>
       <select name='$var.widthunit'>        <select name='$var.widthunit'>
         <option>cm</option><option>in</option>        $wuoptions
       </select>        </select>
     </td>      </td>
   </tr>    </tr>
   <tr>    <tr>
     <td align='right'><b>Height</b>:</td>      <td align='right'><b>Height</b>:</td>
     <td align='left'><input type='text' name="$var.height" value="25.9" size='4'></td>      <td align='left'><input type='text' name="$var.height" value="$height" size='4'></td>
     <td align='left'>      <td align='left'>
       <select name='$var.heightunit'>        <select name='$var.heightunit'>
         <option>cm</option><option>in</option>        $huoptions
       </select>        </select>
     </td>      </td>
   </tr>    </tr>
   <tr>    <tr>
     <td align='right'><b>Left margin</b>:</td>      <td align='right'><b>Left margin</b>:</td>
     <td align='left'><input type='text' name='$var.lmargin' value='-1.5' size='4'></td>      <td align='left'><input type='text' name='$var.lmargin' value="$margin" size='4'></td>
     <td align='left'>      <td align='left'>
       <select name='$var.lmarginunit'>        <select name='$var.lmarginunit'>
         <option>cm</option><option>in</option>        $muoptions
       </select>        </select>
     </td>      </td>
   </tr>    </tr>
Line 3044  sub preprocess { Line 3082  sub preprocess {
     my $helper = Apache::lonhelper::getHelper();      my $helper = Apache::lonhelper::getHelper();
   
     my $format = $helper->{VARS}->{$self->{'formatvar'}};      my $format = $helper->{VARS}->{$self->{'formatvar'}};
     if (substr($format, 2, 1) ne '1') {  
         $helper->changeState($self->{NEXTSTATE});  
     }  
         
     return 1;      return 1;
 }  }

Removed from v.1.462  
changed lines
  Added in v.1.463


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