Diff for /loncom/interface/lonprintout.pm between versions 1.308 and 1.315

version 1.308, 2004/06/14 20:48:26 version 1.315, 2004/07/15 15:53:30
Line 472  sub get_course { Line 472  sub get_course {
 }  }
   
 sub page_format_transformation {  sub page_format_transformation {
     my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist) = @_;       my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist,$selectionmade) = @_; 
     my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin);      my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin);
     $assignment=&Apache::lonxml::latex_special_symbols($assignment,'header');      if ($selectionmade eq '4') {
    $assignment='Problems from the Whole Course';
       } else {
    $assignment=&Apache::lonxml::latex_special_symbols($assignment,'header');
       }
     ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin) = &page_format($papersize,$layout,$numberofcolumns,$topmargin);      ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin) = &page_format($papersize,$layout,$numberofcolumns,$topmargin);
     my $name = &get_name();      my $name = &get_name();
     my $courseidinfo = &get_course();      my $courseidinfo = &get_course();
Line 540  sub latex_corrections { Line 544  sub latex_corrections {
   
 #    $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/;      $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/;
     $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 555  sub latex_corrections { Line 559  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 769  ENDPART Line 772  ENDPART
  $form{'grade_target'}='tex';   $form{'grade_target'}='tex';
  $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);   $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
  $form{'problem_split'}=$parmhash{'problem_stream_switch'};   $form{'problem_split'}=$parmhash{'problem_stream_switch'};
    $form{'suppress_tries'}=$parmhash{'suppress_tries'};
  $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};   $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
    $form{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'};
    if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';}
  if ($helper->{'VARS'}->{'curseed'}) {   if ($helper->{'VARS'}->{'curseed'}) {
     $rndseed=$helper->{'VARS'}->{'curseed'};      $rndseed=$helper->{'VARS'}->{'curseed'};
  }   }
Line 834  ENDPART Line 840  ENDPART
  $form{'grade_target'}='tex';   $form{'grade_target'}='tex';
  $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);   $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
  $form{'problem_split'}=$parmhash{'problem_stream_switch'};   $form{'problem_split'}=$parmhash{'problem_stream_switch'};
    $form{'suppress_tries'}=$parmhash{'suppress_tries'};
  $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};   $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
  $form{'rndseed'}=$rndseed;   $form{'rndseed'}=$rndseed;
  $texversion=&Apache::lonnet::ssi($urlp,%form);   $texversion=&Apache::lonnet::ssi($urlp,%form);
Line 904  ENDPART Line 911  ENDPART
  $form{'grade_target'}='tex';   $form{'grade_target'}='tex';
  $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);   $form{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
  $form{'problem_split'}=$parmhash{'problem_stream_switch'};   $form{'problem_split'}=$parmhash{'problem_stream_switch'};
    $form{'suppress_tries'}=$parmhash{'suppress_tries'};
  $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};   $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
    $form{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'};
    if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';}
  my $flag_latex_header_remove = 'NO';   my $flag_latex_header_remove = 'NO';
  my $flag_page_in_sequence = 'NO';   my $flag_page_in_sequence = 'NO';
  my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};   my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'};
Line 1021  ENDPART Line 1031  ENDPART
  my $flag_latex_header_remove = 'NO';    my $flag_latex_header_remove = 'NO'; 
  my %moreenv;   my %moreenv;
  $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);   $moreenv{'textwidth'}=&get_textwidth($helper,$LaTeXwidth);
    $moreenv{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'};
    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);
  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";
        if (-e $duefile) {
    my $temp_file = Apache::File->new('>>'.$duefile);
    print $temp_file "1969\n";
        }
      $student_counter++;       $student_counter++;
      my $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});       my $i=int($student_counter/$helper->{'VARS'}{'NUMBER_TO_PRINT'});
      my ($output,$fullname)=&print_resources($r,$helper,$person,$type,\%moreenv,\@master_seq,$flag_latex_header_remove);       my ($output,$fullname)=&print_resources($r,$helper,$person,$type,\%moreenv,\@master_seq,$flag_latex_header_remove);
Line 1156  ENDPART Line 1173  ENDPART
  $result .= '\end{document}';         $result .= '\end{document}';      
     }      }
 #-------------------------------------------------------- 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'});      $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);
     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]);}
     #changes page's parameters for the one column output       #changes page's parameters for the one column output 
Line 1353  sub print_resources { Line 1370  sub print_resources {
     } 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.'}}} \vskip -5 mm '.$current_output;
     }      }
     return ($current_output,$fullname);      return ($current_output,$fullname);
   
Line 1845  CHOOSE_FROM_ANY_SEQUENCE Line 1862  CHOOSE_FROM_ANY_SEQUENCE
     $paramHash->{CHOICES} = [      $paramHash->{CHOICES} = [
      ['No', 'no'],       ['No', 'no'],
      ['Yes', 'yes'] ];       ['Yes', 'yes'] ];
       Apache::lonhelper::dropdown->new();
       addMessage("</td></tr>");
       addMessage("<tr><td align='right'>Print Discussions: </td><td>");
       $paramHash = Apache::lonhelper::getParamHash();
       $paramHash->{'variable'} = 'PRINT_DISCUSSIONS';   
       $helper->declareVar('PRINT_DISCUSSIONS');         
       $paramHash->{CHOICES} = [
        ['No', 'no'],
        ['Yes', 'yes'] ];
     Apache::lonhelper::dropdown->new();      Apache::lonhelper::dropdown->new();
     addMessage("</td></tr>");      addMessage("</td></tr>");
  }   }

Removed from v.1.308  
changed lines
  Added in v.1.315


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