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};
 
  30     source    => $params{file_name},
 
  31     form      => $params{form},
 
  32     myconfig  => $params{myconfig}  || \%::myconfig,
 
  33     userspath => $params{userspath} || $::lx_office_conf{paths}->{userspath},
 
  37 sub available_templates {
 
  40   # is there a templates basedir
 
  41   if (!-d $::lx_office_conf{paths}->{templates}) {
 
  42     $::form->error(sprintf($::locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
 
  45   tie my %dir_h, 'IO::Dir', $::lx_office_conf{paths}->{templates};
 
  47   my @alldir  = sort grep {
 
  48        -d ($::lx_office_conf{paths}->{templates} . "/$_")
 
  50     && !m/\.(?:html|tex|sty|odt|xml|txb)$/
 
  51     && !m/^(?:webpages$|print$|mail$|\.)/
 
  54   tie %dir_h, 'IO::Dir', "$::lx_office_conf{paths}->{templates}/print";
 
  55   my @allmaster = ('Standard', sort grep { -d ("$::lx_office_conf{paths}->{templates}/print" . "/$_") && !/^\.\.?$/ && !/^Standard$/ } keys %dir_h);
 
  58     print_templates  => \@alldir,
 
  59     master_templates => \@allmaster,