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

www lon-capa-cvs@mail.lon-capa.org
Sun, 30 Oct 2005 02:24:35 -0000


www		Sat Oct 29 22:24:35 2005 EDT

  Modified files:              
    /loncom/interface	lonprintout.pm 
  Log:
  Bug #4406: links to recently generated printout files in case computer
  crashed, connection broke, etc
  
  
Index: loncom/interface/lonprintout.pm
diff -u loncom/interface/lonprintout.pm:1.394 loncom/interface/lonprintout.pm:1.395
--- loncom/interface/lonprintout.pm:1.394	Fri Oct  7 06:21:08 2005
+++ loncom/interface/lonprintout.pm	Sat Oct 29 22:24:34 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.394 2005/10/07 10:21:08 foxr Exp $
+# $Id: lonprintout.pm,v 1.395 2005/10/30 02:24:34 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -903,6 +903,29 @@
 
 
 #
+# List of recently generated print files
+#
+
+sub recently_generated {
+    my $r=shift;
+    my $prtspool=$r->dir_config('lonPrtDir');
+    $r->print('<h4>'.&mt('Recently generated printouts').'</h4>');
+    opendir(DIR,$prtspool);
+    while (my $filename=readdir(DIR)) {
+	if ($filename=~/^$env{'user.name'}\_$env{'user.domain'}\_printout\_(\d+)\_.*.pdf$/) {
+	    my ($cdev,$cino,$cmode,$cnlink,
+		$cuid,$cgid,$crdev,$csize,
+		$catime,$cmtime,$cctime,
+		$cblksize,$cblocks)=stat($prtspool.'/'.$filename);
+            $r->print ("<a href='/prtspool/$filename'>".
+		&mt('Generated').' '.&Apache::lonlocal::locallocaltime($cctime).
+		       ' ('.$csize.' bytes)</a><br />');
+	}
+    }
+    closedir(DIR);
+}
+
+#
 #   Retrieve the hash of page breaks.
 #
 #  Inputs:
@@ -2462,7 +2485,6 @@
 	    $helper->{'VARS'}->{'style_file'}=$env{'form.style_file_value'};
 	    
 	} 
-
     }
 
 
@@ -2489,7 +2511,9 @@
     }    
 
     $r->print($helper->display());
-
+    if ($helper->{STATE} eq 'START') {
+	&recently_generated($r);
+    }
     &Apache::lonhelper::unregisterHelperTags();
 
     return OK;