--- loncom/interface/lonprintout.pm 2006/06/13 21:49:15 1.442 +++ loncom/interface/lonprintout.pm 2006/06/30 21:26:53 1.451 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.442 2006/06/13 21:49:15 foxr Exp $ +# $Id: lonprintout.pm,v 1.451 2006/06/30 21:26:53 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -702,7 +702,8 @@ sub get_name { if (!defined($udom)) { $udom=$env{'user.domain'}; } my $plainname=&Apache::loncommon::plainname($uname,$udom); if ($plainname=~/^\s*$/) { $plainname=$uname.'@'.$udom; } - $plainname=&Apache::lonxml::latex_special_symbols($plainname,'header'); + # $plainname=&Apache::lonxml::latex_special_symbols($plainname,'header'); + $plainname = &escape_LaTeX($plainname); return $plainname; } @@ -1261,7 +1262,7 @@ ENDPART } if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} $result .= '\end{document}'; - } elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($cleanURL=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;} $resources_printed .= $currentURL.':'; @@ -1379,7 +1380,7 @@ ENDPART } $result .= $texversion; $flag_latex_header_remove = 'YES'; - } elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($urlp=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($urlp=~/\/syllabus$/) {$urlp=~s/\/res//;} $resources_printed .= $urlp.':'; @@ -1672,14 +1673,12 @@ ENDPART $selectionmade, $helper->{'VARS'}->{'ANSWER_TYPE'}); } - &Apache::lonnet::logthis("Resetting page e.g. height -> $helper->{'VARS'}->{'pagesize.height'}"); - &Apache::lonnet::logthis("Before: $result \n--------------------------\n"); - $result =~ s/\\textwidth\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textwidth= $helper->{'VARS'}->{'pagesize.width'} $helper->{'VARS'}->{'pagesize.widthunit'} /; - $result =~ s/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; - $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; - $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; - - &Apache::lonnet::logthis("After: $result \n----------------------------------\n"); + 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/\\textheight\s*=?\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; + $result =~ s/\\evensidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\evensidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; + $result =~ s/\\oddsidemargin\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\oddsidemargin= $helper->{'VARS'}->{'pagesize.lmargin'} $helper->{'VARS'}->{'pagesize.lmarginunit'} /; + } #-- writing .tex file in prtspool my $temp_file; @@ -1804,6 +1803,9 @@ sub print_resources { $namepostfix="\\\\Name: "; $fullname = "CODE - ".$moreenv->{'CODE'}; } + # Fullname may have special latex characters that need \ prefixing: + # + my $i = 0; #goes through all resources, checks if they are available for #current student, and produces output @@ -1872,7 +1874,7 @@ sub print_resources { $rendered =~ s/\\end{document}//; } $current_output .= $rendered; - } elsif ($res_url=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { + } elsif ($res_url=~/\/(smppg|grppg|syllabus|aboutme|bulletinboard)$/) { $printed .= $curresline.':'; my $rendered = &Apache::loncommon::get_student_view($curresline,$username,$userdomain,$env{'request.course.id'},'tex',$moreenv); @@ -1920,7 +1922,7 @@ sub print_resources { # # Close the student bracketing. # - $current_output .= "\n\\special{ps:\nENDOFSTUDENTSTAMP\n}"; + $current_output .= "\n\\special{ps:ENDOFSTUDENTSTAMP}\n"; return ($current_output,$fullname, $printed); } @@ -2195,7 +2197,7 @@ HELPERFRAGMENT # If the user has pfo (print for otheres) allow them to print all # problems and resources in the entier course, optionally for selected students if ($perm{'pfo'} && - ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { + ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|grppg|aboutme|bulletinboard)$/)) { push @{$printChoices}, ['Problems from entire course', 'all_problems', 'ALL_PROBLEMS']; push @{$printChoices}, ['Resources from entire course', 'all_resources', 'ALL_RESOURCES']; @@ -2263,8 +2265,8 @@ ALL_PROBLEMS All assignments in a single PDF file Each PDF contains exactly one section Each PDF contains exactly one assignment - - Specify Number: + + Specify the number of assignments per PDF: RESOURCE_SELECTOR @@ -2312,10 +2314,16 @@ CHOOSE_STUDENTS } if (%codes_to_print) { $code_selection .=' - - push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); - + Choose single code from list + + + + push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); + + +
'.$/; + } @@ -2373,12 +2381,9 @@ CHOOSE_STUDENTS
- Choose single code from list - - $code_selection - -
+ + Reprint a set of saved CODEs: @@ -2424,8 +2429,8 @@ CHOOSE_ANON1 All assignments in a single PDF file Each PDF contains exactly one section Each PDF contains exactly one assignment - - Specify Number: + + Specify the number of assignments per PDF: RESOURCE_SELECTOR @@ -2484,12 +2489,7 @@ CHOOSE_STUDENTS1
- Choose single code from list - - $code_selection - -
Reprint a set of saved CODEs: @@ -2952,9 +2952,9 @@ sub preprocess { my $helper = Apache::lonhelper::getHelper(); my $format = $helper->{VARS}->{$self->{'formatvar'}}; -# if (substr($format, 2, 1) ne '1') { -# $helper->changeState($self->{NEXTSTATE}); -# } + if (substr($format, 2, 1) ne '1') { + $helper->changeState($self->{NEXTSTATE}); + } return 1; }