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

foxr lon-capa-cvs@mail.lon-capa.org
Wed, 01 Mar 2006 11:20:38 -0000


foxr		Wed Mar  1 06:20:38 2006 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Enh request 3809   Separate some of the moster helper pages into 
  multiple states.
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.423 loncom/interface/lonprintout.pm:1.424
--- loncom/interface/lonprintout.pm:1.423	Fri Feb 24 17:37:45 2006
+++ loncom/interface/lonprintout.pm	Wed Mar  1 06:20:37 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.423 2006/02/24 22:37:45 foxr Exp $
+# $Id: lonprintout.pm,v 1.424 2006/03/01 11:20:37 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2169,7 +2169,19 @@
 	    push @{$printChoices}, ["<b>".&mt('Problems')."</b> ".&mt('from')." <b><i>$sequenceTitle</i></b> ".&mt('for')." <b>".&mt('selected students')."</b>", 'problems_for_students', 'CHOOSE_STUDENTS'];
 	    push @{$printChoices}, ["<b>".&mt('Problems')."</b> ".&mt('from')." <b><i>$sequenceTitle</i></b> ".&mt('for')." <b>".&mt('anonymous students')."</b>", 'problems_for_anon', 'CHOOSE_ANON1'];
 	}
+
+	# resource_selector will hold a few states that:
+	#   - Allow resources to be selected for printing.
+	#   - Determine pagination between assignments.
+	#   - Determine how many assignments should be bundled into a single PDF.
+        # TODO:
+	#    Probably good to do things like separate this up into several vars, each
+	#    with one state, and use REGEXPs at inclusion time to set state names
+	#    and next states for better mix and match capability
+	#
 	my $resource_selector=<<RESOURCE_SELECTOR;
+    <state name="SELECT_PROBLEMS" title="Select resources to print">
+   <nextstate>PRINT_FORMATTING</nextstate> 
    <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
     <resource variable="RESOURCES" multichoice="1" addstatus="1" 
               closeallpages="1">
@@ -2178,6 +2190,9 @@
       <valuefunc>return $symbFilter;</valuefunc>
       <option text='New Page' variable='FINISHPAGE' />
       </resource>
+    </state>
+    <state name="PRINT_FORMATTING" title="How should results be printed?">
+    <nextstate>NUMBER_PER_PDF</nextstate>
     <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>
@@ -2185,20 +2200,24 @@
       <choice computer='2'>Add two empty pages/column after each student\'s assignment</choice>
       <choice computer='3'>Add three empty pages/column after each student\'s assignment</choice>
     </choices>
+    </state>
+    <state name="NUMBER_PER_PDF" title="Number printed at once">
+    <nextstate>PAGESIZE</nextstate>
     <message><hr width='33%' /><b>Number of assignments printed at the same time: </b></message>
     <string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string>
+    </state>
 RESOURCE_SELECTOR
 
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS);
   <state name="CHOOSE_STUDENTS" title="Select Students and Resources">
-      <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" coursepersonnel="1"/>
+      <student multichoice='1' variable="STUDENTS" nextstate="SELECT_PROBLEMS" coursepersonnel="1"/>
       <message><b>Select sort order</b> </message>
     <choices variable='student_sort'>
       <choice computer='0'>Sort by section then student</choice>
       <choice computer='1'>Sort by students across sections.</choice>
     </choices>
-    $resource_selector
   </state>
+    $resource_selector
 CHOOSE_STUDENTS
 
 	my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -2244,7 +2263,7 @@
 	}
         &Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON1);
   <state name="CHOOSE_ANON1" title="Select Students and Resources">
-    <nextstate>PAGESIZE</nextstate>
+    <nextstate>SELECT_PROBLEMS</nextstate>
     <message><table><tr><td><b>Number of anonymous assignments to print:</b></td><td></message>
     <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
        <validator>
@@ -2290,8 +2309,8 @@
     </dropdown>
     <message></td></tr></table></message>
     <message><hr width='33%' /></message>
-    $resource_selector
   </state>
+  $resource_selector
 CHOOSE_ANON1
 
 
@@ -2302,6 +2321,8 @@
 	    
 
 	$resource_selector=<<RESOURCE_SELECTOR;
+    <state name="SELECT_RESOURCES" title="Select Resources">
+    <nextstate>PRINT_FORMATTING</nextstate>
     <message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message>
     <resource variable="RESOURCES" multichoice="1" addstatus="1" 
               closeallpages="1">
@@ -2310,6 +2331,9 @@
       <valuefunc>return $symbFilter;</valuefunc>
       <option text='Newpage' variable='FINISHPAGE' />
       </resource>
+    </state>
+    <state name="PRINT_FORMATTING" title="Format of the print job">
+    <nextstate>NUMBER_PER_PDF</nextstate>
     <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>
@@ -2317,25 +2341,29 @@
       <choice computer='2'>Add two empty pages/column after each student\'s assignment</choice>
       <choice computer='3'>Add three empty pages/column after each student\'s assignment</choice>
     </choices>
+    </state>
+    <state name="NUMBER_PER_PDF title="Number assingnments per pdf">
+    <nextstate>PAGESIZE</nextstate>
     <message><hr width='33%' /><b>Number of assignments printed at the same time: </b></message>
     <string variable="NUMBER_TO_PRINT" maxlength="5" size="5"><defaultvalue>"all"</defaultvalue></string>
+    </state>
 RESOURCE_SELECTOR
 
 	&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_STUDENTS1);
   <state name="CHOOSE_STUDENTS1" title="Select Students and Resources">
-    <student multichoice='1' variable="STUDENTS" nextstate="PAGESIZE" coursepersonnel="1" />
+    <student multichoice='1' variable="STUDENTS" nextstate="SELECT_RESOURCES" coursepersonnel="1" />
     <choices variable='student_sort'>
       <choice computer='0'>Sort by section then student</choice>
       <choice computer='1'>Sort by students across sections.</choice>
     </choices>
 
-    $resource_selector
     </state>
+    $resource_selector
 CHOOSE_STUDENTS1
 
 	&Apache::lonxml::xmlparse($r, 'helper', <<CHOOSE_ANON2);
   <state name="CHOOSE_ANON2" title="Select Students and Resources">
-    <nextstate>PAGESIZE</nextstate>
+    <nextstate>SELECT_RESOURCES</nextstate>
     <message><table><tr><td><b>Number of anonymous assignments to print:</b></td><td></message>
     <string variable="NUMBER_TO_PRINT_TOTAL" maxlength="5" size="5">
        <validator>
@@ -2381,8 +2409,8 @@
     </dropdown>
     <message></td></tr></table></message>
     <message><hr width='33%' /></message>
-    $resource_selector
   </state>
+    $resource_selector
 CHOOSE_ANON2
     }