[LON-CAPA-cvs] cvs: loncom /interface lonprintout.pm

raeburn raeburn at source.lon-capa.org
Thu Sep 15 12:02:18 EDT 2011


raeburn		Thu Sep 15 16:02:18 2011 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - &generate_format_selector().
    - Change args: eliminate previous third arg (nextstate) - not needed.
    - Rename final arg as this_state for consistency with usage elsewhere
    - All three args now required.
    - Add documentation
  
  - Eliminate '<nextstate>NUMBER_PER_PDF</nextstate>'.
    - NUMBER_PER_PDF was eliminated as a state in rev 1.435.
    - this <nextstate> tag was being ignored, as another 
      <nextstate> tag occurs later within the <state></state> block.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.597 loncom/interface/lonprintout.pm:1.598
--- loncom/interface/lonprintout.pm:1.597	Thu Sep 15 12:09:44 2011
+++ loncom/interface/lonprintout.pm	Thu Sep 15 16:02:18 2011
@@ -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 @@
 
     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 @@
 
     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 @@
    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 @@
 							  $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 @@
     </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'>




More information about the LON-CAPA-cvs mailing list