--- loncom/interface/lonprintout.pm 2010/08/26 09:30:10 1.583.2.2
+++ loncom/interface/lonprintout.pm 2010/11/09 19:19:25 1.583.2.4
@@ -2,7 +2,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.583.2.2 2010/08/26 09:30:10 raeburn Exp $
+# $Id: lonprintout.pm,v 1.583.2.4 2010/11/09 19:19:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1685,8 +1685,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);
@@ -1719,10 +1719,10 @@ sub recently_generated {
if ($ext eq 'zip') { $zip_result .= $result; }
}
if ($zip_result || $pdf_result) {
- $r->print('
');
+ $output ='
';
}
if ($zip_result) {
- $r->print(''.&mt('Recently generated printout zip files')."
\n"
+ $output .=''.&mt('Recently generated printout zip files')."
\n"
.&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.''.&mt('Download').' | '
@@ -1730,11 +1730,10 @@ sub recently_generated {
.''.&mt('File Size (Bytes)').' | '
.&Apache::loncommon::end_data_table_header_row()
.$zip_result
- .&Apache::loncommon::end_data_table()
- );
+ .&Apache::loncommon::end_data_table();
}
if ($pdf_result) {
- $r->print(''.&mt('Recently generated printouts')."
\n"
+ $output .=''.&mt('Recently generated printouts')."
\n"
.&Apache::loncommon::start_data_table()
.&Apache::loncommon::start_data_table_header_row()
.''.&mt('Download').' | '
@@ -1742,9 +1741,9 @@ sub recently_generated {
.''.&mt('File Size (Bytes)').' | '
.&Apache::loncommon::end_data_table_header_row()
.$pdf_result
- .&Apache::loncommon::end_data_table()
- );
+ .&Apache::loncommon::end_data_table();
}
+ return $output;
}
#
@@ -3143,6 +3142,11 @@ sub init_perm {
$perm{'pfo'}=&Apache::lonnet::allowed('pfo',
$env{'request.course.id'}.'/'.$env{'request.course.sec'});
}
+ $perm{'vgr'}=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
+ if (!$perm{'vgr'}) {
+ $perm{'vgr'}=&Apache::lonnet::allowed('vgr',
+ $env{'request.course.id'}.'/'.$env{'request.course.sec'});
+ }
}
sub get_randomly_ordered_warning {
@@ -3882,7 +3886,7 @@ CHOOSE_FROM_ANY_SEQUENCE
my $startedTable = 0; # have we started an HTML table yet? (need
# to close it later)
- if (($perm{'pav'} and &Apache::lonnet::allowed('vgr',$env{'request.course.id'})) or
+ if (($perm{'pav'} and $perm{'vgr'}) or
($helper->{VARS}->{'construction'} eq '1')) {
&addMessage('
'
.''.&mt('Print Options').'
'
@@ -4129,10 +4133,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;