--- loncom/interface/lonprintout.pm 2006/04/06 22:32:07 1.435 +++ loncom/interface/lonprintout.pm 2006/07/20 03:47:09 1.466 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.435 2006/04/06 22:32:07 foxr Exp $ +# $Id: lonprintout.pm,v 1.466 2006/07/20 03:47:09 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,8 +42,40 @@ use Apache::lonratedt; use POSIX qw(strftime); use Apache::lonlocal; use Carp; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; my %perm; +my %parmhash; +my $resources_printed; + + +# Format a header according to a format. +# + +# Substitutions: +# %a - Assignment name. +# %c - Course name. +# %n - Student name. +# +sub format_page_header { + my ($format, $assignment, $course, $student) = @_; + + # Default format? + + if ($format eq '') { + $format = "\\textbf{$student} $course \\hfill \\thepage \\\\ \\textit{$assignment}"; + + } else { + $format =~ s/%a/$assignment/g; + $format =~ s/%c/$course/g; + $format =~ s/%n/$student/g; + } + + + return $format; + +} # # Convert a numeric code to letters @@ -595,7 +627,7 @@ my %page_formats= '2' => ['3.66 in','9.8 in', '-0.57 in','-0.57 in','0.7 cm'] }, 'album' => { - '1' => [ '8.8 in', '6.8 in','-40 pt in', '-60 pt','1 cm'], + '1' => [ '8.8 in', '6.8 in','-0.55 in', '-0.83 in','1 cm'], '2' => [ '4.4 in', '6.8 in','-0.5 in', '-1.5 in','3.5 in'] }, }, @@ -651,12 +683,12 @@ my %page_formats= }, 'a4' => { 'book' => { - '1' => ['176 mm','272 mm','-40 pt in','-60 pt','-0.5 in'], - '2' => [ '91 mm','272 mm','-40 pt in','-60 pt','-0.5 in'] + '1' => ['17.6 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in'], + '2' => [ '9.1 cm','27.2 cm','-0.55 in','-0.83 in','-0.5 in'] }, 'album' => { - '1' => ['8.5 in','7.7 in','-40 pt in','-60 pt','0 in'], - '2' => ['3.9 in','7.7 in','-40 pt in','-60 pt','0 in'] + '1' => ['8.5 in','7.7 in','-0.55 in','-0.83 in','0 in'], + '2' => ['3.9 in','7.7 in','-0.55 in','-0.83 in','0 in'] }, }, 'a5' => { @@ -700,14 +732,14 @@ 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'); return $plainname; } sub get_course { my $courseidinfo; if (defined($env{'request.course.id'})) { - $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); + $courseidinfo = &Apache::lonxml::latex_special_symbols(&unescape($env{'course.'.$env{'request.course.id'}.'.description'}),'header'); } return $courseidinfo; } @@ -715,22 +747,28 @@ sub get_course { sub page_format_transformation { my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment,$tableofcontents,$indexlist,$selectionmade) = @_; my ($textwidth,$textheight,$oddoffset,$evenoffset,$topmargin); + 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); + + my $name = &get_name(); my $courseidinfo = &get_course(); if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } + my $header_text = $parmhash{'print_header_format'}; + $header_text = &format_page_header($header_text, $assignment, + $courseidinfo, $name); my $topmargintoinsert = ''; if ($topmargin ne '0') {$topmargintoinsert='\setlength{\topmargin}{'.$topmargin.'}';} my $fancypagestatement=''; if ($numberofcolumns eq '2') { - $fancypagestatement="\\fancyhead{}\\fancyhead[LO]{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}"; + $fancypagestatement="\\fancyhead{}\\fancyhead[LO]{$header_text}"; } else { - $fancypagestatement="\\rhead{}\\chead{}\\lhead{\\textbf{$name} $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}"; + $fancypagestatement="\\rhead{}\\chead{}\\lhead{$header_text}"; } if ($layout eq 'album') { $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}$topmargintoinsert\n\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\n\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\usepackage{fancyhdr}\\addtolength{\\headheight}{\\baselineskip}\n\\pagestyle{fancy}$fancypagestatement\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}\n /; @@ -1018,10 +1056,110 @@ sub get_page_breaks { return %page_breaks; } +# Output a sequence (recursively if neeed) +# from construction space. +# Parameters: +# url = URL of the sequence to print. +# helper - Reference to the helper hash. +# form - Copy of the format hash. +# LaTeXWidth +# Returns: +# Text to add to the printout. +# NOTE if the first element of the outermost sequence +# is itself a sequence, the outermost caller may need to +# prefix the latex with the page headers stuff. +# +sub print_construction_sequence { + my ($currentURL, $helper, %form, $LaTeXwidth) = @_; + my $result; + my $rndseed=time; + if ($helper->{'VARS'}->{'curseed'}) { + $rndseed=$helper->{'VARS'}->{'curseed'}; + } + my $errtext=&Apache::lonratedt::mapread($currentURL); + # + # These make this all support recursing for subsequences. + # + my @order = @Apache::lonratedt::order; + my @resources = @Apache::lonratedt::resources; + for (my $member=0;$member<=$#order;$member++) { + $resources[$order[$member]]=~/^([^:]*):([^:]*):/; + my $urlp=$2; + if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { + my $texversion=''; + if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') { + $form{'problem_split'}=$parmhash{'problem_stream_switch'}; + $form{'suppress_tries'}=$parmhash{'suppress_tries'}; + $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; + $form{'rndseed'}=$rndseed; + $resources_printed .=$urlp.':'; + $texversion=&Apache::lonnet::ssi($urlp,%form); + } + if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || + ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) && + ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) { + # Don't permanently modify %$form... + my %answerform = %form; + $answerform{'grade_target'}='answer'; + $answerform{'answer_output_mode'}='tex'; + $answerform{'rndseed'}=$rndseed; + $answerform{'problem_split'}=$parmhash{'problem_stream_switch'}; + if ($urlp=~/\/res\//) {$env{'request.state'}='published';} + $resources_printed .= $urlp.':'; + my $answer=&Apache::lonnet::ssi($urlp,%answerform); + if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { + $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; + } else { + # If necessary, encapsulate answer in minipage: + + $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); + my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm '; + $body.=&path_to_problem($urlp,$LaTeXwidth); + $body.='\vskip 1 mm '.$answer.'\end{document}'; + $body = &encapsulate_minipage($body); + $texversion.=$body; + } + } + $texversion = &latex_header_footer_remove($texversion); + + if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') { + $texversion=&IndexCreation($texversion,$urlp); + } + if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URL'} eq 'yes') { + $texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /; + } + $result.=$texversion; + + } elsif ($urlp=~/\.(sequence|page)$/) { + + # header: + + $result.='\strut\newline\noindent Sequence/page '.$urlp.'\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent '; + + # IF sequence, recurse: + + if ($urlp =~ /\.sequence$/) { + my $sequence_url = $urlp; + my $domain = $env{'user.domain'}; # Constr. space only on local + my $user = $env{'user.name'}; + + $sequence_url =~ s/^\/res\/$domain/\/home/; + $sequence_url =~ s/^(\/home\/$user)/$1\/public_html/; +# $sequence_url =~ s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; + $result .= &print_construction_sequence($sequence_url, + $helper, %form, + $LaTeXwidth); + } + } + } + if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} + return $result; +} + sub output_data { my ($r,$helper,$rparmhash) = @_; my %parmhash = %$rparmhash; - my $resources_printed = ''; + $resources_printed = ''; my $js = < var editbrowser; @@ -1195,70 +1333,15 @@ ENDPART } elsif ($cleanURL!~m|^/adm/| && $currentURL=~/\.sequence$/ && $helper->{'VARS'}->{'construction'} eq '1') { #printing content of sequence from the construction space - my $flag_latex_header_remove = 'NO'; - my $rndseed=time; - if ($helper->{'VARS'}->{'curseed'}) { - $rndseed=$helper->{'VARS'}->{'curseed'}; - } $currentURL=~s|\/~([^\/]+)\/|\/home\/$1\/public_html\/|; - my $errtext=&Apache::lonratedt::mapread($currentURL); - for (my $member=0;$member<=$#Apache::lonratedt::order;$member++) { - $Apache::lonratedt::resources[$Apache::lonratedt::order[$member]]=~/^([^:]*):([^:]*):/; - my $urlp=$2; - if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|xml|html|htm|xhtml|xhtm)$/) { - my $texversion=''; - if ($helper->{'VARS'}->{'ANSWER_TYPE'} ne 'only') { - $form{'problem_split'}=$parmhash{'problem_stream_switch'}; - $form{'suppress_tries'}=$parmhash{'suppress_tries'}; - $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; - $form{'rndseed'}=$rndseed; - $resources_printed .=$urlp.':'; - $texversion=&Apache::lonnet::ssi($urlp,%form); - } - if((($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') || - ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'only')) && - ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page)$/)) { - # Don't permanently modify %$form... - my %answerform = %form; - $answerform{'grade_target'}='answer'; - $answerform{'answer_output_mode'}='tex'; - $answerform{'rndseed'}=$rndseed; - $answerform{'problem_split'}=$parmhash{'problem_stream_switch'}; - if ($urlp=~/\/res\//) {$env{'request.state'}='published';} - $resources_printed .= $urlp.':'; - my $answer=&Apache::lonnet::ssi($urlp,%answerform); - if ($helper->{'VARS'}->{'ANSWER_TYPE'} eq 'no') { - $texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/; - } else { - # If necessary, encapsulate answer in minipage: - - $texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); - my $body ='\vskip 0 mm \noindent\textbf{'.&Apache::lonnet::gettitle($helper->{'VARS'}->{'symb'}).'}\vskip 0 mm '; - $body.=&path_to_problem($urlp,$LaTeXwidth); - $body.='\vskip 1 mm '.$answer.'\end{document}'; - $body = &encapsulate_minipage($body); - $texversion.=$body; - } - } - if ($flag_latex_header_remove ne 'NO') { - $texversion = &latex_header_footer_remove($texversion); - } else { - $texversion =~ s/\\end{document}//; - } - if ($helper->{'VARS'}->{'TABLE_INDEX'} eq 'yes') { - $texversion=&IndexCreation($texversion,$urlp); - } - if ($helper->{'VARS'}->{'CONSTR_RESOURSE_URpL'} eq 'yes') { - $texversion=~s/(\\addcontentsline\{toc\}\{subsection\}\{[^\}]*\})/$1 URL: \\verb|$urlp| \\strut\\\\\\strut /; - } - $result.=$texversion; - $flag_latex_header_remove = 'YES'; - } elsif ($urlp=~/\.(sequence|page)$/) { - $result.='\strut\newline\noindent Sequence/page '.$urlp.'\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent '; - } + $result .= &print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'}); + $result .= &print_construction_sequence($currentURL, $helper, %form, + $LaTeXwidth); + $result .= '\end{document}'; + if (!($result =~ /\\begin\{document\}/)) { + $result = &print_latex_header() . $result; } - if ($helper->{VARS}->{'construction'} eq '1') {$result=~s/(\\begin{document})/$1 \\fbox\{RANDOM SEED IS $rndseed\} /;} - $result .= '\end{document}'; + # End construction space sequence. } elsif ($cleanURL=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) { $form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'}; if ($currentURL=~/\/syllabus$/) {$currentURL=~s/\/res//;} @@ -1322,7 +1405,6 @@ ENDPART $resources_printed .= $urlp.':'; &Apache::lonxml::remember_problem_counter(); - $texversion.=&Apache::lonnet::ssi($urlp,%form); if ($urlp=~/\.page$/) { ($texversion,my $number_of_columns_page) = &page_cleanup($texversion); @@ -1370,10 +1452,15 @@ ENDPART my $courseidinfo = &get_course(); if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } $prevassignment=$assignment; + my $header_text = $parmhash{'print_header_format'}; + $header_text = &format_page_header($header_text, + $assignment, + $courseidinfo, + $name); if ($numberofcolumns eq '1') { - $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; + $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\lhead{'.$header_text.'}} \vskip 5 mm '; } else { - $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{\\textit{\\textbf{'.$name.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$assignment.'}}} \vskip 5 mm '; + $result .='\newpage \noindent\parbox{\minipagewidth}{\noindent\\fancyhead[LO]{'.$header_text.'}} \vskip 5 mm '; } } $result .= $texversion; @@ -1560,6 +1647,7 @@ ENDPART } my @master_seq=split /\|\|\|/, $helper->{'VARS'}->{'RESOURCES'}; my ($type) = split(/_/,$helper->{'VARS'}->{'PRINT_TYPE'}); + &adjust_number_to_print($helper); my $number_per_page=$helper->{'VARS'}->{'NUMBER_TO_PRINT'}; if ($number_per_page eq '0' || $number_per_page eq 'all') { $number_per_page=$num_todo; @@ -1671,13 +1759,12 @@ ENDPART $selectionmade, $helper->{'VARS'}->{'ANSWER_TYPE'}); } - #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/\\textheight\s*=\s*-?\d*\.?\d*\s*(cm|mm|in)/\\textheight $helper->{'VARS'}->{'pagesize.height'} $helper->{'VARS'}->{'pagesize.heightunit'} /; + $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; @@ -1733,7 +1820,7 @@ ENDPART my $URLback=''; #link to original document if ($helper->{'VARS'}->{'construction'} ne '1') { #prints published resource - $URLback=&Apache::lonnet::escape('/adm/flip?postdata=return:'); + $URLback=&escape('/adm/flip?postdata=return:'); } else { #prints resource from the construction space $URLback='/'.$helper->{'VARS'}->{'filename'}; @@ -1802,6 +1889,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 @@ -1810,6 +1900,16 @@ sub print_resources { my %page_breaks = &get_page_breaks($helper); my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'}); my $columns_in_format = $format_array[1]; + # + # end each student with a + # Special that allows the post processor to even out the page + # counts later. Nasty problem this... it would be really + # nice to put the special in as a postscript comment + # e.g. \special{ps:\ENDOFSTUDENTSTAMP} unfortunately, + # The special gets passed the \ and dvips puts it in the output file + # so we will just rely on prntout.pl to strip ENDOFSTUDENTSTAMP from the + # postscript. Each ENDOFSTUDENTSTAMP will go on a line by itself. + # foreach my $curresline (@{$master_seq}) { if (defined $page_breaks{$curresline}) { @@ -1889,22 +1989,28 @@ sub print_resources { if (defined($courseidinfo)) { $courseidinfo=' - '.$courseidinfo } if ($usersection ne '') {$courseidinfo.=' - Sec. '.$usersection} my $currentassignment=&Apache::lonxml::latex_special_symbols($helper->{VARS}->{'assignment'},'header'); + my $HeaderLine = $parmhash{'print_header_format'}; + $HeaderLine = format_page_header($HeaderLine, $currentassignment, $courseidinfo, $fullname); if ($current_output=~/\\documentclass/) { if ($columns_in_format == 1) { - $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; + $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\lhead{$HeaderLine$namepostfix}}\\vskip 5 mm /; } else { - $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{\\textit{\\textbf{$fullname}}$courseidinfo \\hfill \\thepage \\\\ \\textit{$currentassignment}$namepostfix}}\\vskip 5 mm /; + $current_output =~ s/\\begin{document}/\\setlength{\\topmargin}{1cm} \\begin{document}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fancyhead[LO]{$HeaderLine$namepostfix}}\\vskip 5 mm /; } } else { my $blankpages = ''; for (my $j=0;$j<$helper->{'VARS'}->{'EMPTY_PAGES'};$j++) {$blankpages.='\clearpage\strut\clearpage';} if ($columns_in_format == 1) { - $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; + $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{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output; } else { - $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\\fancyhead[LO]{\\textit{\\textbf{'.$fullname.'}}'.$courseidinfo.' \\hfill \\thepage \\\\ \\textit{'.$currentassignment.'}'.$namepostfix.'}} \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\\fancyhead[LO]{'.$HeaderLine.'}'.$namepostfix.'} \vskip 5 mm '.$current_output; } } + # + # Close the student bracketing. + # + $current_output .= "\n\\special{ps:ENDOFSTUDENTSTAMP}\n"; return ($current_output,$fullname, $printed); } @@ -1923,7 +2029,7 @@ sub handler { } - my %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'}); + %parmhash=&Apache::lonnet::coursedescription($env{'request.course.id'}); @@ -1958,7 +2064,7 @@ sub init_perm { $perm{'pav'}=&Apache::lonnet::allowed('pav', $env{'request.course.id'}.'/'.$env{'request.course.sec'}); } - $perm{'pfo'}=&Apache::lonnet::allowed('pav',$env{'request.course.id'}); + $perm{'pfo'}=&Apache::lonnet::allowed('pfo',$env{'request.course.id'}); if (!$perm{'pfo'}) { $perm{'pfo'}=&Apache::lonnet::allowed('pfo', $env{'request.course.id'}.'/'.$env{'request.course.sec'}); @@ -2120,7 +2226,7 @@ sub printHelper { my $paramHash; if ($resourceTitle) { - push @{$printChoices}, ["$resourceTitle (".&mt('what you just saw on the screen').")", 'current_document', 'PAGESIZE']; + push @{$printChoices}, ["$resourceTitle (".&mt('the resource you just saw on the screen').")", 'current_document', 'PAGESIZE']; } # Useful filter strings @@ -2135,40 +2241,44 @@ sub printHelper { $helper->declareVar('SEQUENCE'); + # If we're in a sequence... + my $start_new_option; + if ($perm{'pav'}) { + $start_new_option = + "