2020-08-08 17:06:06 +02: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>
|
2021-12-18 10:25:33 +01:00
|
|
|
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
2020-08-08 17:06:06 +02:00
|
|
|
* @license GNU General Public License, version 3
|
2020-09-01 20:48:40 +02:00
|
|
|
* @link http://zwiicms.fr/
|
2020-08-08 17:06:06 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
$( document).ready(function() {
|
|
|
|
$("#configBackupForm").submit( function(e){
|
2021-12-01 17:34:58 +01:00
|
|
|
//$("#configBackupSubmit").addClass("disabled").prop("disabled", true);
|
2020-08-08 17:06:06 +02:00
|
|
|
e.preventDefault();
|
|
|
|
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/backup";
|
2022-09-17 16:55:22 +02:00
|
|
|
var message_success = "<?php echo template::topic('Sauvegarde générée avec succès.'); ?>";
|
|
|
|
var message_error = "<?php echo template::topic('Erreur : sauvegarde non générée !'); ?>";
|
|
|
|
var message_title = "<?php echo template::topic('Sauvegarder'); ?>";
|
2020-08-08 17:06:06 +02:00
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: url,
|
|
|
|
data: $("form").serialize(),
|
2020-08-09 12:00:29 +02:00
|
|
|
success: function(data){
|
2021-12-02 15:37:43 +01:00
|
|
|
$('body, .button').css('cursor', 'default');
|
2022-09-17 16:55:22 +02:00
|
|
|
core.alert(message_success);
|
2020-08-09 12:00:29 +02:00
|
|
|
},
|
|
|
|
error: function(data){
|
2021-12-02 15:37:43 +01:00
|
|
|
$('body, .button').css('cursor', 'default');
|
2022-09-17 16:55:22 +02:00
|
|
|
core.alert(message_error);
|
2020-08-09 18:11:49 +02:00
|
|
|
},
|
|
|
|
complete: function(){
|
|
|
|
$("#configBackupSubmit").removeClass("disabled").prop("disabled", false);
|
2021-12-01 17:34:58 +01:00
|
|
|
$("#configBackupSubmit").removeClass("uniqueSubmission").prop("uniqueSubmission", false);
|
|
|
|
$("#configBackupSubmit span").removeClass("zwiico-spin animate-spin");
|
2022-09-17 16:55:22 +02:00
|
|
|
$("#configBackupSubmit span").addClass("zwiico-check zwiico-margin-right").text(message_title);
|
2020-08-08 17:14:52 +02:00
|
|
|
}
|
2020-08-08 17:06:06 +02:00
|
|
|
});
|
|
|
|
});
|
2021-11-15 14:22:36 +01:00
|
|
|
|
2021-11-15 21:44:12 +01:00
|
|
|
|
2021-11-15 14:22:36 +01:00
|
|
|
/**
|
2021-11-15 21:44:12 +01:00
|
|
|
* Confirmation de sauvegarde complète
|
|
|
|
*/
|
|
|
|
$("#configBackupSubmit").on("click", function() {
|
|
|
|
if ($("input[name=configBackupOption]").is(':checked')) {
|
2022-09-17 16:55:22 +02:00
|
|
|
var message_warning = "<?php echo template::topic('La sauvegarde des fichiers peut prendre du temps. Continuer ?'); ?>";
|
|
|
|
return core.confirm(message_warning, function() {
|
2021-11-15 21:44:12 +01:00
|
|
|
//$(location).attr("href", _this.attr("href"));
|
2021-12-02 14:52:43 +01:00
|
|
|
$('body, .button').css('cursor', 'wait');
|
2021-11-15 21:44:12 +01:00
|
|
|
$('form#configBackupForm').submit();
|
|
|
|
});
|
|
|
|
}
|
2021-11-15 14:22:36 +01:00
|
|
|
});
|
2021-11-15 21:44:12 +01:00
|
|
|
|
2020-08-08 17:06:06 +02:00
|
|
|
});
|
|
|
|
|