my $self = $type->SUPER::new(@_);
$self->{"rnd"} = int(rand(1000000));
- $self->{"iconv"} = SL::Iconv->new($main::dbcharset, "UTF-8");
+ $self->{"iconv"} = SL::Iconv->new($::lx_office_conf{system}->{dbcharset}, "UTF-8");
$self->set_tag_style('<%', '%>');
$self->{quot_re} = '"';
my $ary = $self->_get_loop_variable($var, 1, @indices);
- for (my $i = 0; $i < scalar(@{$ary}); $i++) {
+ for (my $i = 0; $i < scalar(@{$ary || []}); $i++) {
$form->{"__first__"} = $i == 0;
$form->{"__last__"} = ($i + 1) == scalar(@{$ary});
$form->{"__odd__"} = (($i + 1) % 2) == 1;
my $pid = fork();
if (0 == $pid) {
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
- exec($main::xvfb_bin, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp");
+ exec($::lx_office_conf{applications}->{xvfb}, $display, "-screen", "0", "640x480x8", "-nolisten", "tcp");
}
sleep(3);
$main::lxdebug->message(LXDebug->DEBUG2(), " parent dont sleeping\n");
local *OUT;
my $dfname = $self->{"userspath"} . "/xvfb_display";
- if (!open(OUT, ">$dfname")) {
+ if (!open(OUT, ">", $dfname)) {
$self->{"error"} = "Conversion to PDF failed because OpenOffice could not be started ($dfname: $!)";
unlink($xauthority);
kill($pid);
sub is_openoffice_running {
$main::lxdebug->enter_sub();
- my $output = `./scripts/oo-uno-test-conn.py $main::openofficeorg_daemon_port 2> /dev/null`;
+ my $cmd = "./scripts/oo-uno-test-conn.py " . $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . " 2> /dev/null";
+ my $output = `$cmd`;
chomp $output;
my $res = ($? == 0) || $output;
exit if ($new_pid);
my $ssres = setsid();
$main::lxdebug->message(LXDebug->DEBUG2(), " Child execing\n");
- my @cmdline = ($main::openofficeorg_writer_bin,
+ my @cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer},
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"-accept=socket,host=localhost,port=" .
- $main::openofficeorg_daemon_port . ";urp;");
+ $::lx_office_conf{print_templates}->{openofficeorg_daemon_port} . ";urp;");
exec(@cmdline);
}
}
my @cmdline;
- if (!$main::openofficeorg_daemon) {
- @cmdline = ($main::openofficeorg_writer_bin,
+ if (!$::lx_office_conf{print_templates}->{openofficeorg_daemon}) {
+ @cmdline = ($::lx_office_conf{applications}->{openofficeorg_writer},
"-minimized", "-norestore", "-nologo", "-nolockcheck",
"-headless",
"file:${filename}.odt",
}
@cmdline = ("./scripts/oo-uno-convert-pdf.py",
- $main::openofficeorg_daemon_port,
+ $::lx_office_conf{print_templates}->{openofficeorg_daemon_port},
"${filename}.odt");
}