--- loncom/interface/printout.pl 2004/02/18 22:23:19 1.50 +++ loncom/interface/printout.pl 2004/05/12 18:44:50 1.58 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.50 2004/02/18 22:23:19 albertel Exp $ +# $Id: printout.pl,v 1.58 2004/05/12 18:44:50 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -33,6 +33,8 @@ use File::Path; use IO::File; use Image::Magick; use Apache::lonhtmlcommon; +use Apache::loncommon; +use Apache::lonlocal; $|=1; my %origENV=%ENV; @@ -49,9 +51,10 @@ Your cookie information is incorrect. END return; } - - print "Content-type: text/html\n\n"; - print "\n"; + &Apache::lonlocal::get_language_handle(); + &Apache::loncommon::content_type(undef,'text/html'); + my $bodytag=&Apache::loncommon::bodytag('Creating PDF','',''); + print $bodytag; my $identifier = $ENV{'QUERY_STRING'}; my $texfile = $ENV{'cgi.'.$identifier.'.file'}; @@ -86,7 +89,7 @@ END close $temporary_file; my $noteps; my %prog_state; - if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Coverting Images to EPS','Picture Conversion Status',$#content_of_file); } + if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Coverting Images to EPS','Picture Conversion Status',$#content_of_file,'inline','75'); } foreach $not_eps (@content_of_file) { chomp($not_eps); if ($not_eps ne '') { @@ -97,9 +100,12 @@ END if ($eps_f=~/\/home\/([^\/]+)\/public_html\//) { $eps_f=~s/\/home\/([^\/]+)\/public_html/$1/; $eps_f = '/home/httpd/prtspool/'.$eps_f; - } else { - $eps_f=~m/\/home\/httpd\/html\/res\/(.+)/; + } elsif ($eps_f=~/$Apache::lonnet::perlvar{'lonDocRoot'}\/res\//) { + $eps_f=~m/$Apache::lonnet::perlvar{'lonDocRoot'}\/res\/(.+)/; $eps_f = '/home/httpd/prtspool/'.$1; + } elsif ($eps_f=~/$Apache::lonnet::perlvar{'lonUsersDir'}\//) { + $eps_f=~/$Apache::lonnet::perlvar{'lonUsersDir'}\/([^\/]+)\/\w\/\w\/\w\/(.+)/; + $eps_f = '/home/httpd/prtspool/'.$1.'/'.$2; } my $path=$eps_f; $path=~s/\/([^\/]+)\.eps$//; @@ -113,7 +119,7 @@ END if ($adv) { my $prettyname=$not_eps; $prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; - $prettyname=~s|/home/httpd/html/|/|; + $prettyname=~s|$Apache::lonnet::perlvar{'lonDocRoot'}/|/|; &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state,'Converting to EPS '.$prettyname); } $done_conversion{$not_eps}=1; $status = $image->Read($not_eps); @@ -133,6 +139,7 @@ END } } if ($adv) { &Apache::lonhtmlcommon::Close_PrgWin('',\%prog_state); } + unlink($figfile); } #print "$texfile\n"; #name of the tex file for debugging only my @texfile=($texfile); @@ -147,8 +154,8 @@ END my $ind=-1; my %prog_state; -if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status','Class Print Status',$number_of_files); } -my $final_statement="Return to last resource.

Generated PDF File for:
"; +if ($adv) { %prog_state=&Apache::lonhtmlcommon::Create_PrgWin('','Print Status','Class Print Status',$number_of_files,'inline','75'); } +my $final_statement="
Return to last resource.

Generated PDF File for:
"; foreach $texfile (@texfile) { my $status_statement=''; my $link_text='download PDF';