version 1.165, 2017/11/12 15:41:45
|
version 1.166, 2017/11/12 16:23:03
|
Line 41 use Apache::lonmsg();
|
Line 41 use Apache::lonmsg();
|
use LONCAPA::Enrollment; |
use LONCAPA::Enrollment; |
use LONCAPA::Configuration; |
use LONCAPA::Configuration; |
use LONCAPA; |
use LONCAPA; |
|
use Archive::Zip qw( :ERROR_CODES ); |
|
|
use strict; |
use strict; |
|
|
Line 597 foreach $texfile (@texfile) {
|
Line 598 foreach $texfile (@texfile) {
|
.'</p>'; |
.'</p>'; |
} |
} |
} |
} |
|
if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } |
print "<br />"; |
print "<br />"; |
if ($number_of_files>1) { |
if ($number_of_files>1) { |
|
print('<p>'.&mt('Zip Output:')."\n"); |
|
my %zip_prog_state; |
|
if ($advanced_role) { %zip_prog_state=&Apache::lonhtmlcommon::Create_PrgWin('',$number_of_files); } |
my $zipfile=$texfile[0]; |
my $zipfile=$texfile[0]; |
$zipfile=~s/\.tex/\.zip/; |
$zipfile=~s/\.tex/\.zip/; |
my $statement="zip $zipfile"; |
my $zip = Archive::Zip->new(); |
|
my $counter = 0; |
foreach my $file (@texfile) { |
foreach my $file (@texfile) { |
$file=~s/\.tex/.\pdf/; |
$file=~s/\.tex/.\pdf/; |
$statement.=' '.$file; |
my $dest=$file; |
|
$dest=~s{^\Q$perlvar{'lonPrtDir'}\E}{prtspool}; |
|
$zip->addFile($file,$dest); |
|
$dest=~s/^prtspool//; |
|
$counter ++; |
|
if ($advanced_role) { |
|
&Apache::lonhtmlcommon::Update_PrgWin('',\%zip_prog_state, |
|
&mt('[_1] added to zip archive ([_2] of [_3]', |
|
$dest,$counter,$number_of_files)); |
|
} |
|
} |
|
if ($advanced_role) { |
|
&Apache::lonhtmlcommon::Update_PrgWin('',\%zip_prog_state,&mt('Writing zip file')); |
} |
} |
print('<p>'.&mt('Zip Output:')."\n<pre>\n"); |
if ($zip->writeToFileNamed($zipfile) == AZ_OK) { |
system($statement); |
$zipfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; |
print("</pre></p>\n"); |
print |
$zipfile=~s{^\Q$perlvar{'lonPrtDir'}\E}{/prtspool}; |
'<p>' |
print |
.&mt('A [_1]ZIP file[_2] of all the PDF files is ready for download.', |
'<p>' |
'<a href="'.$zipfile.'">','</a>') |
.&mt('A [_1]ZIP file[_2] of all the PDF files is ready for download.', |
.'</p>'; |
'<a href="'.$zipfile.'">','</a>') |
} else { |
.'</p>'; |
print '<p class="LC_error">'. |
|
&mt('An error occurred creating a ZIP file of all the PDF files'). |
|
'</p>'; |
|
} |
|
if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%zip_prog_state); } |
} |
} |
if ($advanced_role) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } |
|
print(&Apache::loncommon::end_page()); |
print(&Apache::loncommon::end_page()); |
my $done; |
my $done; |
|
|