version 1.309, 2004/06/23 17:42:21
|
version 1.316.2.2, 2004/09/22 20:49:45
|
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 536 sub details_for_menu {
|
Line 540 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 555 sub latex_corrections {
|
Line 563 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 622 sub print_latex_header {
|
Line 629 sub print_latex_header {
|
} |
} |
|
|
sub path_to_problem { |
sub path_to_problem { |
my ($urlp,$LaTeXwidth)=@_; |
my ($urlp,$colwidth)=@_; |
my $newurlp = ''; |
my $newurlp = ''; |
$LaTeXwidth=~s/\s*mm\s*$//; |
$colwidth=~s/\s*mm\s*$//; |
my $HowMany = length($urlp)*2; |
#characters average about 2 mm in width |
if ($HowMany > $LaTeXwidth) { |
if (length($urlp)*2 > $LaTeXwidth) { |
my @temporrary = split '/',$urlp; |
my @elements = split '/',$urlp; |
my $HowManyNew = 0; |
my $curlength=0; |
for (my $ii=0;$ii<=$#temporrary;$ii++) { |
foreach my $element (@elements) { |
if ($temporrary[$ii] ne '') { |
if ($curlength+(length($element)*2) > $colwidth) { |
$HowManyNew += length($temporrary[$ii])*2; |
$newurlp .= '|\vskip -1 mm \noindent \verb|'; |
if ($HowManyNew < $LaTeXwidth ) { |
$curlength=0; |
$newurlp .= '/'.$temporrary[$ii]; |
} else { |
} else { |
$curlength+=length($element)*2; |
$HowManyNew = 0; |
|
$newurlp .= '|\vskip -1 mm \noindent \verb|'; |
|
$ii--; |
|
} |
|
} |
} |
|
$newurlp.='/'.$element; |
} |
} |
} else { |
} else { |
$newurlp=$urlp; |
$newurlp=$urlp; |
Line 769 ENDPART
|
Line 773 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'}; |
$form{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'}; |
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';} |
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';} |
Line 836 ENDPART
|
Line 841 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 906 ENDPART
|
Line 912 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'}; |
$form{'print_discussions'}=$helper->{'VARS'}->{'PRINT_DISCUSSIONS'}; |
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';} |
if ($helper->{'VARS'}->{'PRINT_DISCUSSIONS'} eq 'yes') {$form{'problem_split'}='yes';} |
Line 1024 ENDPART
|
Line 1031 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); |
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 1162 ENDPART
|
Line 1175 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,$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 1359 sub print_resources {
|
Line 1372 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); |
|
|