init + améliorer la notification finale.

This commit is contained in:
Fred Tempez 2020-08-08 17:06:06 +02:00
parent b54f2ed9bc
commit 54b5efd1d8
13 changed files with 106 additions and 126 deletions

View File

@ -8,7 +8,7 @@
*
* @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>
* @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
* @link http://zwiicms.com/
@ -246,8 +246,12 @@ class config extends common {
// Creation du ZIP
$filter = $this->getInput('configBackupOption',helper::FILTER_BOOLEAN) === true ? ['backup','tmp'] : ['backup','tmp','file'];
$fileName = helper::autoBackup(self::TEMP_DIR,$filter);
if (!is_dir(self::FILE_DIR.'source/backup')) {
mkdir(self::FILE_DIR.'source/backup');
}
copy (self::TEMP_DIR . $fileName , self::FILE_DIR.'source/backup/' . $fileName);
// Téléchargement du ZIP
/*// Téléchargement du ZIP // NE marche pas avec le spinner
header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize(self::TEMP_DIR . $fileName));
@ -256,6 +260,7 @@ class config extends common {
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
*/
unlink(self::TEMP_DIR . $fileName);
} else {
// Valeurs en sortie

View File

@ -13,3 +13,37 @@
*/
@import url("site/data/admin.css");
/**
* Effet d'animation
*/
/* Start by setting display:none to make this hidden.
Then we position it in relation to the viewport window
with position:fixed. Width, height, top and left speak
for themselves. Background we set to 80% white with
our animation centered, and no-repeating */
.modal {
display: none;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
height: 100%;
width: 100%;
background: rgba( 255, 255, 255, .2 )
url('core/vendor/zwiico/img/ajax-loader.gif')
50% 50%
no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading .modal {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modal {
display: block;
}

View File

@ -0,0 +1,31 @@
/**
* 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
* @link http://zwiicms.com/
*/
$( document).ready(function() {
$("#configBackupForm").submit( function(e){
console.log('click');
e.preventDefault();
$("body").addClass("loading");
var url = "<?php echo helper::baseUrl() . $this->getUrl(0); ?>/backup";
$.ajax({
type: "POST",
url: url,
data: $("form").serialize(),
complete: function(r, s){
$("body").removeClass("loading");
$("body").append("<div id='notification' class='notificationSuccess'>Sauvegarde générée avec succès !</div>");
$("#notification").delay("3000").fadeOut("1000");
},
});
});
});

View File

@ -10,10 +10,11 @@
</div>
<div class="col2 offset8">
<?php echo template::submit('configBackupSubmit',[
'value' => 'Valider',
'ico' => 'check'
'value' => 'Sauvegarder',
'ico' => 'download-cloud'
]); ?>
</div>
<div class="modal"><!-- Emplacement pour l'animation --></div>
</div>
<div class="row">
<div class="col12">
@ -26,6 +27,9 @@
'help' => 'Cette option n\'est pas recommandée lorsque le contenu du gestionnaire de fichiers est très volumineux.'
]); ?>
</div>
<div class="col12">
<em>Le fichier de sauvegarde est généré dans <a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=backup&type=0&akey=<?php echo md5_file(self::DATA_DIR.'core.json'); ?>" data-lity>le dossier Backup</a> du gestionnaire de fichiers.</em>
</div>
</div>
</div>
</div>

View File

@ -10,8 +10,8 @@
</div>
<div class="col2 offset8">
<?php echo template::submit('configManageSubmit',[
'value' => 'Valider',
'ico' => 'check'
'value' => 'Restaurer',
'ico' => 'upload'
]); ?>
</div>
</div>

View File

@ -1,15 +0,0 @@
/**
* 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 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-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
@import url("site/data/admin.css");

View File

@ -1,85 +0,0 @@
<?php echo template::formOpen('configRestoreForm'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('configRestoreBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('configRestoreSubmit',[
'value' => 'Restaurer',
'ico' => 'upload'
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Restauration ou transfert d'un site</h4>
<div class="row">
<div class="col8 offset2">
<?php echo template::file('configRestoreImportFile', [
'label' => 'Sélectionnez une sauvegarde au format ZIP',
'type' => 2,
'help' => 'L\'archive a été déposée dans le gestionnaire de fichiers. Les archives inférieures à la version 9 ne sont pas acceptées.'
]); ?>
</div>
</div>
<div class="row">
<div class="col8 offset2">
<?php echo template::checkbox('configRestoreImportUser', true, 'Préserver les comptes des utilisateurs', [
'checked' => true,
'help' => 'Les données des utilisateurs installés ne sont pas écrasés par la restauration quand l\'option est active.'
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Conversion des URL après transfert de site</h4>
<div class="row">
<div class="col5">
<?php
if (is_null($this->getData(['core', 'baseUrl'])) ) {
$baseUrlValue = 'Pas de donnée dans la sauvegarde';
$buttonClass = 'disabled';
} elseif ($this->getData(['core', 'baseUrl']) === '') {
$baseUrlValue = '/';
$buttonClass = (helper::baseUrl(true,false) !== $this->getData(['core', 'baseUrl']) ) ? '' : 'disabled';
} else {
$baseUrlValue = $this->getData(['core', 'baseUrl']);
$buttonClass = (helper::baseUrl(true,false) !== $this->getData(['core', 'baseUrl']) ) ? '' : 'disabled';
}
echo template::text('configRestoreBaseURLToConvert', [
'label' => 'Dossier d\'installation de l\'archive' ,
'value' => $baseUrlValue,
'readonly' => true,
'help' => 'Lors de la restauration d\'un backup d\'une version 9.2.10 ou supérieure, l\'URL de base est stockée dans la configuration sinon cette donnée est vide.'
]); ?>
</div>
<div class="col5">
<?php echo template::text('configRestoreCurrentURL', [
'label' => 'Dossier du site actuel',
'value' => helper::baseUrl(true,false),
'readonly' => true,
'help' => 'Dossier du site installé.'
]); ?>
</div>
<div class="col2 verticalAlignBottom">
<?php echo template::button('configRestoreUpdateBaseURLButton', [
'href' => helper::baseUrl() . 'config/updateBaseUrl',
'class' => $buttonClass,
'value' => 'convertir'
]); ?>
</div>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -669,7 +669,7 @@ class theme extends common {
unlink (self::TEMP_DIR . $zipFilename);
// Valeurs en sortie
$this->addOutput([
'notification' => 'Archive <b>'.$zipFilename.'</b> sauvegardée dans fichiers',
'notification' => 'Archive <b>'.$zipFilename.'</b> sauvegardée avec succès',
'redirect' => helper::baseUrl() . 'theme/manage',
'state' => true
]);

View File

@ -49,6 +49,11 @@
]); ?>
</div>
</div>
<div class="row">
<div class="col12">
<em>Le fichier de sauvegarde est généré dans <a href="<?php echo helper::baseUrl(false); ?>core/vendor/filemanager/dialog.php?fldr=theme&type=0&akey=<?php echo md5_file(self::DATA_DIR.'core.json'); ?>" data-lity>le dossier Thème</a> du gestionnaire de fichiers.</em>
</div>
</div>
</div>
<div class="block">
<h4>Télécharger le thème</h4>

BIN
core/vendor/zwiico/img/ajax-loader.gif vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 B

View File

@ -28,6 +28,7 @@ setlocale (LC_TIME, 'fra_FRA', 'french');
/**
* Initialisation de Zwii
*/
session_start();
// Chargement des classes
require 'core/class/autoload.php';