Revert "Merge branch '11300' of https://forge.chapril.org/fredtempez/ZwiiCMS-private into 11300"
This reverts commit81f2fad880
, reversing changes made to333bc1f9cb
.
This commit is contained in:
parent
81f2fad880
commit
b2094b7834
11
CHANGES.md
11
CHANGES.md
@ -1,14 +1,8 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## Version 12.0.00
|
||||
- Modifications :
|
||||
- Module addon refondu et renommé plugin.
|
||||
- Réorganisation massive des modules afin d'éviter de faire cohabiter des formulaires avec des champs d'information.
|
||||
- Désormais, les URL internes seront relatives, cela signifie qu'elles ne contiendront plus le domaine et le chemin d'accès au site. Cela permettra le déplacement d'un site d'un hébergement à un autre, d'un dossier d'hébergement à un autre, sans avoir à convertir les adresses internes. Les données d'un site mis à jour et importées d'une version antérieures sont automatiquement converties. En conséquence, le bloc de conversion de la fenêtre d'import est supprimé.
|
||||
|
||||
## Version 11.3.00
|
||||
Corrections :
|
||||
- Corrections :
|
||||
- Thème / site : problème d'aperçu du body ; police du thème admin non chargées.
|
||||
- Bugs avec les aperçus des sélecteurs de fontes.
|
||||
- Notice générée par l'effacement d'une page sans module.
|
||||
@ -36,8 +30,9 @@ Corrections :
|
||||
- Thème ; pied de page ; option pied de page fixe inopérante.
|
||||
- Edition des pages orphelines : "Ne pas afficher" une page contenant des sous-pages provoquait un bug d'affichage dans le menu, la page était malgré tout affichée en fin de menu. Ce problème était causé par les pages enfants dont l'affichage n'était pas modifié. Le correctif cascade l'option "Ne pas afficher" aux sous-pages. La réciproque n'est pas appliquée, il faudra rendre visible les sous-pages d'une page parente qui devient à nouveau visible.
|
||||
- Modifications :
|
||||
- Mise à jour en ligne, contrôle de la clé MD5 de l'archive update.tar.gz.
|
||||
- Addons (gestion des modules), le bouton d'accès au store est déplacé à la page de gestion des modules. Quelques étiquettes de boutons sont modifiés.
|
||||
- Thème ; pied de page ; options pied de page fixe et alignement avec le contenu déplacées dans les paramètres.
|
||||
- Mise à jour en ligne, contrôle de la clé MD5 de l'archive update.tar.gz.
|
||||
|
||||
## Version 11.2.02
|
||||
- Correction :
|
||||
|
@ -1,6 +1,6 @@
|
||||
|
||||
|
||||
# ZwiiCMS 12.0.00
|
||||
# ZwiiCMS 11.3.0
|
||||
|
||||
Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.
|
||||
|
||||
|
@ -281,7 +281,7 @@ class helper {
|
||||
|
||||
if($version = helper::getOnlineVersion()) {
|
||||
//return (trim($version) !== common::ZWII_VERSION);
|
||||
return ((version_compare(common::ZWII_VERSION,$version)) === -1);
|
||||
return ((version_compare(common::ZWII_VERSION,$version,'<')) === -1);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
@ -19,17 +19,15 @@ class template {
|
||||
'name' => $nameId,
|
||||
'target' => '',
|
||||
'uniqueSubmission' => false,
|
||||
'value' => 'Bouton',
|
||||
'help' => ''
|
||||
'value' => 'Bouton'
|
||||
], $attributes);
|
||||
// Retourne le html
|
||||
return sprintf(
|
||||
'<a %s class="button %s %s %s" %s>%s</a>',
|
||||
'<a %s class="button %s %s %s">%s</a>',
|
||||
helper::sprintAttributes($attributes, ['class', 'disabled', 'ico', 'value']),
|
||||
$attributes['disabled'] ? 'disabled' : '',
|
||||
$attributes['class'],
|
||||
$attributes['uniqueSubmission'] ? 'uniqueSubmission' : '',
|
||||
$attributes['help'] ? ' title="' . $attributes['help'] . '" ': '',
|
||||
($attributes['ico'] ? template::ico($attributes['ico'], 'right') : '') . $attributes['value']
|
||||
);
|
||||
}
|
||||
|
@ -490,6 +490,26 @@ $(document).ready(function(){
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* Active le système d'aide interne
|
||||
*
|
||||
*/
|
||||
|
||||
$(".buttonHelp").click(function() {
|
||||
$(".helpDisplayContent").slideToggle();
|
||||
/**
|
||||
if( $(".buttonHelp").css('opacity') > '0.75'){
|
||||
$(".buttonHelp").css('opacity','0.5');
|
||||
}
|
||||
else{
|
||||
$(".buttonHelp").css('opacity','1');
|
||||
}
|
||||
*/
|
||||
});
|
||||
|
||||
$(".helpDisplayContent").click(function() {
|
||||
$(".helpDisplayContent").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Remove ID Facebook from URL
|
||||
|
@ -45,8 +45,8 @@ class common {
|
||||
|
||||
// Numéro de version
|
||||
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';
|
||||
const ZWII_VERSION = '12.0.00';
|
||||
const ZWII_UPDATE_CHANNEL = "test";
|
||||
const ZWII_VERSION = '11.3.00';
|
||||
const ZWII_UPDATE_CHANNEL = "v11";
|
||||
|
||||
public static $actions = [];
|
||||
public static $coreModuleIds = [
|
||||
@ -58,7 +58,7 @@ class common {
|
||||
'theme',
|
||||
'user',
|
||||
'translate',
|
||||
'plugin'
|
||||
'addon'
|
||||
];
|
||||
public static $accessList = [
|
||||
'user',
|
||||
@ -538,8 +538,6 @@ class common {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Effacer les données de la page
|
||||
* @param string pageId
|
||||
@ -549,8 +547,7 @@ class common {
|
||||
|
||||
return unlink(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content']));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sauvegarde des données
|
||||
@ -1182,34 +1179,13 @@ class common {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fonction de parcours des données de module
|
||||
* @param string $find donnée à rechercher
|
||||
* @param string $replace donnée à remplacer
|
||||
* @param array tableau à analyser
|
||||
* @param int count nombres d'occurrences
|
||||
* @return array avec les valeurs remplacées.
|
||||
*/
|
||||
public function recursive_array_replace ($find, $replace, $array, &$count) {
|
||||
if (!is_array($array)) {
|
||||
return str_replace($find, $replace, $array, $count);
|
||||
}
|
||||
|
||||
$newArray = [];
|
||||
foreach ($array as $key => $value) {
|
||||
$newArray[$key] = $this->recursive_array_replace($find, $replace, $value,$c);
|
||||
$count += $c;
|
||||
}
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Génère une archive d'un dossier et des sous-dossiers
|
||||
* @param string fileName path et nom de l'archive
|
||||
* @param string folder path à zipper
|
||||
* @param array filter dossiers à exclure
|
||||
*/
|
||||
public function makeZip ($fileName, $folder, $filter = [] ) {
|
||||
public function makeZip ($fileName, $folder, $filter ) {
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
|
||||
//$directory = 'site/';
|
||||
@ -2091,7 +2067,7 @@ class common {
|
||||
}
|
||||
if($this->getUser('group') >= self::GROUP_ADMIN) {
|
||||
$rightItems .= '<li><a href="' . helper::baseUrl() . 'theme" data-tippy-content="Personnaliser les thèmes">' . template::ico('brush') . '</a></li>';
|
||||
$rightItems .= '<li><a href="' . helper::baseUrl() . 'plugin" data-tippy-content="Gérer les modules">' . template::ico('puzzle') . '</a></li>';
|
||||
$rightItems .= '<li><a href="' . helper::baseUrl() . 'addon" data-tippy-content="Gérer les modules">' . template::ico('puzzle') . '</a></li>';
|
||||
if ($this->getData(['config', 'i18n', 'enable']) === true) {
|
||||
$rightItems .= '<li><a href="' . helper::baseUrl() . 'translate" data-tippy-content="Gestion des langues">' . template::ico('flag') . '</a></li>';
|
||||
}
|
||||
|
@ -741,55 +741,6 @@ if ($this->getData(['core', 'dataVersion']) < 11202) {
|
||||
$this->setData(['core', 'dataVersion', 11202]);
|
||||
}
|
||||
|
||||
// Version 11.2.03
|
||||
if ($this->getData(['core', 'dataVersion']) < 11203) {
|
||||
// Supprimer l'information de redirection
|
||||
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$new = '';
|
||||
$c3 = 0;
|
||||
$success = false ;
|
||||
// Boucler sur les pages
|
||||
foreach($this->getHierarchy(null,null,null) as $parentId => $childIds) {
|
||||
$content = $this->getPage($parentId, self::$i18n);
|
||||
$titre = $this->getData(['page', $parentId, 'title']);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($parentId, $replace, self::$i18n);
|
||||
$c3 += $c1 + $c2;
|
||||
}
|
||||
foreach($childIds as $childId) {
|
||||
$content = $this->getPage($childId, self::$i18n);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($childId, $replace, self::$i18n);
|
||||
$c3 += $c1 + $c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Traiter les modules dont la redirection
|
||||
$content = $this->getdata(['module']);
|
||||
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2);
|
||||
if ($content !== $replace) {
|
||||
$this->setdata(['module',$replace]);
|
||||
$c3 += $c1 + $c2;
|
||||
$success = true;
|
||||
}
|
||||
|
||||
// Effacer la baseUrl
|
||||
$this->deleteData(['core', 'baseUrl']);
|
||||
|
||||
// Mise à jour
|
||||
$this->setData(['core', 'dataVersion', 11203]);
|
||||
}
|
||||
|
||||
// Version 11.3.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 11300) {
|
||||
|
||||
@ -839,14 +790,4 @@ if ($this->getData(['core', 'dataVersion']) < 11300) {
|
||||
|
||||
// Mise à jour
|
||||
$this->setData(['core', 'dataVersion', 11300]);
|
||||
}
|
||||
|
||||
// Version 12.0.00
|
||||
if ($this->getData(['core', 'dataVersion']) < 12000) {
|
||||
|
||||
// Effacer le dossier
|
||||
$this->removeDir('core/module/addon');
|
||||
|
||||
// Mise à jour
|
||||
$this->setData(['core', 'dataVersion', 12000]);
|
||||
}
|
||||
}
|
@ -1744,6 +1744,22 @@ th.col12 {
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
/* Système d'aide */
|
||||
|
||||
.helpDisplayContent {
|
||||
display: none;
|
||||
width: 100%;
|
||||
padding: 10px 10px;
|
||||
-webkit-box-shadow: 5px 5px 11px 0px #222222;
|
||||
box-shadow: 5px 5px 11px 0px #222222;
|
||||
border-radius: 5px;
|
||||
z-index: 30;
|
||||
}
|
||||
|
||||
.helpDisplayContent, .helpDisplayButton {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Bannière masquable en petit écran*/
|
||||
@media screen and (max-width: 768px) {
|
||||
.bannerDisplay{
|
||||
|
594
core/module/addon/addon.php
Normal file
594
core/module/addon/addon.php
Normal file
@ -0,0 +1,594 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @copyright Copyright (C) 2020-2021, Sylvain Lelièvre
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class addon extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'export' => self::GROUP_ADMIN,
|
||||
'import' => self::GROUP_ADMIN,
|
||||
'store' => self::GROUP_ADMIN,
|
||||
'item' => self::GROUP_ADMIN,
|
||||
'upload' => self::GROUP_ADMIN,
|
||||
'uploadItem'=> self::GROUP_ADMIN
|
||||
];
|
||||
|
||||
// URL des modules
|
||||
const BASEURL_STORE = 'https://store.zwiicms.fr/';
|
||||
const MODULE_STORE = '?modules/';
|
||||
|
||||
// Gestion des modules
|
||||
public static $modInstal = [];
|
||||
|
||||
// pour tests
|
||||
public static $valeur = [];
|
||||
|
||||
// le catalogue
|
||||
public static $storeList = [];
|
||||
public static $storeItem = [];
|
||||
|
||||
|
||||
/*
|
||||
* Effacement d'un module installé et non utilisé
|
||||
*/
|
||||
public function delete() {
|
||||
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else{
|
||||
// Suppression des dossiers
|
||||
$infoModules = helper::getModules();
|
||||
$module = $this->getUrl(2);
|
||||
//Liste des dossiers associés au module non effacés
|
||||
if( $this->removeDir('./module/'.$module ) === true ){
|
||||
$success = true;
|
||||
$notification = 'Module '. $module .' désinstallé';
|
||||
if(($infoModules[$this->getUrl(2)]['dataDirectory']) ) {
|
||||
if (
|
||||
is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
&& !$this->removeDir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
){
|
||||
$notification = 'Module '.$module .' désinstallé, il reste des données dans ' . $infoModules[$this->getUrl(2)]['dataDirectory'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
$notification = 'La suppression a échouée';
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'notification' => $notification,
|
||||
'state' => $success
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module
|
||||
* Fonction utilisée par upload et storeUpload
|
||||
*/
|
||||
private function install ($moduleName, $checkValid){
|
||||
$tempFolder = 'datamodules';//uniqid();
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($moduleName) === TRUE) {
|
||||
$notification = 'Archive ouverte';
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Archive de module ?
|
||||
$success = false;
|
||||
$notification = 'Ce n\'est pas l\'archive d\'un module !';
|
||||
$moduleDir = self::TEMP_DIR . $tempFolder . '/module';
|
||||
$moduleName = '';
|
||||
if ( is_dir( $moduleDir )) {
|
||||
// Lire le nom du module
|
||||
if ($dh = opendir( $moduleDir )) {
|
||||
while ( false !== ($file = readdir($dh)) ) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$moduleName = $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
// Module normalisé ?
|
||||
if( is_file( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php' ) AND is_file( $moduleDir.'/'.$moduleName.'/view/index/index.php' ) ){
|
||||
|
||||
// Lecture de la version et de la validation d'update du module pour validation de la mise à jour
|
||||
// Pour une version <= version installée l'utilisateur doit cocher 'Mise à jour forcée'
|
||||
$version = '0.0';
|
||||
$update = '0.0';
|
||||
$valUpdate = false;
|
||||
$file = file_get_contents( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$file = str_replace(' ','',$file);
|
||||
$file = str_replace("\t",'',$file);
|
||||
$pos1 = strpos($file, 'constVERSION');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$version = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
}
|
||||
$pos1 = strpos($file, 'constUPDATE');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$update = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
}
|
||||
// Si version actuelle >= version indiquée dans UPDATE la mise à jour est validée
|
||||
$infoModules = helper::getModules();
|
||||
if( $infoModules[$moduleName]['update'] >= $update ) $valUpdate = true;
|
||||
|
||||
// Module déjà installé ?
|
||||
$moduleInstal = false;
|
||||
foreach($infoModules as $key=>$value ){
|
||||
if($moduleName === $key){
|
||||
$moduleInstal = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Validation de la maj si autorisation du concepteur du module ET
|
||||
// ( Version plus récente OU Check de forçage )
|
||||
$valNewVersion = floatval($version);
|
||||
$valInstalVersion = floatval( $infoModules[$moduleName]['version'] );
|
||||
$newVersion = false;
|
||||
if( $valNewVersion > $valInstalVersion ) $newVersion = true;
|
||||
$validMaj = $valUpdate && ( $newVersion || $checkValid);
|
||||
|
||||
// Nouvelle installation ou mise à jour du module
|
||||
if( ! $moduleInstal || $validMaj ){
|
||||
// Copie récursive des dossiers
|
||||
$this->copyDir( self::TEMP_DIR . $tempFolder, './' );
|
||||
$success = true;
|
||||
if( ! $moduleInstal ){
|
||||
$notification = 'Module '.$moduleName.' installé';
|
||||
}
|
||||
else{
|
||||
$notification = 'Module '.$moduleName.' mis à jour';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
if( $valNewVersion == $valInstalVersion){
|
||||
$notification = ' Version détectée '.$version.' = à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
else{
|
||||
$notification = ' Version détectée '.$version.' < à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
if( $valUpdate === false){
|
||||
if( $infoModules[$moduleName]['update'] === $update ){
|
||||
$notification = ' Mise à jour par ce procédé interdite par le concepteur du module';
|
||||
}
|
||||
else{
|
||||
$notification = ' Mise à jour par ce procédé interdite, votre version est trop ancienne';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Supprimer le dossier temporaire même si le module est invalide
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
} else {
|
||||
// erreur à l'ouverture
|
||||
$success = false;
|
||||
$notification = 'Impossible d\'ouvrir l\'archive';
|
||||
}
|
||||
return(['success' => $success,
|
||||
'notification'=> $notification
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module à partir du gestionnaire de fichier
|
||||
*/
|
||||
public function upload() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Installation d'un module
|
||||
$checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN);
|
||||
$zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT);
|
||||
if( $zipFilename !== ''){
|
||||
$success = [
|
||||
'success' => false,
|
||||
'notification'=> ''
|
||||
];
|
||||
$state = $this->install(self::FILE_DIR.'source/'.$zipFilename, $checkValidMaj);
|
||||
}
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => $state['notification'],
|
||||
'state' => $state['success']
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Téléverser un module',
|
||||
'view' => 'upload'
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module par le catalogue
|
||||
*/
|
||||
public function uploadItem() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'store',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
} else {
|
||||
// Récupérer le module en ligne
|
||||
$moduleName = $this->getUrl(2);
|
||||
// Informations sur les module en ligne
|
||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
// Url du module à télécharger
|
||||
$moduleFilePath = $store[$moduleName]['file'];
|
||||
// Télécharger le fichier
|
||||
$moduleData = helper::getUrlContents(self::BASEURL_STORE . self::FILE_DIR . 'source/' . $moduleFilePath);
|
||||
// Extraire de l'arborescence
|
||||
$d = explode('/',$moduleFilePath);
|
||||
$moduleFile = $d[count($d)-1];
|
||||
// Créer le dossier modules
|
||||
if (!is_dir(self::FILE_DIR . 'source/modules')) {
|
||||
mkdir (self::FILE_DIR . 'source/modules', 0755);
|
||||
}
|
||||
// Sauver les données du fichiers
|
||||
file_put_contents(self::FILE_DIR . 'source/modules/' . $moduleFile, $moduleData);
|
||||
|
||||
/**
|
||||
* $if( $moduleFile !== ''){
|
||||
* $success = [
|
||||
* 'success' => false,
|
||||
* 'notification'=> ''
|
||||
* ];
|
||||
* $state = $this->install(self::FILE_DIR.'source/modules/'.$moduleFile, false);
|
||||
*}
|
||||
*/
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon/store',
|
||||
'notification' => $moduleFile . ' téléchargé dans le dossier modules du gestionnaire de fichiers',
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Catalogue de modules',
|
||||
'view' => 'store'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Catalogue des modules sur le site ZwiiCMS.fr
|
||||
*/
|
||||
public function store() {
|
||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
if ($store) {
|
||||
// Modules installés
|
||||
$infoModules = helper::getModules();
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
foreach( $inPages as $key=>$value){
|
||||
$inPagesTitle[ $this->getData(['page', $key, 'title' ]) ] = $value;
|
||||
}
|
||||
// Parcourir les données des modules
|
||||
foreach ($store as $key=>$value) {
|
||||
// Module non installé
|
||||
$ico = template::ico('download');
|
||||
$class = '';
|
||||
// Le module est installé
|
||||
if (array_key_exists($key,$infoModules) === true) {
|
||||
$class = 'buttonGreen';
|
||||
$ico = template::ico('update');
|
||||
}
|
||||
// Le module est installé et utilisé
|
||||
if (in_array($key,$inPages) === true) {
|
||||
$class = 'buttonRed';
|
||||
$ico = template::ico('update');
|
||||
}
|
||||
self::$storeList [] = [
|
||||
$store[$key]['category'],
|
||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
||||
$store[$key]['version'],
|
||||
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $store[$key]['versionDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', $store[$key]['versionDate'])),
|
||||
implode(', ', array_keys($inPagesTitle,$key)),
|
||||
template::button('moduleExport' . $key, [
|
||||
'class' => $class,
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/uploadItem/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => $ico
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Catalogue de modules en ligne',
|
||||
'view' => 'store'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Détail d'un objet du catalogue
|
||||
*/
|
||||
public function item() {
|
||||
$store = json_decode(helper::getUrlContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
self::$storeItem = $store [$this->getUrl(2)] ;
|
||||
self::$storeItem ['fileDate'] = mb_detect_encoding(strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' =>'Module ' . self::$storeItem['title'],
|
||||
'view' => 'item'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion des modules
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Lister les modules
|
||||
// $infoModules[nom_module]['realName'], ['version'], ['update'], ['delete'], ['dataDirectory']
|
||||
$infoModules = helper::getModules();
|
||||
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
foreach( $inPages as $key=>$value){
|
||||
$inPagesTitle[ $this->getData(['page', $key, 'title' ]) ] = $value;
|
||||
}
|
||||
|
||||
// Parcourir les données des modules
|
||||
foreach ($infoModules as $key=>$value) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modInstal[] = [
|
||||
$key,
|
||||
$infoModules[$key]['realName'],
|
||||
$infoModules[$key]['version'],
|
||||
implode(', ', array_keys($inPagesTitle,$key)),
|
||||
//|| ('delete',$infoModules[$key]) && $infoModules[$key]['delete'] === true && implode(', ',array_keys($inPages,$key)) === ''
|
||||
$infoModules[$key]['delete'] === true && implode(', ',array_keys($inPages,$key)) === ''
|
||||
? template::button('moduleDelete' . $key, [
|
||||
'class' => 'moduleDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
: '',
|
||||
implode(', ',array_keys($inPages,$key)) !== ''
|
||||
? template::button('moduleExport' . $key, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/export/' . $key . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('download')
|
||||
])
|
||||
: '',
|
||||
implode(', ',array_keys($inPages,$key)) === ''
|
||||
? template::button('moduleExport' . $key, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/import/' . $key . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('upload')
|
||||
])
|
||||
: ''
|
||||
];
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Gestion des modules',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Export des données d'un module externes ou interne à module.json
|
||||
*/
|
||||
public function export(){
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else {
|
||||
// Lire les données du module
|
||||
$infoModules = helper::getModules();
|
||||
// Créer un dossier par défaut
|
||||
$tmpFolder = self::TEMP_DIR . uniqid();
|
||||
//$tmpFolder = self::TEMP_DIR . 'test';
|
||||
if (!is_dir($tmpFolder)) {
|
||||
mkdir($tmpFolder, 0755);
|
||||
}
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
// Parcourir les pages utilisant le module
|
||||
foreach (array_keys($inPages,$this->getUrl(2)) as $pageId) {
|
||||
// Export des pages hébergeant le module
|
||||
$pageParam[$pageId] = $this->getData(['page',$pageId]);
|
||||
// Export du contenu de la page
|
||||
//$pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content']));
|
||||
$pageContent[$pageId] = $this->getPage($pageId, self::$i18n);
|
||||
// Export de fr/module.json
|
||||
$moduleId = 'fr/module.json';
|
||||
$moduleDir = str_replace('site/data/','',$infoModules[$this->getUrl(2)]['dataDirectory']);
|
||||
// Création de l'arborescence des langues
|
||||
// Pas de nom dossier de langue - dossier par défaut
|
||||
$t = explode ('/',$moduleId);
|
||||
if ( is_array($t)) {
|
||||
$lang = 'fr';
|
||||
} else {
|
||||
$lang = $t[0];
|
||||
}
|
||||
// Créer le dossier temporaire si inexistant sinon le nettoie et le créer
|
||||
if (!is_dir($tmpFolder . '/' . $lang)) {
|
||||
mkdir ($tmpFolder . '/' . $lang, 0755, true);
|
||||
} else {
|
||||
$this->removeDir($tmpFolder . '/' . $lang);
|
||||
mkdir ($tmpFolder . '/' . $lang, 0755, true);
|
||||
}
|
||||
// Créer le dossier temporaire des données du module
|
||||
if ($infoModules[$this->getUrl(2)]['dataDirectory']) {
|
||||
if (!is_dir($tmpFolder . '/' . $moduleDir)) {
|
||||
mkdir ($tmpFolder . '/' . $moduleDir, 0755, true) ;
|
||||
}
|
||||
}
|
||||
// Sauvegarde si données non vides
|
||||
$tmpData [$pageId] = $this->getData(['module',$pageId ]);
|
||||
if ($tmpData [$pageId] !== null) {
|
||||
file_put_contents($tmpFolder . '/' . $moduleId, json_encode($tmpData));
|
||||
}
|
||||
// Export des données localisées dans le dossier de données du module
|
||||
if ($infoModules[$this->getUrl(2)]['dataDirectory'] &&
|
||||
is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])) {
|
||||
$this->copyDir ($infoModules[$this->getUrl(2)]['dataDirectory'], $tmpFolder . '/' . $moduleDir);
|
||||
}
|
||||
}
|
||||
// Enregistrement des pages dans le dossier de langue identique à module
|
||||
if (!file_exists($tmpFolder . '/' . $lang . '/page.json')) {
|
||||
file_put_contents($tmpFolder . '/' . $lang . '/page.json', json_encode($pageParam));
|
||||
mkdir ($tmpFolder . '/' . $lang . '/content', 0755);
|
||||
file_put_contents($tmpFolder . '/' . $lang . '/content/' . $this->getData(['page', $pageId, 'content']), $pageContent);
|
||||
}
|
||||
// création du zip
|
||||
$fileName = $this->getUrl(2) . '.zip';
|
||||
$this->makeZip ($fileName, $tmpFolder, []);
|
||||
if (file_exists($fileName)) {
|
||||
ob_start();
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize($fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $fileName);
|
||||
unlink($fileName);
|
||||
$this->removeDir($tmpFolder);
|
||||
exit();
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'notification' => 'Quelque chose s\'est mal passé',
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Importer des données d'un module externes ou interne à module.json
|
||||
*/
|
||||
public function import(){
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Récupérer le fichier et le décompacter
|
||||
$zipFilename = $this->getInput('addonImportFile', helper::FILTER_STRING_SHORT, true);
|
||||
$tempFolder = uniqid();
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open(self::FILE_DIR . 'source/' . $zipFilename) === TRUE) {
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
}
|
||||
// Import des données localisées page.json et module.json
|
||||
// Pour chaque dossier localisé
|
||||
$dataTarget = array();
|
||||
$dataSource = array();
|
||||
// Liste des pages de même nom dans l'archive et le site
|
||||
$list = '';
|
||||
foreach (self::$i18nList as $key=>$value) {
|
||||
// Les Pages et les modules
|
||||
foreach (['page','module'] as $fileTarget){
|
||||
if (file_exists(self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json')) {
|
||||
// Le dossier de langue existe
|
||||
// faire la fusion
|
||||
$dataSource = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json'), true);
|
||||
// Des pages de même nom que celles de l'archive existent
|
||||
if( $fileTarget === 'page' ){
|
||||
foreach( $dataSource as $keydataSource=>$valuedataSource ){
|
||||
foreach( $this->getData(['page']) as $keypage=>$valuepage ){
|
||||
if( $keydataSource === $keypage){
|
||||
$list === '' ? $list .= ' '.$this->getData(['page', $keypage, 'title']) : $list .= ', '.$this->getData(['page', $keypage, 'title']);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$dataTarget = json_decode(file_get_contents(self::DATA_DIR . $key . '/' . $fileTarget . '.json'), true);
|
||||
$data [$fileTarget] = array_merge($dataTarget[$fileTarget], $dataSource);
|
||||
if( $list === ''){
|
||||
file_put_contents(self::DATA_DIR . '/' .$key . '/' . $fileTarget . '.json', json_encode( $data ,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|LOCK_EX) );
|
||||
}
|
||||
// copie du contenu de la page
|
||||
$this->copyDir (self::TEMP_DIR . $tempFolder . '/' .$key . '/content', self::DATA_DIR . '/' .$key . '/content');
|
||||
// Supprimer les fichiers importés
|
||||
unlink (self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Import des fichiers placés ailleurs que dans les dossiers localisés.
|
||||
$this->copyDir (self::TEMP_DIR . $tempFolder,self::DATA_DIR );
|
||||
|
||||
// Supprimer le dossier temporaire
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
if( $list !== '' ){
|
||||
$success = false;
|
||||
strpos( $list, ',') === false ? $notification = 'Import impossible la page suivante doit être renommée :'.$list : $notification = 'Import impossible les pages suivantes doivent être renommées :'.$list;
|
||||
}
|
||||
else{
|
||||
$success = true;
|
||||
$notification = 'Import réussi';
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'addon',
|
||||
'state' => $success,
|
||||
'notification' => $notification
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Importer des données de module',
|
||||
'view' => 'import'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
31
core/module/addon/view/import/import.php
Normal file
31
core/module/addon/view/import/import.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php echo template::formOpen('addonImportForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('addonImportBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'addon',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('addonImportSubmit', [
|
||||
'value' => 'Appliquer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Installer des données de module</h4>
|
||||
<div class="row">
|
||||
<div class="col6 offset3">
|
||||
<?php echo template::file('addonImportFile', [
|
||||
'label' => 'Archive ZIP :',
|
||||
'type' => 2
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
8
core/module/addon/view/index/index.help.html
Normal file
8
core/module/addon/view/index/index.help.html
Normal file
@ -0,0 +1,8 @@
|
||||
<h3>MODULES INSTALLES</h3>
|
||||
Les modules installés sont listés dans le tableau avec leur nom usuel (alias) et leur numéro de version.
|
||||
Si le module est utilisé le nom de la page ou des pages apparaît, dans le cas contraire une icône permet de le supprimer.
|
||||
<h3>EXPORTER IMPORTER</h3>
|
||||
<p>Exporter produit une archive au nom du module contenant les pages concernées ainsi que les données et ressources utilisées par le module dans ces pages.</p>
|
||||
<p>Vous pouvez vous en servir comme d'une sauvegarde partielle ou pour transférer les pages et les données du module vers un autre site.</p>
|
||||
<p>Une fois le module installé l'import permet de restaurer les pages et les données sauvegardées. Vous devrez avoir au préalable transféré le fichier zip d'un export sur votre serveur par 'Gérer les fichiers'.
|
||||
Si une page de même nom existe sur votre site vous serez invité à modifier son nom.</p>
|
@ -1,6 +1,5 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
@ -12,7 +11,12 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".moduleDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer ce module ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
40
core/module/addon/view/index/index.php
Normal file
40
core/module/addon/view/index/index.php
Normal file
@ -0,0 +1,40 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('configModulesHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/les-modules',
|
||||
'target' => '_blank',
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset4">
|
||||
<?php echo template::button('configModulesStore', [
|
||||
'href' => helper::baseUrl() . 'addon/store',
|
||||
'value' => 'Catalogue en ligne'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('configStoreUpload', [
|
||||
'href' => helper::baseUrl() . 'addon/upload',
|
||||
'value' => 'Installer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Aide à propos de la gestion des modules, view index -->
|
||||
<div class="helpDisplayContent">
|
||||
<?php echo file_get_contents( 'core/module/addon/view/index/index.help.html') ;?>
|
||||
</div>
|
||||
<?php if($module::$modInstal): ?>
|
||||
<?php echo template::table([2, 2, 2, 2, 1, 1, 1], $module::$modInstal, ['Module installé', 'Alias', 'Version', 'Page(s)', 'Supprimer', 'Exporter', 'Importer']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun module installé.'); ?>
|
||||
<?php endif; ?>
|
15
core/module/addon/view/store/store.php
Normal file
15
core/module/addon/view/store/store.php
Normal file
@ -0,0 +1,15 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configStoreBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'addon/upload',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$storeList): ?>
|
||||
<?php echo template::table([2, 2, 1, 2, 2, 2, 1], $module::$storeList, ['Catégorie', 'Module', 'Version', 'Date', 'Pages', 'Télécharger ou <br> Mettre à jour']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Le catalogue est vide.'); ?>
|
||||
<?php endif; ?>
|
6
core/module/addon/view/upload/upload.help.html
Normal file
6
core/module/addon/view/upload/upload.help.html
Normal file
@ -0,0 +1,6 @@
|
||||
<h3>INSTALLER OU METTRE A JOUR</h3>
|
||||
<p>Avant de choisir le fichier ZIP du module à installer vous devez le télécharger sur votre serveur en utilisant le 'Catalogue en ligne'.</p>
|
||||
<p>D'autres modules sont également disponibles sur le <a href="https://forum.zwiicms.fr/categories/t%C3%A9l%C3%A9chargements-de-modules" target="_blank" rel="noopener">forum de ZwiiCMS</a>,
|
||||
téléversez les sur votre serveur avec 'Gérer les fichiers'.</p>
|
||||
<p>Lors d'une mise à jour Zwii contrôle la version du module à installer, pour réinstaller un module de même numéro de version vous devez cocher 'Mise à jour forcée'.
|
||||
Il est déconseillé d'installer un module plus ancien.</p>
|
@ -1,27 +1,30 @@
|
||||
<?php echo template::formOpen('configModulesUpload'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'plugin',
|
||||
'value' => template::ico('left')
|
||||
'href' => helper::baseUrl() . 'addon',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('pluginIndexHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/installation-d-un-module',
|
||||
'target' => '_blank',
|
||||
<div class="col2">
|
||||
<?php echo template::button('addonIndexHelp', [
|
||||
'class' => 'buttonHelp',
|
||||
'value' => template::ico('help'),
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::submit('configModulesSubmit',[
|
||||
'value' => 'Valider',
|
||||
'ico' => 'check'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Aide à propos de la gestion des modules, view upload -->
|
||||
<div class="helpDisplayContent">
|
||||
<?php echo file_get_contents( 'core/module/addon/view/upload/upload.help.html') ;?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
@ -19,7 +19,6 @@ class config extends common {
|
||||
public static $actions = [
|
||||
'backup' => self::GROUP_ADMIN,
|
||||
'copyBackups'=> self::GROUP_ADMIN,
|
||||
'delBackups'=> self::GROUP_ADMIN,
|
||||
'configMetaImage' => self::GROUP_ADMIN,
|
||||
'generateFiles' => self::GROUP_ADMIN,
|
||||
'index' => self::GROUP_ADMIN,
|
||||
@ -384,15 +383,6 @@ class config extends common {
|
||||
$this->setData(['user',$users]);
|
||||
}
|
||||
}
|
||||
// Conversion vers des Url relatives
|
||||
if ($this->getData(['core', 'baseUrl'])) {
|
||||
$url = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
// Suppresion de la base Url
|
||||
$this->updateBaseUrl($url);
|
||||
// Effacer la baseUrl
|
||||
$this->deleteData(['core', 'baseUrl']);
|
||||
}
|
||||
|
||||
// Message de notification
|
||||
$notification = $success === true ? 'Restaurer effectuée avec succès' : 'Erreur inconnue';
|
||||
$redirect = $this->getInput('configRestoreImportUser', helper::FILTER_BOOLEAN) === true ? helper::baseUrl() . 'config/restore' : helper::baseUrl() . 'user/login/';
|
||||
@ -594,7 +584,7 @@ class config extends common {
|
||||
$this->generateFiles();
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Modifications enregistrées ' ,
|
||||
'state' => true
|
||||
@ -626,7 +616,7 @@ class config extends common {
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
@ -665,8 +655,10 @@ class config extends common {
|
||||
/**
|
||||
* Met à jour les données de site avec l'adresse transmise
|
||||
*/
|
||||
public function updateBaseUrl ($url) {
|
||||
public function updateBaseUrl () {
|
||||
// Supprimer l'information de redirection
|
||||
$old = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$new = helper::baseUrl(false,false);
|
||||
$c3 = 0;
|
||||
$success = false ;
|
||||
// Boucler sur les pages
|
||||
@ -674,8 +666,8 @@ class config extends common {
|
||||
$content = $this->getPage($parentId, self::$i18n);
|
||||
$titre = $this->getData(['page', $parentId, 'title']);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
@ -685,8 +677,8 @@ class config extends common {
|
||||
foreach($childIds as $childId) {
|
||||
$content = $this->getPage($childId, self::$i18n);
|
||||
$content = $titre . ' ' . $content ;
|
||||
$replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ;
|
||||
$replace = str_replace( 'href="' . $old , 'href="'. $new , stripslashes($content),$c1) ;
|
||||
$replace = str_replace( 'src="' . $old , 'src="'. $new , stripslashes($replace),$c2) ;
|
||||
if ($c1 > 0 || $c2 > 0) {
|
||||
$success = true;
|
||||
$this->setPage($childId, $replace, self::$i18n);
|
||||
@ -696,8 +688,8 @@ class config extends common {
|
||||
}
|
||||
// Traiter les modules dont la redirection
|
||||
$content = $this->getdata(['module']);
|
||||
$replace = $this->recursive_array_replace('href="' . $url , 'href="'. '', $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $url , 'src="'. '', $replace, $c2);
|
||||
$replace = $this->recursive_array_replace('href="' . $old , 'href="'. $new, $content, $c1);
|
||||
$replace = $this->recursive_array_replace('src="' . $old , 'src="'. $new, $replace, $c2);
|
||||
if ($content !== $replace) {
|
||||
$this->setdata(['module',$replace]);
|
||||
$c3 += $c1 + $c2;
|
||||
@ -726,7 +718,7 @@ class config extends common {
|
||||
file_put_contents(self::DATA_DIR . 'journal.log',$d);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Journal réinitialisé avec succès',
|
||||
'state' => true
|
||||
@ -734,7 +726,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucun journal à effacer',
|
||||
'state' => false
|
||||
@ -762,7 +754,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucun fichier journal à télécharger',
|
||||
'state' => false
|
||||
@ -799,7 +791,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Aucune liste noire à télécharger',
|
||||
'state' => false
|
||||
@ -816,7 +808,7 @@ class config extends common {
|
||||
$this->setData(['blacklist',[]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Liste noire réinitialisée avec succès',
|
||||
'state' => true
|
||||
@ -824,7 +816,7 @@ class config extends common {
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Pas de liste à effacer',
|
||||
'state' => false
|
||||
@ -843,37 +835,32 @@ class config extends common {
|
||||
$this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' );
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'title' => 'Configuration',
|
||||
'view' => 'index',
|
||||
'notification' => 'Copie terminée',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Vider le dosser des sauvegardes automatisées
|
||||
* Fonction de parcours des données de module
|
||||
* @param string $find donnée à rechercher
|
||||
* @param string $replace donnée à remplacer
|
||||
* @param array tableau à analyser
|
||||
* @param int count nombres d'occurrences
|
||||
* @return array avec les valeurs remplacées.
|
||||
*/
|
||||
public function delBackups() {
|
||||
$path = realpath(self::BACKUP_DIR);
|
||||
$success = $fail = 0;
|
||||
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename)
|
||||
{
|
||||
if (strpos($filename,'.zip')) {
|
||||
|
||||
$r = unlink($filename);
|
||||
$success = $r === true ? $succes + 1 : $success;
|
||||
$fail = $r === false ? $fail + 1 : $fail;
|
||||
}
|
||||
private function recursive_array_replace ($find, $replace, $array, &$count) {
|
||||
if (!is_array($array)) {
|
||||
return str_replace($find, $replace, $array, $count);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du site',
|
||||
'view' => 'index',
|
||||
'notification' => 'Suppression terminée :<br />' . $success . ' fichiers effacé(s) <br />' . $fail . ' échec(s)',
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
$newArray = [];
|
||||
foreach ($array as $key => $value) {
|
||||
$newArray[$key] = $this->recursive_array_replace($find, $replace, $value,$c);
|
||||
$count += $c;
|
||||
}
|
||||
return $newArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php echo template::formOpen('configBackupForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configBackupBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('configBackupSubmit',[
|
||||
'value' => 'Sauvegarder',
|
||||
'uniqueSubmission' => true
|
||||
|
@ -10,17 +10,7 @@
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$("#configBackupDelButton").on("click", function () {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer les sauvegardes automatisées ?", function () {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
$( document).ready(function() {
|
||||
|
||||
// Positionnement inital des options
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
@ -55,36 +45,36 @@ $(document).ready(function () {
|
||||
$("#connectCaptchaStrongWrapper").addClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").addClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
} else {
|
||||
$("#connectCaptchaStrongWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideUp();
|
||||
$("#connectCaptchaTypeWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideUp();
|
||||
$("#connectCaptchaStrong").prop("checked", false);
|
||||
$( "#connectCaptchaStrong" ).prop( "checked", false );
|
||||
}
|
||||
|
||||
var configLayout = getCookie("configLayout");
|
||||
if (configLayout == null) {
|
||||
configLayout = "setup";
|
||||
setCookie("configLayout", "setup");
|
||||
setCookie("configLayout","setup");
|
||||
}
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
$("#networkContainer").hide();
|
||||
$("#setupContainer").hide();
|
||||
$("#" + configLayout + "Container").show();
|
||||
$("#" + configLayout + "Container" ).show();
|
||||
$("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton");
|
||||
|
||||
|
||||
// Gestion des événements
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
/**
|
||||
* Afficher et masquer options smtp
|
||||
*/
|
||||
$("input[name=smtpEnable]").on("change", function () {
|
||||
$("input[name=smtpEnable]").on("change", function() {
|
||||
if ($("input[name=smtpEnable]").is(':checked')) {
|
||||
$("#smtpParam").addClass("disabled");
|
||||
$("#smtpParam").slideDown();
|
||||
@ -98,7 +88,7 @@ $(document).ready(function () {
|
||||
* Afficher et masquer options Auth
|
||||
*/
|
||||
|
||||
$("select[name=smtpAuth]").on("change", function () {
|
||||
$("select[name=smtpAuth]").on("change", function() {
|
||||
if ($("select[name=smtpAuth]").val() == true) {
|
||||
$("#smtpAuthParam").addClass("disabled");
|
||||
$("#smtpAuthParam").slideDown();
|
||||
@ -112,7 +102,7 @@ $(document).ready(function () {
|
||||
* Options de blocage de connexions
|
||||
* Contrôle la cohérence des sélections et interdit une seule valeur Aucune
|
||||
*/
|
||||
$("select[name=connectAttempt]").on("change", function () {
|
||||
$("select[name=connectAttempt]").on("change", function() {
|
||||
if ($("select[name=connectAttempt]").val() === "999") {
|
||||
$("select[name=connectTimeout]").val(0);
|
||||
} else {
|
||||
@ -121,7 +111,7 @@ $(document).ready(function () {
|
||||
}
|
||||
}
|
||||
});
|
||||
$("select[name=connectTimeout]").on("change", function () {
|
||||
$("select[name=connectTimeout]").on("change", function() {
|
||||
if ($("select[name=connectTimeout]").val() === "0") {
|
||||
$("select[name=connectAttempt]").val(999);
|
||||
} else {
|
||||
@ -134,20 +124,20 @@ $(document).ready(function () {
|
||||
/**
|
||||
* Captcha strong si captcha sélectionné
|
||||
*/
|
||||
$("input[name=connectCaptcha]").on("change", function () {
|
||||
|
||||
$("input[name=connectCaptcha]").on("change", function() {
|
||||
|
||||
if ($("input[name=connectCaptcha]").is(':checked')) {
|
||||
$("#connectCaptchaStrongWrapper").addClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideDown();
|
||||
$("#connectCaptchaTypeWrapper").addClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
|
||||
$("#connectCaptchaTypeWrapper").slideDown();
|
||||
|
||||
} else {
|
||||
$("#connectCaptchaStrongWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaStrongWrapper").slideUp();
|
||||
$("#connectCaptchaTypeWrapper").removeClass("disabled");
|
||||
$("#connectCaptchaTypeWrapper").slideUp();
|
||||
$("#connectCaptchaStrong").prop("checked", false);
|
||||
$( "#connectCaptchaStrong" ).prop( "checked", false );
|
||||
}
|
||||
});
|
||||
|
||||
@ -155,7 +145,7 @@ $(document).ready(function () {
|
||||
/**
|
||||
* Sélection de la page de configuration à afficher
|
||||
*/
|
||||
$("#configSetupButton").on("click", function () {
|
||||
$("#configSetupButton").on("click", function() {
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
@ -166,9 +156,9 @@ $(document).ready(function () {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout", "setup");
|
||||
setCookie("configLayout","setup");
|
||||
});
|
||||
$("#configLocaleButton").on("click", function () {
|
||||
$("#configLocaleButton").on("click", function() {
|
||||
$("#setupContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
$("#connectContainer").hide();
|
||||
@ -179,9 +169,9 @@ $(document).ready(function () {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout", "locale");
|
||||
setCookie("configLayout","locale");
|
||||
});
|
||||
$("#configSocialButton").on("click", function () {
|
||||
$("#configSocialButton").on("click", function() {
|
||||
$("#connectContainer").hide();
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
@ -192,9 +182,9 @@ $(document).ready(function () {
|
||||
$("#configSocialButton").addClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout", "social");
|
||||
setCookie("configLayout","social");
|
||||
});
|
||||
$("#configConnectButton").on("click", function () {
|
||||
$("#configConnectButton").on("click", function() {
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
@ -205,9 +195,9 @@ $(document).ready(function () {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").addClass("activeButton");
|
||||
$("#configNetworkButton").removeClass("activeButton");
|
||||
setCookie("configLayout", "connect");
|
||||
setCookie("configLayout","connect");
|
||||
});
|
||||
$("#configNetworkButton").on("click", function () {
|
||||
$("#configNetworkButton").on("click", function() {
|
||||
$("#setupContainer").hide();
|
||||
$("#localeContainer").hide();
|
||||
$("#socialContainer").hide();
|
||||
@ -218,49 +208,49 @@ $(document).ready(function () {
|
||||
$("#configSocialButton").removeClass("activeButton");
|
||||
$("#configConnectButton").removeClass("activeButton");
|
||||
$("#configNetworkButton").addClass("activeButton");
|
||||
setCookie("configLayout", "network");
|
||||
setCookie("configLayout","network");
|
||||
});
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Aspect de la souris
|
||||
*/
|
||||
$("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function (event) {
|
||||
*/
|
||||
$("#socialMetaImage, #socialSiteMap, #configBackupCopyButton").click(function(event) {
|
||||
$('body, .button').css('cursor', 'wait');
|
||||
});
|
||||
|
||||
|
||||
// Mise en évidence des erreurs de saisie dans les boutons de sélection
|
||||
var containers = ["setup", "locale", "social", "connect", "network"];
|
||||
$.each(containers, function (index, value) {
|
||||
$.each( containers, function( index, value ){
|
||||
var a = $("div#" + value + "Container").find("input.notice").not(".displayNone");
|
||||
if (a.length > 0) {
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice");
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").addClass("buttonNotice");
|
||||
} else {
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice");
|
||||
$("#config" + capitalizeFirstLetter(value) + "Button").removeClass("buttonNotice");
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
function setCookie(name, value, days) {
|
||||
function setCookie(name,value,days) {
|
||||
var expires = "";
|
||||
if (days) {
|
||||
var date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
date.setTime(date.getTime() + (days*24*60*60*1000));
|
||||
expires = "; expires=" + date.toUTCString();
|
||||
}
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
||||
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
for (var i = 0; i < ca.length; i++) {
|
||||
for(var i=0;i < ca.length;i++) {
|
||||
var c = ca[i];
|
||||
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
|
||||
while (c.charAt(0)==' ') c = c.substring(1,c.length);
|
||||
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1,22 +1,23 @@
|
||||
<?php echo template::formOpen('configForm');?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('configBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'value' => template::ico('home')
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2 ">
|
||||
<?php echo template::button('configHelp', [
|
||||
'class' => 'buttonHelp',
|
||||
'href' => 'https://doc.zwiicms.fr/configuration-du-site',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::submit('Submit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -38,4 +38,46 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Conversion après la restauration<?php echo template::help('Conversion des URL des ressources multimédia entre deux sites aux arborescences différentes.');?></h4>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<?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(false,false) !== $this->getData(['core', 'baseUrl']) ? '' : 'disabled';
|
||||
} else {
|
||||
$baseUrlValue = str_replace('?','',$this->getData(['core', 'baseUrl']));
|
||||
$buttonClass = helper::baseUrl(false,false) !== $baseUrlValue ? '' : 'disabled';
|
||||
}
|
||||
echo template::text('configRestoreBaseURLToConvert', [
|
||||
'label' => 'Dossier de l\'archive' ,
|
||||
'value' => $baseUrlValue,
|
||||
'readonly' => true,
|
||||
'help' => 'Le dossier de base du site est stockée dans la sauvegarde.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('configRestoreCurrentURL', [
|
||||
'label' => 'Dossier du site actuel',
|
||||
'value' => helper::baseUrl(false,false),
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 verticalAlignMiddle">
|
||||
<?php echo template::button('configRestoreUpdateBaseURLButton', [
|
||||
'href' => helper::baseUrl() . 'config/updateBaseUrl',
|
||||
'class' => $buttonClass,
|
||||
'value' => 'convertir'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
|
@ -118,36 +118,26 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<div class="rows textAlignCenter">
|
||||
<div class="col3">
|
||||
<?php echo template::button('configBackupButton', [
|
||||
'href' => helper::baseUrl() . 'config/backup',
|
||||
'value' => 'Sauvegarder les données du site',
|
||||
'value' => 'Sauvegarder',
|
||||
'ico' => 'download-cloud'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 offset1">
|
||||
<div class="col3">
|
||||
<?php echo template::button('configRestoreButton', [
|
||||
'href' => helper::baseUrl() . 'config/restore',
|
||||
'value' => 'Restaurer les données du site',
|
||||
'value' => 'Restaurer',
|
||||
'ico' => 'upload-cloud'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4 offset1">
|
||||
<div class="col3">
|
||||
<?php echo template::button('configBackupCopyButton', [
|
||||
'href' => helper::baseUrl() . 'config/copyBackups',
|
||||
'value' => 'Copier sauvegardes auto',
|
||||
'ico' => 'docs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 offset1">
|
||||
<?php echo template::button('configBackupDelButton', [
|
||||
'href' => helper::baseUrl() . 'config/delBackups',
|
||||
'value' => 'Vider dossier sauvegardes auto',
|
||||
'ico' => 'cancel',
|
||||
'class' => 'buttonRed'
|
||||
'value' => 'Copie sauvegardes auto',
|
||||
'ico' => 'download-cloud'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -56,7 +56,7 @@ class init extends common {
|
||||
]
|
||||
],
|
||||
'core' => [
|
||||
'dataVersion' => 12000,
|
||||
'dataVersion' => 11300,
|
||||
'lastBackup' => 0,
|
||||
'lastClearTmp' => 0,
|
||||
'lastAutoUpdate' => 0,
|
||||
|
@ -1,36 +1,37 @@
|
||||
<?php echo template::formOpen('pageEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php $href = helper::baseUrl() . $this->getUrl(2); ?>
|
||||
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
|
||||
<?php echo template::button('pageEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => $href,
|
||||
'value' => template::ico('home')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('pageEditHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/edition-des-pages',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset6">
|
||||
<div class="col2 offset2">
|
||||
<?php echo template::button('pageEditDuplicate', [
|
||||
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
|
||||
'value' => 'Dupliquer',
|
||||
'ico' => 'clone'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('pageEditDelete', [
|
||||
'class' => 'buttonRed',
|
||||
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Effacer la page'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('pageEditDuplicate', [
|
||||
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
|
||||
'value' => template::ico('clone'),
|
||||
'help' => 'Dupliquer la page'
|
||||
'value' => 'Supprimer',
|
||||
'ico' => 'cancel'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
|
@ -1,750 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* 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) 2020-2021, Sylvain Lelièvre
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class plugin extends common {
|
||||
|
||||
public static $actions = [
|
||||
'index' => self::GROUP_ADMIN,
|
||||
'delete' => self::GROUP_ADMIN,
|
||||
'save' => self::GROUP_ADMIN, // Sauvegarde le module dans un fichier ZIP ou dans le gestionnaire
|
||||
'dataExport' => self::GROUP_ADMIN, // Fonction muette d'exportation
|
||||
'dataImport' => self::GROUP_ADMIN, // les données d'un module
|
||||
'dataDelete' => self::GROUP_ADMIN,
|
||||
'store' => self::GROUP_ADMIN,
|
||||
'item' => self::GROUP_ADMIN, // détail d'un objet
|
||||
'upload' => self::GROUP_ADMIN, // Téléverser catalogue
|
||||
'uploadItem'=> self::GROUP_ADMIN // Téléverser par archive
|
||||
];
|
||||
|
||||
// URL des modules
|
||||
const BASEURL_STORE = 'https://store.zwiicms.fr/';
|
||||
const MODULE_STORE = '?modules/';
|
||||
|
||||
// Gestion des modules
|
||||
public static $modulesData = [];
|
||||
public static $modulesOrphan = [];
|
||||
public static $modulesInstalled = [];
|
||||
|
||||
// pour tests
|
||||
public static $valeur = [];
|
||||
|
||||
// le catalogue
|
||||
public static $storeList = [];
|
||||
public static $storeItem = [];
|
||||
|
||||
// Liste de pages
|
||||
public static $pagesList = [];
|
||||
|
||||
|
||||
/*
|
||||
* Effacement d'un module installé et non utilisé
|
||||
*/
|
||||
public function delete() {
|
||||
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
else{
|
||||
// Suppression des dossiers
|
||||
$infoModules = helper::getModules();
|
||||
$module = $this->getUrl(2);
|
||||
//Liste des dossiers associés au module non effacés
|
||||
if( $this->removeDir('./module/'.$module ) === true ){
|
||||
$success = true;
|
||||
$notification = 'Module '. $module .' désinstallé';
|
||||
if(($infoModules[$this->getUrl(2)]['dataDirectory']) ) {
|
||||
if (
|
||||
is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
&& !$this->removeDir($infoModules[$this->getUrl(2)]['dataDirectory'])
|
||||
){
|
||||
$notification = 'Module '.$module .' désinstallé, il reste des données dans ' . $infoModules[$this->getUrl(2)]['dataDirectory'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
$notification = 'La suppression a échouée';
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => $notification,
|
||||
'state' => $success
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module
|
||||
* Fonction utilisée par upload et storeUpload
|
||||
*/
|
||||
private function install ($moduleName, $checkValid){
|
||||
$tempFolder = 'datamodules';//uniqid();
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($moduleName) === TRUE) {
|
||||
$notification = 'Archive ouverte';
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Archive de module ?
|
||||
$success = false;
|
||||
$notification = 'Ce n\'est pas l\'archive d\'un module !';
|
||||
$moduleDir = self::TEMP_DIR . $tempFolder . '/module';
|
||||
$moduleName = '';
|
||||
if ( is_dir( $moduleDir )) {
|
||||
// Lire le nom du module
|
||||
if ($dh = opendir( $moduleDir )) {
|
||||
while ( false !== ($file = readdir($dh)) ) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$moduleName = $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
// Module normalisé ?
|
||||
if( is_file( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php' ) AND is_file( $moduleDir.'/'.$moduleName.'/view/index/index.php' ) ){
|
||||
|
||||
// Lecture de la version et de la validation d'update du module pour validation de la mise à jour
|
||||
// Pour une version <= version installée l'utilisateur doit cocher 'Mise à jour forcée'
|
||||
$version = '0.0';
|
||||
$update = '0.0';
|
||||
$valUpdate = false;
|
||||
$file = file_get_contents( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$file = str_replace(' ','',$file);
|
||||
$file = str_replace("\t",'',$file);
|
||||
$pos1 = strpos($file, 'constVERSION');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$version = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
}
|
||||
$pos1 = strpos($file, 'constUPDATE');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$update = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
}
|
||||
// Si version actuelle >= version indiquée dans UPDATE la mise à jour est validée
|
||||
$infoModules = helper::getModules();
|
||||
if( $infoModules[$moduleName]['update'] >= $update ) $valUpdate = true;
|
||||
|
||||
// Module déjà installé ?
|
||||
$moduleInstal = false;
|
||||
foreach($infoModules as $key=>$value ){
|
||||
if($moduleName === $key){
|
||||
$moduleInstal = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Validation de la maj si autorisation du concepteur du module ET
|
||||
// ( Version plus récente OU Check de forçage )
|
||||
$valNewVersion = floatval($version);
|
||||
$valInstalVersion = floatval( $infoModules[$moduleName]['version'] );
|
||||
$newVersion = false;
|
||||
if( $valNewVersion > $valInstalVersion ) $newVersion = true;
|
||||
$validMaj = $valUpdate && ( $newVersion || $checkValid);
|
||||
|
||||
// Nouvelle installation ou mise à jour du module
|
||||
if( ! $moduleInstal || $validMaj ){
|
||||
// Copie récursive des dossiers
|
||||
$this->copyDir( self::TEMP_DIR . $tempFolder, './' );
|
||||
$success = true;
|
||||
if( ! $moduleInstal ){
|
||||
$notification = 'Module '.$moduleName.' installé';
|
||||
}
|
||||
else{
|
||||
$notification = 'Module '.$moduleName.' mis à jour';
|
||||
}
|
||||
}
|
||||
else{
|
||||
$success = false;
|
||||
if( $valNewVersion == $valInstalVersion){
|
||||
$notification = ' Version détectée '.$version.' = à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
else{
|
||||
$notification = ' Version détectée '.$version.' < à celle installée '.$infoModules[$moduleName]['version'];
|
||||
}
|
||||
if( $valUpdate === false){
|
||||
if( $infoModules[$moduleName]['update'] === $update ){
|
||||
$notification = ' Mise à jour par ce procédé interdite par le concepteur du module';
|
||||
}
|
||||
else{
|
||||
$notification = ' Mise à jour par ce procédé interdite, votre version est trop ancienne';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Supprimer le dossier temporaire même si le module est invalide
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
} else {
|
||||
// erreur à l'ouverture
|
||||
$success = false;
|
||||
$notification = 'Impossible d\'ouvrir l\'archive';
|
||||
}
|
||||
return(['success' => $success,
|
||||
'notification'=> $notification
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module à partir du gestionnaire de fichier
|
||||
*/
|
||||
public function upload() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Installation d'un module
|
||||
$checkValidMaj = $this->getInput('configModulesCheck', helper::FILTER_BOOLEAN);
|
||||
$zipFilename = $this->getInput('configModulesInstallation', helper::FILTER_STRING_SHORT);
|
||||
if( $zipFilename !== ''){
|
||||
$success = [
|
||||
'success' => false,
|
||||
'notification'=> ''
|
||||
];
|
||||
$state = $this->install(self::FILE_DIR.'source/'.$zipFilename, $checkValidMaj);
|
||||
}
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => $state['notification'],
|
||||
'state' => $state['success']
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Téléverser un module',
|
||||
'view' => 'upload'
|
||||
]);
|
||||
}
|
||||
|
||||
/***
|
||||
* Installation d'un module depuis le catalogue
|
||||
*/
|
||||
public function uploadItem() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'store',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
} else {
|
||||
// Récupérer le module en ligne
|
||||
$moduleName = $this->getUrl(2);
|
||||
// Informations sur les module en ligne
|
||||
$store = json_decode(helper::urlGetContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
// Url du module à télécharger
|
||||
$moduleFilePath = $store[$moduleName]['file'];
|
||||
// Télécharger le fichier
|
||||
$moduleData = helper::urlGetContents(self::BASEURL_STORE . self::FILE_DIR . 'source/' . $moduleFilePath);
|
||||
// Extraire de l'arborescence
|
||||
$d = explode('/',$moduleFilePath);
|
||||
$moduleFile = $d[count($d)-1];
|
||||
// Créer le dossier modules
|
||||
if (!is_dir(self::FILE_DIR . 'source/modules')) {
|
||||
mkdir (self::FILE_DIR . 'source/modules', 0755);
|
||||
}
|
||||
// Sauver les données du fichiers
|
||||
file_put_contents(self::FILE_DIR . 'source/modules/' . $moduleFile, $moduleData);
|
||||
|
||||
/**
|
||||
* $if( $moduleFile !== ''){
|
||||
* $success = [
|
||||
* 'success' => false,
|
||||
* 'notification'=> ''
|
||||
* ];
|
||||
* $state = $this->install(self::FILE_DIR.'source/modules/'.$moduleFile, false);
|
||||
*}
|
||||
*/
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin/store',
|
||||
'notification' => $moduleFile . ' téléchargé dans le dossier modules du gestionnaire de fichiers',
|
||||
'state' => true
|
||||
]);
|
||||
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Catalogue de modules',
|
||||
'view' => 'store'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Catalogue des modules sur le site ZwiiCMS.fr
|
||||
*/
|
||||
public function store() {
|
||||
$store = json_decode(helper::urlGetContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
if ($store) {
|
||||
// Modules installés
|
||||
$infoModules = helper::getModules();
|
||||
// Clés moduleIds dans les pages
|
||||
$inPages = helper::arrayCollumn($this->getData(['page']),'moduleId', 'SORT_DESC');
|
||||
foreach( $inPages as $key=>$value){
|
||||
$pagesInfos[ $this->getData(['page', $key, 'title' ]) ] = $value;
|
||||
}
|
||||
// Parcourir les données des modules
|
||||
foreach ($store as $key=>$value) {
|
||||
// Module non installé
|
||||
$ico = template::ico('download');
|
||||
$class = '';
|
||||
$help = 'Télécharger le module';
|
||||
// Le module est installé
|
||||
if (array_key_exists($key,$infoModules) === true) {
|
||||
$class = 'buttonGreen';
|
||||
$ico = template::ico('update');
|
||||
$help = 'Mettre à jour ce module';
|
||||
}
|
||||
// Le module est installé et utilisé
|
||||
if (in_array($key,$inPages) === true) {
|
||||
$class = 'buttonRed';
|
||||
$ico = template::ico('update');
|
||||
$help = 'Mettre à jour le module';
|
||||
}
|
||||
self::$storeList [] = [
|
||||
$store[$key]['category'],
|
||||
'<a href="' . self::BASEURL_STORE . self::MODULE_STORE . $key . '" target="_blank" >'.$store[$key]['title'].'</a>',
|
||||
$store[$key]['version'],
|
||||
mb_detect_encoding(strftime('%d %B %Y', $store[$key]['versionDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $store[$key]['versionDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', $store[$key]['versionDate'])),
|
||||
implode(', ', array_keys($pagesInfos,$key)),
|
||||
template::button('moduleExport' . $key, [
|
||||
'class' => $class,
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/uploadItem/' . $key.'/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => $ico,
|
||||
'help' => $help
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Catalogue de modules en ligne',
|
||||
'view' => 'store'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Détail d'un objet du catalogue
|
||||
*/
|
||||
public function item() {
|
||||
$store = json_decode(helper::urlGetContents(self::BASEURL_STORE . self::MODULE_STORE . 'list'), true);
|
||||
self::$storeItem = $store [$this->getUrl(2)] ;
|
||||
self::$storeItem ['fileDate'] = mb_detect_encoding(strftime('%d %B %Y',self::$storeItem ['fileDate']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', self::$storeItem ['fileDate'])
|
||||
: utf8_encode(strftime('%d %B %Y', self::$storeItem ['fileDate']));
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' =>'Module ' . self::$storeItem['title'],
|
||||
'view' => 'item'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gestion des modules
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Tableau des langues rédigées
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
if ($this->getData(['config','i18n', $key]) === 'site' ||
|
||||
$key === 'fr') {
|
||||
$i18nSites[$key] = $value;
|
||||
}
|
||||
}
|
||||
// Lister les modules installés
|
||||
$infoModules = helper::getModules();
|
||||
|
||||
// Parcourir les langues du site traduit et recherche les modules affectés à des pages
|
||||
foreach ($i18nSites as $keyi18n=>$valuei18n) {
|
||||
|
||||
// Clés moduleIds dans les pages de la langue
|
||||
$pages = json_decode(file_get_contents(self::DATA_DIR . $keyi18n . '/' . 'page.json'), true);
|
||||
|
||||
// Extraire les clés des modules
|
||||
$pagesModules [$keyi18n] = array_filter(helper::arrayCollumn($pages['page'],'moduleId', 'SORT_DESC'), 'strlen');
|
||||
|
||||
// Générer ls liste des pages avec module pour la sauvegarde ou le backup
|
||||
foreach( $pagesModules [$keyi18n] as $key=>$value ) {
|
||||
if (!empty($value)) {
|
||||
$pagesInfos [$keyi18n] [$key] ['pageId'] = $key ;
|
||||
$pagesInfos [$keyi18n] [$key] ['title'] = $this->getData(['page', $key, 'title' ]) ;
|
||||
$pagesInfos [$keyi18n] [$key] ['moduleId'] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Recherche des modules orphelins dans toutes les langues
|
||||
$orphans = $installed = array_flip(array_keys ($infoModules));
|
||||
foreach ($i18nSites as $keyi18n=>$valuei18n) {
|
||||
// Générer la liste des modules orphelins
|
||||
foreach ($infoModules as $key=>$value) {
|
||||
// Supprimer les éléments affectés
|
||||
if (array_search($key, $pagesModules[$keyi18n]) ) {
|
||||
unset($orphans [$key]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$orphans = array_flip($orphans);
|
||||
|
||||
// Mise en forme du tableau des modules orphelins
|
||||
if (isset($orphans)) {
|
||||
foreach ($orphans as $key) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modulesOrphan [] = [
|
||||
$infoModules [$key] ['realName'],
|
||||
$key,
|
||||
$infoModules [$key] ['version'],
|
||||
'',
|
||||
$infoModules[$key] ['delete'] === true
|
||||
? template::button('moduleDelete' . $key, [
|
||||
'class' => 'moduleDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' .$key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Supprimer le module'
|
||||
])
|
||||
: '',
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Modules installés non orphelins
|
||||
// Mise en forme du tableau des modules utilisés
|
||||
if (isset($installed)) {
|
||||
foreach (array_flip($installed) as $key) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modulesInstalled [] = [
|
||||
$infoModules [$key] ['realName'],
|
||||
$key,
|
||||
$infoModules [$key] ['version'],
|
||||
'',
|
||||
template::button('moduleSave' . $key, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/filemanager/' .$key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('download-cloud'),
|
||||
'help' => 'Sauvegarder le module dans le gestionnaire de fichiers'
|
||||
]),
|
||||
template::button('moduleDownload' . $key, [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/save/download/' .$key . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('download'),
|
||||
'help' => 'Sauvegarder et télécharger le module'
|
||||
])
|
||||
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Mise en forme du tableau des modules employés dans les pages
|
||||
// Avec les commandes de sauvegarde et de restauration
|
||||
//foreach ($pagesInfos as $keyi18n=>$valueI18n) {
|
||||
|
||||
$keyi18n = self::$i18n;
|
||||
$valueI18n = $pagesInfos[self::$i18n];
|
||||
foreach ($valueI18n as $keyPage=>$value) {
|
||||
// Construire le tableau de sortie
|
||||
self::$modulesData[] = [
|
||||
$infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']] ['realName'],
|
||||
$pagesInfos[$keyi18n][$keyPage]['moduleId'],
|
||||
$infoModules[$pagesInfos [$keyi18n][$keyPage]['moduleId']] ['version'],
|
||||
//template::flag($keyi18n, '20px'),
|
||||
'<a href ="' . helper::baseUrl() . $keyPage . '" target="_blank">' . $pagesInfos [$keyi18n][$keyPage]['title'] . ' (' .$keyPage . ')</a>',
|
||||
template::button('dataExport' . $keyPage, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/dataExport/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('download'),
|
||||
'help' => 'Exporter les données du module'
|
||||
]),
|
||||
template::button('dataDelete' . $keyPage, [
|
||||
'href' => helper::baseUrl(). $this->getUrl(0) . '/dataDelete/' . $keyi18n . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage . '/' . $_SESSION['csrf'],// appel de fonction vaut exécution, utiliser un paramètre
|
||||
'value' => template::ico('cancel'),
|
||||
'class' => 'buttonRed dataDelete',
|
||||
'help' => 'Détacher le module de la page',
|
||||
])
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Gestion des modules',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sauvegarde un module sans les données
|
||||
*/
|
||||
|
||||
public function save() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(4) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
} else {
|
||||
|
||||
// Créer un dossier temporaire
|
||||
$tmpFolder = self::TEMP_DIR . uniqid();
|
||||
if (!is_dir($tmpFolder)) {
|
||||
mkdir($tmpFolder, 0755);
|
||||
}
|
||||
|
||||
//Nom de l'archive
|
||||
$fileName = $this->getUrl(3) . '.zip';
|
||||
$this->makeZip ($tmpFolder . '/' . $fileName, 'module/' . $this->getUrl(3));
|
||||
|
||||
switch ($this->getUrl(2)) {
|
||||
case 'filemanager':
|
||||
if (!file_exists(self::FILE_DIR . 'source/modules')) {
|
||||
mkdir(self::FILE_DIR . 'source/modules');
|
||||
}
|
||||
$success = copy($tmpFolder . '/' . $fileName , self::FILE_DIR . 'source/modules/' . $this->getUrl(3) . '.zip' );
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => $success ? $this->getUrl(3) . '.zip copié dans le dossier Module du gestionnaire de fichier' : 'Erreur de copie',
|
||||
'state' => $success
|
||||
]);
|
||||
break;
|
||||
case 'download':
|
||||
default:
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize($tmpFolder . '/' . $fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $tmpFolder . '/' .$fileName);
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
// Nettoyage
|
||||
unlink($tmpFolder . '/' . $fileName);
|
||||
$this->removeDir($tmpFolder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Détacher un module d'une page en supprimant les données du module
|
||||
* 2 : i18n id
|
||||
* 3 : moduleId
|
||||
* 4 : pageId
|
||||
* 5 : CSRF
|
||||
*/
|
||||
public function dataDelete() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(5) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
} else {
|
||||
$this->setData(['page', $this->getUrl(4), 'moduleId', '']);
|
||||
$this->deleteData(['module', $this->getUrl(4)]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => 'Le module ' . $this->getUrl(3) . ' de la page '. $this->getUrl(4) . ' a été supprimé.',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Export des données d'un module
|
||||
* Structure de l'adresse reçue
|
||||
* 2 : i18n id
|
||||
* 3 : moduleId
|
||||
* 4 : pageId
|
||||
* 5 : CSRF
|
||||
*/
|
||||
public function dataExport() {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(5) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
} else {
|
||||
|
||||
// Créer un dossier temporaire
|
||||
$tmpFolder = self::TEMP_DIR . uniqid();
|
||||
if (!is_dir($tmpFolder)) {
|
||||
mkdir($tmpFolder, 0755);
|
||||
}
|
||||
|
||||
|
||||
// Copie des infos sur le module
|
||||
$modulesData = json_decode(file_get_contents(self::DATA_DIR . $this->getUrl(2) . '/module.json' ), true);
|
||||
$moduleData = $modulesData['module'] [$this->getUrl(4)];
|
||||
$success = file_put_contents ($tmpFolder . '/module.json', json_encode($moduleData));
|
||||
|
||||
// Le dossier du module s'il existe
|
||||
if (is_dir(self::DATA_DIR . $this->getUrl(3) . '/' . $this->getUrl(4) ) ) {
|
||||
// Copier le dossier des données
|
||||
$success .= $this->copyDir(self::DATA_DIR . $this->getUrl(3) . '/' . $this->getUrl(4), $tmpFolder);
|
||||
}
|
||||
|
||||
// Descripteur de l'archive
|
||||
$infoModule = helper::getModules();
|
||||
$success .= file_put_contents ($tmpFolder . '/descripteur.json', json_encode( [$this->getUrl(3) => $infoModule [$this->getUrl(3)]] ));
|
||||
|
||||
|
||||
// création du zip
|
||||
if ($success)
|
||||
{
|
||||
$fileName = $this->getUrl(2) . '-' . $this->getUrl(3) . '-' . $this->getUrl(4) . '.zip';
|
||||
$this->makeZip ($fileName, $tmpFolder);
|
||||
if (file_exists($fileName)) {
|
||||
ob_start();
|
||||
header('Content-Type: application/octet-stream');
|
||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||
header('Content-Length: ' . filesize($fileName));
|
||||
ob_clean();
|
||||
ob_end_flush();
|
||||
readfile( $fileName);
|
||||
unlink($fileName);
|
||||
$this->removeDir($tmpFolder);
|
||||
exit();
|
||||
}
|
||||
} else {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'notification' => 'Quelque chose s\'est mal passé',
|
||||
'state' => false
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Importer des données d'un module externes ou interne à module.json
|
||||
*/
|
||||
public function dataImport(){
|
||||
|
||||
// Soumission du formulaire d'importation du module dans une page libre
|
||||
if($this->isPost()) {
|
||||
// Récupérer le fichier et le décompacter
|
||||
$zipFilename = $this->getInput('pluginImportFile', helper::FILTER_STRING_SHORT, true);
|
||||
$targetPage = $this->getInput('pluginImportPage', helper::FILTER_STRING_SHORT, true);
|
||||
$tempFolder = uniqid();
|
||||
|
||||
// Extraction dans un dossier temporaire
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open(self::FILE_DIR . 'source/' . $zipFilename) === TRUE) {
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
}
|
||||
|
||||
// Lire le descripteur
|
||||
$descripteur = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/descripteur.json'), true);
|
||||
|
||||
// Lecture des données du module
|
||||
$moduleData = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . '/module.json'), true );
|
||||
// Chargement des données du module importé
|
||||
$this->setData(['module', $targetPage, $moduleData ]);
|
||||
// Intégration des données du module importé dans la page
|
||||
$this->setData(['page', $targetPage ,'moduleId', array_key_first($descripteur) ]);
|
||||
|
||||
// Supprimer le dossier temporaire
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
|
||||
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => true,
|
||||
'notification' => 'Import des données effectué'
|
||||
]);
|
||||
}
|
||||
// Bouton d'importation des données d'un module spécifique
|
||||
if (count(explode('/',$this->getUrl())) === 6) {
|
||||
// Jeton incorrect
|
||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => false,
|
||||
'notification' => 'Action non autorisée'
|
||||
]);
|
||||
}
|
||||
|
||||
// Traitement
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . 'plugin',
|
||||
'state' => true,
|
||||
'notification' => 'Okay'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liste des pages sans module
|
||||
* et ne sont pas des barres latérales
|
||||
*/
|
||||
self::$pagesList = $this->getHierarchy(null, null, null);
|
||||
foreach(self::$pagesList as $page => $pageId) {
|
||||
if ($this->getData(['page',$page,'block']) === 'bar' ||
|
||||
//$this->getData(['page',$page,'disable']) === true ||
|
||||
$this->getData(['page',$page,'moduleId']) !== ''
|
||||
) {
|
||||
unset(self::$pagesList[$page]);
|
||||
}
|
||||
}
|
||||
self::$pagesList = array_keys(self::$pagesList);
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Importer des données de module',
|
||||
'view' => 'dataImport'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?php echo template::formOpen('pluginImportForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('pluginImportBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'plugin',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('pluginImportSubmit', [
|
||||
'value' => 'Appliquer'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Installer des données de module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::file('pluginImportFile', [
|
||||
'label' => 'Archive ZIP :',
|
||||
'type' => 2
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('pluginImportPage', $module::$pagesList, [
|
||||
'label' => 'Importer le module dans la page ' . template::flag('site', '20px')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,22 +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-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
.activeButton {
|
||||
filter : brightness(150%);
|
||||
}
|
@ -1,50 +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-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".moduleDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir désinstaller ce module ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".dataDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer le module de cette page ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
// Sélecteur de fonctions
|
||||
|
||||
$("#configManageModuleButton").on("click", function () {
|
||||
console.log("clic");
|
||||
$("#manageDatas").hide();
|
||||
$("#manageModules").show();
|
||||
$("#configManageModuleButton").addClass("activeButton");
|
||||
$("#configManageDatasButton").removeClass("activeButton");
|
||||
setCookie("pluginLayout", "module");
|
||||
});
|
||||
$("#configManageDatasButton").on("click", function () {
|
||||
$("#manageModules").hide();
|
||||
$("#manageDatas").show();
|
||||
$("#configManageModuleButton").removeClass("activeButton");
|
||||
$("#configManageDatasButton").addClass("activeButton");
|
||||
setCookie("pluginLayout", "data");
|
||||
});
|
@ -1,105 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configModulesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('configModulesHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/gestion-des-modules',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="row textAlignCenter">
|
||||
<div class="col3">
|
||||
<?php echo template::button('configManageModuleButton', [
|
||||
'value' => 'Modules installés',
|
||||
'class' => 'activeButton'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::button('configManageDatasButton', [
|
||||
'value' => 'Données des modules'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="manageModules">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Installation / mise à jour d'un module</h4>
|
||||
<div class="row textAlignCenter">
|
||||
<div class="col4">
|
||||
<?php echo template::button('configModulesStore', [
|
||||
'href' => helper::baseUrl() . 'plugin/store',
|
||||
'value' => template::ico('shopping-basket') . ' Catalogue en ligne'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::button('configStoreUpload', [
|
||||
'href' => helper::baseUrl() . 'plugin/upload',
|
||||
'value' => template::ico('upload') . ' Depuis une archive ZIP'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$modulesInstalled): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Sauvegarde des modules installés</h4>
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesInstalled, [ 'Modules', 'moduleId', 'Versions', '', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun module installé.'); ?>
|
||||
<?php endif; ?>
|
||||
<?php if($module::$modulesOrphan): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Désinstallation des modules orphelins</h4>
|
||||
<?php echo template::table([2, 2, 1, 6, 1], $module::$modulesOrphan, [ 'Modules', 'moduleId', 'Versions', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div id="manageDatas" class="displayNone">
|
||||
<?php if($module::$modulesData): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Modules configurés <?php echo template::flag( self::$i18n, '20px'); ?> </h4>
|
||||
<div class="row">
|
||||
<div class="col1 offset11">
|
||||
<?php echo template::button('configModuledataImport', [
|
||||
'href' => helper::baseUrl() . 'plugin/dataImport',
|
||||
'value' => template::ico('upload'),
|
||||
"help" => 'Importer des données de module dans une page libre'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::table([2, 2, 1, 5, 1, 1], $module::$modulesData, [ 'Modules', 'moduleId', 'Versions', 'Pages (pageId)', '', '']); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
@ -1,14 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('configStoreBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'plugin',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$storeList): ?>
|
||||
<?php echo template::table([2, 2, 1, 2, 2, 1], $module::$storeList, ['Catégorie', 'Module', 'Version', 'Date', 'Pages', '']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Le catalogue est vide.'); ?>
|
||||
<?php endif; ?>
|
@ -19,4 +19,4 @@
|
||||
<?php echo template::table([3, 3, 3, 3, 1], $module::$fontsList, ['Family Name', 'Font Id', 'Affectation', 'Ressource', 'Effacer']); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune fonte !'); ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
@ -1,16 +1,15 @@
|
||||
<?php echo template::formOpen('translateFormCopy'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('translateFormCopyBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'translate',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('translateFormCopySubmit', [
|
||||
'value' => 'Copier'
|
||||
]); ?>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('translateFormCopySubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
@ -1,27 +1,28 @@
|
||||
<?php echo template::formOpen('translateForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('translateFormBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('translateHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/prise-en-charge-des-langues-etrangeres',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset7">
|
||||
<div class="col3 offset3">
|
||||
<?php echo template::button('translateButton', [
|
||||
'href' => helper::baseUrl() . 'translate/copy',
|
||||
'value' => template::ico('docs'),
|
||||
'disabled' => $module::$siteTranslate,
|
||||
'help' => 'Copie de sites inter-langues'
|
||||
'value' => 'Utilitaire de copie',
|
||||
'ico' => 'cog-alt',
|
||||
'disabled' => $module::$siteTranslate
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
|
@ -346,14 +346,12 @@ class user extends common {
|
||||
self::$groups[$this->getData(['user', $userId, 'group'])],
|
||||
template::button('userEdit' . $userId, [
|
||||
'href' => helper::baseUrl() . 'user/edit/' . $userId . '/back/'. $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Editer ' . $userId
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('userDelete' . $userId, [
|
||||
'class' => 'userDelete buttonRed',
|
||||
'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Supprimer ' . $userId
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php echo template::formOpen('userAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('userAddSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,21 +1,23 @@
|
||||
<?php echo template::formOpen('userEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<div class="col2">
|
||||
<?php if($this->getUser('group') === self::GROUP_ADMIN): ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::button('userEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'value' => template::ico('home')
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('userEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,10 +3,11 @@
|
||||
'label' => 'Identifiant'
|
||||
]); ?>
|
||||
<div class="row">
|
||||
<div class="col1 offset9">
|
||||
<div class="col3 offset6">
|
||||
<?php echo template::button('userForgotBack', [
|
||||
'href' => helper::baseUrl() . 'user/login/' . $this->getUrl(2),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
|
4
core/module/user/view/import/import.help.html
Normal file
4
core/module/user/view/import/import.help.html
Normal file
@ -0,0 +1,4 @@
|
||||
<h3>IMPORT</h3>
|
||||
<p>Pour réaliser un fichier CSV d'utilisateurs les en-têtes obligatoires sont : id, nom, prenom, email et groupe ( 1 : membre - 2 : éditeur - 3 : administrateur )</p>
|
||||
<p>Voir ce <a href="core/module/user/ressource/template.csv">modèle</a> à compléter avec un tableur.</p>
|
||||
<p>Enregistrez au format CSV, séparateur ; ou , ou : puis téléversez votre fichier avec 'Gérer les fichiers'.</p>
|
@ -1,22 +1,23 @@
|
||||
<?php echo template::formOpen('userImportForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userImportBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'user',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::submit('userImportSubmit', [
|
||||
'value' => 'Importer'
|
||||
]); ?>
|
||||
@ -27,7 +28,7 @@
|
||||
<div class="block">
|
||||
<h4>Importation de fichier plat CSV</h4>
|
||||
<div class="row">
|
||||
<div class="col10">
|
||||
<div class="col6">
|
||||
<?php echo template::file('userImportCSVFile', [
|
||||
'label' => 'Liste d\'utilisateurs :'
|
||||
]); ?>
|
||||
|
@ -1,32 +1,33 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(false),
|
||||
'value' => template::ico('home')
|
||||
'ico' => 'home',
|
||||
'value' => 'Accueil'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userHelp', [
|
||||
'href' => 'https://doc.zwiicms.fr/gestion-des-utilisateurs',
|
||||
'target' => '_blank',
|
||||
'value' => template::ico('help'),
|
||||
'class' => 'buttonHelp',
|
||||
'help' => 'Consulter l\'aide en ligne'
|
||||
'ico' => 'help',
|
||||
'value' => 'Aide',
|
||||
'class' => 'buttonHelp'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset8">
|
||||
<div class="col2 offset4">
|
||||
<?php echo template::button('userImport', [
|
||||
'href' => helper::baseUrl() . 'user/import',
|
||||
'value' => template::ico('upload') ,
|
||||
'help' => 'Importer des utilisateurs en masse'
|
||||
'ico' => 'plus',
|
||||
'value' => 'Importation'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('userAdd', [
|
||||
'href' => helper::baseUrl() . 'user/add',
|
||||
'value' => template::ico('plus'),
|
||||
'help' => 'Ajouter un utilisateur'
|
||||
'ico' => 'plus',
|
||||
'value' => 'Utilisateur'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
4
core/vendor/tinymce/init.js
vendored
4
core/vendor/tinymce/init.js
vendored
@ -114,7 +114,7 @@ tinymce.init({
|
||||
// Active l'onglet avancé lors de l'ajout d'une image
|
||||
image_advtab: true,
|
||||
// Urls absolues
|
||||
relative_urls: true,
|
||||
relative_urls: false,
|
||||
// Url de base
|
||||
document_base_url: baseUrl,
|
||||
// Gestionnaire de fichiers
|
||||
@ -294,7 +294,7 @@ tinymce.init({
|
||||
// Active l'onglet avancé lors de l'ajout d'une image
|
||||
image_advtab: true,
|
||||
// Urls absolues
|
||||
relative_urls: true,
|
||||
relative_urls: false,
|
||||
// Url de base
|
||||
document_base_url: baseUrl,
|
||||
// Contenu du bouton formats
|
||||
|
81
core/vendor/tippy/init.js
vendored
81
core/vendor/tippy/init.js
vendored
@ -1,49 +1,38 @@
|
||||
/**
|
||||
* Initialisation de Tippy
|
||||
*/
|
||||
$(document).ready(function () {
|
||||
|
||||
// Tooltip des attributs title
|
||||
tippy("[data-tippy-content]", {
|
||||
arrow: true,
|
||||
placement: "top"
|
||||
});
|
||||
|
||||
// Pour les images map, pas de flèche, bulle haut suivant le curseur
|
||||
tippy('img[title], a[title]:not(.button), area[title]', {
|
||||
|
||||
content(reference) {
|
||||
const title = reference.getAttribute('title')
|
||||
reference.removeAttribute('title')
|
||||
return title
|
||||
},
|
||||
|
||||
placement: "top",
|
||||
followCursor: true,
|
||||
animation: "fade",
|
||||
animateFill: true
|
||||
});
|
||||
|
||||
// Tooltip des aides
|
||||
tippy('a.button[title]', {
|
||||
content(reference) {
|
||||
const title = reference.getAttribute('title')
|
||||
reference.removeAttribute('title')
|
||||
return title
|
||||
},
|
||||
delay: [1000,250],
|
||||
placement: "bottom",
|
||||
followCursor: false,
|
||||
arrow: true,
|
||||
animateFill: true,
|
||||
arrowType: "round",
|
||||
});
|
||||
|
||||
// Pour les images map, pas de flèche, bulle haut suivant le curseur
|
||||
tippy("#image-map", {
|
||||
placement: "top",
|
||||
followCursor: true,
|
||||
animation: "fade",
|
||||
animateFill: true
|
||||
});
|
||||
});
|
||||
$(document).ready(function() {
|
||||
// Tooltip des aides
|
||||
tippy(".helpButton", {
|
||||
arrow: true,
|
||||
arrowType: "round",
|
||||
placement: "top"
|
||||
});
|
||||
// Tooltip des attributs title
|
||||
tippy("[data-tippy-content]", {
|
||||
arrow: true,
|
||||
placement: "top"
|
||||
});
|
||||
// Pour les images map, pas de flèche, bulle haut suivant le curseur
|
||||
|
||||
tippy('img[title], a[title], area[title]', {
|
||||
|
||||
content(reference) {
|
||||
const title = reference.getAttribute('title')
|
||||
reference.removeAttribute('title')
|
||||
return title
|
||||
},
|
||||
|
||||
placement: "top",
|
||||
followCursor: true,
|
||||
animation: "fade",
|
||||
animateFill: true
|
||||
});
|
||||
// Pour les images map, pas de flèche, bulle haut suivant le curseur
|
||||
tippy("#image-map", {
|
||||
placement: "top",
|
||||
followCursor: true,
|
||||
animation: "fade",
|
||||
animateFill: true
|
||||
});
|
||||
});
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
class blog extends common {
|
||||
|
||||
const VERSION = '6.0';
|
||||
const VERSION = '5.1';
|
||||
const REALNAME = 'Blog';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -32,7 +32,6 @@ class blog extends common {
|
||||
'commentDelete' => self::GROUP_MODERATOR,
|
||||
'commentDeleteAll' => self::GROUP_MODERATOR,
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'option' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'edit' => self::GROUP_MODERATOR,
|
||||
'index' => self::GROUP_VISITOR,
|
||||
@ -101,9 +100,6 @@ class blog extends common {
|
||||
self::EDIT_OWNER => 'Propriétaire'
|
||||
];
|
||||
|
||||
// Nombre d'articles dans la page de config:
|
||||
public static $itemsperPage = 8;
|
||||
|
||||
|
||||
public static $users = [];
|
||||
|
||||
@ -402,116 +398,103 @@ class blog extends common {
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Gestion des droits d'accès
|
||||
$filterData=[];
|
||||
foreach ($articleIds as $key => $value) {
|
||||
if (
|
||||
( // Propriétaire
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
|
||||
OR (
|
||||
// Groupe
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
|
||||
)
|
||||
) {
|
||||
$filterData[] = $value;
|
||||
}
|
||||
}
|
||||
$articleIds = $filterData;
|
||||
// Pagination
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),self::$itemsperPage);
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Nombre de commentaires à approuver et approuvés
|
||||
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
||||
if ( is_array($approvals) ) {
|
||||
$a = array_values($approvals);
|
||||
$toApprove = count(array_keys($a,false));
|
||||
$approved = count(array_keys($a,true));
|
||||
} else {
|
||||
$toApprove = 0;
|
||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
self::$articles[] = [
|
||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||
'</a>',
|
||||
$date .' à '. $heure,
|
||||
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
||||
// Bouton pour afficher les commentaires de l'article
|
||||
template::button('blogConfigComment' . $articleIds[$i], [
|
||||
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
|
||||
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
|
||||
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved,
|
||||
'help' => ($toApprove || $approved ) > 0 ? 'Editer / Approuver les commentaires' : ''
|
||||
]),
|
||||
template::button('blogConfigEdit' . $articleIds[$i], [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Editer l\'article'
|
||||
]),
|
||||
template::button('blogConfigDelete' . $articleIds[$i], [
|
||||
'class' => 'blogConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Effacer l\'article'
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
|
||||
public function option() {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('blogOptionShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true),
|
||||
'feeds' => $this->getInput('blogConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Ids des articles par ordre de publication
|
||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Gestion des droits d'accès
|
||||
$filterData=[];
|
||||
foreach ($articleIds as $key => $value) {
|
||||
if (
|
||||
( // Propriétaire
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'posts', $value,'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
|
||||
OR (
|
||||
// Groupe
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) !== self::EDIT_OWNER
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'posts', $value,'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $value,'editConsent']) === self::EDIT_ALL
|
||||
)
|
||||
) {
|
||||
$filterData[] = $value;
|
||||
}
|
||||
}
|
||||
$articleIds = $filterData;
|
||||
// Pagination
|
||||
$pagination = helper::pagination($articleIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Articles en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Nombre de commentaires à approuver et approuvés
|
||||
$approvals = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'comment' ]),'approval', 'SORT_DESC');
|
||||
if ( is_array($approvals) ) {
|
||||
$a = array_values($approvals);
|
||||
$toApprove = count(array_keys($a,false));
|
||||
$approved = count(array_keys($a,true));
|
||||
} else {
|
||||
$toApprove = 0;
|
||||
$approved = count($this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i],'comment']));
|
||||
}
|
||||
// Met en forme le tableau
|
||||
$date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'publishedOn'])));
|
||||
self::$articles[] = [
|
||||
'<a href="' . helper::baseurl() . $this->getUrl(0) . '/' . $articleIds[$i] . '" target="_blank" >' .
|
||||
$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) .
|
||||
'</a>',
|
||||
$date .' à '. $heure,
|
||||
self::$states[$this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'state'])],
|
||||
// Bouton pour afficher les commentaires de l'article
|
||||
template::button('blogConfigComment' . $articleIds[$i], [
|
||||
'class' => ($toApprove || $approved ) > 0 ? '' : 'buttonGrey' ,
|
||||
'href' => ($toApprove || $approved ) > 0 ? helper::baseUrl() . $this->getUrl(0) . '/comment/' . $articleIds[$i] : '',
|
||||
'value' => $toApprove > 0 ? $toApprove . '/' . $approved : $approved
|
||||
]),
|
||||
template::button('blogConfigEdit' . $articleIds[$i], [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('blogConfigDelete' . $articleIds[$i], [
|
||||
'class' => 'blogConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $articleIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Options de configuration',
|
||||
'view' => 'option'
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Suppression
|
||||
*/
|
||||
|
@ -1,2 +0,0 @@
|
||||
# version 6
|
||||
- mise à la norme avec le module news : le formulaire est sorti de l'écran principal
|
@ -1,16 +1,17 @@
|
||||
<?php echo template::formOpen('blogAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('blogAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset7">
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('blogAddDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Brouillon'
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('blogAddState', [
|
||||
'value' => true
|
||||
|
@ -1,27 +1,51 @@
|
||||
<?php echo template::formOpen('blogConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('blogConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'posts',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset9">
|
||||
<?php echo template::button('blogConfigOption', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'value' => template::ico('sliders'),
|
||||
'help' => 'Options de configuration'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('blogConfigAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||
'value' => template::ico('plus'),
|
||||
'help' => 'Rédiger un article'
|
||||
'ico' => 'plus',
|
||||
'value' => 'Article'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('blogConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('blogConfigFeedslabel', [
|
||||
'label' => 'Texte de l\'étiquette',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset6">
|
||||
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if($module::$articles): ?>
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?php echo template::formOpen('blogEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('blogEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset6">
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('blogEditDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Brouillon'
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('blogEditState', [
|
||||
'value' => true
|
||||
|
@ -1,46 +0,0 @@
|
||||
<?php echo template::formOpen('blogOption'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('blogOptionBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('blogOptionSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('blogOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('blogOptionFeedslabel', [
|
||||
'label' => 'Texte de l\'étiquette',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset6">
|
||||
<?php echo template::select('blogOptionItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
||||
|
@ -1,3 +0,0 @@
|
||||
# Version 3
|
||||
- Déplacement des options de formulaires
|
||||
- Gabarit du formulaire sur la page
|
@ -16,7 +16,7 @@
|
||||
|
||||
class form extends common {
|
||||
|
||||
const VERSION = '3.0';
|
||||
const VERSION = '2.11';
|
||||
const REALNAME = 'Formulaire';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -24,7 +24,6 @@ class form extends common {
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'option' => self::GROUP_MODERATOR,
|
||||
'data' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'deleteall' => self::GROUP_MODERATOR,
|
||||
@ -39,9 +38,6 @@ class form extends common {
|
||||
|
||||
public static $pagination;
|
||||
|
||||
// Nombre d'articles dans la page de config:
|
||||
public static $itemperPage = 20;
|
||||
|
||||
|
||||
// Objets
|
||||
const TYPE_MAIL = 'mail';
|
||||
@ -79,35 +75,38 @@ class form extends common {
|
||||
'100' => '100%'
|
||||
];
|
||||
|
||||
public static $optionOffset = [
|
||||
0 => 'Aucune',
|
||||
1 => 'Une colonne',
|
||||
2 => 'Deux colonnes'
|
||||
];
|
||||
|
||||
public static $optionWidth = [
|
||||
6 => 'Six colonnes',
|
||||
7 => 'Sept colonnes',
|
||||
8 => 'Huit colonnes',
|
||||
9 => 'Neuf colonnes',
|
||||
10 => 'Dix colonnes',
|
||||
11 => 'Onze colonnes',
|
||||
12 => 'Douze colonnes',
|
||||
];
|
||||
|
||||
public static $optionAlign = [
|
||||
'' => 'A gauche',
|
||||
'textAlignCenter' => 'Au centre',
|
||||
'textAlignRight' => 'A droite'
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Liste des utilisateurs
|
||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
self::$listUsers [] = '';
|
||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||
self::$listUsers [] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Configuration
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'button' => $this->getInput('formConfigButton'),
|
||||
'captcha' => $this->getInput('formConfigCaptcha', helper::FILTER_BOOLEAN),
|
||||
'group' => $this->getInput('formConfigGroup', helper::FILTER_INT),
|
||||
'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)],
|
||||
'mail' => $this->getInput('formConfigMail') ,
|
||||
'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '',
|
||||
'subject' => $this->getInput('formConfigSubject'),
|
||||
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN),
|
||||
'signature' => $this->getInput('formConfigSignature'),
|
||||
'logoUrl' => $this->getInput('formConfigLogo'),
|
||||
'logoWidth' => $this->getInput('formConfigLogoWidth')
|
||||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
@ -149,75 +148,6 @@ class form extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function option() {
|
||||
// Liste des utilisateurs
|
||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
self::$listUsers [] = '';
|
||||
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
||||
self::$listUsers [] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
// Débordement
|
||||
$width = $this->getInput('formOptionWidth');
|
||||
if ($this->getInput('formOptionWidth',helper::FILTER_INT) + $this->getInput('formOptionOffset',helper::FILTER_INT) > 12 ) {
|
||||
$width = (string) $this->getInput('formOptionWidth',helper::FILTER_INT) - $this->getInput('formOptionOffset',helper::FILTER_INT);
|
||||
}
|
||||
|
||||
// Configuration
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'button' => $this->getInput('formOptionButton'),
|
||||
'captcha' => $this->getInput('formOptionCaptcha', helper::FILTER_BOOLEAN),
|
||||
'group' => $this->getInput('formOptionGroup', helper::FILTER_INT),
|
||||
'user' => self::$listUsers [$this->getInput('formOptionUser', helper::FILTER_INT)],
|
||||
'mail' => $this->getInput('formOptionMail') ,
|
||||
'pageId' => $this->getInput('formOptionPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formOptionPageId', helper::FILTER_ID) : '',
|
||||
'subject' => $this->getInput('formOptionSubject'),
|
||||
'replyto' => $this->getInput('formOptionMailReplyTo', helper::FILTER_BOOLEAN),
|
||||
'signature' => $this->getInput('formOptionSignature'),
|
||||
'logoUrl' => $this->getInput('formOptionLogo'),
|
||||
'logoWidth' => $this->getInput('formOptionLogoWidth'),
|
||||
'offset' =>$this->getInput('formOptionOffset'),
|
||||
'width' =>$width,
|
||||
'align' =>$this->getInput('formOptionAlign'),
|
||||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées' ,
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Liste des pages
|
||||
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
|
||||
self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
|
||||
foreach($childrenPageIds as $childKey) {
|
||||
self::$pages[$childKey] = ' ' . $this->getData(['page', $childKey, 'title']);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Options de configuration',
|
||||
'vendor' => [
|
||||
'html-sortable',
|
||||
'flatpickr'
|
||||
],
|
||||
'view' => 'option'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Données enregistrées
|
||||
*/
|
||||
@ -225,7 +155,7 @@ class form extends common {
|
||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||
if($data) {
|
||||
// Pagination
|
||||
$pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPages);
|
||||
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE);
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Inverse l'ordre du tableau
|
||||
|
@ -54,15 +54,6 @@ function add(inputUid, input) {
|
||||
position();
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher/cacher les options supplémentaires
|
||||
*/
|
||||
$(document).on("click", ".formConfigMoreToggle", function() {
|
||||
|
||||
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
|
||||
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Calcul des positions
|
||||
*/
|
||||
@ -85,6 +76,14 @@ if(inputs) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher/cacher les options supplémentaires
|
||||
*/
|
||||
$(document).on("click", ".formConfigMoreToggle", function() {
|
||||
|
||||
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
|
||||
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Crée un nouveau champ à partir des champs cachés
|
||||
@ -97,12 +96,6 @@ $("#formConfigAdd").on("click", function() {
|
||||
/**
|
||||
* Actions sur les champs
|
||||
*/
|
||||
|
||||
// Validation auto après ajout d'un champ
|
||||
$("a#formConfigAdd.button").click(function () {
|
||||
$("#formConfigForm").submit();
|
||||
});
|
||||
|
||||
// Tri entre les champs
|
||||
sortable("#formConfigInputs", {
|
||||
forcePlaceholderSize: true,
|
||||
@ -150,3 +143,73 @@ $("#formConfigInputs")
|
||||
});
|
||||
// Simule un changement de type au chargement de la page
|
||||
$(".formConfigType").trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher du mail
|
||||
*/
|
||||
$("#formConfigMailOptionsToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigMailOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formConfigMailOptions").slideUp(function() {
|
||||
$("#formConfigGroup").val("");
|
||||
$("#formConfigSubject").val("");
|
||||
$("#formConfigMail").val("");
|
||||
$("#formConfigUser").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher de la redirection
|
||||
*/
|
||||
$("#formConfigPageIdToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigPageIdWrapper").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formConfigPageIdWrapper").slideUp(function() {
|
||||
$("#formConfigPageId").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Paramètres par défaut au chargement
|
||||
*/
|
||||
$( document ).ready(function() {
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
if ($("#formConfigSignature").val() !== "text") {
|
||||
$("#formConfigLogoWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideDown();
|
||||
$("#formConfigLogoWidthWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formConfigLogoWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideUp();
|
||||
$("#formConfigLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
var formConfigSignatureDOM = $("#formConfigSignature");
|
||||
formConfigSignatureDOM.on("change", function() {
|
||||
if ($(this).val() !== "text") {
|
||||
$("#formConfigLogoWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideDown();
|
||||
$("#formConfigLogoWidthWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formConfigLogoWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideUp();
|
||||
$("#formConfigLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
@ -49,48 +49,140 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formOpen('formConfigForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('formConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset7">
|
||||
<?php echo template::button('formConfigData', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||
'value' => template::ico('code'),
|
||||
'help' => 'Voir et exporter les données du formulaire'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<?php echo template::button('formConfigLayout', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'value' => template::ico('sliders'),
|
||||
'help' => 'Options de configuration'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('formConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Liste des champs</h4>
|
||||
<div id="formConfigNoInput">
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
</div>
|
||||
<div id="formConfigInputs"></div>
|
||||
<div class="row">
|
||||
<div class="col1 offset11">
|
||||
<?php echo template::button('formConfigAdd', [
|
||||
'value' => template::ico('plus'),
|
||||
'class' => 'buttonGreen'
|
||||
<div class="col2">
|
||||
<?php echo template::button('formConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('formConfigData', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||
'value' => 'Gérer les données'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('formConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<?php echo template::text('formConfigButton', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Texte du bouton de soumission',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('formConfigMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
|
||||
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email. Votre serveur doit autoriser les envois de mail.'
|
||||
]); ?>
|
||||
<div id="formConfigMailOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col11 offset1">
|
||||
<?php echo template::text('formConfigSubject', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Sujet du mail',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Element 0 quand aucun membre a été sélectionné
|
||||
$groupMembers = [''] + $module::$groupNews;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col3 offset1">
|
||||
<?php echo template::select('formConfigGroup', $groupMembers, [
|
||||
'label' => 'Aux groupes à partir de',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('formConfigUser', $module::$listUsers, [
|
||||
'label' => 'A un membre',
|
||||
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('formConfigMail', [
|
||||
'label' => 'A une adresse email',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
|
||||
'help' => 'Un email ou une liste de diffusion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset1">
|
||||
<?php echo template::checkbox('formConfigMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
|
||||
'help' => 'Cette option permet de réponse drectement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formConfigSignature', $module::$signature, [
|
||||
'label' => 'Sélectionner le type de signature',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::file('formConfigLogo', [
|
||||
'help' => 'Sélectionnez le logo du site',
|
||||
'label' => 'Logo',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formConfigLogoWidth', $module::$logoWidth, [
|
||||
'label' => 'Sélectionner la largeur du logo',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col5">
|
||||
<?php echo template::select('formConfigPageId', $module::$pages, [
|
||||
'classWrapper' => 'displayNone',
|
||||
'label' => 'Sélectionner une page du site :',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::checkbox('formConfigCaptcha', true, 'Valider un captcha afin de soumettre le formulaire.', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Liste des champs</h4>
|
||||
<div id="formConfigNoInput">
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
</div>
|
||||
<div id="formConfigInputs"></div>
|
||||
<div class="row">
|
||||
<div class="col1 offset11">
|
||||
<?php echo template::button('formConfigAdd', [
|
||||
'value' => template::ico('plus')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
|
@ -1,24 +1,25 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('formDataBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset9">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('formDataDeleteAll', [
|
||||
'class' => 'formDataDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Effacer toutes les données'
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Tout effacer'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('formDataBack', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('download'),
|
||||
'help' => 'Exporter toutes les données'
|
||||
'ico' => 'download',
|
||||
'value' => 'Export CSV'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,75 +1,67 @@
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
||||
<div class="row <?php echo $this->getData(['module', $this->getUrl(0), 'config', 'align']);?>">
|
||||
<div class="<?php
|
||||
echo 'col' . $this->getData(['module', $this->getUrl(0), 'config', 'width']) . ' ';
|
||||
echo $this->getData(['module', $this->getUrl(0), 'config', 'offset']) !== 0 ? 'offset' . $this->getData(['module', $this->getUrl(0), 'config', 'offset']) : '';
|
||||
?>">
|
||||
<?php echo template::formOpen('formForm'); ?>
|
||||
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
||||
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
||||
<?php echo template::mail('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
|
||||
<?php
|
||||
$values = array_flip(explode(',', $input['values']));
|
||||
foreach($values as $value => $key) {
|
||||
$values[$value] = trim($value);
|
||||
}
|
||||
?>
|
||||
<?php echo template::select('formInput[' . $index . ']', $values, [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
||||
<?php echo template::text('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
||||
<?php echo template::textarea('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
||||
<?php echo template::date('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name'],
|
||||
'vendor' => 'flatpickr'
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
||||
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
|
||||
); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
||||
<h3 class='formLabel'>
|
||||
<?php echo $input['name']; ?>
|
||||
<hr class="formLabel">
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo template::captcha('formCaptcha', [
|
||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formOpen('formForm'); ?>
|
||||
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
||||
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
||||
<?php echo template::mail('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_SELECT): ?>
|
||||
<?php
|
||||
$values = array_flip(explode(',', $input['values']));
|
||||
foreach($values as $value => $key) {
|
||||
$values[$value] = trim($value);
|
||||
}
|
||||
?>
|
||||
<?php echo template::select('formInput[' . $index . ']', $values, [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
|
||||
<?php echo template::text('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
|
||||
<?php echo template::textarea('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name']
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
||||
<?php echo template::date('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name'],
|
||||
'vendor' => 'flatpickr'
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
|
||||
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name']
|
||||
); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_LABEL): ?>
|
||||
<h3 class='formLabel'>
|
||||
<?php echo $input['name']; ?>
|
||||
<hr class="formLabel">
|
||||
</h3>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset10">
|
||||
<?php echo template::submit('formSubmit', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
|
||||
'ico' => ''
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo template::captcha('formCaptcha', [
|
||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset10">
|
||||
<?php echo template::submit('formSubmit', [
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer',
|
||||
'ico' => ''
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
<?php endif; ?>
|
@ -1,72 +0,0 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affiche/cache les options de la case à cocher du mail
|
||||
*/
|
||||
$("#formOptionMailOptionsToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formOptionMailOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formOptionMailOptions").slideUp(function() {
|
||||
$("#formOptionGroup").val("");
|
||||
$("#formOptionSubject").val("");
|
||||
$("#formOptionMail").val("");
|
||||
$("#formOptionUser").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher de la redirection
|
||||
*/
|
||||
$("#formOptionPageIdToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formOptionPageIdWrapper").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formOptionPageIdWrapper").slideUp(function() {
|
||||
$("#formOptionPageId").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Paramètres par défaut au chargement
|
||||
*/
|
||||
$( document ).ready(function() {
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
if ($("#formOptionSignature").val() !== "text") {
|
||||
$("#formOptionLogoWrapper").addClass("disabled");
|
||||
$("#formOptionLogoWrapper").slideDown();
|
||||
$("#formOptionLogoWidthWrapper").addClass("disabled");
|
||||
$("#formOptionLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formOptionLogoWrapper").removeClass("disabled");
|
||||
$("#formOptionLogoWrapper").slideUp();
|
||||
$("#formOptionLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formOptionLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
var formOptionSignatureDOM = $("#formOptionSignature");
|
||||
formOptionSignatureDOM.on("change", function() {
|
||||
if ($(this).val() !== "text") {
|
||||
$("#formOptionLogoWrapper").addClass("disabled");
|
||||
$("#formOptionLogoWrapper").slideDown();
|
||||
$("#formOptionLogoWidthWrapper").addClass("disabled");
|
||||
$("#formOptionLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formOptionLogoWrapper").removeClass("disabled");
|
||||
$("#formOptionLogoWrapper").slideUp();
|
||||
$("#formOptionLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formOptionLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
@ -1,157 +0,0 @@
|
||||
<?php echo template::formOpen('formOptionForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('formOptionBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('formOptionSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Validation du formulaire</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formOptionCaptcha', true, 'Captcha', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('formOptionButton', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Etiquette du bouton de soumission',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formOptionPageIdToggle', true, 'Redirection après soumission du formulaire', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col5">
|
||||
<?php echo template::select('formOptionPageId', $module::$pages, [
|
||||
'classWrapper' => 'displayNone',
|
||||
'label' => 'Page du site :',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Gabarit</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('formOptionAlign', $module::$optionAlign, [
|
||||
'label' => 'Alignement du formulaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'align'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::select('formOptionOffset', $module::$optionOffset, [
|
||||
'label' => 'Décalage à gauche',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'offset'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::select('formOptionWidth', $module::$optionWidth, [
|
||||
'label' => 'Largeur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'width'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Courriel</h4>
|
||||
<?php echo template::checkbox('formOptionMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
|
||||
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saisissez un email. Votre serveur doit autoriser les envois de mail.'
|
||||
]); ?>
|
||||
<div id="formOptionMailOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('formOptionSubject', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Sujet du mail',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Element 0 quand aucun membre a été sélectionné
|
||||
$groupMembers = [''] + $module::$groupNews;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formOptionGroup', $groupMembers, [
|
||||
'label' => 'Aux groupes à partir de',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formOptionUser', $module::$listUsers, [
|
||||
'label' => 'A un membre',
|
||||
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('formOptionMail', [
|
||||
'label' => 'A une adresse email',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
|
||||
'help' => 'Un email ou une liste de diffusion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formOptionSignature', $module::$signature, [
|
||||
'label' => 'Sélectionner le type de signature',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::file('formOptionLogo', [
|
||||
'help' => 'Sélectionnez le logo du site',
|
||||
'label' => 'Logo',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formOptionLogoWidth', $module::$logoWidth, [
|
||||
'label' => 'Sélectionner la largeur du logo',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formOptionMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
|
||||
'help' => 'Cette option permet de réponse directement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -1,2 +0,0 @@
|
||||
# version 3.4
|
||||
- Changement de nom du bouton Thème devient mise en page
|
@ -17,7 +17,7 @@
|
||||
class gallery extends common {
|
||||
|
||||
|
||||
const VERSION = '3.4';
|
||||
const VERSION = '3.3';
|
||||
const REALNAME = 'Galerie';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -346,14 +346,12 @@ class gallery extends common {
|
||||
$gallery['config']['directory'],
|
||||
template::button('galleryConfigEdit' . $galleryId , [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Configuration de la galerie '
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('galleryConfigDelete' . $galleryId, [
|
||||
'class' => 'galleryConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Supprimer cette galerie'
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
// Tableau des id des galleries pour le drag and drop
|
||||
|
@ -1,17 +1,17 @@
|
||||
<?php echo template::formOpen('galleryConfigForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('galleryConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset10">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('galleryConfigBack', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('sliders'),
|
||||
'help' => 'Options de configuration'
|
||||
'value' => template::ico('brush','right') . 'Thème'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php echo template::formOpen('galleryEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('galleryEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('galleryEditSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,9 +1,10 @@
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('galleryGalleryBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,14 +1,15 @@
|
||||
<?php echo template::formOpen('galleryThemeForm'); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('galleryThemeBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('galleryThemeBack'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +0,0 @@
|
||||
# Version 4
|
||||
- Config : le nombre d'objet est fixe, constante dans news.php
|
||||
- Ecran layout réservé à la configuration et au thème
|
||||
- Bug avec l'initialisation, fichier css déclaré mais absent
|
||||
|
||||
A faire partie CSS à amléiorer au niveau des options
|
@ -15,7 +15,7 @@
|
||||
|
||||
class news extends common {
|
||||
|
||||
const VERSION = '4.0';
|
||||
const VERSION = '3.7';
|
||||
const REALNAME = 'News';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -23,8 +23,7 @@ class news extends common {
|
||||
|
||||
public static $actions = [
|
||||
'add' => self::GROUP_MODERATOR,
|
||||
'config' => self::GROUP_MODERATOR, // Edition des news
|
||||
'option' => self::GROUP_MODERATOR, // paramétrage des news
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'edit' => self::GROUP_MODERATOR,
|
||||
'index' => self::GROUP_VISITOR,
|
||||
@ -89,8 +88,7 @@ class news extends common {
|
||||
|
||||
// Signature de l'article
|
||||
public static $articleSignature = '';
|
||||
// Nombre d'articles dans la page de config:
|
||||
public static $itemsperPage = 8;
|
||||
|
||||
|
||||
/**
|
||||
* Flux RSS
|
||||
@ -191,65 +189,10 @@ class news extends common {
|
||||
// Mise à jour des données de module
|
||||
$this->update();
|
||||
|
||||
// Ids des news par ordre de publication
|
||||
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Pagination fixe
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),self::$itemsperPage );
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// News en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Met en forme le tableau
|
||||
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||
$dateOn .= ' à ';
|
||||
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
|
||||
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||
$dateOff .= ' à ';
|
||||
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||
} else {
|
||||
$dateOff = 'Permanent';
|
||||
}
|
||||
self::$news[] = [
|
||||
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
|
||||
$dateOn,
|
||||
$dateOff,
|
||||
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
|
||||
template::button('newsConfigEdit' . $newsIds[$i], [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil'),
|
||||
'help' => 'Editer cette nouvelle'
|
||||
]),
|
||||
template::button('newsConfigDelete' . $newsIds[$i], [
|
||||
'class' => 'newsConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel'),
|
||||
'help' => 'Effacer cette nouvelle'
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
public function option() {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
|
||||
|
||||
// Générer la feuille de CSS
|
||||
$style = '.newsFrame {';
|
||||
$style .= 'border:' . $this->getInput('newsThemeBorderStyle',helper::FILTER_STRING_SHORT) . ' ' . $this->getInput('newsThemeBorderColor') . ' ' . $this->getInput('newsThemeBorderWidth',helper::FILTER_STRING_SHORT) . ';';
|
||||
@ -274,26 +217,69 @@ class news extends common {
|
||||
]]);
|
||||
|
||||
$this->setData(['module', $this->getUrl(0), 'config',[
|
||||
'feeds' => $this->getInput('newsOptionShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('newsOptionFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('newsOptionItemsperPage', helper::FILTER_INT,true),
|
||||
'itemsperCol' => $this->getInput('newsOptionItemsperCol', helper::FILTER_INT,true),
|
||||
'height' => $this->getInput('newsOptionHeight', helper::FILTER_INT,true),
|
||||
'feeds' => $this->getInput('newsConfigShowFeeds',helper::FILTER_BOOLEAN),
|
||||
'feedsLabel' => $this->getInput('newsConfigFeedslabel',helper::FILTER_STRING_SHORT),
|
||||
'itemsperPage' => $this->getInput('newsConfigItemsperPage', helper::FILTER_INT,true),
|
||||
'itemsperCol' => $this->getInput('newsConfigItemsperCol', helper::FILTER_INT,true),
|
||||
'height' => $this->getInput('newsConfigHeight', helper::FILTER_INT,true),
|
||||
'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData'])
|
||||
]]);
|
||||
|
||||
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Ids des news par ordre de publication
|
||||
$newsIds = array_keys(helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'posts']), 'publishedOn', 'SORT_DESC'));
|
||||
// Pagination
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) );
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// News en fonction de la pagination
|
||||
for($i = $pagination['first']; $i < $pagination['last']; $i++) {
|
||||
// Met en forme le tableau
|
||||
$dateOn = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||
$dateOn .= ' à ';
|
||||
$dateOn .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOn'])));
|
||||
if ($this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])) {
|
||||
$dateOff = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||
$dateOff .= ' à ';
|
||||
$dateOff .= mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'publishedOff'])));
|
||||
} else {
|
||||
$dateOff = 'Permanent';
|
||||
}
|
||||
self::$news[] = [
|
||||
$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'title']),
|
||||
$dateOn,
|
||||
$dateOff,
|
||||
self::$states[$this->getData(['module', $this->getUrl(0),'posts', $newsIds[$i], 'state'])],
|
||||
template::button('newsConfigEdit' . $newsIds[$i], [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsIds[$i]. '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('pencil')
|
||||
]),
|
||||
template::button('newsConfigDelete' . $newsIds[$i], [
|
||||
'class' => 'newsConfigDelete buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $newsIds[$i] . '/' . $_SESSION['csrf'],
|
||||
'value' => template::ico('cancel')
|
||||
])
|
||||
];
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Options de configuration',
|
||||
'view' => 'option',
|
||||
'title' => 'Configuration du module',
|
||||
'view' => 'config',
|
||||
'vendor' => [
|
||||
'tinycolorpicker'
|
||||
]
|
||||
@ -449,7 +435,8 @@ class news extends common {
|
||||
$newsIds[] = $newsId;
|
||||
}
|
||||
}
|
||||
// Pagination selon le layout
|
||||
// Pagination
|
||||
//$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage']));
|
||||
$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']));
|
||||
// Nombre de colonnes
|
||||
self::$nbrCol = $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']);
|
||||
|
@ -1,16 +1,17 @@
|
||||
<?php echo template::formOpen('newsAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('newsAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset7">
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('newsAddDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Brouillon'
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('newsAddState', [
|
||||
'value' => true
|
||||
|
@ -1,28 +1,102 @@
|
||||
<?php echo template::formOpen('newsConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('newsConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 offset9">
|
||||
<?php echo template::button('newsConfigLayout', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/option',
|
||||
'value' => template::ico('sliders'),
|
||||
'help' => 'Options de configuration'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1">
|
||||
<div class="col2 offset6">
|
||||
<?php echo template::button('newsConfigAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||
'value' => template::ico('plus'),
|
||||
'help' => 'Rédiger une news'
|
||||
'ico' => 'plus',
|
||||
'value' => 'News'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('newsConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('newsConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
'help' => 'Flux limité aux articles de la première page.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('newsConfigFeedslabel', [
|
||||
'label' => 'Etiquette RSS',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperCol', $module::$columns, [
|
||||
'label' => 'Nombre de colonnes',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigItemsperPage', $module::$itemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsConfigHeight', $module::$height, [
|
||||
'label' => 'Abrégé de l\'article',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Thème du module</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
|
||||
'label' => 'Epaisseur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('newsThemeBorderColor', [
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de la bordure',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('newsThemeBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur du fond',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($module::$news): ?>
|
||||
<?php echo template::table([4, 2, 2, 2, 1, 1], $module::$news, ['Titre', 'Publication', 'Dépublication', 'État', '', '']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
|
@ -4,13 +4,14 @@
|
||||
<?php echo template::button('newsEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset6">
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('newsEditDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Brouillon'
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('newsEditState', [
|
||||
'value' => true
|
||||
|
@ -1,18 +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-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
@ -1,95 +0,0 @@
|
||||
<?php echo template::formOpen('newsOption'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<?php echo template::button('newsOptionBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'value' => template::ico('left')
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<?php echo template::submit('newsOptionSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres du module</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('newsOptionShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
'help' => 'Flux limité aux articles de la première page.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('newsOptionFeedslabel', [
|
||||
'label' => 'Etiquette RSS',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsOptionItemsperCol', $module::$columns, [
|
||||
'label' => 'Nombre de colonnes',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsOptionItemsperPage', $module::$itemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('newsOptionHeight', $module::$height, [
|
||||
'label' => 'Abrégé de l\'article',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Thème du module</h4>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderStyle', $module::$borderStyle, [
|
||||
'label' => 'Bordure',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('newsThemeBorderWidth', $module::$borderWidth, [
|
||||
'label' => 'Epaisseur',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('newsThemeBorderColor', [
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur de la bordure',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('newsThemeBackgroundColor', [
|
||||
'class' => 'colorPicker',
|
||||
'help' => 'Couleur visible en l\'absence d\'une image.<br />Le curseur horizontal règle le niveau de transparence.',
|
||||
'label' => 'Couleur du fond',
|
||||
'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
@ -1,13 +1,14 @@
|
||||
<?php echo template::formOpen('redirectionConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('redirectionConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('redirectionConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?php echo template::formOpen('searchConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col1">
|
||||
<div class="col2">
|
||||
<?php echo template::button('searchConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'value' => template::ico('left')
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset9">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('searchConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user