Revision ef888d16
Von Bernd Blessmann vor fast 13 Jahren hinzugefügt
bin/mozilla/amtemplates.pl | ||
---|---|---|
31 | 31 |
# |
32 | 32 |
#====================================================================== |
33 | 33 |
|
34 |
use File::Find; |
|
35 |
|
|
34 | 36 |
use SL::AM; |
35 | 37 |
use SL::Form; |
36 | 38 |
|
... | ... | |
113 | 115 |
|
114 | 116 |
$main::auth->assert('config'); |
115 | 117 |
|
116 |
$form->{"formname"} =~ s|.*/||; |
|
118 |
if ($form->{"formname"} =~ m|\.\.| || $form->{"formname"} =~ m|^/|) { |
|
119 |
$form->{"formname"} =~ s|.*/||; |
|
120 |
} |
|
121 |
|
|
117 | 122 |
my $format = $form->{"format"} eq "html" ? "html" : "tex"; |
118 | 123 |
|
119 | 124 |
$form->{"title"} = $form->{"type"} eq "stylesheet" ? $locale->text("Edit the stylesheet") : $locale->text("Edit templates"); |
... | ... | |
187 | 192 |
|
188 | 193 |
@values = sort({ $a->{"label"} cmp $b->{"label"} } @values); |
189 | 194 |
|
195 |
# |
|
196 |
# at the end: others/includes for tex |
|
197 |
# |
|
198 |
if ($format eq "tex") { |
|
199 |
# search all .tex-files in template dir (recursively) |
|
200 |
my @all_files; |
|
201 |
find( |
|
202 |
sub { |
|
203 |
next if (-l $_ || -d $_); |
|
204 |
next unless (-f $_ && $_ =~ m/.*?\.tex$/); |
|
205 |
|
|
206 |
my $fname = $File::Find::name; |
|
207 |
# remove template dir from name |
|
208 |
$fname =~ s|^$myconfig{templates}/||; |
|
209 |
# remove .tex from name |
|
210 |
$fname =~ s|.tex$||; |
|
211 |
|
|
212 |
push(@all_files, $fname); |
|
213 |
|
|
214 |
}, $myconfig{templates}); |
|
215 |
|
|
216 |
# filter all files already set up (i.e. not already in @values) |
|
217 |
my @other_files = grep { my $a=$_; not grep {$a eq $_->{value}} @values } @all_files; |
|
218 |
|
|
219 |
# add other tex files |
|
220 |
foreach my $o (@other_files) { |
|
221 |
push(@values, { "value" => $o, "label" => $locale->text("Others")." ($o)" }); |
|
222 |
} |
|
223 |
} |
|
224 |
|
|
190 | 225 |
$options{FORMNAME} = [ @values ]; |
191 | 226 |
|
192 | 227 |
# |
Auch abrufbar als: Unified diff
beliebige tex-Dateien im Vorlagenverzeichnis und Unterverzeichnissen anzeig- ...
... und editierbar gemacht.