2019-12-10 10:53:31 +01:00
|
|
|
/**
|
|
|
|
* This file is part of Zwii.
|
|
|
|
*
|
|
|
|
* For full copyright and license information, please see the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*
|
|
|
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
|
|
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
|
|
|
* @license GNU General Public License, version 3
|
2020-09-01 20:48:40 +02:00
|
|
|
* @link http://zwiicms.fr/
|
2019-12-10 10:53:31 +01:00
|
|
|
*/
|
|
|
|
|
2020-05-29 17:53:30 +02:00
|
|
|
$( document).ready(function() {
|
2020-05-11 17:02:32 +02:00
|
|
|
/**
|
|
|
|
* Afficher et masquer options SMTP
|
|
|
|
*/
|
|
|
|
if ($("input[name=configSmtpEnable]").is(':checked')) {
|
|
|
|
$("#configSmtpParam").addClass("disabled");
|
2020-05-29 17:53:30 +02:00
|
|
|
$("#configSmtpParam").slideDown();
|
2020-05-11 17:02:32 +02:00
|
|
|
} else {
|
|
|
|
$("#configSmtpParam").removeClass("disabled");
|
2020-05-29 17:53:30 +02:00
|
|
|
$("#configSmtpParam").slideUp();
|
2020-05-11 17:02:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Afficher et masquer options Auth
|
|
|
|
*/
|
|
|
|
|
2020-05-29 17:53:30 +02:00
|
|
|
if ($("select[name=configSmtpAuth]").val() == true) {
|
2020-05-11 17:02:32 +02:00
|
|
|
$("#configSmtpAuthParam").addClass("disabled");
|
2020-05-29 17:53:30 +02:00
|
|
|
$("#configSmtpAuthParam").slideDown();
|
|
|
|
} else {
|
2020-05-11 17:02:32 +02:00
|
|
|
$("#configSmtpAuthParam").removeClass("disabled");
|
2020-05-29 17:53:30 +02:00
|
|
|
$("#configSmtpAuthParam").slideUp();
|
2020-05-11 17:02:32 +02:00
|
|
|
}
|
|
|
|
|
2020-06-11 11:25:53 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialisation des blocs
|
|
|
|
*/
|
|
|
|
|
2020-09-27 12:32:34 +02:00
|
|
|
var i = [ "social", "ceo", "network", "smtp", "login", "logs", "script" ];
|
2020-06-11 11:25:53 +02:00
|
|
|
$.each(i,function(e) {
|
|
|
|
if (getCookie(i[e]) === "true") {
|
2020-09-19 18:14:06 +02:00
|
|
|
$("#" + i[e]).find(".zwiico-plus-circled").hide();
|
|
|
|
$("#" + i[e]).find(".zwiico-minus-circled").show();
|
2020-06-11 11:25:53 +02:00
|
|
|
$("#" + i[e]).find(".blockContainer").show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
/**
|
2020-08-08 10:17:16 +02:00
|
|
|
*
|
2020-06-07 09:25:54 +02:00
|
|
|
* Blocs dépliants
|
|
|
|
*/
|
2020-06-05 07:23:36 +02:00
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
$("div .block").click(function(e) {
|
2020-09-19 18:14:06 +02:00
|
|
|
$(this).find(".zwiico-plus-circled").toggle();
|
|
|
|
$(this).find(".zwiico-minus-circled").toggle();
|
2020-06-07 09:25:54 +02:00
|
|
|
$(this).find(".blockContainer").slideToggle();
|
2020-08-08 10:17:16 +02:00
|
|
|
/*
|
2020-06-11 11:25:53 +02:00
|
|
|
* Sauvegarder la position des blocs
|
|
|
|
* true = bloc déplié
|
|
|
|
*/
|
2020-11-21 15:09:10 +01:00
|
|
|
document.cookie = $(this).attr('id') + "=" + $(this).find(".zwiico-minus-circled").is(":visible") + ";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;SameSite=Lax";
|
2020-07-06 19:50:53 +02:00
|
|
|
}).on("click", "span > input, input, textarea, label, option, button, a:not(.inputFile), .blockContainer", function(e) {
|
2020-06-07 09:25:54 +02:00
|
|
|
// Empêcher les déclenchements dans les blocs
|
|
|
|
e.stopPropagation();
|
|
|
|
});
|
2020-06-05 07:23:36 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
/**
|
|
|
|
* Afficher et masquer options SMTP
|
|
|
|
*/
|
|
|
|
$("input[name=configSmtpEnable]").on("change", function() {
|
|
|
|
if ($("input[name=configSmtpEnable]").is(':checked')) {
|
|
|
|
$("#configSmtpParam").addClass("disabled");
|
|
|
|
$("#configSmtpParam").slideDown();
|
|
|
|
} else {
|
|
|
|
$("#configSmtpParam").removeClass("disabled");
|
|
|
|
$("#configSmtpParam").slideUp();
|
|
|
|
}
|
|
|
|
});
|
2020-06-05 07:23:36 +02:00
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
/**
|
|
|
|
* Afficher et masquer options Auth
|
|
|
|
*/
|
2020-06-05 07:23:36 +02:00
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
$("select[name=configSmtpAuth]").on("change", function() {
|
|
|
|
if ($("select[name=configSmtpAuth]").val() == true) {
|
|
|
|
$("#configSmtpAuthParam").addClass("disabled");
|
|
|
|
$("#configSmtpAuthParam").slideDown();
|
|
|
|
} else {
|
|
|
|
$("#configSmtpAuthParam").removeClass("disabled");
|
|
|
|
$("#configSmtpAuthParam").slideUp();
|
|
|
|
}
|
|
|
|
});
|
2020-06-05 07:23:36 +02:00
|
|
|
|
2020-06-07 09:25:54 +02:00
|
|
|
/**
|
|
|
|
* Options de blocage de connexions
|
|
|
|
* Contrôle la cohérence des sélections et interdit une seule valeur Aucune
|
|
|
|
*/
|
|
|
|
$("select[name=configConnectAttempt]").on("change", function() {
|
|
|
|
if ($("select[name=configConnectAttempt]").val() === "999") {
|
|
|
|
$("select[name=configConnectTimeout]").val(0);
|
|
|
|
} else {
|
|
|
|
if ($("select[name=configConnectTimeout]").val() === "0") {
|
|
|
|
$("select[name=configConnectTimeout]").val(300);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$("select[name=configConnectTimeout]").on("change", function() {
|
|
|
|
if ($("select[name=configConnectTimeout]").val() === "0") {
|
|
|
|
$("select[name=configConnectAttempt]").val(999);
|
|
|
|
} else {
|
|
|
|
if ($("select[name=configConnectAttempt]").val() === "999") {
|
|
|
|
$("select[name=configConnectAttempt]").val(3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2020-06-05 07:23:36 +02:00
|
|
|
|
2020-06-11 11:25:53 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Lire un cookie s'il existe
|
|
|
|
*/
|
|
|
|
function getCookie(name) {
|
|
|
|
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
|
|
|
return v ? v[2] : null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|