ZwiiCMS/core/module/config/view/index/index.js.php

260 lines
8.6 KiB
PHP
Raw Normal View History

/**
* 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>
2021-02-17 13:49:58 +01:00
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
$( document).ready(function() {
/**
* Afficher et masquer options SMTP
*/
if ($("input[name=SmtpEnable]").is(':checked')) {
$("#SmtpParam").addClass("disabled");
$("#SmtpParam").slideDown();
} else {
$("#SmtpParam").removeClass("disabled");
$("#SmtpParam").slideUp();
}
/**
* Afficher et masquer options Auth
*/
if ($("select[name=SmtpEnable]").val() == true) {
$("#SmtpAuthParam").addClass("disabled");
$("#SmtpAuthParam").slideDown();
} else {
$("#SmtpAuthParam").removeClass("disabled");
$("#SmtpAuthParam").slideUp();
}
2021-10-29 18:34:01 +02:00
/**
* Afficher et masquer options SMTP
*/
$("input[name=SmtpEnable]").on("change", function() {
if ($("input[name=SmtpEnable]").is(':checked')) {
$("#SmtpParam").addClass("disabled");
$("#SmtpParam").slideDown();
} else {
$("#SmtpParam").removeClass("disabled");
$("#SmtpParam").slideUp();
}
});
/**
* Afficher et masquer options Auth
*/
$("select[name=SmtpAuth]").on("change", function() {
if ($("select[name=SmtpAuth]").val() == true) {
$("#SmtpAuthParam").addClass("disabled");
$("#SmtpAuthParam").slideDown();
} else {
$("#SmtpAuthParam").removeClass("disabled");
$("#SmtpAuthParam").slideUp();
}
});
/**
* Options de blocage de connexions
* Contrôle la cohérence des sélections et interdit une seule valeur Aucune
*/
2021-10-30 18:59:58 +02:00
$("select[name=connectAttempt]").on("change", function() {
if ($("select[name=connectAttempt]").val() === "999") {
$("select[name=connectTimeout]").val(0);
} else {
2021-10-30 18:59:58 +02:00
if ($("select[name=connectTimeout]").val() === "0") {
$("select[name=connectTimeout]").val(300);
}
}
});
2021-10-30 18:59:58 +02:00
$("select[name=connectTimeout]").on("change", function() {
if ($("select[name=connectTimeout]").val() === "0") {
$("select[name=connectAttempt]").val(999);
} else {
2021-10-30 18:59:58 +02:00
if ($("select[name=connectAttempt]").val() === "999") {
$("select[name=connectAttempt]").val(3);
}
}
});
2021-10-30 18:12:34 +02:00
/**
* Captcha strong si captcha sélectionné
*/
2021-10-30 18:59:58 +02:00
$("input[name=connectCaptcha]").on("change", function() {
2021-10-30 18:12:34 +02:00
2021-10-30 18:59:58 +02:00
if ($("input[name=connectCaptcha]").is(':checked')) {
$("#connectCaptchaStrongWrapper").addClass("disabled");
$("#connectCaptchaStrongWrapper").slideDown();
$( "#connectCaptchaStrong" ).prop( "checked", false );
2021-10-30 18:12:34 +02:00
} else {
2021-10-30 18:59:58 +02:00
$("#connectCaptchaStrongWrapper").removeClass("disabled");
$("#connectCaptchaStrongWrapper").slideUp();
2021-10-30 18:12:34 +02:00
}
});
/**
* Sélection de la page de configuration à afficher
*/
$("#configSetupButton").on("click", function() {
2021-10-31 11:32:56 +01:00
$("#localeContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").hide();
$("#setupContainer").show();
$("#configSetupButton").addClass("activeButton");
$("#configLocalButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
2021-10-31 17:11:05 +01:00
setCookie("configLayout","setup");
2021-10-30 18:12:34 +02:00
});
$("#configLocalButton").on("click", function() {
2021-10-31 11:32:56 +01:00
$("#setupContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").hide();
$("#localeContainer").show();
$("#configSetupButton").removeClass("activeButton");
$("#configLocalButton").addClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
2021-10-31 17:11:05 +01:00
setCookie("configLayout","locale");
2021-10-30 18:12:34 +02:00
});
$("#configSocialButton").on("click", function() {
2021-10-31 11:32:56 +01:00
$("#connectContainer").hide();
$("#setupContainer").hide();
$("#localeContainer").hide();
$("#networkContainer").hide();
$("#socialContainer").show();
$("#configSetupButton").removeClass("activeButton");
$("#configLocalButton").removeClass("activeButton");
$("#configSocialButton").addClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
2021-10-31 17:11:05 +01:00
setCookie("configLayout","social");
2021-10-30 18:12:34 +02:00
});
$("#configConnectButton").on("click", function() {
2021-10-31 11:32:56 +01:00
$("#setupContainer").hide();
$("#localeContainer").hide();
$("#socialContainer").hide();
$("#networkContainer").hide();
$("#connectContainer").show();
$("#configSetupButton").removeClass("activeButton");
$("#configLocalButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").addClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
2021-10-31 17:11:05 +01:00
setCookie("configLayout","connect");
2021-10-30 18:12:34 +02:00
});
$("#configNetworkButton").on("click", function() {
2021-10-31 11:32:56 +01:00
$("#setupContainer").hide();
$("#localeContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").show();
$("#configSetupButton").removeClass("activeButton");
$("#configLocalButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").addClass("activeButton");
2021-10-31 17:11:05 +01:00
setCookie("configLayout","network");
2021-10-30 18:12:34 +02:00
});
2021-11-01 20:05:33 +01:00
/**
* Boutons d'aide
* Page des paramètres
*/
2021-11-01 20:05:09 +01:00
$("#setupHelpButton").on("click", function() {
$("#setupHelpContainer").slideDown();
});
$("#updateHelpButton").on("click", function() {
$("#updateHelpContainer").slideDown();
});
$("#maintenanceHelpButton").on("click", function() {
$("#maintenanceHelpContainer").slideDown();
});
2021-11-01 20:05:33 +01:00
/**
* Boutons d'aide
* Page des locales
*/
$("#localeHelpButton").on("click", function() {
$("#localeHelpContainer").slideDown();
});
$("#labelHelpButton").on("click", function() {
console.log("e");
$("#labelHelpContainer").slideDown();
});
$("#specialeHelpButton").on("click", function() {
console.log("f");
$("#specialeHelpContainer").slideDown();
});
2021-11-01 20:05:09 +01:00
/** Bouton de fermeture */
$(".zwiico-cancel").click(function() {
$(".helpDisplayContainer").slideUp();
});
});
2021-10-31 17:11:05 +01:00
$( document).ready(function() {
var configLayout = getCookie("configLayout");
if (configLayout == null) {
$("#localeContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").hide();
$("#setupContainer").show();
$("#configSetupButton").addClass("activeButton");
2021-11-01 14:38:15 +01:00
$("#configLocaleButton").removeClass("activeButton");
2021-10-31 17:11:05 +01:00
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","setup");
}
$("#localeContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").hide();
$("#setupContainer").hide();
$("#" + configLayout + "Container" ).show();
});
function setCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}