Revision 9ead220c
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
SL/Template.pm | ||
---|---|---|
10 | 10 |
|
11 | 11 |
use strict; |
12 | 12 |
|
13 |
use IO::Dir; |
|
14 |
|
|
13 | 15 |
use SL::Template::Simple; |
14 | 16 |
use SL::Template::Excel; |
15 | 17 |
use SL::Template::HTML; |
... | ... | |
26 | 28 |
$package->new($params{file_name}, $params{form}, $params{myconfig} || \%::myconfig, $params{userspath} || $::lx_office_conf{paths}->{userspath}); |
27 | 29 |
} |
28 | 30 |
|
31 |
sub available_templates { |
|
32 |
my ($class) = @_; |
|
33 |
|
|
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})); |
|
37 |
} |
|
38 |
|
|
39 |
tie my %dir_h, 'IO::Dir', $::lx_office_conf{paths}->{templates}; |
|
40 |
|
|
41 |
my @alldir = sort grep { |
|
42 |
-d ($::lx_office_conf{paths}->{templates} . "/$_") |
|
43 |
&& !/^\.\.?$/ |
|
44 |
&& !m/\.(?:html|tex|sty|odt|xml|txb)$/ |
|
45 |
&& !m/^(?:webpages$|print$|mail$|\.)/ |
|
46 |
} keys %dir_h; |
|
47 |
|
|
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); |
|
50 |
|
|
51 |
return ( |
|
52 |
print_templates => \@alldir, |
|
53 |
master_templates => \@allmaster, |
|
54 |
); |
|
55 |
} |
|
56 |
|
|
29 | 57 |
1; |
bin/mozilla/admin.pl | ||
---|---|---|
55 | 55 |
use SL::Inifile; |
56 | 56 |
use SL::DBUpgrade2; |
57 | 57 |
use SL::DBUtils; |
58 |
use SL::Template; |
|
58 | 59 |
|
59 | 60 |
require "bin/mozilla/common.pl"; |
60 | 61 |
require "bin/mozilla/admin_groups.pl"; |
... | ... | |
1168 | 1169 |
} |
1169 | 1170 |
|
1170 | 1171 |
sub _search_templates { |
1171 |
# is there a templates basedir |
|
1172 |
if (!-d $::lx_office_conf{paths}->{templates}) { |
|
1173 |
$::form->error(sprintf($::locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates})); |
|
1174 |
} |
|
1175 |
|
|
1176 |
tie my %dir_h, 'IO::Dir', $::lx_office_conf{paths}->{templates}; |
|
1177 |
|
|
1178 |
my @alldir = sort grep { |
|
1179 |
-d ($::lx_office_conf{paths}->{templates} . "/$_") |
|
1180 |
&& !/^\.\.?$/ |
|
1181 |
&& !m/\.(?:html|tex|sty|odt|xml|txb)$/ |
|
1182 |
&& !m/^(?:webpages$|print$|mail$|\.)/ |
|
1183 |
} keys %dir_h; |
|
1184 |
|
|
1185 |
tie %dir_h, 'IO::Dir', "$::lx_office_conf{paths}->{templates}/print"; |
|
1186 |
my @allmaster = ('Standard', sort grep { -d ("$::lx_office_conf{paths}->{templates}/print" . "/$_") && !/^\.\.?$/ && !/^Standard$/ } keys %dir_h); |
|
1172 |
my %templates = SL::Template->available_templates; |
|
1187 | 1173 |
|
1188 |
return \@alldir, \@allmaster;
|
|
1174 |
return ($templates{print_templates}, $templates{master_templates});
|
|
1189 | 1175 |
} |
1190 | 1176 |
|
1191 | 1177 |
1; |
Auch abrufbar als: Unified diff
Funktion zum Auflisten vorhandener Druckvorlagen nach SL::Template verschoben