Commit f92a925f authored by Xavier Guimard's avatar Xavier Guimard

Restore custom messages (#1518)

parent 30b7ce63
......@@ -110,7 +110,7 @@ sub display {
&& $req->data->{login},
ASK_LOGINS => $req->param('checkLogins') || 0,
CONFIRMKEY => $self->stamp(),
LIST => $req->data->{list} || [],
LIST => $req->data->{list} || [],
REMEMBER => $req->data->{confirmRemember},
(
$req->data->{customScript}
......@@ -408,8 +408,11 @@ sub display {
}
# Additional $req param
%templateParams =
( %templateParams, %{ $req->{customParameters} // {} }, );
%templateParams = (
%templateParams,
TROVER => $self->trOver,
%{ $req->{customParameters} // {} },
);
$self->logger->debug("Skin returned: $skinfile");
return ( $skinfile, \%templateParams );
......
......@@ -22,6 +22,7 @@ use Regexp::Assemble;
has localConfig => ( is => 'rw', default => sub { {} } );
has conf => ( is => 'rw', default => sub { {} } );
has menu => ( is => 'rw', default => sub { {} } );
has trOver => ( is => 'rw', default => sub { { all => {} } } );
# Sub modules
has _authentication => ( is => 'rw' );
......@@ -95,7 +96,16 @@ sub init {
if ( $k =~ /tpl_(.*)/ ) {
$self->customParameters->{$1} = $self->localConfig->{$k};
}
elsif ( $k =~ /error_(?:(\w+?)_)?(\d+)$/ ) {
my $lang = $1 || 'all';
$self->trOver->{$lang}->{"PE$2"} = $self->localConfig->{$k};
}
elsif ( $k =~ /msg_(?:(\w+?)_)?(\w+)$/ ) {
my $lang = $1 || 'all';
$self->trOver->{$lang}->{$2} = $self->localConfig->{$k};
}
}
$self->trOver( JSON::to_json( $self->trOver ) );
# Purge loaded module list
$self->loadedModules( {} );
......
......@@ -16,6 +16,11 @@ translationFields = {}
translatePage = (lang) ->
$.getJSON "#{window.staticPrefix}languages/#{lang}.json", (data) ->
translationFields = data
for k,v of window.datas.trOver.all
translationFields[k] = v
if window.datas.trOver[lang]
for k,v of window.datas.trOver[lang]
translationFields[k] = v
$("[trspan]").each ->
args = $(this).attr('trspan').split(',')
txt = translate args.shift()
......
// Generated by CoffeeScript 1.12.7
// Generated by CoffeeScript 1.12.8
/*
LemonLDAP::NG Portal jQuery scripts
......@@ -12,9 +12,22 @@ LemonLDAP::NG Portal jQuery scripts
translatePage = function(lang) {
return $.getJSON(window.staticPrefix + "languages/" + lang + ".json", function(data) {
var k, ref, ref1, v;
translationFields = data;
ref = window.datas.trOver.all;
for (k in ref) {
v = ref[k];
translationFields[k] = v;
}
if (window.datas.trOver[lang]) {
ref1 = window.datas.trOver[lang];
for (k in ref1) {
v = ref1[k];
translationFields[k] = v;
}
}
$("[trspan]").each(function() {
var args, i, len, txt, v;
var args, i, len, txt;
args = $(this).attr('trspan').split(',');
txt = translate(args.shift());
for (i = 0, len = args.length; i < len; i++) {
......
......@@ -26,7 +26,8 @@
"appslistorder":"<TMPL_VAR NAME="APPSLIST_ORDER">",
"scriptname":"<TMPL_VAR NAME="SCRIPT_NAME">",
"activeTimer":<TMPL_VAR NAME="ACTIVE_TIMER" DEFAULT="0">,
"pingInterval":<TMPL_VAR NAME="PING" DEFAULT="0">
"pingInterval":<TMPL_VAR NAME="PING" DEFAULT="0">,
"trOver":<TMPL_VAR NAME="TROVER" DEFAULT="[]">
}
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment