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

12 lines
6.8 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>
2023-01-09 10:23:32 +01:00
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
2022-10-01 16:44:23 +02:00
function setCookie(name,value,days){var expires="";if(days){var date=new Date;date.setTime(date.getTime()+24*days*60*60*1e3),expires="; expires="+date.toUTCString()}document.cookie=name+"="+(value||"")+expires+"; path=/; samesite=lax"}function getCookie(name){for(var nameEQ=name+"=",ca=document.cookie.split(";"),i=0;i<ca.length;i++){for(var c=ca[i];" "==c.charAt(0);)c=c.substring(1,c.length);if(0==c.indexOf(nameEQ))return c.substring(nameEQ.length,c.length)}return null}function capitalizeFirstLetter(string){return string.charAt(0).toUpperCase()+string.slice(1)}$(document).ready((function(){$("#configBackupDelButton").on("click",(function(){var _this=$(this),message_warning="<?php echo helper::translate('Supprimer toutes les sauvegardes automatiques ?'); ?>";return core.confirm(message_warning,(function(){$(location).attr("href",_this.attr("href"))}))})),$("input[name=smtpEnable]").is(":checked")?($("#smtpParam").addClass("disabled"),$("#smtpParam").slideDown()):($("#smtpParam").removeClass("disabled"),$("#smtpParam").slideUp()),1==$("select[name=smtpAuth]").val()?($("#smtpAuthParam").addClass("disabled"),$("#smtpAuthParam").slideDown()):($("#smtpAuthParam").removeClass("disabled"),$("#smtpAuthParam").slideUp()),$("input[name=connectCaptcha]").is(":checked")?($("#connectCaptchaStrongWrapper").addClass("disabled"),$("#connectCaptchaStrongWrapper").slideDown(),$("#connectCaptchaTypeWrapper").addClass("disabled"),$("#connectCaptchaTypeWrapper").slideDown()):($("#connectCaptchaStrongWrapper").removeClass("disabled"),$("#connectCaptchaStrongWrapper").slideUp(),$("#connectCaptchaTypeWrapper").removeClass("disabled"),$("#connectCaptchaTypeWrapper").slideUp(),$("#connectCaptchaStrong").prop("checked",!1));var configLayout=getCookie("configLayout");null==configLayout&&(configLayout="setup",setCookie("configLayout","setup")),$("#localeContainer").hide(),$("#socialContainer").hide(),$("#connectContainer").hide(),$("#networkContainer").hide(),$("#setupContainer").hide(),$("#"+configLayout+"Container").show(),$("#config"+capitalizeFirstLetter(configLayout)+"Button").addClass("activeButton"),$("input[name=smtpEnable]").on("change",(function(){$("input[name=smtpEnable]").is(":checked")?($("#smtpParam").addClass("disabled"),$("#smtpParam").slideDown()):($("#smtpParam").removeClass("disabled"),$("#smtpParam").slideUp())})),$("select[name=smtpAuth]").on("change",(function(){1==$("select[name=smtpAuth]").val()?($("#smtpAuthParam").addClass("disabled"),$("#smtpAuthParam").slideDown()):($("#smtpAuthParam").removeClass("disabled"),$("#smtpAuthParam").slideUp())})),$("select[name=connectAttempt]").on("change",(function(){"999"===$("select[name=connectAttempt]").val()?$("select[name=connectTimeout]").val(0):"0"===$("select[name=connectTimeout]").val()&&$("select[name=connectTimeout]").val(300)})),$("select[name=connectTimeout]").on("change",(function(){"0"===$("select[name=connectTimeout]").val()?$("select[name=connectAttempt]").val(999):"999"===$("select[name=connectAttempt]").val()&&$("select[name=connectAttempt]").val(3)})),$("input[name=connectCaptcha]").on("change",(function(){$("input[name=connectCaptcha]").is(":checked")?($("#connectCaptchaStrongWrapper").addClass("disabled"),$("#connectCaptchaStrongWrapper").slideDown(),$("#connectCaptchaTypeWrapper").addClass("disabled"),$("#connectCaptchaTypeWrapper").slideDown()):($("#connectCaptchaStrongWrapper").removeClass("disabled"),$("#connectCaptchaStrongWrapper").slideUp(),$("#connectCaptchaTypeWrapper").removeClass("disabled"),$("#connectCaptchaTypeWrapper").slideUp(),$("#connectCaptchaStrong").prop("checked",!1))})),$("#configSetupButton").on("click",(function(){$("#localeContainer").hide(),$("#socialContainer").hide(),$("#connectContainer").hide(),$("#networkContainer").hide(),$("#setupContainer").show(),$("#configSetupButton").addClass("activeButton"),$("#configLocaleButton").removeClass("activeButton"),$("#configSocialButton").removeClass("activeButton"),$("#configConnectButton").removeClass("activeButton"),$("#configNetworkButton").removeClass("activeButton"),setCookie("configLayout","s