version 1.141, 2009/04/17 10:02:49
|
version 1.146.4.3, 2014/02/13 17:47:30
|
Line 127 sub send_error_mail {
|
Line 127 sub send_error_mail {
|
|
|
# Todo: Convert badurl into a url from file path: |
# Todo: Convert badurl into a url from file path: |
|
|
my $subject = "Error [$badurl] Print failed for $user".'@'.$domain; |
my $subject = "Error [$badurl] Print failed for $user".':'.$domain; |
my $message .= "Print failed to render LaTeX for $user".'@'."$domain\n"; |
my $message .= "Print failed to render LaTeX for $user".':'."$domain\n"; |
$message .= " User was attempting to print: \n"; |
$message .= " User was attempting to print: \n"; |
foreach my $resource (split(/:/,$resources)) { |
foreach my $resource (split(/:/,$resources)) { |
$message .= " $resource\n"; |
$message .= " $resource\n"; |
Line 171 Your cookie information is incorrect.
|
Line 171 Your cookie information is incorrect.
|
</body> |
</body> |
</html> |
</html> |
END |
END |
return; |
exit; |
} |
} |
|
|
my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; |
my %perlvar=%{&LONCAPA::Configuration::read_conf('loncapa.conf')}; |
&Apache::lonlocal::get_language_handle(); |
&Apache::lonlocal::get_language_handle(); |
&Apache::loncommon::content_type(undef,'text/html'); |
&Apache::loncommon::content_type(undef,'text/html'); |
$env{'request.noversionuri'} = '/cgi-bin/printout.pl'; |
$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 $identifier = $ENV{'QUERY_STRING'}; |
my $texfile = $env{'cgi.'.$identifier.'.file'}; |
my $texfile = $env{'cgi.'.$identifier.'.file'}; |
Line 298 foreach $texfile (@texfile) {
|
Line 308 foreach $texfile (@texfile) {
|
my $name; |
my $name; |
my $name_range=''; |
my $name_range=''; |
|
|
# $name -> Either user's full name or username@domain |
# $name -> Either user's full name or username:domain |
# $name_range -> Either user's last name or usrname. |
# $name_range -> Either user's last name or username. |
|
|
if ($tempo_array[3]) { |
if ($tempo_array[3]) { |
$name=$tempo_array[3]; |
$name=$tempo_array[3]; |
($name_range) = split(/,/,$name, 2); |
$name =~ s{^\s+|\s+$}{}g; |
|
if ($name =~ /,/) { |
|
($name_range) = split(/,/,$name, 2); |
|
} elsif ($name =~ /\s/) { |
|
$name_range = $name; |
|
$name_range =~ s/\s+/_/; |
|
} else { |
|
$name_range = $name; |
|
} |
|
$name_range =~ s/[^\w\:\-]+//g; |
} else { |
} else { |
$name=$tempo_array[0].'@'.$tempo_array[1]; |
$name=$tempo_array[0].':'.$tempo_array[1]; |
$name_range = $tempo_array[0]; |
$name_range = $tempo_array[0]; |
} |
} |
|
|
Line 313 foreach $texfile (@texfile) {
|
Line 332 foreach $texfile (@texfile) {
|
# user is getting printed. |
# user is getting printed. |
# |
# |
|
|
if (($name ne "") && ($name ne '@') ) { # Could be printing codes... |
if (($name ne "") && ($name ne ':') ) { # Could be printing codes... |
$link_text='<b>'.$name.'</b>'; |
$link_text='<b>'.$name.'</b>'; |
$status_statement.=$name; |
$status_statement.=$name; |
} |
} |
Line 326 foreach $texfile (@texfile) {
|
Line 345 foreach $texfile (@texfile) {
|
@tempo_array=split(/:/,$stud_info[-1]); |
@tempo_array=split(/:/,$stud_info[-1]); |
if ($tempo_array[3]) { |
if ($tempo_array[3]) { |
$name=$tempo_array[3]; |
$name=$tempo_array[3]; |
my ($lastname) = split(/,/, $name,2); |
$name =~ s{^\s+|\s+$}{}g; |
$name_range .= "-".$lastname; |
my $lastname; |
|
if ($name =~ /,/) { |
|
($lastname) = split(/,/, $name,2); |
|
} elsif ($name =~ /\s/) { |
|
$lastname = $name; |
|
$lastname =~ s/\s+/_/; |
|
} else { |
|
$lastname = $name; |
|
} |
|
$name_range .= "-".$lastname; |
|
$name_range =~ s/[^\w\:\-]+//g; |
} else { |
} else { |
$name=$tempo_array[0].'@'.$tempo_array[1]; |
$name=$tempo_array[0].':'.$tempo_array[1]; |
$name_range .= '-'.$tempo_array[0]; |
$name_range .= '-'.$tempo_array[0]; |
} |
} |
if (($name ne "") && ($name ne '@')) { |
if (($name ne "") && ($name ne ':')) { |
$link_text.=' - <b>'.$name.'</b>'; |
$link_text.=' - <b>'.$name.'</b>'; |
$status_statement.=' - '.$name; |
$status_statement.=' - '.$name; |
|
|
Line 468 foreach $texfile (@texfile) {
|
Line 497 foreach $texfile (@texfile) {
|
my $pdf_file = $1.'.pdf'; |
my $pdf_file = $1.'.pdf'; |
$papera=~s/t/p/; |
$papera=~s/t/p/; |
if ($laystyle eq 'album' and $numberofcolumns eq '2') { |
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"); |
&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", |
"for $status_statement now Modifying PS layout", |
\%prog_state,$tempo_file); |
\%prog_state,$tempo_file); |
} elsif ($laystyle eq 'book' and $numberofcolumns eq '2') { |
} 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 "); |
&debug("PSTOPS command: $comma "); |
|
&busy_wait_command("$comma $tempo_file 1>/dev/null 2>/dev/null", |
&busy_wait_command("$comma 1>$tempo_file 2>/dev/null", |
|
"for $status_statement now Modifying PS layout", |
"for $status_statement now Modifying PS layout", |
\%prog_state,$tempo_file); |
\%prog_state,$tempo_file); |
} else { |
} else { |
Line 895 sub convert_figure {
|
Line 923 sub convert_figure {
|
$not_eps =~ s/^\s+//; |
$not_eps =~ s/^\s+//; |
$not_eps =~ s/\s+$//; |
$not_eps =~ s/\s+$//; |
$not_eps =~ s/ /\\ /g; |
$not_eps =~ s/ /\\ /g; |
|
my $prettyname=$not_eps; |
if ($advanced_role) { |
if ($advanced_role) { |
my $prettyname=$not_eps; |
|
$prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; |
$prettyname=~s|/home/([^/]+)/public_html|/priv/$1|; |
$prettyname=~s|$perlvar{'lonDocRoot'}/|/|; |
$prettyname=~s|$perlvar{'lonDocRoot'}/|/|; |
&Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state, |
&Apache::lonhtmlcommon::Update_PrgWin('',\%prog_state, |
Line 919 sub convert_figure {
|
Line 947 sub convert_figure {
|
system("pdftops $not_eps $eps_f"); |
system("pdftops $not_eps $eps_f"); |
} else { |
} else { |
system("convert $not_eps $eps_f"); |
system("convert $not_eps $eps_f"); |
|
if ($? and $advanced_role) { |
|
print '<p class="LC_warning">' |
|
.&mt('An error occured during the conversion of [_1].[_2]If possible try to save this image using different settings and republish it.', |
|
'<span class="LC_filename">'.$prettyname.'</span>','<br/>') |
|
.'</p>'; |
|
} |
} |
} |
|
|
if (not -e $eps_f) { |
if (not -e $eps_f) { |
Line 1056 sub analyze_logfile {
|
Line 1090 sub analyze_logfile {
|
# $name_file - is the name of the LaTeX file. |
# $name_file - is the name of the LaTeX file. |
# $identifier - is the unique LaTeX identifier.l |
# $identifier - is the unique LaTeX identifier.l |
|
|
print "<br />"; |
print '<p class="LC_error">'; |
if ($badtext) { |
if ($badtext) { |
print &mt('There are errors in [_1].',$badtext); |
print &mt('There are errors in [_1].',$badtext); |
} else { |
} else { |
print &mt('There are errors.'); |
print &mt('There are errors.'); |
} |
} |
print "<br />".&mt('These errors prevent this resource from printing correctly.'); |
print '</p>' |
|
.&mt('These errors prevent this resource from printing correctly.'); |
|
|
my $tex_handle = IO::File->new($texfile); |
my $tex_handle = IO::File->new($texfile); |
my @tex_contents = <$tex_handle>; |
my @tex_contents = <$tex_handle>; |
&send_error_mail($identifier, $badresource, $body_log_file, \@tex_contents); |
&send_error_mail($identifier, $badresource, $body_log_file, \@tex_contents); |