--- loncom/interface/lonprintout.pm 2005/02/22 11:43:05 1.363
+++ loncom/interface/lonprintout.pm 2005/02/23 11:51:40 1.366
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.363 2005/02/22 11:43:05 foxr Exp $
+# $Id: lonprintout.pm,v 1.366 2005/02/23 11:51:40 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -794,14 +794,12 @@ sub unsupported {
sub get_page_breaks {
my ($helper) = @_;
my %page_breaks;
-
-
foreach my $break (split /\|\|\|/, $helper->{'VARS'}->{'FINISHPAGE'}) {
$page_breaks{$break} = 1;
}
- return \%page_breaks;
+ return %page_breaks;
}
sub output_data {
@@ -847,14 +845,13 @@ 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'});
-
- my $page_hashref = &get_page_breaks($helper);
- my %page_breaks = %$page_hashref;
-
+ {'pagebreaks' => 'scalar',
+ 'lastprinttype' => 'scalar'});
+ my %page_breaks = &get_page_breaks($helper);
my $format_from_helper = $helper->{'VARS'}->{'FORMAT'};
my ($result,$selectionmade) = ('','');
@@ -1466,8 +1463,7 @@ sub print_resources {
&Apache::lonnet::delenv('form.counter');
&Apache::lonxml::init_counter();
- my $page_hashref = &get_page_breaks($helper);
- my %page_breaks = %$page_hashref;
+ my %page_breaks = &get_page_breaks($helper);
foreach my $curresline (@{$master_seq}) {
if (defined $page_breaks{$curresline}) {
@@ -1643,13 +1639,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.
@@ -1757,8 +1766,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') &&
@@ -1824,7 +1833,6 @@ HELPERFRAGMENT
suppressEmptySequences='0' addstatus='1' closeallpages='1'>
PAGESIZE
return $isNotMap;
- $map
return $symbFilter;
@@ -2037,7 +2045,6 @@ CHOOSE_FROM_ANY_SEQUENCE
Apache::lonhelper::message->new();
$paramHash = Apache::lonhelper::getParamHash();
$paramHash->{'variable'} = 'PRINT_TYPE';
- $helper->declareVar('PRINT_TYPE');
$paramHash->{CHOICES} = $printChoices;
Apache::lonhelper::choices->new();