--- loncom/interface/printout.pl 2009/06/02 12:20:14 1.142 +++ loncom/interface/printout.pl 2011/02/08 12:53:39 1.147 @@ -1,7 +1,7 @@ #!/usr/bin/perl # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc. # -# $Id: printout.pl,v 1.142 2009/06/02 12:20:14 bisitz Exp $ +# $Id: printout.pl,v 1.147 2011/02/08 12:53:39 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -171,14 +171,24 @@ Your cookie information is incorrect. END - return; + exit; } my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; &Apache::lonlocal::get_language_handle(); &Apache::loncommon::content_type(undef,'text/html'); $env{'request.noversionuri'} = '/cgi-bin/printout.pl'; -print(&Apache::loncommon::start_page('Creating PDF')); +# Breadcrumbs +#FIXME: Choose better/different breadcrumbs?!? Links? +my $brcrum = [{'href' => '', + 'text' => 'Helper'}, #FIXME: Different origin possible than print out helper? + {'href' => '', + 'text' => 'Preparing Printout'}, + {'href' => '', + 'text' => 'Creating PDF'}]; +print(&Apache::loncommon::start_page('Creating PDF', + undef, + {'bread_crumbs' => $brcrum,})); my $identifier = $ENV{'QUERY_STRING'}; my $texfile = $env{'cgi.'.$identifier.'.file'}; @@ -467,17 +477,23 @@ foreach $texfile (@texfile) { my $ps_file = my $tempo_file = $1.'temporar.ps'; my $pdf_file = $1.'.pdf'; $papera=~s/t/p/; + $comma = "fixps --force $new_name_file"; + &debug("FIXPS command: $comma"); + &busy_wait_command("$comma 1>$tempo_file 2>/dev/null", + "for $status_statement now validating PS", + \%prog_state,$tempo_file); + &busy_wait_command("mv $tempo_file $new_name_file", + 'File move', \%prog_state, $new_name_file); if ($laystyle eq 'album' and $numberofcolumns eq '2') { - $comma = "fixps --force ".$new_name_file." | psnup $papera -2 -s1.0 "; + $comma = "psnup $papera -2 -s1.0 $new_name_file"; &debug("PSNUP command: $comma"); - &busy_wait_command("$comma 1>$tempo_file 2>/dev/null", + &busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null", "for $status_statement now Modifying PS layout", \%prog_state,$tempo_file); } elsif ($laystyle eq 'book' and $numberofcolumns eq '2') { - $comma = 'fixps --force '.$new_name_file.' | pstops '.$papera.' "2:0+1(0.48w,0)"'; + $comma = 'pstops '.$papera.' "2:0+1(0.48w,0)" '.$new_name_file; &debug("PSTOPS command: $comma "); - - &busy_wait_command("$comma 1>$tempo_file 2>/dev/null", + &busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null", "for $status_statement now Modifying PS layout", \%prog_state,$tempo_file); } else { @@ -895,8 +911,8 @@ sub convert_figure { $not_eps =~ s/^\s+//; $not_eps =~ s/\s+$//; $not_eps =~ s/ /\\ /g; + my $prettyname=$not_eps; if ($advanced_role) { - my $prettyname=$not_eps; $prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; $prettyname=~s|$perlvar{'lonDocRoot'}/|/|; &Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state, @@ -919,6 +935,13 @@ sub convert_figure { system("pdftops $not_eps $eps_f"); } else { system("convert $not_eps $eps_f"); + if($? and $advanced_role){ + print "

" + .mt("An error occured during the conversion of [_1].[_2]" + ."If possible try to save this image using different settings and republish it.", + "".$prettyname."", "
") + ."

"; + } } if (not -e $eps_f) {