1 #====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #====================================================================
15 use SL::Template::Simple;
16 use SL::Template::Excel;
17 use SL::Template::HTML;
18 use SL::Template::LaTeX;
19 use SL::Template::OpenDocument;
20 use SL::Template::PlainText;
21 use SL::Template::ShellCommand;
22 use SL::Template::XML;
26 my $package = "SL::Template::" . $params{type};
28 $package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::lx_office_conf{paths}->{userspath});
31 sub available_templates {
34 # is there a templates basedir
35 if (!-d $::lx_office_conf{paths}->{templates}) {
36 $::form->error(sprintf($::locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
39 tie my %dir_h, 'IO::Dir', $::lx_office_conf{paths}->{templates};
41 my @alldir = sort grep {
42 -d ($::lx_office_conf{paths}->{templates} . "/$_")
44 && !m/\.(?:html|tex|sty|odt|xml|txb)$/
45 && !m/^(?:webpages$|print$|mail$|\.)/
48 tie %dir_h, 'IO::Dir', "$::lx_office_conf{paths}->{templates}/print";
49 my @allmaster = ('Standard', sort grep { -d ("$::lx_office_conf{paths}->{templates}/print" . "/$_") && !/^\.\.?$/ && !/^Standard$/ } keys %dir_h);
52 print_templates => \@alldir,
53 master_templates => \@allmaster,