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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 14 Aug 2006 22:20:23 -0000


foxr		Mon Aug 14 18:20:23 2006 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Restrict what can be printed from resource space for now to just the
  file being looked at.. need to add code to look at files in current
  res dir.
  
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.478 loncom/interface/lonprintout.pm:1.479
--- loncom/interface/lonprintout.pm:1.478	Mon Aug 14 06:52:04 2006
+++ loncom/interface/lonprintout.pm	Mon Aug 14 18:20:20 2006
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.478 2006/08/14 10:52:04 foxr Exp $
+# $Id: lonprintout.pm,v 1.479 2006/08/14 22:20:20 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2272,6 +2272,7 @@
     if (($helper->{'VARS'}->{'construction'} ne '1') &&
 
 	$helper->{VARS}->{'postdata'} &&
+	($helper->{VARS}->{'postdata'} !~ /^\/res\//) &&
 	$helper->{VARS}->{'assignment'}) {
         # Allow problems from sequence
         push @{$printChoices}, [&mt('Selected <b>Problems</b> in folder <b><i>[_1]</i></b>',$sequenceTitle), 'map_problems', 'CHOOSE_PROBLEMS'];
@@ -2308,8 +2309,8 @@
     # If the user has pfo (print for otheres) allow them to print all 
     # problems and resources  in the entier course, optionally for selected students
     if ($perm{'pfo'} && 
-        ($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { 
-
+        $helper->{VARS}->{'postdata'} !~/^\/res\// && 
+	$helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/) { 
         push @{$printChoices}, ['Selected <b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS'];
 	push @{$printChoices}, ['Selected <b>Resources</b> from <b>entire course</b>', 'all_resources', 'ALL_RESOURCES'];
          &Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS);
@@ -2617,10 +2618,12 @@
   </state>
     $resource_selector
 CHOOSE_ANON2
-    }
+}
 
     # FIXME: That RE should come from a library somewhere.
-    if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or defined $helper->{'VARS'}->{'construction'}) and $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {    
+    if ((((&Apache::lonnet::allowed('bre',$subdir) eq 'F') and 
+	  ($helper->{VARS}->{'postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)/)) or 
+	 defined $helper->{'VARS'}->{'construction'}) and $perm{'pav'} and $subdir ne $Apache::lonnet::perlvar{'lonDocRoot'}.'/res/') {    
         push @{$printChoices}, [&mt("Selected <b>Problems</b> from current subdirectory <b><i>[_1]</i></b>",$subdir), 'problems_from_directory', 'CHOOSE_FROM_SUBDIR'];
 
         my $f = '$filename';
@@ -2646,7 +2649,7 @@
 
     # Allow the user to select any sequence in the course, feed it to
     # another resource selector for that sequence
-    if (!$helper->{VARS}->{'construction'}) {
+    if (!$helper->{VARS}->{'construction'} && ($helper->{VARS}->{'postdata'} !~ /^\/res\//)) {
 	push @$printChoices, ["Selected <b>Resources</b> from <b>selected folder</b> in course",
 			      'select_sequences', 'CHOOSE_SEQUENCE'];
 	my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'};
@@ -2677,7 +2680,6 @@
     </state>
 CHOOSE_FROM_ANY_SEQUENCE
 }
-
     # Generate the first state, to select which resources get printed.
     Apache::lonhelper::state->new("START", "Select Printing Options:");
     $paramHash = Apache::lonhelper::getParamHash();