--- loncom/interface/lonprintout.pm	2011/09/15 12:09:44	1.597
+++ loncom/interface/lonprintout.pm	2011/09/15 16:02:18	1.598
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.597 2011/09/15 12:09:44 raeburn Exp $
+# $Id: lonprintout.pm,v 1.598 2011/09/15 16:02:18 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -123,7 +123,7 @@ sub create_incomplete_folder_selstud_hel
 
     my $format_chooser = &generate_format_selector($helper,
 						'Format of the print job',
-						'','CHOOSE_STUDENTS_INCOMPLETE_FORMAT'); # end state.
+						'CHOOSE_STUDENTS_INCOMPLETE_FORMAT'); # end state.
 
     return $resource_chooser . $student_chooser . $format_chooser;
 }  
@@ -172,7 +172,6 @@ sub create_incomplete_course_helper {
 
     my $format = &generate_format_selector($helper,
 					   'Format of the print job',
-					   '',
 					   'INCOMPLETE_PROBLEMS_COURSE_FORMAT'); # end state.
 
     return $resource_chooser . $people_chooser . $format;
@@ -395,21 +394,25 @@ CHOOSE_ANON1
    return $result;
 }
 
+#  Returns the XML for choosing how assignments are to be formatted 
+#  that text must still be parsed by the helper xml parser.
+# Parameters: 3 (required)
+
+#   helper       - The helper; $helper->{'VARS'}->{'PRINT_TYPE'} used
+#                  to check if splitting PDFs by section can be offered.
+#   title        - Title for the current state. 
+#   this_state   - State name of the chooser.
+
 sub generate_format_selector {
-    my ($helper,$title,$nextstate, $thisstate) = @_;
+    my ($helper,$title,$this_state) = @_;
     my $secpdfoption;
-    my $state = 'PRINT_FORMATTING';
-    if ($thisstate) {
-	$state = $thisstate;
-    }
     unless (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon')     ||
             ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'problems_for_anon_page') ||
             ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'resources_for_anon')  ) {
         $secpdfoption =  '<choice computer="sections">Each PDF contains exactly one section</choice>';
     }
     return <<RESOURCE_SELECTOR;
-    <state name="$state" title="$title">
-    $nextstate
+    <state name="$this_state" title="$title">
     <message><br /><big><i><b>How should the results be printed?</b></i></big><br /></message>
     <choices variable="EMPTY_PAGES">
       <choice computer='0'>Start each student\'s assignment on a new page/column (add a pagefeed after each assignment)</choice>
@@ -3994,7 +3997,8 @@ ALL_PROBLEMS
 							  $isProblem, '', $symbFilter,
 							  $start_new_option);
 	$resource_selector .=  &generate_format_selector($helper,
-                                                         'How should results be printed?').
+                                                         'How should results be printed?',
+                                                         'PRINT_FORMATTING').
                                &generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
 							'Select Problem(s) to print',
 							"multichoice='1' addstatus='1' closeallpages ='1'",
@@ -4128,10 +4132,9 @@ ALL_PROBLEMS
     </state>
 RESOURCE_SELECTOR
 
-        my $nextstate = '<nextstate>NUMBER_PER_PDF</nextstate>'; 
         $resource_selector .= &generate_format_selector($helper,
                                                         'Format of the print job',
-                                                        $nextstate);
+                                                        'PRINT_FORMATTING');
 	&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS1);
   <state name="CHOOSE_STUDENTS1" title="Select Students and Resources">
     <choices variable='student_sort'>