--- loncom/interface/lonprintout.pm	2010/08/04 22:17:14	1.583
+++ loncom/interface/lonprintout.pm	2010/09/01 23:58:40	1.584
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # Printout
 #
-# $Id: lonprintout.pm,v 1.583 2010/08/04 22:17:14 raeburn Exp $
+# $Id: lonprintout.pm,v 1.584 2010/09/01 23:58:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1707,8 +1707,8 @@ sub print_page_in_course {
 # List of recently generated print files
 #
 sub recently_generated {
-    my $r=shift;
-    my $prtspool=$r->dir_config('lonPrtDir');
+    my ($prtspool) = @_;
+    my $output;
     my $zip_result;
     my $pdf_result;
     opendir(DIR,$prtspool);
@@ -1741,10 +1741,10 @@ sub recently_generated {
 	if ($ext eq 'zip') { $zip_result .= $result; }
     }
     if ($zip_result || $pdf_result) {
-        $r->print('<hr />');
+        $output ='<hr />';
     }
     if ($zip_result) {
-	$r->print('<h3>'.&mt('Recently generated printout zip files')."</h3>\n"
+	$output .='<h3>'.&mt('Recently generated printout zip files')."</h3>\n"
                   .&Apache::loncommon::start_data_table()
                   .&Apache::loncommon::start_data_table_header_row()
                   .'<th>'.&mt('Download').'</th>'
@@ -1752,11 +1752,10 @@ sub recently_generated {
                   .'<th>'.&mt('File Size (Bytes)').'</th>'
                   .&Apache::loncommon::end_data_table_header_row()
                   .$zip_result
-                  .&Apache::loncommon::end_data_table()
-        );
+                  .&Apache::loncommon::end_data_table();
     }
     if ($pdf_result) {
-	$r->print('<h3>'.&mt('Recently generated printouts')."</h3>\n"
+	$output .='<h3>'.&mt('Recently generated printouts')."</h3>\n"
                   .&Apache::loncommon::start_data_table()
                   .&Apache::loncommon::start_data_table_header_row()
                   .'<th>'.&mt('Download').'</th>'
@@ -1764,9 +1763,9 @@ sub recently_generated {
                   .'<th>'.&mt('File Size (Bytes)').'</th>'
                   .&Apache::loncommon::end_data_table_header_row()
                   .$pdf_result
-                  .&Apache::loncommon::end_data_table()
-        );
+                  .&Apache::loncommon::end_data_table();
     }
+    return $output;
 }
 
 #
@@ -4148,10 +4147,12 @@ PROBTYPE
         return $helper;
     }    
 
-    $r->print($helper->display());
+    my $footer;
     if ($helper->{STATE} eq 'START') {
-	&recently_generated($r);
+        my $prtspool=$r->dir_config('lonPrtDir'); 
+	$footer = &recently_generated($prtspool);
     }
+    $r->print($helper->display($footer));
     &Apache::lonhelper::unregisterHelperTags();
 
     return OK;