Réinitialisation des thèmes

This commit is contained in:
Fred Tempez 2020-11-07 17:48:10 +01:00
parent 159c7f82e2
commit d486674d73
7 changed files with 82 additions and 41 deletions

View File

@ -13,6 +13,8 @@
- Suppression des commentaires en masse.
- Limiter l'édition des articles et des commentaires à l'id de l'éditeur
- Approbation des commentaires
- Gestion des thèmes :
- Bouton de réinitialisation avec confirmation
## version 10.3.04
- Corrections :

View File

@ -24,7 +24,6 @@ class theme extends common {
'index' => self::GROUP_ADMIN,
'menu' => self::GROUP_ADMIN,
'reset' => self::GROUP_ADMIN,
'resetAdmin' => self::GROUP_ADMIN,
'site' => self::GROUP_ADMIN,
'admin' => self::GROUP_ADMIN,
'manage' => self::GROUP_ADMIN,
@ -535,29 +534,32 @@ class theme extends common {
*/
public function reset() {
// Supprime le fichier de personnalisation avancée
$redirect ='';
switch ($this->getUrl(2)) {
case 'admin':
$this->initData('admin');
$redirect = helper::baseUrl() . 'theme/admin';
break;
case 'manage':
$this->initData('theme');
$redirect = helper::baseUrl() . 'theme/manage';
break;
case 'custom':
unlink(self::DATA_DIR.'custom.css');
$redirect = helper::baseUrl() . 'theme/advanced';
break;
default :
$redirect = helper::baseUrl() . 'theme';
}
// Valeurs en sortie
$this->addOutput([
'notification' => 'Personnalisation avancée réinitialisée',
'redirect' => helper::baseUrl() . 'theme/advanced',
'notification' => 'Réinitialisation effectuée',
'redirect' => $redirect,
'state' => true
]);
}
/**
* Réinitialisation de la personnalisation avancée
*/
public function resetAdmin() {
// Supprime le fichier de personnalisation avancée
//unlink(self::DATA_DIR.'admin.json');
$this->initData('admin');
// Valeurs en sortie
$this->addOutput([
'notification' => 'Thème réinitialisé',
'redirect' => helper::baseUrl() . 'theme/admin',
'state' => true
]);
}
/**
* Options du site

View File

@ -46,3 +46,13 @@ $("input, select").on("change", function() {
.appendTo("head");
});
/**
* Confirmation de réinitialisation
*/
$("#configAdminReset").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème de l\'administration ?", function() {
$(location).attr("href", _this.attr("href"));
});
});

View File

@ -16,7 +16,7 @@
<div class="col2 offset">
<?php echo template::button('configAdminReset', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'theme/resetAdmin',
'href' => helper::baseUrl() . 'theme/reset/admin',
'value' => 'Réinitialiser',
'ico' => 'cancel'
]); ?>

View File

@ -10,7 +10,7 @@
</div>
<div class="col2 offset6">
<?php echo template::button('themeAdvancedReset', [
'href' => helper::baseUrl() . 'theme/reset',
'href' => helper::baseUrl() . 'theme/reset/custom',
'class' => 'buttonRed',
'ico' => 'cancel',
'value' => 'Réinitialiser'

View File

@ -0,0 +1,21 @@
/**
* 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
* @license GNU General Public License, version 3
* @link http://zwiicms.fr/
*/
/**
* Confirmation de réinitialisation
*/
$("#configManageReset").on("click", function() {
var _this = $(this);
return core.confirm("Êtes-vous sûr de vouloir réinitialiser à son état d'origine le thème du site ?", function() {
$(location).attr("href", _this.attr("href"));
});
});

View File

@ -8,53 +8,59 @@
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('configManageReset', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'theme/reset/manage',
'value' => 'Réinitialiser',
'ico' => 'cancel'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('themeImportSubmit', [
'value' => 'Appliquer'
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<div class="block">
<h4>Installer un thème archivé</h4>
<div class="row">
<div class="col12">
<div class="block">
<h4>Installer un thème archivé (site ou administration)</h4>
<div class="row">
<div class="col6 offset3">
<?php echo template::file('themeManageImport', [
'label' => 'Archive ZIP :',
'type' => 2
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col5 offset3">
<?php echo template::submit('themeImportSubmit', [
'value' => 'Appliquer'
]); ?>
</div>
</div>
</div>
</div>
<div class="col6">
<div class="block">
<h4>Sauvegarder le thème</h4>
<h4>Sauvegarde du thème dans les <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>fichiers</a> du site</h4>
<div class="row">
<div class="col6">
<?php echo template::button('themeSave', [
'href' => helper::baseUrl() . 'theme/save/theme',
'ico' => 'download-cloud',
'value' => 'Thème site'
'value' => 'Thème du site'
]); ?>
</div>
<div class="col6">
<?php echo template::button('themeSaveAdmin', [
'href' => helper::baseUrl() . 'theme/save/admin',
'ico' => 'download-cloud',
'value' => 'Thème administration'
'value' => 'Thème de l\'administration'
]); ?>
</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="col6">
<div class="block">
<h4>Télécharger le thème</h4>
<div class="row">
@ -62,14 +68,14 @@
<?php echo template::button('themeExport', [
'href' => helper::baseUrl() . 'theme/export/theme',
'ico' => 'download',
'value' => 'Thème site'
'value' => 'Thème du site'
]); ?>
</div>
<div class="col6">
<?php echo template::button('themeExport', [
'href' => helper::baseUrl() . 'theme/export/admin',
'ico' => 'download',
'value' => 'Thème administration'
'value' => 'Thème de l\'administration'
]); ?>
</div>
</div>