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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 20 Jul 2006 03:38:53 -0000


albertel		Wed Jul 19 23:38:53 2006 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  - pfo wasn't being properly detected in all cases
  - hidea to 'force a newpage' from  non pav users
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.464 loncom/interface/lonprintout.pm:1.465
--- loncom/interface/lonprintout.pm:1.464	Tue Jul 18 14:19:51 2006
+++ loncom/interface/lonprintout.pm	Wed Jul 19 23:38:52 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.464 2006/07/18 18:19:51 albertel Exp $
+# $Id: lonprintout.pm,v 1.465 2006/07/20 03:38:52 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2064,7 +2064,7 @@
 	$perm{'pav'}=&Apache::lonnet::allowed('pav',
 		  $env{'request.course.id'}.'/'.$env{'request.course.sec'});
     }
-    $perm{'pfo'}=&Apache::lonnet::allowed('pav',$env{'request.course.id'});
+    $perm{'pfo'}=&Apache::lonnet::allowed('pfo',$env{'request.course.id'});
     if (!$perm{'pfo'}) {
 	$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
 		  $env{'request.course.id'}.'/'.$env{'request.course.sec'});
@@ -2241,10 +2241,15 @@
 
     $helper->declareVar('SEQUENCE');
 
+    # If we're in a sequence...
 
+    my $start_new_option;
+    if ($perm{'pav'}) {
+	$start_new_option = 
+	    "<option text='".&mt('Start new page<br />before selected').
+	    "' variable='FINISHPAGE' />";
+    }
 
-    # If we're in a sequence...
-    my $startnew=&mt('Start new page<br />before selected');
     if (($helper->{'VARS'}->{'construction'} ne '1') &&
 
 	$helper->{VARS}->{'postdata'} &&
@@ -2253,6 +2258,7 @@
         push @{$printChoices}, [&mt('Selected <b>Problems</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
         # Allow all resources from sequence
         push @{$printChoices}, [&mt('Selected <b>Resources</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
+
         my $helperFragment = <<HELPERFRAGMENT;
   <state name="CHOOSE_PROBLEMS" title="Select Problem(s) to print">
     <resource variable="RESOURCES" multichoice="1" toponly='1' addstatus="1"
@@ -2261,7 +2267,7 @@
       <filterfunc>return $isProblem;</filterfunc>
       <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
       </resource>
     </state>
 
@@ -2272,7 +2278,7 @@
       <filterfunc>return $isNotMap;</filterfunc>
       <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
       </resource>
     </state>
 HELPERFRAGMENT
@@ -2295,7 +2301,7 @@
       <filterfunc>return $isProblemOrMap;</filterfunc>
       <choicefunc>return $isNotMap;</choicefunc>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
     </resource>
   </state>
   <state name="ALL_RESOURCES" title="Select Resource(s) to print">
@@ -2304,7 +2310,7 @@
       <nextstate>PAGESIZE</nextstate>
       <filterfunc>return $isNotMap; </filterfunc>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
     </resource>
   </state>
 ALL_PROBLEMS
@@ -2332,7 +2338,7 @@
       <filterfunc>return $isProblem;</filterfunc>
       <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
       </resource>
     </state>
     <state name="PRINT_FORMATTING" title="How should results be printed?">
@@ -2496,7 +2502,7 @@
       <filterfunc>return $isNotMap;</filterfunc>
       <mapurl>$map</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
       </resource>
     </state>
     <state name="PRINT_FORMATTING" title="Format of the print job">
@@ -2640,7 +2646,7 @@
       <filterfunc>return $isProblem</filterfunc>
       <mapurl evaluate='1'>return '$escapedSequenceName';</mapurl>
       <valuefunc>return $symbFilter;</valuefunc>
-      <option text='$startnew' variable='FINISHPAGE' />
+      $start_new_option
       </resource>
     </state>
 CHOOSE_FROM_ANY_SEQUENCE