Diff for /loncom/interface/lonprintout.pm between versions 1.415 and 1.416

version 1.415, 2006/01/17 18:39:50 version 1.416, 2006/01/26 23:15:54
Line 687  sub page_format_transformation { Line 687  sub page_format_transformation {
     my $topmargintoinsert = '';      my $topmargintoinsert = '';
     if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}      if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}
     my $fancypagestatement='';      my $fancypagestatement='';
   #    &Apache::lonnet::logthis("1: columns = $numberofcolumns");
     if ($numberofcolumns eq '2') {      if ($numberofcolumns eq '2') {
  $fancypagestatement="\\fancyhead{}\\fancyhead[LO]{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}";   $fancypagestatement="\\fancyhead{}\\fancyhead[LO]{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}";
     } else {      } else {
Line 963  sub recently_generated { Line 964  sub recently_generated {
 #    A reference to a page break hash.  #    A reference to a page break hash.
 #  #
 #  #
   #use Data::Dumper;
   #sub dump_helper_vars {
   #    my ($helper) = @_;
   #    my $helpervars = Dumper($helper->{'VARS'});
   #    &Apache::lonnet::logthis("Dump of helper vars:\n $helpervars");
   #}
   
 sub get_page_breaks  {  sub get_page_breaks  {
     my ($helper) = @_;      my ($helper) = @_;
     my %page_breaks;      my %page_breaks;
       
     foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {      foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
  $page_breaks{$break} = 1;   $page_breaks{$break} = 1;
     }      }
       
     return %page_breaks;      return %page_breaks;
 }  }
   
Line 1253  ENDPART Line 1259  ENDPART
  &Apache::lonnet::delenv('form.counter');   &Apache::lonnet::delenv('form.counter');
  &Apache::lonxml::init_counter();   &Apache::lonxml::init_counter();
  &Apache::lonxml::store_counter();   &Apache::lonxml::store_counter();
    my $pbreakresources = keys %page_breaks;
  for (my $i=0;$i<=$#master_seq;$i++) {   for (my $i=0;$i<=$#master_seq;$i++) {
   
     # Note due to document structure, not allowed to put \newpage      # Note due to document structure, not allowed to put \newpage
Line 1322  ENDPART Line 1329  ENDPART
     my $courseidinfo = &get_course();      my $courseidinfo = &get_course();
     if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }      if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
     $prevassignment=$assignment;      $prevassignment=$assignment;
     $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm ';  #    &Apache::lonnet::logthis("2: Number of columns: $number_of_columns");
       if ($number_of_columns eq '1') {
    $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm ';
       } else {
    $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm ';
       }
  }   }
  $result .= $texversion;   $result .= $texversion;
  $flag_latex_header_remove = 'YES';      $flag_latex_header_remove = 'YES';   
Line 1812  sub print_resources { Line 1824  sub print_resources {
     if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection}      if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection}
     my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');      my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header');
     if ($current_output=~/\\documentclass/) {      if ($current_output=~/\\documentclass/) {
  $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /;  # &Apache::lonnet::logthis("3: Number of columns = $number_of_columns");
    if ($number_of_columns == 1) {
       $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /;
    } else {
           $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /;
   
    }
     } else {      } else {
  my $blankpages = '';   my $blankpages = '';
  for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';}   for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';}
  $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output;  # &Apache::lonnet::logthis("4: Number of columns = $number_of_columns");
    if ($number_of_columns == 1) {
       $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output;
    } else {
      $current_output = '\strut\vspace*{-6 mm}\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\vspace*{-2 mm}\\newline\\noindent{\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License }\\newpage '.$blankpages.'\setcounter{page}{1}\noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \vskip 5 mm '.$current_output;
    }
     }      }
     return ($current_output,$fullname, $printed);      return ($current_output,$fullname, $printed);
   
Line 1828  sub handler { Line 1851  sub handler {
           
     &init_perm();      &init_perm();
   
 #    my $loaderror=&Apache::lonnet::overloaderror($r);  
 #    if ($loaderror) { return $loaderror; }  
 #    $loaderror=  
 #       &Apache::lonnet::overloaderror($r,  
 #         $env{'course.'.$env{'request.course.id'}.'.home'});  
 #    if ($loaderror) { return $loaderror; }  
   
     my $helper = printHelper($r);      my $helper = printHelper($r);
     if (!ref($helper)) {      if (!ref($helper)) {
  return $helper;   return $helper;
     }      }
         
 # my $key;   
 # foreach $key (keys %{$helper->{'VARS'}}) {  
 #    $r->print(' '.$key.'->'.$helper->{'VARS'}->{$key}.'<-<br />');  
 # }  
 # foreach $key (keys %env) {  
 #    $r->print(' '.$key.'->'.$env{$key}.'<-<br />');  
 # }  
 # return OK;  
   
     my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'});      my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'});
     
 # my $key;   
 # foreach $key (keys %parmhash) {  
 #    $r->print(' '.$key.'->'.$parmhash{$key}.'<-<br />');  
 # }  
 #  
   
   
     #  If a figure conversion queue file exists for this user.domain      #  If a figure conversion queue file exists for this user.domain
Line 1879  sub addMessage { Line 1885  sub addMessage {
     Apache::lonhelper::message->new();      Apache::lonhelper::message->new();
 }  }
   
 use Data::Dumper;  
   
 sub init_perm {  sub init_perm {
     undef(%perm);      undef(%perm);
Line 1941  sub printHelper { Line 1947  sub printHelper {
     # But we only do this in the initial state so that they are allowed to change.      # But we only do this in the initial state so that they are allowed to change.
     #      #
   
     $helper->{VARS}->{FINISHPAGE} = '';      # $helper->{VARS}->{FINISHPAGE} = '';
           
     &Apache::loncommon::restore_course_settings('print',      &Apache::loncommon::restore_course_settings('print',
  {'pagebreaks'  => 'scalar',   {'pagebreaks'  => 'scalar',
Line 1960  sub printHelper { Line 1966  sub printHelper {
  }   }
   
     }      }
       
           
     # This will persistently load in the data we want from the      # This will persistently load in the data we want from the
     # very first screen.      # very first screen.
Line 1978  sub printHelper { Line 1984  sub printHelper {
         if ($env{'form.url'}) {          if ($env{'form.url'}) {
             $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});              $helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
         }          }
   
     }      }
   
     if ($env{'form.symb'}) {      if ($env{'form.symb'}) {
Line 2064  sub printHelper { Line 2071  sub printHelper {
   
     $helper->declareVar('SEQUENCE');      $helper->declareVar('SEQUENCE');
   
     # Useful for debugging: Dump the help vars  
 #     $r->print(Dumper($helper->{VARS}));  
 #    $r->print($map);  
   
     # If we're in a sequence...      # If we're in a sequence...
     if (($helper->{'VARS'}->{'construction'} ne '1') &&      if (($helper->{'VARS'}->{'construction'} ne '1') &&
Line 2547  RNDSEED Line 2552  RNDSEED
   
     $helper->process();      $helper->process();
   
   
     # MANUAL BAILOUT CONDITION:      # MANUAL BAILOUT CONDITION:
     # If we're in the "final" state, bailout and return to handler      # If we're in the "final" state, bailout and return to handler
     if ($helper->{STATE} eq 'FINAL') {      if ($helper->{STATE} eq 'FINAL') {

Removed from v.1.415  
changed lines
  Added in v.1.416


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