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

foxr lon-capa-cvs@mail.lon-capa.org
Mon, 25 Jul 2005 10:27:54 -0000


foxr		Mon Jul 25 06:27:54 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm printout.pl 
  Log:
  bug 4047 - get filenames uniquified by a serial number for now (first
  suggestion).
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.378 loncom/interface/lonprintout.pm:1.379
--- loncom/interface/lonprintout.pm:1.378	Tue Jul 12 17:16:52 2005
+++ loncom/interface/lonprintout.pm	Mon Jul 25 06:27:51 2005
@@ -1,7 +1,7 @@
 #  The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.378 2005/07/12 21:16:52 albertel Exp $
+# $Id: lonprintout.pm,v 1.379 2005/07/25 10:27:51 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1373,7 +1373,7 @@
 #-- writing .tex file in prtspool 
     my $temp_file;
     my $identifier = &Apache::loncommon::get_cgi_id();
-    my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_".$identifier.".tex";
+    my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout_$identifier.tex";
     if (!($#print_array>0)) { 
 	unless ($temp_file = Apache::File->new('>'.$filename)) {
 	    $r->log_error("Couldn't open $filename for output $!");
@@ -1396,7 +1396,8 @@
 	    my $temp_file;
 	    my $newfilename=$filename;
 	    my $num=$i+1;
-	    $newfilename =~s/\.tex$/_$num\.tex/; 
+	    $newfilename =~s/\.tex$//; 
+	    $newfilename=sprintf("%s_%03d.tex",$newfilename, $num);
 	    unless ($temp_file = Apache::File->new('>'.$newfilename)) {
 		$r->log_error("Couldn't open $newfilename for output $!");
 		return SERVER_ERROR; 
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.85 loncom/interface/printout.pl:1.86
--- loncom/interface/printout.pl:1.85	Fri Jul 22 07:42:50 2005
+++ loncom/interface/printout.pl	Mon Jul 25 06:27:51 2005
@@ -262,7 +262,9 @@
       @texfile=();
       for (my $i=1;$i<=$number_of_files;$i++) {
 	  my $new_texfile=$texfile;
-	  $new_texfile=~s/\.tex/_$i\.tex/;
+	  $new_texfile=~s/\.tex//;
+	  $new_texfile = sprintf("%s_%03d.tex", $new_texfile,$i);
+	  print "<BR>Produced file: $new_texfile";
 	  push @texfile,$new_texfile;
       } 
   }