Diff for /loncom/interface/lonprintout.pm between versions 1.312 and 1.323

version 1.312, 2004/06/28 19:08:22 version 1.323, 2004/08/13 17:40:55
Line 415  sub page_format { Line 415  sub page_format {
  $topmargin = '3.5 in';   $topmargin = '3.5 in';
     }      }
  }   }
 #    } elsif($papersize eq '1') {  <<<<<<< lonprintout.pm
 #    } elsif($papersize eq '2') {      } elsif($papersize eq '1') {
 #    } elsif($papersize eq '3'/) {   if ($layout eq 'book') {
       if ($numberofcolumns == 1) {
    $textwidth = '7.1 in';      
    $textheight = '13 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       } elsif ($numberofcolumns == 2) {
    $textwidth = '3.66 in';     
    $textheight = '13 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       }
    } elsif ($layout eq 'album') {
       if ($numberofcolumns eq '1') {
   # $textwidth = '8.8 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-40 pt';
   # $evenoffset = '-60 pt';
       } elsif ($numberofcolumns == 2) {
   # $textwidth = '4.4 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-0.5 in';
   # $evenoffset = '-1.5 in';
   # $topmargin = '3.5 in';
       }
    }
       } elsif($papersize eq '2') {
    if ($layout eq 'book') {
       if ($numberofcolumns == 1) {
    $textwidth = '9.8 in';      
    $textheight = '16 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       } elsif ($numberofcolumns == 2) {
    $textwidth = '4.9 in';     
    $textheight = '16 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       }
    } elsif ($layout eq 'album') {
       if ($numberofcolumns eq '1') {
   # $textwidth = '8.8 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-40 pt';
   # $evenoffset = '-60 pt';
       } elsif ($numberofcolumns == 2) {
   # $textwidth = '4.4 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-0.5 in';
   # $evenoffset = '-1.5 in';
   # $topmargin = '3.5 in';
       }
    }
       } elsif($papersize eq '3') {
    if ($layout eq 'book') {
       if ($numberofcolumns == 1) {
    $textwidth = '7 in';      
    $textheight = '9 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       } elsif ($numberofcolumns == 2) {
    $textwidth = '3.5 in';     
    $textheight = '9 in';    
    $oddoffset = '-0.57 in';
    $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
       }
    } elsif ($layout eq 'album') {
       if ($numberofcolumns eq '1') {
   # $textwidth = '8.8 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-40 pt';
   # $evenoffset = '-60 pt';
       } elsif ($numberofcolumns == 2) {
   # $textwidth = '4.4 in';
   # $textheight = '6.8 in';
   # $oddoffset = '-0.5 in';
   # $evenoffset = '-1.5 in';
   # $topmargin = '3.5 in';
       }
    }
     } elsif($papersize eq '6') {      } elsif($papersize eq '6') {
  if ($layout eq 'book') {   if ($layout eq 'book') {
     if ($numberofcolumns == 1) {      if ($numberofcolumns == 1) {
  $textwidth = '176 mm';   $textwidth = '176 mm';
  $textheight = '254 mm';   $textheight = '272 mm';
  $oddoffset = '-0.57 in';   $oddoffset = '-0.57 in';
  $evenoffset = '-0.57 in';   $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
     } elsif ($numberofcolumns == 2) {      } elsif ($numberofcolumns == 2) {
  $textwidth = '91 mm';   $textwidth = '91 mm';
  $textheight = '254 mm';   $textheight = '272 mm';
  $oddoffset = '-0.57 in';   $oddoffset = '-0.57 in';
  $evenoffset = '-0.57 in';   $evenoffset = '-0.57 in';
    $topmargin = '-0.5 in';
     }      }
  } elsif ($layout eq 'album') {   } elsif ($layout eq 'album') {
     if ($numberofcolumns eq '1') {      if ($numberofcolumns eq '1') {
Line 483  sub page_format_transformation { Line 570  sub page_format_transformation {
     my $name = &get_name();      my $name = &get_name();
     my $courseidinfo = &get_course();      my $courseidinfo = &get_course();
     if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }      if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo }
       my $topmargintoinsert = '';
       if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}
     if ($layout eq 'album') {      if ($layout eq 'album') {
  my $topmargintoinsert = '';  
  if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';}  
     $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}} \\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1} /;      $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}} \\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1} /;
     } elsif ($layout eq 'book') {      } elsif ($layout eq 'book') {
   
  if ($choice ne 'All class print') {    if ($choice ne 'All class print') { 
     $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/;      $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset $topmargintoinsert\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/;
  } else {   } else {
     $text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\begin{document}\\voffset=-0\.8cm\\setcounter{page}{1}  \\vskip 5 mm /;      $text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight = $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset $topmargintoinsert\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\begin{document}\\voffset=-0\.8cm\\setcounter{page}{1}  \\vskip 5 mm /;
    }
    if ($papersize eq '6') {
       $text =~ s/(\\begin{document})/$1\\special{papersize=210mm,297mm}/;
  }   }
     }      }
     if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}      if ($tableofcontents eq 'yes') {$text=~s/(\\setcounter\{page\}\{1\})/$1 \\tableofcontents\\newpage /;}
Line 540  sub details_for_menu { Line 631  sub details_for_menu {
   
 sub latex_corrections {  sub latex_corrections {
   
     my ($number_of_columns,$result) = @_;      my ($number_of_columns,$result,$selectionmade) = @_;
   
 #    $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g;  #    $result =~ s/\\includegraphics{/\\includegraphics\[width=\\minipagewidth\]{/g;
     $result =~ s/\$number_of_columns/$number_of_columns/g;      $result =~ s/\$number_of_columns/$number_of_columns/g;
     $result =~ s/(\\end{document})/\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License  $1/;      if ($selectionmade ne '1') {
    $result =~ s/(\\end{document})/\\strut\\vspace\*{-4 mm}\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License  $1/;
       } else {
    $result =~ s/(\\end{document})/\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill}\\newline\\noindent\\tiny Printed from LON-CAPA\\copyright MSU{\\hfill} Licensed under GNU General Public License  $1/;
       }
     $result =~ s/(\\end{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g;      $result =~ s/(\\end{longtable}\s*)(\\strut\\newline\\noindent\\makebox\[\\textwidth\/$number_of_columns\]\[b\]{\\hrulefill})/$2$1/g;
     $result =~ s/(\\end{longtable}\s*)\\strut\\newline/$1/g;      $result =~ s/(\\end{longtable}\s*)\\strut\\newline/$1/g;
 #-- LaTeX corrections       #-- LaTeX corrections     
Line 559  sub latex_corrections { Line 654  sub latex_corrections {
     $result =~ s/\\\\\s*\\vskip/\\vskip/gm;      $result =~ s/\\\\\s*\\vskip/\\vskip/gm;
     $result =~ s/\\\\\s*\\noindent\s*(\\\\)+/\\\\\\noindent /g;      $result =~ s/\\\\\s*\\noindent\s*(\\\\)+/\\\\\\noindent /g;
     $result =~ s/{\\par }\s*\\\\/\\\\/gm;      $result =~ s/{\\par }\s*\\\\/\\\\/gm;
  $result =~ s/\\\\\s+\[/ \[/g;      $result =~ s/\\\\\s+\[/ \[/g;
     $result =~ s/\b__+\b/\\makebox\[1 cm\]\[b\]{\\hrulefill}/g;  
     #conversion of html characters to LaTeX equivalents      #conversion of html characters to LaTeX equivalents
     if ($result =~ m/&(\w+|#\d+);/) {      if ($result =~ m/&(\w+|#\d+);/) {
  $result = &character_chart($result);   $result = &character_chart($result);
Line 1034  ENDPART Line 1128  ENDPART
  $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);   $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
  $moreenv{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'};   $moreenv{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'};
  if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$moreenv{'problem_split'}='yes';}   if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$moreenv{'problem_split'}='yes';}
  my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1);   my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75');
  my $student_counter=-1;   my $student_counter=-1;
  foreach my $person (@students) {   foreach my $person (@students) {
              my $duefile="/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";               my $duefile="/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.due";
Line 1175  ENDPART Line 1269  ENDPART
     }      }
 #-------------------------------------------------------- corrections for the different page formats  #-------------------------------------------------------- corrections for the different page formats
     $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade);      $result = &page_format_transformation($papersize,$laystyle,$numberofcolumns,$helper->{'VARS'}->{'PRINT_TYPE'},$result,$helper->{VARS}->{'assignment'},$helper->{'VARS'}->{'TABLE_CONTENTS'},$helper->{'VARS'}->{'TABLE_INDEX'},$selectionmade);
     $result = &latex_corrections($number_of_columns,$result);      $result = &latex_corrections($number_of_columns,$result,$selectionmade);
     for (my $i=1;$i<=$#print_array;$i++) {$print_array[$i] = &latex_corrections($number_of_columns,$print_array[$i]);}      for (my $i=1;$i<=$#print_array;$i++) {$print_array[$i] = &latex_corrections($number_of_columns,$print_array[$i],$selectionmade);}
     #changes page's parameters for the one column output       #changes page's parameters for the one column output 
     if ($numberofcolumns == 1) {      if ($numberofcolumns == 1) {
  $result =~ s/\\textwidth\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;   $result =~ s/\\textwidth\s*=\s*\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /;
Line 1260  ENDPART Line 1354  ENDPART
                             'cgi.'.$identifier.'backref' => $URLback,);                              'cgi.'.$identifier.'backref' => $URLback,);
     
 $r->print(<<FINALEND);  $r->print(<<FINALEND);
   <br />
 <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />  <meta http-equiv="Refresh" content="0; url=/cgi-bin/printout.pl?$identifier" />
   <a href="/cgi-bin/printout.pl?$identifier">Continue</a>
 </body>  </body>
 </html>  </html>
 FINALEND  FINALEND
Line 1293  sub print_resources { Line 1389  sub print_resources {
     my $current_output = '';       my $current_output = ''; 
     my ($username,$userdomain,$usersection) = split /:/,$person;      my ($username,$userdomain,$usersection) = split /:/,$person;
     my $fullname = &get_name($username,$userdomain);      my $fullname = &get_name($username,$userdomain);
       my $namepostfix;
     if ($person =~ 'anon') {      if ($person =~ 'anon') {
    $namepostfix="\\\\Name: ";
  $fullname = "CODE - ".$moreenv->{'CODE'};   $fullname = "CODE - ".$moreenv->{'CODE'};
     }      }
     #goes through all resources, checks if they are available for       #goes through all resources, checks if they are available for 
Line 1367  sub print_resources { Line 1465  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\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}}\\vskip 3 mm /;   $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}\\vskip 3 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\\newline\\noindent\\makebox[\\textwidth/$number_of_columns][b]{\\hrulefill}\\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.'}}} \vskip -5 mm '.$current_output;   $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;
     }      }
     return ($current_output,$fullname);      return ($current_output,$fullname);
   

Removed from v.1.312  
changed lines
  Added in v.1.323


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