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

sakharuk lon-capa-cvs@mail.lon-capa.org
Tue, 19 Nov 2002 15:45:26 -0000


sakharuk		Tue Nov 19 10:45:26 2002 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug 974 (Printout for construction space directories) is partly resolved. Now
  you can print a short message that you are trying to print eather sequence or something like this. In addition I removed the menu item with invitation to print the whole subdirectory. I've written "partly" because we have to determine 
  what we really have to print in this case (for example, the contents of subdirectory) and to whom we have to give this possibility (course coordinator, author, ta, ...).
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.91 loncom/interface/lonprintout.pm:1.92
--- loncom/interface/lonprintout.pm:1.91	Mon Nov 18 15:30:49 2002
+++ loncom/interface/lonprintout.pm	Tue Nov 19 10:45:25 2002
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.91 2002/11/18 20:30:49 sakharuk Exp $
+# $Id: lonprintout.pm,v 1.92 2002/11/19 15:45:25 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -107,7 +107,7 @@
     }
       my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'});
       $subdirtoprint =~ s/\/[^\/]+$//;
-      if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') {
+      if ((&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') and ($ENV{'form.postdata'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/)) {
 	  $r->print(<<ENDMENUOUT4);
   <input type="radio" name="choice" value="Subdirectory print">  Problems from current subdirectory <b>$subdir_to_print</b><br />
 ENDMENUOUT4
@@ -449,19 +449,23 @@
     if ($choice eq 'Standard LaTeX output for current document') {
       #-- single document - problem, page, html, xml  
       $selectionmade = 1;
-      my %moreenv;
-      $moreenv{'form.grade_target'}='tex';
-      if (&Apache::lonnet::allowed('bre',$ENV{'form.url'})) {
+      if ($ENV{'form.url'}=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
+        my %moreenv;
+        $moreenv{'form.grade_target'}='tex';
+        if (&Apache::lonnet::allowed('bre',$ENV{'form.url'})) {
 	  $ENV{'form.url'}=~s/http:\/\/[^\/]+//;
-      }
-      $moreenv{'request.filename'}=$ENV{'form.url'};
-      $moreenv{'form.textwidth'}=$LaTeXwidth;
-      &Apache::lonnet::appenv(%moreenv);
-      my $texversion=&Apache::lonnet::ssi($ENV{'form.url'});
-      &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
-      $result .= $texversion;
-      if ($ENV{'form.url'}=~m/\.page\s*$/) {
+        }
+        $moreenv{'request.filename'}=$ENV{'form.url'};
+        $moreenv{'form.textwidth'}=$LaTeXwidth;
+        &Apache::lonnet::appenv(%moreenv);
+        my $texversion=&Apache::lonnet::ssi($ENV{'form.url'});
+        &Apache::lonnet::delenv('form.grade_target','form.textwidth','form.counter');
+        $result .= $texversion;
+        if ($ENV{'form.url'}=~m/\.page\s*$/) {
 	  ($result,$number_of_columns) = &page_cleanup($result);
+        }
+      } else{
+        $result='\documentclass[letterpaper]{article}\usepackage{calc}\begin{document}You are trying to print eather sequence or something simular. Currently this option is not supported. Sorry for the inconvenience. Bye.\end{document}'
       }
     } elsif ($choice eq 'Standard LaTeX output for the primary sequence' or 
              $choice eq 'Standard LaTeX output for whole primary sequence') {