Effacement de police WIP
This commit is contained in:
parent
be0b4ca818
commit
d64c743467
@ -1940,6 +1940,7 @@ class common {
|
||||
$notificationClass = 'notificationSuccess';
|
||||
}
|
||||
if(common::$inputNotices) {
|
||||
var_dump(common::$inputNotices);
|
||||
$notification = 'Impossible de soumettre le formulaire, car il contient des erreurs';
|
||||
$notificationClass = 'notificationError';
|
||||
}
|
||||
|
@ -30,7 +30,9 @@ class theme extends common {
|
||||
'export' => self::GROUP_ADMIN,
|
||||
'import' => self::GROUP_ADMIN,
|
||||
'save' => self::GROUP_ADMIN,
|
||||
'fonts' => self::GROUP_ADMIN
|
||||
'fonts' => self::GROUP_ADMIN,
|
||||
'fontAdd' => self::GROUP_ADMIN,
|
||||
'fontDelete' => self::GROUP_ADMIN
|
||||
];
|
||||
public static $aligns = [
|
||||
'left' => 'À gauche',
|
||||
@ -548,16 +550,22 @@ class theme extends common {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
}
|
||||
//Polices trouvées dans la configuration
|
||||
|
||||
if ( file_exists(self::DATA_DIR . 'fonts.json') ) {
|
||||
$localFonts = $this->getData(['fonts', 'files']);
|
||||
}
|
||||
//Polices trouvées dans la configuration
|
||||
$fonts = $this->getData(['fonts']);
|
||||
// Parcourir les fontes installées et construire le tableau pour le formulaire
|
||||
foreach (self::$fonts as $fontId => $fontName) {
|
||||
self::$fontsList [] = [
|
||||
self::$fontsList [] = [
|
||||
$fontName,
|
||||
$fontId
|
||||
$fontId,
|
||||
array_key_exists($fontId, $fonts['imported']) ? 'Importée' : '',
|
||||
array_key_exists($fontId, $fonts['files']) ? $fonts['files'][$fontId] : 'CDN Fonts',
|
||||
array_key_exists($fontId, $fonts['imported']) || array_key_exists($fontId, $fonts['files'])
|
||||
? template::button('themeFontDelete' . $fontId, [
|
||||
'class' => 'themeFontDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $fontId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
: ''
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
@ -567,6 +575,80 @@ class theme extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajouter une fonte
|
||||
*/
|
||||
public function fontAdd() {
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
$fontId = $this->getInput('fontAddFontId', null, true);
|
||||
$fontName = $this->getInput('fontAddFontName', null, true);
|
||||
$file = $this->getInput('fontAddFile', null, true);
|
||||
|
||||
// Charger les données des fontes
|
||||
$files = $this->getData(['fonts', 'files']);
|
||||
$imported = $this->getData(['fonts', 'imported']);
|
||||
// Concaténation dans les tableaux existants
|
||||
$imported = array_merge([$fontId => $fontName], $imported);
|
||||
$files = array_merge([$fontId => $file], $files);
|
||||
// Mettre à jour le fichier des fontes
|
||||
$this->setData(['fonts', 'imported', $imported ]);
|
||||
$this->setData(['fonts', 'files', $files ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Fonte importée',
|
||||
'redirect' => helper::baseUrl() . 'theme/fonts',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Ajouter une fonte',
|
||||
'view' => 'fontAdd'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Effacer une fonte
|
||||
*/
|
||||
public function fontDelete() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'theme/fonts',
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
// Suppression
|
||||
else {
|
||||
|
||||
// Charger les données des fontes
|
||||
$files = $this->getData(['fonts', 'files']);
|
||||
$imported = $this->getData(['fonts', 'imported']);
|
||||
|
||||
// Effacer le fichier existant
|
||||
if ( file_exists(self::DATA_DIR . $files[$this->getUrl(2)]) ) {
|
||||
unlink(self::DATA_DIR . $files[$this->getUrl(2)]);
|
||||
}
|
||||
|
||||
// Supprimer les entrées
|
||||
unset($file[$this->getUrl(2)]);
|
||||
unset($imported[$this->getUrl(2)]);
|
||||
|
||||
// Mettre à jour le fichier des fontes
|
||||
$this->setData(['fonts', 'files', $files ]);
|
||||
$this->setData(['fonts', 'imported', $imported ]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'theme/fonts',
|
||||
'notification' => 'Fonte supprimée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Réinitialisation de la personnalisation avancée
|
||||
*/
|
||||
|
18
core/module/theme/view/fontAdd/fontAdd.css
Normal file
18
core/module/theme/view/fontAdd/fontAdd.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
58
core/module/theme/view/fontAdd/fontAdd.php
Normal file
58
core/module/theme/view/fontAdd/fontAdd.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php echo template::formOpen('fontAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('fontAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/font',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('fontAddPublish', [
|
||||
'value' => 'Valider',
|
||||
'uniqueSubmission' => true
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Identification</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('fontAddFontId', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Identifiant',
|
||||
'placeholder' => 'perry-gothic'
|
||||
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('fontAddFontName', [
|
||||
'autocomplete' => 'off',
|
||||
'label' => 'Nom (Font Family)',
|
||||
'placeholder' => 'PerryGothic'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Source</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::file('fontAddFile', [
|
||||
'label' => 'Fichier de police (Format WOFF)',
|
||||
'placeholder' => 'https://fonts.cdnfonts.com/s/7896/PERRYGOT.woff'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php echo template::formClose(); ?>
|
21
core/module/theme/view/fonts/fonts.js.php
Normal file
21
core/module/theme/view/fonts/fonts.js.php
Normal 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 Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".themeFontDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette fonte ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
@ -1,5 +1,22 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('themeFontBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'theme',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('themeFontAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/fontAdd',
|
||||
'ico' => 'plus',
|
||||
'value' => 'Fonte'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$fontsList): ?>
|
||||
<?php echo template::table([6, 6], $module::$fontsList, ['Family Name', 'Font Id']); ?>
|
||||
<?php echo template::table([4, 4, 3, 4, 1], $module::$fontsList, ['Family Name', 'Font Id', '', 'Accès', 'Effacer']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune news.'); ?>
|
||||
<?php echo template::speech('Aucune fonte !'); ?>
|
||||
<?php endif; ?>
|
2
core/vendor/filemanager/config/config.php
vendored
2
core/vendor/filemanager/config/config.php
vendored
@ -458,7 +458,7 @@ $config = array(
|
||||
'ext_file' => array( 'doc', 'docx', 'rtf', 'pdf', 'xls', 'xlsx', 'txt', 'csv', 'html', 'xhtml', 'psd', 'sql', 'log', 'fla', 'xml', 'ade', 'adp', 'mdb', 'accdb', 'ppt', 'pptx', 'odt', 'ots', 'ott', 'odb', 'odg', 'otp', 'otg', 'odf', 'ods', 'odp', 'css', 'ai', 'kmz','dwg', 'dxf', 'hpgl', 'plt', 'spl', 'step', 'stp', 'iges', 'igs', 'sat', 'cgm', 'ics', 'gpx', 'kml', ''), //Files
|
||||
'ext_video' => array( 'mov', 'mpeg', 'm4v', 'mp4', 'avi', 'mpg', 'wma', "flv", "webm" ), //Video
|
||||
'ext_music' => array( 'mp3', 'mpga', 'm4a', 'ac3', 'aiff', 'mid', 'ogg', 'wav' ), //Audio
|
||||
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg' ), //Archives
|
||||
'ext_misc' => array( 'zip', 'rar', 'gz', 'tar', 'iso', 'dmg', 'woff' ), //Archives et polices de caractères
|
||||
|
||||
|
||||
//*********************
|
||||
|
Loading…
Reference in New Issue
Block a user