Deltacms/core/module/config/view/backup/backup.js.php

72 lines
2.8 KiB
PHP

/**
* This file is part of DeltaCMS.
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
* @copyright Copyright (C) 2021-2022, Sylvain Lelièvre
* @license GNU General Public License, version 3
* @link https://deltacms.fr/
*
* Delta was created from version 11.2.00.24 of ZwiiCMS
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
*/
$( document).ready(function() {
var text1 = "";
var text2 = "";
var text3 = "";
<?php if( $this->getData(['config', 'i18n', 'langAdmin' ]) === 'fr'){
echo 'text1 = "La sauvegarde a été générée avec succès.";' ;
echo 'text2 = "Une erreur s\'est produite, la sauvegarde n\'a pas été générée !";' ;
echo 'text3 = "Une sauvegarde avec le contenu du gestionnaire de fichier peut prendre du temps à générer. Confirmez-vous ?";' ;
}
else{
echo 'text1 = "The backup was successfully generated.";' ;
echo 'text2 = "An error occurred, the backup was not generated !";' ;
echo 'text3 = "A backup with the contents of the file manager may take some time to generate. Can you confirm?";' ;
} ?>
$("#configBackupForm").submit( function(e){
//$("#configBackupSubmit").addClass("disabled").prop("disabled", true);
e.preventDefault();
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/backup";
$.ajax({
type: "POST",
url: url,
data: $("form").serialize(),
success: function(data){
$('body, .button').css('cursor', 'default');
core.alert(text1);
},
error: function(data){
$('body, .button').css('cursor', 'default');
core.alert(text2);
},
complete: function(){
$("#configBackupSubmit").removeClass("disabled").prop("disabled", false);
$("#configBackupSubmit").removeClass("uniqueSubmission").prop("uniqueSubmission", false);
$("#configBackupSubmit span").removeClass("zwiico-spin animate-spin");
$("#configBackupSubmit span").addClass("zwiico-check zwiico-margin-right").text("Sauvegarder");
}
});
});
/**
* Confirmation de sauvegarde complète
*/
$("#configBackupSubmit").on("click", function() {
if ($("input[name=configBackupOption]").is(':checked')) {
return core.confirm(text3, function() {
//$(location).attr("href", _this.attr("href"));
$('body, .button').css('cursor', 'wait');
$('form#configBackupForm').submit();
});
}
});
});