Revision 4af0c21e
Von Bernd Blessmann vor fast 13 Jahren hinzugefügt
bin/mozilla/admin.pl | ||
---|---|---|
425 | 425 |
opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO"); |
426 | 426 |
my @all = readdir(TEMPLATEDIR); |
427 | 427 |
my @alldir = sort grep { -d ($::lx_office_conf{paths}->{templates} . "/$_") && !/^\.\.?$/ } @all; |
428 |
my @allhtml = sort grep { -f ($::lx_office_conf{paths}->{templates} . "/$_") && /\.html$/ } @all; |
|
429 | 428 |
closedir TEMPLATEDIR; |
430 | 429 |
|
431 | 430 |
@alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir; |
432 |
@alldir = grep !/^(webpages|\.svn)$/, @alldir; |
|
433 |
|
|
434 |
@allhtml = reverse grep !/Default/, @allhtml; |
|
435 |
push @allhtml, 'Default'; |
|
436 |
@allhtml = reverse @allhtml; |
|
431 |
@alldir = grep !/^(webpages|mstertemplates|\.svn)$/, @alldir; |
|
437 | 432 |
|
438 | 433 |
$form->{ALL_TEMPLATES} = [ map { { "name", => $_, "selected" => $_ eq $myconfig->{templates} } } @alldir ]; |
439 | 434 |
|
440 |
my $lastitem = $allhtml[0]; |
|
441 |
$lastitem =~ s/-.*//g; |
|
442 |
$form->{ALL_MASTER_TEMPLATES} = [ { "name" => $lastitem, "selected" => $lastitem eq "German" } ]; |
|
443 |
foreach my $item (@allhtml) { |
|
444 |
$item =~ s/-.*//g; |
|
445 |
next if ($item eq $lastitem); |
|
435 |
# mastertemplates |
|
436 |
opendir TEMPLATEDIR, "$::lx_office_conf{paths}->{templates}/mastertemplates" or $form->error("$::lx_office_conf{paths}->{templates}/mastertemplates" . " : $ERRNO"); |
|
437 |
my @allmaster = readdir(TEMPLATEDIR); |
|
438 |
closedir TEMPLATEDIR; |
|
439 |
|
|
440 |
@allmaster = sort grep { -d ("$::lx_office_conf{paths}->{templates}/mastertemplates" . "/$_") && !/^\.\.?$/ } @allmaster; |
|
441 |
@allmaster = reverse grep !/Default/, @allmaster; |
|
442 |
push @allmaster, 'Default'; |
|
443 |
@allmaster = reverse @allmaster; |
|
446 | 444 |
|
445 |
foreach my $item (@allmaster) { |
|
447 | 446 |
push @{ $form->{ALL_MASTER_TEMPLATES} }, { "name" => $item, "selected" => $item eq "German" }; |
448 |
$lastitem = $item; |
|
449 | 447 |
} |
450 | 448 |
|
451 | 449 |
# css dir has styles that are not intended as general layouts. |
... | ... | |
541 | 539 |
umask(007); |
542 | 540 |
|
543 | 541 |
# copy templates to the directory |
544 |
opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO"); |
|
545 |
my @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/, |
|
542 |
my $templatedir = "$::lx_office_conf{paths}->{templates}/mastertemplates/$form->{mastertemplates}"; |
|
543 |
|
|
544 |
opendir TEMPLATEDIR, $templatedir or $form->error($templatedir . " : $ERRNO"); |
|
545 |
my @templates = grep /.*?\.(html|tex|sty|odt|xml|txb)$/, |
|
546 | 546 |
readdir TEMPLATEDIR; |
547 | 547 |
closedir TEMPLATEDIR; |
548 | 548 |
|
549 | 549 |
foreach my $file (@templates) { |
550 |
open(TEMP, "<", $::lx_office_conf{paths}->{templates} . "/$file")
|
|
551 |
or $form->error($::lx_office_conf{paths}->{templates} . "/$file : $ERRNO");
|
|
550 |
open(TEMP, "<", $templatedir . "/$file")
|
|
551 |
or $form->error($templatedir . "/$file : $ERRNO");
|
|
552 | 552 |
|
553 |
$file =~ s/\Q$form->{mastertemplates}\E-//; |
|
554 | 553 |
open(NEW, ">", "$form->{templates}/$file") |
555 | 554 |
or $form->error("$form->{templates}/$file : $ERRNO"); |
556 | 555 |
|
Auch abrufbar als: Unified diff
Vorlagensätze nach mastertemplates in eigene Verzeichnisse verschoben.