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;
 
  25   my $package = "SL::Template::" . $params{type};
 
  29     source    => $params{file_name},
 
  30     form      => $params{form},
 
  31     myconfig  => $params{myconfig}  || \%::myconfig,
 
  32     userspath => $params{userspath} || $::lx_office_conf{paths}->{userspath},
 
  36 sub available_templates {
 
  39   # is there a templates basedir
 
  40   if (!-d $::lx_office_conf{paths}->{templates}) {
 
  41     $::form->error(sprintf($::locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
 
  44   tie my %dir_h, 'IO::Dir', $::lx_office_conf{paths}->{templates};
 
  46   my @alldir  = sort grep {
 
  47        -d ($::lx_office_conf{paths}->{templates} . "/$_")
 
  49     && !m/\.(?:html|tex|sty|odt)$/
 
  50     && !m/^(?:webpages$|print$|mail$|\.)/
 
  53   tie %dir_h, 'IO::Dir', "$::lx_office_conf{paths}->{templates}/print";
 
  54   my @allmaster = (sort grep { -d ("$::lx_office_conf{paths}->{templates}/print" . "/$_") && !/^\.\.?$/ && !/^Standard$/ } keys %dir_h);
 
  57     print_templates  => \@alldir,
 
  58     master_templates => \@allmaster,