--- loncom/interface/lonprintout.pm 2005/02/22 16:08:11 1.364 +++ loncom/interface/lonprintout.pm 2005/03/08 23:29:11 1.367 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.364 2005/02/22 16:08:11 albertel Exp $ +# $Id: lonprintout.pm,v 1.367 2005/03/08 23:29:11 foxr Exp $ # # Copyright Michigan State University Board of Trustees # @@ -845,9 +845,11 @@ ENDPART # The page breaks will be pulled into the hash %page_breaks which is # indexed by symb and contains 1's for each break. - $ENV{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'}; + $ENV{'form.pagebreaks'} = $helper->{'VARS'}->{'FINISHPAGE'}; + $ENV{'form.lastprinttype'} = $helper->{'VARS'}->{'PRINT_TYPE'}; &Apache::loncommon::store_course_settings('print', - {'pagebreaks' => 'scalar'}); + {'pagebreaks' => 'scalar', + 'lastprinttype' => 'scalar'}); my %page_breaks = &get_page_breaks($helper); @@ -1338,6 +1340,7 @@ ENDPART $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; my $identifier = &Apache::loncommon::get_cgi_id(); @@ -1582,7 +1585,14 @@ sub handler { # - + # If a figure conversion queue file exists for this user.domain + # we delete it since it can only be bad (if it were good, printout.pl + # would have deleted it the last time around. + + my $conversion_queuefile = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; + if(-e $conversion_queuefile) { + unlink $conversion_queuefile; + } &output_data($r,$helper,\%parmhash); return OK; } @@ -1637,13 +1647,26 @@ sub printHelper { $helper->declareVar('style_file'); $helper->declareVar('student_sort'); $helper->declareVar('FINISHPAGE'); + $helper->declareVar('PRINT_TYPE'); # The page breaks can get loaded initially from the course environment: + + if((!defined($ENV{"form.CURRENT_STATE"})) || + ($ENV{'form.CURRENT_STATE'} == "START")) { + $helper->{VARS}->{FINISHPAGE} = ""; # In case they did a back e.g. + } + + &Apache::loncommon::restore_course_settings('print', - {'pagebreaks' => 'scalar'}); + {'pagebreaks' => 'scalar', + 'lastprinttype' => 'scalar'}); - $helper->{VARS}->{FINISHPAGE} = $ENV{'form.pagebreaks'}; + + if("$helper->{VARS}->{PRINT_TYPE}" eq "$ENV{'form.lastprinttype'}") { + $helper->{VARS}->{FINISHPAGE} = $ENV{'form.pagebreaks'}; + } + # This will persistently load in the data we want from the # very first screen. @@ -1751,8 +1774,8 @@ sub printHelper { $helper->declareVar('SEQUENCE'); # Useful for debugging: Dump the help vars - #$r->print(Dumper($helper->{VARS})); - #$r->print($map); +# $r->print(Dumper($helper->{VARS})); +# $r->print($map); # If we're in a sequence... if (($helper->{'VARS'}->{'construction'} ne '1') && @@ -1818,7 +1841,6 @@ HELPERFRAGMENT suppressEmptySequences='0' addstatus='1' closeallpages='1'> PAGESIZE return $isNotMap; - $map return $symbFilter;