version 1.316.2.3, 2004/09/24 21:01:50
|
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 629 sub print_latex_header {
|
Line 720 sub print_latex_header {
|
} |
} |
|
|
sub path_to_problem { |
sub path_to_problem { |
my ($urlp,$colwidth)=@_; |
my ($urlp,$LaTeXwidth)=@_; |
my $newurlp = ''; |
my $newurlp = ''; |
$colwidth=~s/\s*mm\s*$//; |
$LaTeXwidth=~s/\s*mm\s*$//; |
#characters average about 2 mm in width |
my $HowMany = length($urlp)*2; |
if (length($urlp)*2 > $LaTeXwidth) { |
if ($HowMany > $LaTeXwidth) { |
my @elements = split '/',$urlp; |
my @temporrary = split '/',$urlp; |
my $curlength=0; |
my $HowManyNew = 0; |
foreach my $element (@elements) { |
for (my $ii=0;$ii<=$#temporrary;$ii++) { |
if ($curlength+(length($element)*2) > $colwidth) { |
if ($temporrary[$ii] ne '') { |
$newurlp .= '|\vskip -1 mm \noindent \verb|'; |
$HowManyNew += length($temporrary[$ii])*2; |
$curlength=0; |
if ($HowManyNew < $LaTeXwidth ) { |
} else { |
$newurlp .= '/'.$temporrary[$ii]; |
$curlength+=length($element)*2; |
} else { |
|
$HowManyNew = 0; |
|
$newurlp .= '|\vskip -1 mm \noindent \verb|'; |
|
$ii--; |
|
} |
} |
} |
$newurlp.='/'.$element; |
|
} |
} |
} else { |
} else { |
$newurlp=$urlp; |
$newurlp=$urlp; |
Line 1007 ENDPART
|
Line 1101 ENDPART
|
$result .= $texversion; |
$result .= $texversion; |
$flag_latex_header_remove = 'YES'; |
$flag_latex_header_remove = 'YES'; |
} |
} |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
|
} |
} |
&Apache::lonnet::delenv('form.counter'); |
&Apache::lonnet::delenv('form.counter'); |
if ($flag_page_in_sequence eq 'YES') {$result =~ s/\\usepackage{calc}/\\usepackage{calc}\\usepackage{longtable}/;} |
if ($flag_page_in_sequence eq 'YES') {$result =~ s/\\usepackage{calc}/\\usepackage{calc}\\usepackage{longtable}/;} |
Line 1032 ENDPART
|
Line 1125 ENDPART
|
#loop over students |
#loop over students |
my $flag_latex_header_remove = 'NO'; |
my $flag_latex_header_remove = 'NO'; |
my %moreenv; |
my %moreenv; |
$moreenv{'instructor_comments'}='hide'; |
|
$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 1051 ENDPART
|
Line 1143 ENDPART
|
$student_names[$i].=$person.':'.$fullname.'_END_'; |
$student_names[$i].=$person.':'.$fullname.'_END_'; |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname); |
&Apache::lonhtmlcommon::Increment_PrgWin($r,\%prog_state,&mt('last student').' '.$fullname); |
$flag_latex_header_remove = 'YES'; |
$flag_latex_header_remove = 'YES'; |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
|
} |
} |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
$result .= $print_array[0].' \end{document}'; |
$result .= $print_array[0].' \end{document}'; |
Line 1101 ENDPART
|
Line 1192 ENDPART
|
&mt('last assignment').' '.$fullname); |
&mt('last assignment').' '.$fullname); |
$flag_latex_header_remove = 'YES'; |
$flag_latex_header_remove = 'YES'; |
$count++; |
$count++; |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
|
} |
} |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
$result .= $print_array[0].' \end{document}'; |
$result .= $print_array[0].' \end{document}'; |
Line 1264 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 1297 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 1365 sub print_resources {
|
Line 1459 sub print_resources {
|
} |
} |
$remove_latex_header = 'YES'; |
$remove_latex_header = 'YES'; |
} |
} |
if (&Apache::loncommon::connection_aborted($r)) { last; } |
|
} |
} |
my $courseidinfo = &get_course(); |
my $courseidinfo = &get_course(); |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } |
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\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; |
$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); |
|
|