Optimization (#595)
This commit is contained in:
parent
3db9bec588
commit
6cc554ac75
|
@ -341,25 +341,12 @@ sub display {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
## Common template params
|
# Additional $req param
|
||||||
my $skin = $self->getSkin($req);
|
|
||||||
my $portalPath = $self->conf->{portal};
|
|
||||||
$portalPath =~ s#^https?://[^/]+/?#/#;
|
|
||||||
$portalPath =~ s#[^/]+\.fcgi$##;
|
|
||||||
%templateParams = (
|
%templateParams = (
|
||||||
%templateParams,
|
%templateParams,
|
||||||
SKIN_PATH => $portalPath . "skins",
|
|
||||||
ANTIFRAME => $self->conf->{portalAntiFrame},
|
|
||||||
SKIN_BG => $self->conf->{portalSkinBackground},
|
|
||||||
%{ $self->customParameters },
|
|
||||||
%{ $req->{customParameters} // {} },
|
%{ $req->{customParameters} // {} },
|
||||||
);
|
);
|
||||||
|
|
||||||
## Custom template params
|
|
||||||
if ( my $customParams = $self->getCustomTemplateParameters() ) {
|
|
||||||
%templateParams = ( %templateParams, %$customParams );
|
|
||||||
}
|
|
||||||
|
|
||||||
$self->logger->debug("Skin returned: $skinfile");
|
$self->logger->debug("Skin returned: $skinfile");
|
||||||
return ( $skinfile, \%templateParams );
|
return ( $skinfile, \%templateParams );
|
||||||
}
|
}
|
||||||
|
@ -438,26 +425,6 @@ sub getSkin {
|
||||||
return $skin;
|
return $skin;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Find custom templates parameters
|
|
||||||
# @return Custom parameters
|
|
||||||
sub getCustomTemplateParameters {
|
|
||||||
my ($self) = @_;
|
|
||||||
my $conf = $self->conf;
|
|
||||||
my $customTplParams = {};
|
|
||||||
|
|
||||||
foreach ( keys %$conf ) {
|
|
||||||
next unless ( $_ =~ /^tpl_(.+)$/ );
|
|
||||||
my $tplParam = $1;
|
|
||||||
my $tplValue = $conf->{$_};
|
|
||||||
$self->logger->debug(
|
|
||||||
"Set custom template parameter $tplParam with $tplValue");
|
|
||||||
|
|
||||||
$customTplParams->{$tplParam} = $tplValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $customTplParams;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Build an HTML array to display sessions
|
# Build an HTML array to display sessions
|
||||||
# @param $sessions Array ref of hash ref containing sessions datas
|
# @param $sessions Array ref of hash ref containing sessions datas
|
||||||
# @param $title Title of the array
|
# @param $title Title of the array
|
||||||
|
|
|
@ -571,7 +571,7 @@ sub setHiddenFormValue {
|
||||||
$base64 = 1 unless defined $base64;
|
$base64 = 1 unless defined $base64;
|
||||||
|
|
||||||
# Store value
|
# Store value
|
||||||
if ( $val or !($val & ~$val) ) {
|
if ( $val or !( $val & ~$val ) ) {
|
||||||
$key = $prefix . $key;
|
$key = $prefix . $key;
|
||||||
$val =~ s/\+/%2B/g;
|
$val =~ s/\+/%2B/g;
|
||||||
$req->{portalHiddenFormValues}->{$key} = $val;
|
$req->{portalHiddenFormValues}->{$key} = $val;
|
||||||
|
@ -764,9 +764,16 @@ sub rebuildCookies {
|
||||||
}
|
}
|
||||||
|
|
||||||
sub tplParams {
|
sub tplParams {
|
||||||
|
my $portalPath = $_[0]->conf->{portal};
|
||||||
|
$portalPath =~ s#^https?://[^/]+/?#/#;
|
||||||
|
$portalPath =~ s#[^/]+\.fcgi$##;
|
||||||
return (
|
return (
|
||||||
SKIN => $_[0]->getSkin( $_[1] ),
|
SKIN => $_[0]->getSkin( $_[1] ),
|
||||||
PORTAL_URL => $_[0]->conf->{portal},
|
PORTAL_URL => $_[0]->conf->{portal},
|
||||||
|
SKIN_PATH => $portalPath . "skins",
|
||||||
|
ANTIFRAME => $_[0]->conf->{portalAntiFrame},
|
||||||
|
SKIN_BG => $_[0]->conf->{portalSkinBackground},
|
||||||
|
( $_[0]->customParameters ? ( %{ $_[0]->customParameters } ) : () ),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -554,7 +554,7 @@ sub display {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Custom template parameters
|
# Custom template parameters
|
||||||
if ( my $customParams = $self->p->getCustomTemplateParameters() ) {
|
if ( my $customParams = $self->p->customParameters ) {
|
||||||
foreach ( keys %$customParams ) {
|
foreach ( keys %$customParams ) {
|
||||||
$tplPrm{$_} = $customParams->{$_};
|
$tplPrm{$_} = $customParams->{$_};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user