--- loncom/interface/lonprintout.pm 2006/03/14 23:24:46 1.429 +++ loncom/interface/lonprintout.pm 2006/06/06 11:02:38 1.440 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.429 2006/03/14 23:24:46 foxr Exp $ +# $Id: lonprintout.pm,v 1.440 2006/06/06 11:02:38 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,8 @@ use Apache::lonratedt; use POSIX qw(strftime); use Apache::lonlocal; use Carp; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; my %perm; @@ -707,7 +709,7 @@ sub get_name { 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; } @@ -1022,12 +1024,8 @@ sub output_data { my ($r,$helper,$rparmhash) = @_; my %parmhash = %$rparmhash; my $resources_printed = ''; - my $html=&Apache::lonxml::xmlbegin(); - my $bodytag=&Apache::loncommon::bodytag('Preparing Printout'); - $r->print(< - -LON-CAPA output for printing - -$bodytag -

-Please stand by while processing your print request, this may take some time ... -

ENDPART + my $start_page = &Apache::loncommon::start_page('Preparing Printout',$js); + my $msg = &mt('Please stand by while processing your print request, this may take some time ...'); + $r->print($start_page."\n

\n$msg\n

\n"); # fetch the pagebreaks and store them in the course environment # The page breaks will be pulled into the hash %page_breaks which is @@ -1329,7 +1324,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); @@ -1471,7 +1465,7 @@ ENDPART my %prog_state=&Apache::lonhtmlcommon::Create_PrgWin($r,'Print Status','Class Print Status',$#students+1,'inline','75'); my $student_counter=-1; my $i = 0; - my ($junku, $junkd, $last_section) = split /:/,$students[0]; + my $last_section = (split(/:/,$students[0]))[2]; foreach my $person (@students) { my $duefile="/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due"; @@ -1481,8 +1475,7 @@ ENDPART } $student_counter++; if ($split_on_sections) { - my $this_section; - ($junku, $junkd, $this_section) = split /:/,$person; + my $this_section = (split(/:/,$person))[2]; if ($this_section ne $last_section) { $i++; $last_section = $this_section; @@ -1679,13 +1672,14 @@ ENDPART $selectionmade, $helper->{'VARS'}->{'ANSWER_TYPE'}); } - #changes page's parameters for the one column output - 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'} /; - } + &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"); #-- writing .tex file in prtspool my $temp_file; @@ -1741,7 +1735,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'}; @@ -1771,12 +1765,12 @@ ENDPART "cgi.$identifier.coursedom" => $cdom, "cgi.$identifier.resources" => $resources_printed); -$r->print(<print(< Continue - - +$end_page FINALEND } @@ -1818,6 +1812,18 @@ sub print_resources { my %page_breaks = &get_page_breaks($helper); my @format_array = split(/\|/,$helper->{'VARS'}->{'FORMAT'}); my $columns_in_format = $format_array[1]; + # + # Bracket 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:\%STARTOFSTUDENTSTAMP} unfortunately, + # The special gets passed the \ and dvips puts it in the output file + # so we'll just put STARTOFSTUDENTSTAMP in the postscript and rely + # on printout.pl to strip it...simlarly with ENDOFSTUDENTSTAMP. + # These will go on a line by themselves. + # + $current_output .= "\\special{ps:\nSTARTOFSTUDENTSTAMP\n}"; foreach my $curresline (@{$master_seq}) { if (defined $page_breaks{$curresline}) { @@ -1913,6 +1919,10 @@ sub print_resources { $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; } } + # + # Close the student bracketing. + # + $current_output .= "\\special{ps:\nENDOFSTUDENTSTAMP\n}"; return ($current_output,$fullname, $printed); } @@ -2242,7 +2252,6 @@ ALL_PROBLEMS - NUMBER_PER_PDF
How should the results be printed?
Start each student\'s assignment on a new page/column (add a pagefeed after each assignment) @@ -2250,17 +2259,15 @@ ALL_PROBLEMS Add two empty pages/column after each student\'s assignment Add three empty pages/column after each student\'s assignment -
- PAGESIZE
How do you want assignments split into PDF files?
All assignments in a single PDF file Each PDF contains exactly one section Each PDF contains exactly one assignment - Specify Number: + + Specify Number: - "all"
RESOURCE_SELECTOR @@ -2271,6 +2278,7 @@ RESOURCE_SELECTOR Sort by section then student Sort by students across sections. +


$resource_selector @@ -2302,8 +2310,17 @@ CHOOSE_STUDENTS if ($code =~ /^[A-Z]+$/) { # Alpha code $choice = &letters_to_num($code); } - $code_selection .= ' '.$code."\n"; + push(@{$helper->{DATA}{ALL_CODE_CHOICES}},[$code,$choice]); + } + if (%codes_to_print) { + $code_selection .=' + + push(@{$state->{CHOICES}},@{$helper->{DATA}{ALL_CODE_CHOICES}}); + + '.$/; } + + open(FH,$Apache::lonnet::perlvar{'lonTabDir'}.'/scantronformat.tab'); my $codechoice=''; foreach my $line () { @@ -2358,6 +2375,12 @@ CHOOSE_STUDENTS
+ Choose single code from list + + + $code_selection + +
Reprint a set of saved CODEs: @@ -2397,17 +2420,15 @@ CHOOSE_ANON1 Add two empty pages/column after each student\'s assignment Add three empty pages/column after each student\'s assignment - - PAGESIZE
How do you want assignments split into PDF files?
All assignments in a single PDF file Each PDF contains exactly one section Each PDF contains exactly one assignment - Specify Number: + + Specify Number: - "all"
RESOURCE_SELECTOR @@ -2417,6 +2438,7 @@ RESOURCE_SELECTOR Sort by section then student Sort by students across sections. +


@@ -2464,6 +2486,12 @@ CHOOSE_STUDENTS1
+ Choose single code from list + + + $code_selection + +
Reprint a set of saved CODEs: @@ -2872,6 +2900,12 @@ sub render { $result .= '
' . $self->{ERROR_MSG} . '
'; } + my $width = 18; + my $format = $helper->{VARS}->{$self->{'formatvar'}}; + if (substr($format, 2, 1) ne '1') { + $width = 9; + } + $result .= <How should the column be formatted?

@@ -2879,7 +2913,7 @@ sub render { - +
Width: