Manage template inclusion when file is not in configured portal theme (#1653)
This commit is contained in:
parent
413cc98fba
commit
ae3a728378
|
@ -17,7 +17,7 @@ has languages => ( is => 'rw', isa => 'Str', default => 'en' );
|
|||
has logLevel => ( is => 'rw', isa => 'Str', default => 'info' );
|
||||
has portal => ( is => 'rw', isa => 'Str' );
|
||||
has staticPrefix => ( is => 'rw', isa => 'Str' );
|
||||
has templateDir => ( is => 'rw', isa => 'Str' );
|
||||
has templateDir => ( is => 'rw', isa => 'Str|ArrayRef' );
|
||||
has links => ( is => 'rw', isa => 'ArrayRef' );
|
||||
has menuLinks => ( is => 'rw', isa => 'ArrayRef' );
|
||||
has logger => ( is => 'rw' );
|
||||
|
@ -250,6 +250,7 @@ sub sendHtml {
|
|||
$htpl = HTML::Template->new(
|
||||
filehandle => IO::File->new($template),
|
||||
path => $self->templateDir,
|
||||
search_path_on_include => 1,
|
||||
die_on_bad_params => 0,
|
||||
die_on_missing_include => 1,
|
||||
cache => 0,
|
||||
|
|
|
@ -15,7 +15,7 @@ use Email::Sender::Transport::SMTP qw();
|
|||
use MIME::Base64;
|
||||
use Encode;
|
||||
|
||||
our $VERSION = '2.0.2';
|
||||
our $VERSION = '2.0.3';
|
||||
|
||||
our $transport;
|
||||
|
||||
|
@ -185,7 +185,9 @@ sub send_mail {
|
|||
$message->attach(
|
||||
Type => "image/" . ( $cid{$_} =~ m/\.(\w+)/ )[0],
|
||||
Id => $_,
|
||||
Path => $self->p->{templateDir} . "/" . $cid{$_},
|
||||
Path => $self->conf->{templateDir} . "/"
|
||||
. $self->conf->{portalSkin} . "/"
|
||||
. $cid{$_},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,6 +194,8 @@ sub reloadConf {
|
|||
$self->error("Template dir $self->{templateDir} doesn't exist");
|
||||
return $self->fail;
|
||||
}
|
||||
$self->templateDir(
|
||||
[ $self->{templateDir}, $self->conf->{templateDir} . '/bootstrap' ] );
|
||||
|
||||
$self->{staticPrefix} = $self->conf->{staticPrefix} || '/static';
|
||||
$self->{languages} = $self->conf->{languages} || '/';
|
||||
|
|
|
@ -743,6 +743,7 @@ sub sendHtml {
|
|||
my ( $self, $req, $template, %args ) = @_;
|
||||
|
||||
my $templateDir = $self->conf->{templateDir} . '/' . $self->getSkin($req);
|
||||
$self->templateDir( [ $templateDir, @{ $self->templateDir } ] );
|
||||
|
||||
# Check template
|
||||
$args{templateDir} = $templateDir;
|
||||
|
@ -1004,17 +1005,14 @@ sub _sumUpSession {
|
|||
sub loadTemplate {
|
||||
my ( $self, $name, %prm ) = @_;
|
||||
$name .= '.tpl';
|
||||
my $file =
|
||||
$self->conf->{templateDir} . '/'
|
||||
. $self->conf->{portalSkin} . '/'
|
||||
. $name;
|
||||
$file = $self->conf->{templateDir} . '/common/' . $name
|
||||
unless ( -e $file );
|
||||
unless ( -e $file ) {
|
||||
die "Unable to find $name in $self->conf->{templateDir}";
|
||||
}
|
||||
my $tpl = HTML::Template->new(
|
||||
filename => $file,
|
||||
filename => $name,
|
||||
path => [
|
||||
$self->conf->{templateDir} . '/' . $self->conf->{portalSkin},
|
||||
$self->conf->{templateDir} . '/bootstrap/',
|
||||
$self->conf->{templateDir} . '/common/'
|
||||
],
|
||||
search_path_on_include => 1,
|
||||
die_on_bad_params => 0,
|
||||
die_on_missing_include => 1,
|
||||
cache => 1,
|
||||
|
|
Loading…
Reference in New Issue
Block a user