2020-07-24 18:11:07 +02:00
|
|
|
// Generated by CoffeeScript 1.12.8
|
2016-01-21 12:36:23 +01:00
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
/*
|
|
|
|
LemonLDAP::NG Portal jQuery scripts
|
|
|
|
*/
|
2016-01-21 12:36:23 +01:00
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
(function() {
|
2020-07-24 18:11:07 +02:00
|
|
|
var datas, delKey, getCookie, getQueryParam, getValues, isHiddenFormValueSet, ping, removeOidcConsent, restoreOrder, setCookie, setKey, setOrder, setSelector, translate, translatePage, translationFields,
|
2016-05-20 19:09:32 +02:00
|
|
|
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
2016-01-21 12:36:23 +01:00
|
|
|
|
2016-05-21 08:52:16 +02:00
|
|
|
translationFields = {};
|
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
translatePage = function(lang) {
|
2016-05-21 08:52:16 +02:00
|
|
|
return $.getJSON(window.staticPrefix + "languages/" + lang + ".json", function(data) {
|
2018-10-17 10:49:00 +02:00
|
|
|
var k, ref, ref1, v;
|
2016-05-21 08:52:16 +02:00
|
|
|
translationFields = data;
|
2018-10-17 10:49:00 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
2016-05-22 08:58:03 +02:00
|
|
|
$("[trspan]").each(function() {
|
2020-08-21 16:35:33 +02:00
|
|
|
var args, l, len1, txt;
|
2017-02-15 20:13:03 +01:00
|
|
|
args = $(this).attr('trspan').split(',');
|
2017-02-16 08:37:47 +01:00
|
|
|
txt = translate(args.shift());
|
2020-08-21 16:35:33 +02:00
|
|
|
for (l = 0, len1 = args.length; l < len1; l++) {
|
|
|
|
v = args[l];
|
2017-06-28 17:49:59 +02:00
|
|
|
txt = txt.replace(/%[sd]/, v);
|
2017-02-15 20:13:03 +01:00
|
|
|
}
|
2019-05-17 08:05:36 +02:00
|
|
|
return $(this).html(txt);
|
2016-05-21 08:52:16 +02:00
|
|
|
});
|
2017-03-14 12:04:05 +01:00
|
|
|
$("[trmsg]").each(function() {
|
2019-02-26 23:03:30 +01:00
|
|
|
var msg;
|
2019-05-17 08:05:36 +02:00
|
|
|
$(this).html(translate("PE" + ($(this).attr('trmsg'))));
|
2019-02-26 23:03:30 +01:00
|
|
|
msg = translate("PE" + ($(this).attr('trmsg')));
|
2019-02-27 09:49:58 +01:00
|
|
|
if (msg.match(/_hide_/)) {
|
2019-02-26 23:03:30 +01:00
|
|
|
return $(this).parent().hide();
|
|
|
|
}
|
2016-05-22 08:58:03 +02:00
|
|
|
});
|
2017-03-15 22:20:10 +01:00
|
|
|
$("[trplaceholder]").each(function() {
|
2017-03-14 12:04:05 +01:00
|
|
|
return $(this).attr('placeholder', translate($(this).attr('trplaceholder')));
|
|
|
|
});
|
2017-03-15 22:20:10 +01:00
|
|
|
return $("[localtime]").each(function() {
|
|
|
|
var d;
|
|
|
|
d = new Date($(this).attr('localtime') * 1000);
|
|
|
|
return $(this).text(d.toLocaleString());
|
|
|
|
});
|
2016-01-21 12:36:23 +01:00
|
|
|
});
|
2016-05-20 19:09:32 +02:00
|
|
|
};
|
2016-01-21 12:36:23 +01:00
|
|
|
|
2016-05-21 08:52:16 +02:00
|
|
|
translate = function(str) {
|
|
|
|
if (translationFields[str]) {
|
|
|
|
return translationFields[str];
|
|
|
|
} else {
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
};
|
2012-12-04 17:31:12 +01:00
|
|
|
|
2017-02-08 19:10:06 +01:00
|
|
|
window.translate = translate;
|
|
|
|
|
2017-01-19 07:09:20 +01:00
|
|
|
getValues = function() {
|
|
|
|
var values;
|
|
|
|
values = {};
|
|
|
|
$("script[type='application/init']").each(function() {
|
2018-04-04 22:26:50 +02:00
|
|
|
var e, k, results, tmp;
|
2017-01-19 07:09:20 +01:00
|
|
|
try {
|
2017-01-19 13:13:36 +01:00
|
|
|
tmp = JSON.parse($(this).text());
|
2017-01-19 07:09:20 +01:00
|
|
|
results = [];
|
|
|
|
for (k in tmp) {
|
|
|
|
results.push(values[k] = tmp[k]);
|
|
|
|
}
|
|
|
|
return results;
|
2018-06-20 06:56:32 +02:00
|
|
|
} catch (error1) {
|
|
|
|
e = error1;
|
2017-01-19 13:13:36 +01:00
|
|
|
console.log('Parsing error', e);
|
|
|
|
return console.log('JSON', $(this).text());
|
2017-01-19 07:09:20 +01:00
|
|
|
}
|
|
|
|
});
|
2019-02-19 22:51:45 +01:00
|
|
|
console.log(values);
|
2017-01-19 07:09:20 +01:00
|
|
|
return values;
|
|
|
|
};
|
|
|
|
|
2020-07-24 18:11:07 +02:00
|
|
|
getQueryParam = function(name) {
|
|
|
|
var match;
|
|
|
|
match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
|
|
|
|
if (match) {
|
|
|
|
return decodeURIComponent(match[1].replace(/\+/g, ' '));
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
setSelector = "#appslist";
|
2012-12-04 17:31:12 +01:00
|
|
|
|
2017-09-18 21:10:01 +02:00
|
|
|
setOrder = function() {
|
2017-09-18 22:40:01 +02:00
|
|
|
return setKey('_appsListOrder', $(setSelector).sortable("toArray").join());
|
|
|
|
};
|
|
|
|
|
|
|
|
removeOidcConsent = function(partner) {
|
2018-06-20 21:38:26 +02:00
|
|
|
var e;
|
|
|
|
e = function(j, s, e) {
|
2017-09-19 19:01:19 +02:00
|
|
|
return alert(s + " " + e);
|
2018-06-20 21:38:26 +02:00
|
|
|
};
|
2018-07-15 22:08:30 +02:00
|
|
|
return delKey("_oidcConsents", partner, function() {
|
|
|
|
return $("[partner='" + partner + "']").hide();
|
2018-06-20 21:38:26 +02:00
|
|
|
}, e);
|
2017-09-18 22:40:01 +02:00
|
|
|
};
|
|
|
|
|
2017-09-19 19:01:19 +02:00
|
|
|
setKey = function(key, val, success, error) {
|
2016-05-20 19:09:32 +02:00
|
|
|
return $.ajax({
|
2017-09-18 22:40:01 +02:00
|
|
|
type: "GET",
|
|
|
|
url: datas['scriptname'] + '/mysession/?gettoken',
|
|
|
|
dataType: 'json',
|
2017-09-19 19:01:19 +02:00
|
|
|
error: error,
|
2017-09-18 22:40:01 +02:00
|
|
|
success: function(data) {
|
|
|
|
var d;
|
|
|
|
d = {
|
|
|
|
token: data.token
|
|
|
|
};
|
|
|
|
d[key] = val;
|
|
|
|
return $.ajax({
|
|
|
|
type: "PUT",
|
|
|
|
url: datas['scriptname'] + '/mysession/persistent',
|
|
|
|
dataType: 'json',
|
2017-09-19 19:01:19 +02:00
|
|
|
data: d,
|
|
|
|
success: success,
|
|
|
|
error: error
|
2017-09-18 22:40:01 +02:00
|
|
|
});
|
|
|
|
}
|
2016-05-20 19:09:32 +02:00
|
|
|
});
|
|
|
|
};
|
2012-12-04 17:31:12 +01:00
|
|
|
|
2018-07-17 18:18:50 +02:00
|
|
|
delKey = function(key, sub, success, error) {
|
2018-06-20 21:38:26 +02:00
|
|
|
return $.ajax({
|
|
|
|
type: "GET",
|
|
|
|
url: datas['scriptname'] + '/mysession/?gettoken',
|
|
|
|
dataType: 'json',
|
|
|
|
error: error,
|
|
|
|
success: function(data) {
|
|
|
|
return $.ajax({
|
|
|
|
type: "DELETE",
|
2018-07-17 18:18:50 +02:00
|
|
|
url: datas['scriptname'] + "/mysession/persistent/" + key + "?sub=" + sub + "&token=" + data.token,
|
2018-06-20 21:38:26 +02:00
|
|
|
dataType: 'json',
|
|
|
|
success: success,
|
|
|
|
error: error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
restoreOrder = function() {
|
2020-08-21 16:35:33 +02:00
|
|
|
var IDs, child, item, itemID, items, l, len1, len2, list, m, rebuild, savedOrd, v;
|
2016-05-20 19:09:32 +02:00
|
|
|
list = $(setSelector);
|
2017-01-19 12:33:11 +01:00
|
|
|
if (!((list != null) && datas['appslistorder'])) {
|
2016-05-20 19:09:32 +02:00
|
|
|
return null;
|
|
|
|
}
|
2017-01-19 12:33:11 +01:00
|
|
|
IDs = datas['appslistorder'].split(',');
|
2016-05-20 19:09:32 +02:00
|
|
|
items = list.sortable("toArray");
|
|
|
|
rebuild = [];
|
2020-08-21 16:35:33 +02:00
|
|
|
for (l = 0, len1 = items.length; l < len1; l++) {
|
|
|
|
v = items[l];
|
2016-05-20 19:09:32 +02:00
|
|
|
rebuild[v] = v;
|
|
|
|
}
|
2020-08-21 16:35:33 +02:00
|
|
|
for (m = 0, len2 = IDs.length; m < len2; m++) {
|
|
|
|
itemID = IDs[m];
|
2017-09-05 16:40:52 +02:00
|
|
|
if (rebuild[itemID]) {
|
|
|
|
item = rebuild[itemID];
|
2016-05-20 19:09:32 +02:00
|
|
|
child = $(setSelector + ".ui-sortable").children("#" + item);
|
|
|
|
savedOrd = $(setSelector + ".ui-sortable").children("#" + itemID);
|
|
|
|
child.remove();
|
|
|
|
$(setSelector + ".ui-sortable").filter(":first").append(savedOrd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
};
|
|
|
|
|
|
|
|
isHiddenFormValueSet = function(option) {
|
|
|
|
return $('#lmhidden_' + option).length;
|
|
|
|
};
|
|
|
|
|
|
|
|
ping = function() {
|
|
|
|
return $.ajax({
|
|
|
|
type: "POST",
|
2017-01-19 12:33:11 +01:00
|
|
|
url: datas['scriptname'],
|
2016-05-20 19:09:32 +02:00
|
|
|
data: {
|
|
|
|
ping: 1
|
|
|
|
},
|
|
|
|
dataType: 'json',
|
|
|
|
success: function(data) {
|
2017-02-19 12:45:26 +01:00
|
|
|
if ((data.result != null) && data.result === 1) {
|
2017-01-19 12:33:11 +01:00
|
|
|
return setTimeout(ping, datas['pingInterval']);
|
2016-05-20 19:09:32 +02:00
|
|
|
} else {
|
2017-01-19 22:48:07 +01:00
|
|
|
return location.reload(true);
|
2016-05-20 19:09:32 +02:00
|
|
|
}
|
2017-02-19 12:45:26 +01:00
|
|
|
},
|
|
|
|
error: function(j, t, e) {
|
|
|
|
return location.reload(true);
|
2016-05-20 19:09:32 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2012-12-04 17:31:12 +01:00
|
|
|
|
2016-05-20 19:09:32 +02:00
|
|
|
window.ping = ping;
|
2012-12-04 17:31:12 +01:00
|
|
|
|
2017-02-16 08:37:47 +01:00
|
|
|
getCookie = function(cname) {
|
2020-08-21 16:35:33 +02:00
|
|
|
var c, ca, l, len1, name, re;
|
2017-02-16 08:37:47 +01:00
|
|
|
name = cname + "=";
|
|
|
|
ca = decodeURIComponent(document.cookie).split(';');
|
|
|
|
re = new RegExp('^ *' + cname + '=');
|
2020-08-21 16:35:33 +02:00
|
|
|
for (l = 0, len1 = ca.length; l < len1; l++) {
|
|
|
|
c = ca[l];
|
2017-02-16 08:37:47 +01:00
|
|
|
if (c.match(re)) {
|
|
|
|
c = c.replace(re, '');
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return '';
|
|
|
|
};
|
|
|
|
|
|
|
|
setCookie = function(name, value, exdays) {
|
|
|
|
var d;
|
|
|
|
d = new Date();
|
|
|
|
d.setTime(d.getTime() + exdays * 86400000);
|
|
|
|
return document.cookie = name + "=" + value + "; expires=" + (d.toUTCString()) + "; path=/";
|
|
|
|
};
|
|
|
|
|
2017-01-19 12:33:11 +01:00
|
|
|
datas = {};
|
|
|
|
|
2019-09-15 22:15:34 +02:00
|
|
|
$(window).on('load', function() {
|
2020-08-21 16:35:33 +02:00
|
|
|
var action, al, authMenuIndex, authMenuTabs, back_url, checkpassword, checksamepass, hiddenParams, isAlphaNumeric, l, lang, langdiv, langs, langs2, len1, len2, len3, len4, link, m, menuIndex, menuTabs, method, n, nl, nlangs, o, queryLang, re, ref, ref1, ref2, setCookieLang;
|
2017-01-19 12:33:11 +01:00
|
|
|
datas = getValues();
|
2020-03-27 19:03:56 +01:00
|
|
|
if ("datas" in window && "choicetab" in window.datas) {
|
|
|
|
datas.choicetab = window.datas.choicetab;
|
|
|
|
}
|
2017-01-19 12:33:11 +01:00
|
|
|
window.datas = datas;
|
2016-05-20 19:09:32 +02:00
|
|
|
$("#appslist").sortable({
|
|
|
|
axis: "y",
|
|
|
|
cursor: "move",
|
|
|
|
opacity: 0.5,
|
|
|
|
revert: true,
|
|
|
|
items: "> div.category",
|
|
|
|
update: function() {
|
2017-09-18 21:10:01 +02:00
|
|
|
return setOrder();
|
2016-01-21 12:36:23 +01:00
|
|
|
}
|
2016-05-20 19:09:32 +02:00
|
|
|
});
|
|
|
|
restoreOrder();
|
|
|
|
$("div.message").fadeIn('slow');
|
|
|
|
$("input[name=timezone]").val(-(new Date().getTimezoneOffset() / 60));
|
|
|
|
menuTabs = $("#menu").tabs({
|
|
|
|
active: 0
|
|
|
|
});
|
2017-01-19 12:33:11 +01:00
|
|
|
menuIndex = $('#menu a[href="#' + datas['displaytab'] + '"]').parent().index();
|
2016-05-20 19:09:32 +02:00
|
|
|
if (menuIndex < 0) {
|
|
|
|
menuIndex = 0;
|
|
|
|
}
|
|
|
|
menuTabs.tabs("option", "active", menuIndex);
|
|
|
|
authMenuTabs = $("#authMenu").tabs({
|
|
|
|
active: 0
|
|
|
|
});
|
2020-03-11 11:46:14 +01:00
|
|
|
authMenuIndex = $('#authMenu a[href="#' + datas['displaytab'] + '"]').parent().index();
|
|
|
|
if (authMenuIndex < 0) {
|
|
|
|
authMenuIndex = 0;
|
|
|
|
}
|
|
|
|
authMenuTabs.tabs("option", "active", authMenuIndex);
|
2017-01-19 12:33:11 +01:00
|
|
|
if (datas['choicetab']) {
|
|
|
|
authMenuTabs.tabs("option", "active", $('#authMenu a[href="#' + datas['choicetab'] + '"]').parent().index());
|
2016-05-20 19:09:32 +02:00
|
|
|
}
|
2017-01-19 12:33:11 +01:00
|
|
|
if (datas['login']) {
|
2016-05-20 19:09:32 +02:00
|
|
|
$("input[type=password]:first").focus();
|
|
|
|
} else {
|
2019-07-31 18:30:16 +02:00
|
|
|
if ($("input[autofocus]").length === 0) {
|
|
|
|
$("input[type!=hidden]:first").focus();
|
|
|
|
}
|
2016-05-20 19:09:32 +02:00
|
|
|
}
|
2017-01-19 12:33:11 +01:00
|
|
|
if (datas['newwindow']) {
|
2016-05-20 19:09:32 +02:00
|
|
|
$('#appslist a').attr("target", "_blank");
|
|
|
|
}
|
|
|
|
if ($("p.removeOther").length) {
|
2020-04-24 21:27:23 +02:00
|
|
|
action = $("#form").attr("action");
|
|
|
|
method = $("#form").attr("method");
|
|
|
|
console.log('method=', method);
|
|
|
|
hiddenParams = "";
|
2020-04-25 11:41:08 +02:00
|
|
|
if ($("#form input[type=hidden]")) {
|
2020-04-24 21:27:23 +02:00
|
|
|
console.log('Parse hidden values');
|
2020-04-25 11:41:08 +02:00
|
|
|
$("#form input[type=hidden]").each(function(index) {
|
|
|
|
console.log(' ->', $(this).attr("name"), $(this).val());
|
|
|
|
return hiddenParams += "&" + $(this).attr("name") + "=" + $(this).val();
|
|
|
|
});
|
|
|
|
}
|
2016-05-20 19:09:32 +02:00
|
|
|
back_url = "";
|
2020-04-24 21:27:23 +02:00
|
|
|
if (action) {
|
|
|
|
console.log('action=', action);
|
|
|
|
if (action.indexOf("?") !== -1) {
|
|
|
|
action.substring(0, action.indexOf("?")) + "?";
|
|
|
|
} else {
|
|
|
|
back_url = action + "?";
|
|
|
|
}
|
|
|
|
back_url += hiddenParams;
|
|
|
|
hiddenParams = "";
|
2016-01-21 12:36:23 +01:00
|
|
|
}
|
2020-04-25 11:41:08 +02:00
|
|
|
link = $("p.removeOther a").attr("href") + "&method=" + method + hiddenParams;
|
|
|
|
if (back_url) {
|
|
|
|
link += "&url=" + btoa(back_url);
|
|
|
|
}
|
2016-05-20 19:09:32 +02:00
|
|
|
$("p.removeOther a").attr("href", link);
|
2016-01-21 12:36:23 +01:00
|
|
|
}
|
2020-07-24 18:11:07 +02:00
|
|
|
if (window.location.search) {
|
|
|
|
queryLang = getQueryParam('llnglanguage');
|
2020-04-13 12:02:15 +02:00
|
|
|
if (queryLang) {
|
|
|
|
console.log('Get lang from parameter');
|
|
|
|
}
|
2020-07-24 18:11:07 +02:00
|
|
|
setCookieLang = getQueryParam('setCookieLang');
|
2020-04-13 12:02:15 +02:00
|
|
|
if (setCookieLang === 1) {
|
|
|
|
console.log('Set lang cookie');
|
|
|
|
}
|
2020-04-13 10:55:56 +02:00
|
|
|
}
|
|
|
|
if (!lang) {
|
|
|
|
lang = getCookie('llnglanguage');
|
2020-04-13 11:42:59 +02:00
|
|
|
if (lang && !queryLang) {
|
2020-04-13 10:55:56 +02:00
|
|
|
console.log('Get lang from cookie');
|
|
|
|
}
|
|
|
|
}
|
2017-02-16 08:37:47 +01:00
|
|
|
if (!lang) {
|
|
|
|
if (navigator) {
|
|
|
|
langs = [];
|
|
|
|
langs2 = [];
|
|
|
|
nlangs = [navigator.language];
|
|
|
|
if (navigator.languages) {
|
|
|
|
nlangs = navigator.languages;
|
|
|
|
}
|
2016-05-21 08:52:16 +02:00
|
|
|
ref = window.availableLanguages;
|
2020-08-21 16:35:33 +02:00
|
|
|
for (l = 0, len1 = ref.length; l < len1; l++) {
|
|
|
|
al = ref[l];
|
2017-05-24 20:11:58 +02:00
|
|
|
langdiv += "<img class=\"langicon\" src=\"" + window.staticPrefix + "common/" + al + ".png\" title=\"" + al + "\" alt=\"[" + al + "]\"> ";
|
2018-12-11 21:35:40 +01:00
|
|
|
}
|
2020-08-21 16:35:33 +02:00
|
|
|
for (m = 0, len2 = nlangs.length; m < len2; m++) {
|
|
|
|
nl = nlangs[m];
|
2018-12-11 21:35:40 +01:00
|
|
|
console.log('Navigator lang', nl);
|
|
|
|
ref1 = window.availableLanguages;
|
2020-08-21 16:35:33 +02:00
|
|
|
for (n = 0, len3 = ref1.length; n < len3; n++) {
|
|
|
|
al = ref1[n];
|
2018-12-11 21:35:40 +01:00
|
|
|
console.log(' Available lang', al);
|
2018-12-10 21:14:30 +01:00
|
|
|
re = new RegExp('^' + al + '-?');
|
|
|
|
if (nl.match(re)) {
|
2018-12-11 21:46:39 +01:00
|
|
|
console.log(' Matching lang =', al);
|
2017-02-16 08:37:47 +01:00
|
|
|
langs.push(al);
|
|
|
|
} else if (al.substring(0, 1) === nl.substring(0, 1)) {
|
|
|
|
langs2.push(al);
|
|
|
|
}
|
2016-05-21 08:52:16 +02:00
|
|
|
}
|
|
|
|
}
|
2017-05-05 08:50:38 +02:00
|
|
|
lang = langs[0] ? langs[0] : langs2[0] ? langs2[0] : window.availableLanguages[0];
|
2020-04-13 11:42:59 +02:00
|
|
|
if (lang && !queryLang) {
|
2020-04-13 10:55:56 +02:00
|
|
|
console.log('Get lang from navigator');
|
|
|
|
}
|
2017-02-16 08:37:47 +01:00
|
|
|
} else {
|
2017-05-05 08:50:38 +02:00
|
|
|
lang = window.availableLanguages[0];
|
2020-04-13 11:42:59 +02:00
|
|
|
if (lang && !queryLang) {
|
2020-04-13 10:55:56 +02:00
|
|
|
console.log('Get lang from window');
|
|
|
|
}
|
2016-05-21 08:52:16 +02:00
|
|
|
}
|
2017-05-05 08:50:38 +02:00
|
|
|
} else if (indexOf.call(window.availableLanguages, lang) < 0) {
|
|
|
|
lang = window.availableLanguages[0];
|
2020-04-13 11:42:59 +02:00
|
|
|
if (!queryLang) {
|
2020-04-16 12:25:39 +02:00
|
|
|
console.log('Lang not available -> Get default lang');
|
2020-04-13 11:42:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (queryLang) {
|
2020-04-16 12:25:39 +02:00
|
|
|
if (indexOf.call(window.availableLanguages, queryLang) < 0) {
|
|
|
|
console.log('Lang not available -> Get default lang');
|
|
|
|
queryLang = window.availableLanguages[0];
|
|
|
|
}
|
2020-04-13 11:42:59 +02:00
|
|
|
console.log('Selected lang ->', queryLang);
|
2020-04-13 12:02:15 +02:00
|
|
|
if (setCookieLang) {
|
2020-04-16 12:25:39 +02:00
|
|
|
console.log('Set cookie lang ->', queryLang);
|
2020-04-13 12:02:15 +02:00
|
|
|
setCookie('llnglanguage', queryLang);
|
|
|
|
}
|
2020-04-13 11:42:59 +02:00
|
|
|
translatePage(queryLang);
|
|
|
|
} else {
|
|
|
|
console.log('Selected lang ->', lang);
|
|
|
|
setCookie('llnglanguage', lang);
|
|
|
|
translatePage(lang);
|
2016-05-21 08:52:16 +02:00
|
|
|
}
|
2017-02-16 08:37:47 +01:00
|
|
|
langdiv = '';
|
2018-12-11 21:35:40 +01:00
|
|
|
ref2 = window.availableLanguages;
|
2020-08-21 16:35:33 +02:00
|
|
|
for (o = 0, len4 = ref2.length; o < len4; o++) {
|
|
|
|
al = ref2[o];
|
2017-05-24 20:11:58 +02:00
|
|
|
langdiv += "<img class=\"langicon\" src=\"" + window.staticPrefix + "common/" + al + ".png\" title=\"" + al + "\" alt=\"[" + al + "]\"> ";
|
2017-02-16 08:37:47 +01:00
|
|
|
}
|
|
|
|
$('#languages').html(langdiv);
|
|
|
|
$('.langicon').on('click', function() {
|
|
|
|
lang = $(this).attr('title');
|
|
|
|
setCookie('llnglanguage', lang);
|
|
|
|
return translatePage(lang);
|
|
|
|
});
|
2020-08-21 16:35:33 +02:00
|
|
|
isAlphaNumeric = function(chr) {
|
|
|
|
var code;
|
|
|
|
code = chr.charCodeAt(0);
|
|
|
|
if (code > 47 && code < 58 || code > 64 && code < 91 || code > 96 && code < 123) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
checkpassword = function(password) {
|
|
|
|
var digit, hasforbidden, i, len, lower, nonwhitespechar, numspechar, result, upper;
|
|
|
|
result = true;
|
|
|
|
if (window.datas.ppolicy.minsize > 0) {
|
|
|
|
if (password.length >= window.datas.ppolicy.minsize) {
|
|
|
|
$('#ppolicy-minsize-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minsize-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-minsize-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minsize-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (window.datas.ppolicy.minupper > 0) {
|
|
|
|
upper = password.match(/[A-Z]/g);
|
|
|
|
if (upper && upper.length >= window.datas.ppolicy.minupper) {
|
|
|
|
$('#ppolicy-minupper-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minupper-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-minupper-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minupper-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (window.datas.ppolicy.minlower > 0) {
|
|
|
|
lower = password.match(/[a-z]/g);
|
|
|
|
if (lower && lower.length >= window.datas.ppolicy.minlower) {
|
|
|
|
$('#ppolicy-minlower-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minlower-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-minlower-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minlower-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (window.datas.ppolicy.mindigit > 0) {
|
|
|
|
digit = password.match(/[0-9]/g);
|
|
|
|
if (digit && digit.length >= window.datas.ppolicy.mindigit) {
|
|
|
|
$('#ppolicy-mindigit-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-mindigit-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-mindigit-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-mindigit-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (window.datas.ppolicy.allowedspechar) {
|
|
|
|
nonwhitespechar = window.datas.ppolicy.allowedspechar.replace(/\s/g, '');
|
|
|
|
hasforbidden = false;
|
|
|
|
i = 0;
|
|
|
|
len = password.length;
|
|
|
|
while (i < len) {
|
|
|
|
if (!isAlphaNumeric(password.charAt(i))) {
|
|
|
|
if (nonwhitespechar.indexOf(password.charAt(i)) < 0) {
|
|
|
|
hasforbidden = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (hasforbidden === false) {
|
|
|
|
$('#ppolicy-allowedspechar-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-allowedspechar-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-allowedspechar-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-allowedspechar-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (window.datas.ppolicy.minspechar > 0 && window.datas.ppolicy.allowedspechar) {
|
|
|
|
numspechar = 0;
|
|
|
|
nonwhitespechar = window.datas.ppolicy.allowedspechar.replace(/\s/g, '');
|
|
|
|
i = 0;
|
|
|
|
while (i < password.length) {
|
|
|
|
if (nonwhitespechar.indexOf(password.charAt(i)) >= 0) {
|
|
|
|
numspechar++;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
if (numspechar >= window.datas.ppolicy.minspechar) {
|
|
|
|
$('#ppolicy-minspechar-feedback').addClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minspechar-feedback').removeClass('fa-times text-danger');
|
|
|
|
} else {
|
|
|
|
$('#ppolicy-minspechar-feedback').removeClass('fa-check text-success');
|
|
|
|
$('#ppolicy-minspechar-feedback').addClass('fa-times text-danger');
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (result) {
|
|
|
|
$('.ppolicy').removeClass('border-danger').addClass('border-success');
|
|
|
|
$('#newpassword')[0].setCustomValidity('');
|
|
|
|
} else {
|
|
|
|
$('.ppolicy').removeClass('border-success').addClass('border-danger');
|
|
|
|
$('#newpassword')[0].setCustomValidity(translate('PE28'));
|
|
|
|
}
|
|
|
|
};
|
|
|
|
if (window.datas.ppolicy != null) {
|
|
|
|
checkpassword('');
|
|
|
|
$('#newpassword').keyup(function(e) {
|
|
|
|
checkpassword(e.target.value);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
checksamepass = function() {
|
|
|
|
if ($('#confirmpassword')[0].value === $('#newpassword')[0].value) {
|
|
|
|
$('#confirmpassword')[0].setCustomValidity('');
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
$('#confirmpassword')[0].setCustomValidity(translate('PE34'));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
$('#newpassword').change(checksamepass);
|
|
|
|
$('#confirmpassword').change(checksamepass);
|
2017-01-19 12:33:11 +01:00
|
|
|
if (datas['pingInterval'] && datas['pingInterval'] > 0) {
|
|
|
|
window.setTimeout(ping, datas['pingInterval']);
|
|
|
|
}
|
2017-09-18 22:40:01 +02:00
|
|
|
$(".localeDate").each(function() {
|
2017-01-19 22:48:07 +01:00
|
|
|
var s;
|
|
|
|
s = new Date($(this).attr("val") * 1000);
|
|
|
|
return $(this).text(s.toLocaleString());
|
|
|
|
});
|
2020-04-29 23:45:25 +02:00
|
|
|
$('.oidcConsent').on('click', function() {
|
2017-09-18 22:40:01 +02:00
|
|
|
return removeOidcConsent($(this).attr('partner'));
|
|
|
|
});
|
2020-04-29 23:45:25 +02:00
|
|
|
return $('#show-hide-button').on('click', function() {
|
|
|
|
if ($("#newpassword").attr('type') === 'password') {
|
|
|
|
console.log('Show passwords');
|
|
|
|
$("#newpassword").attr('type', 'input');
|
|
|
|
$("#confirmpassword").attr('type', 'input');
|
|
|
|
$("#show-hide-icon-button").removeClass('fa-eye');
|
|
|
|
return $("#show-hide-icon-button").addClass('fa-eye-slash');
|
|
|
|
} else {
|
|
|
|
console.log('Hide passwords');
|
|
|
|
$("#newpassword").attr('type', 'password');
|
|
|
|
$("#confirmpassword").attr('type', 'password');
|
|
|
|
$("#show-hide-icon-button").removeClass('fa-eye-slash');
|
|
|
|
return $("#show-hide-icon-button").addClass('fa-eye');
|
|
|
|
}
|
|
|
|
});
|
2016-01-21 12:36:23 +01:00
|
|
|
});
|
2016-05-20 19:09:32 +02:00
|
|
|
|
|
|
|
}).call(this);
|