From b49c7b5bf5ebec124a40698bb5bda86e8802559c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Fri, 18 Feb 2022 12:43:48 +0100 Subject: [PATCH] =?UTF-8?q?R=C3=A9cup=C3=A9ration=20extra?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/template.class.php | 6 +- core/core.js.php | 20 -- core/core.php | 306 ++++++++++---------- core/include/update.inc.php | 63 +++- core/layout/common.css | 16 - core/module/config/config.php | 83 +++--- core/module/config/view/backup/backup.php | 7 +- core/module/config/view/index/index.js.php | 84 +++--- core/module/config/view/index/index.php | 13 +- core/module/config/view/restore/restore.php | 42 --- core/module/config/view/setup/setup.php | 26 +- core/module/page/view/edit/edit.php | 33 +-- core/module/theme/view/fontAdd/fontAdd.php | 4 +- core/module/translate/view/copy/copy.php | 11 +- core/module/translate/view/index/index.php | 21 +- core/module/user/user.php | 6 +- core/module/user/view/add/add.php | 7 +- core/module/user/view/edit/edit.php | 12 +- core/module/user/view/forgot/forgot.php | 5 +- core/module/user/view/import/import.php | 17 +- core/module/user/view/index/index.php | 25 +- core/vendor/tinymce/init.js | 4 +- module/blog/blog.php | 175 ++++++----- module/blog/changes.md | 2 + module/blog/view/add/add.php | 9 +- module/blog/view/config/config.php | 50 +--- module/blog/view/edit/edit.php | 9 +- module/blog/view/index/index.php | 2 +- module/blog/view/option/option.css | 18 ++ module/blog/view/option/option.php | 46 +++ module/form/changes.md | 3 + module/form/form.php | 126 ++++++-- module/form/view/config/config.js.php | 93 +----- module/form/view/config/config.php | 164 +++-------- module/form/view/data/data.php | 17 +- module/form/view/index/index.php | 122 ++++---- module/form/view/option/option.css | 18 ++ module/form/view/option/option.js.php | 72 +++++ module/form/view/option/option.php | 157 ++++++++++ module/gallery/changes.md | 2 + module/gallery/gallery.php | 8 +- module/gallery/view/config/config.php | 10 +- module/gallery/view/edit/edit.php | 7 +- module/gallery/view/gallery/gallery.php | 5 +- module/gallery/view/theme/theme.php | 7 +- module/news/changes.md | 6 + module/news/news.php | 127 ++++---- module/news/view/add/add.php | 9 +- module/news/view/config/config.php | 100 +------ module/news/view/edit/edit.php | 7 +- module/news/view/option/option.css | 18 ++ module/news/view/option/option.php | 95 ++++++ module/redirection/view/config/config.php | 7 +- module/search/view/config/config.php | 7 +- 54 files changed, 1294 insertions(+), 1015 deletions(-) create mode 100644 module/blog/changes.md create mode 100644 module/blog/view/option/option.css create mode 100644 module/blog/view/option/option.php create mode 100644 module/form/changes.md create mode 100644 module/form/view/option/option.css create mode 100644 module/form/view/option/option.js.php create mode 100644 module/form/view/option/option.php create mode 100644 module/gallery/changes.md create mode 100644 module/news/changes.md create mode 100644 module/news/view/option/option.css create mode 100644 module/news/view/option/option.php diff --git a/core/class/template.class.php b/core/class/template.class.php index d246b719..1e9aea0f 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -19,15 +19,17 @@ class template { 'name' => $nameId, 'target' => '', 'uniqueSubmission' => false, - 'value' => 'Bouton' + 'value' => 'Bouton', + 'help' => '' ], $attributes); // Retourne le html return sprintf( - '%s', + '%s', 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'] ); } diff --git a/core/core.js.php b/core/core.js.php index afceb326..e97e0bf7 100644 --- a/core/core.js.php +++ b/core/core.js.php @@ -490,26 +490,6 @@ $(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 diff --git a/core/core.php b/core/core.php index 1a8f0ee3..ecf9950c 100644 --- a/core/core.php +++ b/core/core.php @@ -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 = '11.3.01'; - const ZWII_UPDATE_CHANNEL = "v11"; + const ZWII_VERSION = '12.0.00'; + const ZWII_UPDATE_CHANNEL = "test"; public static $actions = []; public static $coreModuleIds = [ @@ -538,6 +538,8 @@ class common { } + + /** * Effacer les données de la page * @param string pageId @@ -547,7 +549,8 @@ class common { return unlink(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content'])); - } + } + /** * Sauvegarde des données @@ -1032,8 +1035,6 @@ class common { case 'gif': $source_image = imagecreatefromgif($src); break; - case 'webp': - $source_image = imagecreatefromwebp($src); } // Image valide if ($source_image) { @@ -1056,9 +1057,6 @@ class common { case 'image/gif': return (imagegif($virtual_image, $dest)); break; - case 'image/webp': - return (imagewebp($virtual_image, $dest)); - break; } } else { return (false); @@ -1184,13 +1182,34 @@ 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/'; @@ -1656,11 +1675,130 @@ class common { */ public function showMenu() { // Met en forme les items du menu - $itemsLeft = $this->formatMenu(false); + $itemsLeft = ''; + $currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2); + foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) { + // Passer les entrées masquées + // Propriétés de l'item + $active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : ''; + $targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : ''; + // Mise en page de l'item + $itemsLeft .= '
  • '; - // Menu extra - $itemsRight = $this->formatMenu(true); + if ( ( $this->getData(['page',$parentPageId,'disable']) === true + AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') + ) OR ( + $this->getData(['page',$parentPageId,'disable']) === true + AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + AND $this->getUser('group') < self::GROUP_MODERATOR + ) + ){ + $pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); + $itemsLeft .= ''; + } else { + $pageUrl = ($this->getData(['locale', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId; + $itemsLeft .= ''; + } + + switch ($this->getData(['page', $parentPageId, 'typeMenu'])) { + case '' : + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); + break; + case 'text' : + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); + break; + case 'icon' : + if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; + } else { + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); + } + break; + case 'icontitle' : + if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'titlshortTitlee']).''; + } else { + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); + } + break; + } + // Cas où les pages enfants enfant sont toutes masquées dans le menu + // ne pas afficher de symbole lorsqu'il n'y a rien à afficher + $totalChild = 0; + $disableChild = 0; + foreach($childrenPageIds as $childKey) { + $totalChild += 1; + } + if($childrenPageIds && $disableChild !== $totalChild && + $this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) { + $itemsLeft .= template::ico('down', 'left'); + } + // ------------------------------------------------ + $itemsLeft .= ''; + if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true || + empty($childrenPageIds)) { + continue; + } + $itemsLeft .= ''; + } // Lien de connexion + $itemsRight = ''; if( ( $this->getData(['theme', 'menu', 'loginLink']) @@ -1692,146 +1830,6 @@ class common { echo ''; } - /** - * Cette fonction est appelée par showMenu - * Elle permet de générer le menu selon qu'il s'agisse du menu principal ou du petit menu - * @param $menu bool false pour le menu principal, true pour le petit menu - */ - private function formatMenu($extra = false) { - $items = ''; - $currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2); - foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) { - // Menu extra ou standard - - if ( - // Absence de la position extra, la page est toujours affichée à gauche. - ($this->getData(['page',$parentPageId,'extraPosition']) !== NULL || $extra === true) - && - $this->getData(['page',$parentPageId,'extraPosition']) !== $extra ) { - continue; - } - // Propriétés de l'item - $active = ($parentPageId === $currentPageId OR in_array($currentPageId, $childrenPageIds)) ? 'active ' : ''; - $targetBlank = $this->getData(['page', $parentPageId, 'targetBlank']) ? ' target="_blank"' : ''; - // Mise en page de l'item - $items .= '
  • '; - - if ( ( $this->getData(['page',$parentPageId,'disable']) === true - AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') - ) OR ( - $this->getData(['page',$parentPageId,'disable']) === true - AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - AND $this->getUser('group') < self::GROUP_MODERATOR - ) - ){ - $pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); - $items .= ''; - } else { - $pageUrl = ($this->getData(['locale', 'homePageId']) === $parentPageId) ? helper::baseUrl(false) : helper::baseUrl() . $parentPageId; - $items .= ''; - } - - switch ($this->getData(['page', $parentPageId, 'typeMenu'])) { - case '' : - $items .= $this->getData(['page', $parentPageId, 'shortTitle']); - break; - case 'text' : - $items .= $this->getData(['page', $parentPageId, 'shortTitle']); - break; - case 'icon' : - if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; - } else { - $items .= $this->getData(['page', $parentPageId, 'shortTitle']); - } - break; - case 'icontitle' : - if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $items .= ''.$this->getData(['page', $parentPageId, 'titlshortTitlee']).''; - } else { - $items .= $this->getData(['page', $parentPageId, 'shortTitle']); - } - break; - } - // Cas où les pages enfants enfant sont toutes masquées dans le menu - // ne pas afficher de symbole lorsqu'il n'y a rien à afficher - $totalChild = 0; - $disableChild = 0; - foreach($childrenPageIds as $childKey) { - $totalChild += 1; - } - if($childrenPageIds && $disableChild !== $totalChild && - $this->getdata(['page',$parentPageId,'hideMenuChildren']) === false) { - $items .= template::ico('down', 'left'); - } - // ------------------------------------------------ - $items .= ''; - if ($this->getdata(['page',$parentPageId,'hideMenuChildren']) === true || - empty($childrenPageIds)) { - continue; - } - $items .= ''; - - } - return($items); - } - /** * Générer un menu pour la barre latérale * Uniquement texte @@ -2324,7 +2322,7 @@ class core extends common { */ foreach ($fonts as $fontId) { if (!array_key_exists($fontId, $localFonts) ) { - $css .= '@import url("https://fonts.cdnfonts.com/css/' . $fontId . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $fontId . '");'; // Supprimer l'élément des fontes chargées en ligne unset($fonts[$fontId]); } @@ -2550,7 +2548,7 @@ class core extends common { */ foreach ($fonts as $fontId) { if (!array_key_exists($fontId, $localFonts) ) { - $css .= '@import url("https://fonts.cdnfonts.com/css/' . $fontId . '");'; + $css .= '@import url("http://fonts.cdnfonts.com/css/' . $fontId . '");'; // Supprimer l'élément des fontes chargées en ligne unset($fonts[$fontId]); } diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 35e79a5b..ac8171bc 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -714,7 +714,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) { // Option de dévoilement du mdp $this->setData(['config', 'connect', 'showPassword', true]); - + // Mise à jour $this->setData(['core', 'dataVersion', 11200]); } @@ -722,7 +722,7 @@ if ($this->getData(['core', 'dataVersion']) < 11200) { // Version 11.2.02 if ($this->getData(['core', 'dataVersion']) < 11202) { - // Renommer les champs + // Renommer les champs $this->setData(['locale', 'cookies', 'mainLabel', $this->getData(['locale', 'cookies', 'cookiesZwiiText']) ]); $this->setData(['locale', 'cookies', 'gaLabel', $this->getData(['locale', 'cookies', 'cookiesGaText']) ]); $this->setData(['locale', 'cookies', 'titleLabel', $this->getData(['locale', 'cookies', 'cookiesTitleText']) ]); @@ -741,6 +741,55 @@ 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) { @@ -784,7 +833,7 @@ if ($this->getData(['core', 'dataVersion']) < 11300) { $this->setData(['theme', 'title', 'font', $fonts[ $this->getData (['theme', 'title', 'font' ]) ] ]); $this->setData(['admin', 'fontTitle', $fonts[ $this->getData (['admin', 'fontTitle' ]) ] ]); $this->setData(['admin', 'fontText', $fonts[$this->getData (['admin','fontText' ]) ] ]); - + unlink(self::DATA_DIR . 'admin.css'); unlink(self::DATA_DIR . 'theme.css'); @@ -795,11 +844,9 @@ if ($this->getData(['core', 'dataVersion']) < 11300) { // Version 12.0.00 if ($this->getData(['core', 'dataVersion']) < 12000) { - // Effacer le dossier - if (is_dir('core/module/addon')) { - $this->removeDir('core/module/addon'); - } + // Effacer le dossier + $this->removeDir('core/module/addon'); // Mise à jour $this->setData(['core', 'dataVersion', 12000]); -} +} diff --git a/core/layout/common.css b/core/layout/common.css index 451a10d0..16550540 100755 --- a/core/layout/common.css +++ b/core/layout/common.css @@ -1744,22 +1744,6 @@ 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{ diff --git a/core/module/config/config.php b/core/module/config/config.php index f274265d..526604a8 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -19,6 +19,7 @@ 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, @@ -383,6 +384,15 @@ 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/'; @@ -584,7 +594,7 @@ class config extends common { $this->generateFiles(); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Modifications enregistrées ' , 'state' => true @@ -616,7 +626,7 @@ class config extends common { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index' ]); } @@ -655,10 +665,8 @@ class config extends common { /** * Met à jour les données de site avec l'adresse transmise */ - public function updateBaseUrl () { + public function updateBaseUrl ($url) { // 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 @@ -666,8 +674,8 @@ class config extends common { $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) ; + $replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ; + $replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ; if ($c1 > 0 || $c2 > 0) { $success = true; @@ -677,8 +685,8 @@ class config extends common { 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) ; + $replace = str_replace( 'href="' . $url , 'href="'. '' , stripslashes($content),$c1) ; + $replace = str_replace( 'src="' . $url , 'src="'. '' , stripslashes($replace),$c2) ; if ($c1 > 0 || $c2 > 0) { $success = true; $this->setPage($childId, $replace, self::$i18n); @@ -688,8 +696,8 @@ class config extends common { } // 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); + $replace = $this->recursive_array_replace('href="' . $url , 'href="'. '', $content, $c1); + $replace = $this->recursive_array_replace('src="' . $url , 'src="'. '', $replace, $c2); if ($content !== $replace) { $this->setdata(['module',$replace]); $c3 += $c1 + $c2; @@ -718,7 +726,7 @@ class config extends common { file_put_contents(self::DATA_DIR . 'journal.log',$d); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Journal réinitialisé avec succès', 'state' => true @@ -726,7 +734,7 @@ class config extends common { } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Aucun journal à effacer', 'state' => false @@ -754,7 +762,7 @@ class config extends common { } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Aucun fichier journal à télécharger', 'state' => false @@ -791,7 +799,7 @@ class config extends common { } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Aucune liste noire à télécharger', 'state' => false @@ -808,7 +816,7 @@ class config extends common { $this->setData(['blacklist',[]]); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Liste noire réinitialisée avec succès', 'state' => true @@ -816,7 +824,7 @@ class config extends common { } else { // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Pas de liste à effacer', 'state' => false @@ -835,32 +843,37 @@ class config extends common { $this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' ); // Valeurs en sortie $this->addOutput([ - 'title' => 'Configuration', + 'title' => 'Configuration du site', 'view' => 'index', 'notification' => 'Copie terminée', 'state' => true ]); } - /** - * 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. + * Vider le dosser des sauvegardes automatisées */ - private function recursive_array_replace ($find, $replace, $array, &$count) { - if (!is_array($array)) { - return str_replace($find, $replace, $array, $count); + 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; + } } - - $newArray = []; - foreach ($array as $key => $value) { - $newArray[$key] = $this->recursive_array_replace($find, $replace, $value,$c); - $count += $c; - } - return $newArray; + // Valeurs en sortie + $this->addOutput([ + 'title' => 'Configuration du site', + 'view' => 'index', + 'notification' => 'Suppression terminée :
    ' . $success . ' fichiers effacé(s)
    ' . $fail . ' échec(s)', + 'state' => true + ]); } + + + } diff --git a/core/module/config/view/backup/backup.php b/core/module/config/view/backup/backup.php index 070ab2cd..25071a93 100644 --- a/core/module/config/view/backup/backup.php +++ b/core/module/config/view/backup/backup.php @@ -1,14 +1,13 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    'Sauvegarder', 'uniqueSubmission' => true diff --git a/core/module/config/view/index/index.js.php b/core/module/config/view/index/index.js.php index ee94b0e5..b50acb6d 100644 --- a/core/module/config/view/index/index.js.php +++ b/core/module/config/view/index/index.js.php @@ -10,7 +10,17 @@ * @link http://zwiicms.fr/ */ -$( document).ready(function() { +$(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")); + }); + }); // Positionnement inital des options //----------------------------------------------------------------------------------------------------- @@ -45,36 +55,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(); @@ -88,7 +98,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(); @@ -102,7 +112,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 { @@ -111,7 +121,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 { @@ -124,20 +134,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); } }); @@ -145,7 +155,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(); @@ -156,9 +166,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(); @@ -169,9 +179,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(); @@ -182,9 +192,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(); @@ -195,9 +205,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(); @@ -208,49 +218,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; } diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 3738b0e0..b7cb0008 100644 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -1,23 +1,22 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl(false), - 'ico' => 'home', - 'value' => 'Accueil' + 'value' => template::ico('home') ]); ?>
    -
    +
    'buttonHelp', 'href' => 'https://doc.zwiicms.fr/configuration-du-site', 'target' => '_blank', - 'ico' => 'help', - 'value' => 'Aide' + 'value' => template::ico('help'), + 'help' => 'Consulter l\'aide en ligne' ]); ?>
    -
    +
    diff --git a/core/module/config/view/restore/restore.php b/core/module/config/view/restore/restore.php index 22a63cc1..5e4ff26d 100644 --- a/core/module/config/view/restore/restore.php +++ b/core/module/config/view/restore/restore.php @@ -38,46 +38,4 @@
    -
    -
    -
    -

    Conversion après la restauration

    -
    -
    - 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.' - ]); ?> -
    -
    - 'Dossier du site actuel', - 'value' => helper::baseUrl(false,false), - 'readonly' => true - ]); ?> -
    -
    - helper::baseUrl() . 'config/updateBaseUrl', - 'class' => $buttonClass, - 'value' => 'convertir' - ]); ?> -
    -
    -
    -
    -
    diff --git a/core/module/config/view/setup/setup.php b/core/module/config/view/setup/setup.php index 97c603c0..20e7e1ff 100644 --- a/core/module/config/view/setup/setup.php +++ b/core/module/config/view/setup/setup.php @@ -118,26 +118,36 @@ ]); ?>
    -
    -
    +
    +
    helper::baseUrl() . 'config/backup', - 'value' => 'Sauvegarder', + 'value' => 'Sauvegarder les données du site', 'ico' => 'download-cloud' ]); ?>
    -
    +
    helper::baseUrl() . 'config/restore', - 'value' => 'Restaurer', + 'value' => 'Restaurer les données du site', 'ico' => 'upload-cloud' ]); ?>
    -
    +
    +
    +
    helper::baseUrl() . 'config/copyBackups', - 'value' => 'Copie sauvegardes auto', - 'ico' => 'download-cloud' + 'value' => 'Copier sauvegardes auto', + 'ico' => 'docs' + ]); ?> +
    +
    + helper::baseUrl() . 'config/delBackups', + 'value' => 'Vider dossier sauvegardes auto', + 'ico' => 'cancel', + 'class' => 'buttonRed' ]); ?>
    diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index e6a1fa82..abf02ab3 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -1,37 +1,36 @@
    -
    +
    getUrl(2); ?> getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?> 'buttonGrey', 'href' => $href, - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('home') ]); ?>
    -
    +
    'https://doc.zwiicms.fr/edition-des-pages', 'target' => '_blank', - 'ico' => 'help', - 'value' => 'Aide', - 'class' => 'buttonHelp' + 'value' => template::ico('help'), + 'class' => 'buttonHelp', + 'help' => 'Consulter l\'aide en ligne' ]); ?>
    -
    - helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'], - 'value' => 'Dupliquer', - 'ico' => 'clone' - ]); ?> -
    -
    +
    'buttonRed', 'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'], - 'value' => 'Supprimer', - 'ico' => 'cancel' + 'value' => template::ico('cancel'), + 'help' => 'Effacer la page' + ]); ?> +
    +
    + helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'], + 'value' => template::ico('clone'), + 'help' => 'Dupliquer la page' ]); ?>
    diff --git a/core/module/theme/view/fontAdd/fontAdd.php b/core/module/theme/view/fontAdd/fontAdd.php index 23028e9f..8ee65489 100644 --- a/core/module/theme/view/fontAdd/fontAdd.php +++ b/core/module/theme/view/fontAdd/fontAdd.php @@ -21,13 +21,13 @@

    Identité de la fonte

    - cdnFonts', [ + 'Police utilisée en ligne, se connecter sur cdnFonts pour récupérer les informations nécessaires.' ]); ?>
    'Sélectionnez un fichier de fonte au format WOFF.' + 'help' => '
    Sélectionnez un fichier de fonte au format WOFF.' ]); ?>
    diff --git a/core/module/translate/view/copy/copy.php b/core/module/translate/view/copy/copy.php index 4cb9e1fd..890128b8 100644 --- a/core/module/translate/view/copy/copy.php +++ b/core/module/translate/view/copy/copy.php @@ -1,15 +1,16 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'translate', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    - +
    + 'Copier' + ]); ?>
    diff --git a/core/module/translate/view/index/index.php b/core/module/translate/view/index/index.php index 69821aaa..fabc4e6a 100644 --- a/core/module/translate/view/index/index.php +++ b/core/module/translate/view/index/index.php @@ -1,28 +1,27 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl(), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    'https://doc.zwiicms.fr/prise-en-charge-des-langues-etrangeres', 'target' => '_blank', - 'ico' => 'help', - 'value' => 'Aide', - 'class' => 'buttonHelp' + 'value' => template::ico('help'), + 'class' => 'buttonHelp', + 'help' => 'Consulter l\'aide en ligne' ]); ?>
    -
    +
    helper::baseUrl() . 'translate/copy', - 'value' => 'Utilitaire de copie', - 'ico' => 'cog-alt', - 'disabled' => $module::$siteTranslate + 'value' => template::ico('docs'), + 'disabled' => $module::$siteTranslate, + 'help' => 'Copie de sites inter-langues' ]); ?>
    diff --git a/core/module/user/user.php b/core/module/user/user.php index 82a22882..dab81c76 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -346,12 +346,14 @@ 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') + 'value' => template::ico('pencil'), + 'help' => 'Editer ' . $userId ]), template::button('userDelete' . $userId, [ 'class' => 'userDelete buttonRed', 'href' => helper::baseUrl() . 'user/delete/' . $userId. '/' . $_SESSION['csrf'], - 'value' => template::ico('cancel') + 'value' => template::ico('cancel'), + 'help' => 'Supprimer ' . $userId ]) ]; } diff --git a/core/module/user/view/add/add.php b/core/module/user/view/add/add.php index d84c8ed1..bd806a49 100644 --- a/core/module/user/view/add/add.php +++ b/core/module/user/view/add/add.php @@ -1,14 +1,13 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'user', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    diff --git a/core/module/user/view/edit/edit.php b/core/module/user/view/edit/edit.php index aa739b33..30a91c97 100644 --- a/core/module/user/view/edit/edit.php +++ b/core/module/user/view/edit/edit.php @@ -1,23 +1,21 @@
    -
    - getUser('group') === self::GROUP_ADMIN): ?> +
    + getUser('group') === self::GROUP_ADMIN): ?> 'buttonGrey', 'href' => helper::baseUrl() . 'user', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?> 'buttonGrey', 'href' => helper::baseUrl(false), - 'ico' => 'home', - 'value' => 'Accueil' + 'value' => template::ico('home') ]); ?>
    -
    +
    diff --git a/core/module/user/view/forgot/forgot.php b/core/module/user/view/forgot/forgot.php index 29dc17e8..3e163deb 100644 --- a/core/module/user/view/forgot/forgot.php +++ b/core/module/user/view/forgot/forgot.php @@ -3,11 +3,10 @@ 'label' => 'Identifiant' ]); ?>
    -
    +
    helper::baseUrl() . 'user/login/' . $this->getUrl(2), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    diff --git a/core/module/user/view/import/import.php b/core/module/user/view/import/import.php index 81e6a929..e6d1ee43 100644 --- a/core/module/user/view/import/import.php +++ b/core/module/user/view/import/import.php @@ -1,23 +1,22 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'user', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    'https://doc.zwiicms.fr/importation-d-une-liste-d-utilisateurs', 'target' => '_blank', - 'ico' => 'help', - 'value' => 'Aide', - 'class' => 'buttonHelp' + 'value' => template::ico('help'), + 'class' => 'buttonHelp', + 'help' => 'Consulter l\'aide en ligne' ]); ?>
    -
    +
    'Importer' ]); ?> @@ -28,7 +27,7 @@

    Importation de fichier plat CSV

    -
    +
    'Liste d\'utilisateurs :' ]); ?> diff --git a/core/module/user/view/index/index.php b/core/module/user/view/index/index.php index 98fc2388..1a89a67e 100644 --- a/core/module/user/view/index/index.php +++ b/core/module/user/view/index/index.php @@ -1,33 +1,32 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl(false), - 'ico' => 'home', - 'value' => 'Accueil' + 'value' => template::ico('home') ]); ?>
    -
    +
    'https://doc.zwiicms.fr/gestion-des-utilisateurs', 'target' => '_blank', - 'ico' => 'help', - 'value' => 'Aide', - 'class' => 'buttonHelp' + 'value' => template::ico('help'), + 'class' => 'buttonHelp', + 'help' => 'Consulter l\'aide en ligne' ]); ?>
    -
    +
    helper::baseUrl() . 'user/import', - 'ico' => 'plus', - 'value' => 'Importation' + 'value' => template::ico('upload') , + 'help' => 'Importer des utilisateurs en masse' ]); ?>
    -
    +
    helper::baseUrl() . 'user/add', - 'ico' => 'plus', - 'value' => 'Utilisateur' + 'value' => template::ico('plus'), + 'help' => 'Ajouter un utilisateur' ]); ?>
    diff --git a/core/vendor/tinymce/init.js b/core/vendor/tinymce/init.js index 6daa4b89..b4d3bad3 100755 --- a/core/vendor/tinymce/init.js +++ b/core/vendor/tinymce/init.js @@ -114,7 +114,7 @@ tinymce.init({ // Active l'onglet avancé lors de l'ajout d'une image image_advtab: true, // Urls absolues - relative_urls: false, + relative_urls: true, // 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: false, + relative_urls: true, // Url de base document_base_url: baseUrl, // Contenu du bouton formats diff --git a/module/blog/blog.php b/module/blog/blog.php index 18964165..b25c4b0f 100644 --- a/module/blog/blog.php +++ b/module/blog/blog.php @@ -15,7 +15,7 @@ class blog extends common { - const VERSION = '5.2'; + const VERSION = '6.0'; const REALNAME = 'Blog'; const DELETE = true; const UPDATE = '0.0'; @@ -32,6 +32,7 @@ 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, @@ -100,6 +101,9 @@ class blog extends common { self::EDIT_OWNER => 'Propriétaire' ]; + // Nombre d'articles dans la page de config: + public static $itemsperPage = 8; + public static $users = []; @@ -398,103 +402,116 @@ 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[] = [ + '' . + $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . + '', + $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('blogConfigShowFeeds',helper::FILTER_BOOLEAN), - 'feedsLabel' => $this->getInput('blogConfigFeedslabel',helper::FILTER_STRING_SHORT), - 'itemsperPage' => $this->getInput('blogConfigItemsperPage', helper::FILTER_INT,true), + 'feeds' => $this->getInput('blogOptionShowFeeds',helper::FILTER_BOOLEAN), + 'feedsLabel' => $this->getInput('blogOptionFeedslabel',helper::FILTER_STRING_SHORT), + 'itemsperPage' => $this->getInput('blogOptionItemsperPage', helper::FILTER_INT,true), 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']) ]]); // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option', '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[] = [ - '' . - $this->getData(['module', $this->getUrl(0), 'posts', $articleIds[$i], 'title']) . - '', - $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' => 'Configuration du module', - 'view' => 'config' + 'title' => 'Options de configuration', + 'view' => 'option' ]); } } + /** * Suppression */ diff --git a/module/blog/changes.md b/module/blog/changes.md new file mode 100644 index 00000000..6a7d7be0 --- /dev/null +++ b/module/blog/changes.md @@ -0,0 +1,2 @@ +# version 6 + - mise à la norme avec le module news : le formulaire est sorti de l'écran principal \ No newline at end of file diff --git a/module/blog/view/add/add.php b/module/blog/view/add/add.php index 7f50b45e..22e51de4 100644 --- a/module/blog/view/add/add.php +++ b/module/blog/view/add/add.php @@ -1,17 +1,16 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    true, - 'value' => 'Enregistrer en brouillon' + 'value' => 'Brouillon' ]); ?> true diff --git a/module/blog/view/config/config.php b/module/blog/view/config/config.php index 736151c9..df44db80 100644 --- a/module/blog/view/config/config.php +++ b/module/blog/view/config/config.php @@ -1,51 +1,27 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'posts', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    + helper::baseUrl() . $this->getUrl(0) . '/option', + 'value' => template::ico('sliders'), + 'help' => 'Options de configuration' + ]); ?> + +
    +
    helper::baseUrl() . $this->getUrl(0) . '/add', - 'ico' => 'plus', - 'value' => 'Article' + 'value' => template::ico('plus'), + 'help' => 'Rédiger un article' ]); ?>
    -
    - -
    -
    -
    -
    -
    -

    Paramètres du module

    -
    -
    - $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), - ]); ?> -
    -
    - 'Texte de l\'étiquette', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) - ]); ?> -
    -
    -
    -
    - 'Articles par page', - 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) - ]); ?> -
    -
    -
    -
    diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 404467b8..b60da969 100644 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -1,17 +1,16 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    true, - 'value' => 'Enregistrer en brouillon' + 'value' => 'Brouillon' ]); ?> true diff --git a/module/blog/view/index/index.php b/module/blog/view/index/index.php index 5ecfb53a..39b537eb 100644 --- a/module/blog/view/index/index.php +++ b/module/blog/view/index/index.php @@ -41,7 +41,7 @@ : utf8_encode(strftime('%d %B %Y', $article['publishedOn'])); ?>

    -

    '), 0, 400); ?>... + ... Lire la suite

    diff --git a/module/blog/view/option/option.css b/module/blog/view/option/option.css new file mode 100644 index 00000000..52709ea6 --- /dev/null +++ b/module/blog/view/option/option.css @@ -0,0 +1,18 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @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 +*/ \ No newline at end of file diff --git a/module/blog/view/option/option.php b/module/blog/view/option/option.php new file mode 100644 index 00000000..721eb6a7 --- /dev/null +++ b/module/blog/view/option/option.php @@ -0,0 +1,46 @@ + +
    +
    + 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'value' => template::ico('left') + ]); ?> +
    +
    + +
    +
    +
    +
    +
    +

    Paramètres du module

    +
    +
    + $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), + ]); ?> +
    +
    + 'Texte de l\'étiquette', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) + ]); ?> +
    +
    +
    +
    + 'Articles par page', + 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) + ]); ?> +
    +
    +
    +
    +
    + +
    Version n° + +
    + diff --git a/module/form/changes.md b/module/form/changes.md new file mode 100644 index 00000000..c8442301 --- /dev/null +++ b/module/form/changes.md @@ -0,0 +1,3 @@ +# Version 3 + - Déplacement des options de formulaires + - Gabarit du formulaire sur la page \ No newline at end of file diff --git a/module/form/form.php b/module/form/form.php index 627ad4da..496272ba 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -16,7 +16,7 @@ class form extends common { - const VERSION = '2.11'; + const VERSION = '3.0'; const REALNAME = 'Formulaire'; const DELETE = true; const UPDATE = '0.0'; @@ -24,6 +24,7 @@ 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, @@ -38,6 +39,9 @@ class form extends common { public static $pagination; + // Nombre d'articles dans la page de config: + public static $itemperPage = 20; + // Objets const TYPE_MAIL = 'mail'; @@ -75,38 +79,35 @@ 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', []]); @@ -148,6 +149,75 @@ 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 */ @@ -155,7 +225,7 @@ class form extends common { $data = $this->getData(['module', $this->getUrl(0), 'data']); if($data) { // Pagination - $pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE); + $pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPages); // Liste des pages self::$pages = $pagination['pages']; // Inverse l'ordre du tableau diff --git a/module/form/view/config/config.js.php b/module/form/view/config/config.js.php index 1522ee3d..2d64a2aa 100644 --- a/module/form/view/config/config.js.php +++ b/module/form/view/config/config.js.php @@ -54,6 +54,15 @@ 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 */ @@ -76,14 +85,6 @@ 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 @@ -96,6 +97,12 @@ $("#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, @@ -143,73 +150,3 @@ $("#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(); - } -}); diff --git a/module/form/view/config/config.php b/module/form/view/config/config.php index 6631a20a..49050a8d 100644 --- a/module/form/view/config/config.php +++ b/module/form/view/config/config.php @@ -49,140 +49,48 @@
    -
    -
    - 'buttonGrey', - 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), - 'ico' => 'left', - 'value' => 'Retour' - ]); ?> -
    -
    - helper::baseUrl() . $this->getUrl(0) . '/data', - 'value' => 'Gérer les données' - ]); ?> -
    -
    +
    +
    + 'buttonGrey', + 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), + 'value' => template::ico('left') + ]); ?> +
    +
    + helper::baseUrl() . $this->getUrl(0) . '/data', + 'value' => template::ico('code'), + 'help' => 'Voir et exporter les données du formulaire' + ]); ?> +
    +
    + helper::baseUrl() . $this->getUrl(0) . '/option', + 'value' => template::ico('sliders'), + 'help' => 'Options de configuration' + ]); ?> +
    +
    +
    +
    +

    Liste des champs

    +
    +
    +
    -
    -
    -

    Configuration

    - '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']) - ]); ?> - (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.' - ]); ?> -
    -
    -
    - 'Laissez vide afin de conserver le texte par défaut.', - 'label' => 'Sujet du mail', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject']) - ]); ?> -
    -
    - -
    -
    - 'Aux groupes à partir de', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']), - 'help' => 'Editeurs = éditeurs + administrateurs
    Membres = membres + éditeurs + administrateurs' - ]); ?> -
    -
    - 'A un membre', - 'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers) - ]); ?> -
    -
    - 'A une adresse email', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']), - 'help' => 'Un email ou une liste de diffusion' - ]); ?> -
    -
    -
    -
    - (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.' - ]); ?> -
    -
    -
    -
    -
    - 'Sélectionner le type de signature', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature']) - ]); ?> -
    -
    - 'Sélectionnez le logo du site', - 'label' => 'Logo', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl']) - ]); ?> -
    -
    - 'Sélectionner la largeur du logo', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth']) - ]); ?> -
    -
    -
    -
    - (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) - ]); ?> -
    -
    - 'displayNone', - 'label' => 'Sélectionner une page du site :', - 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) - ]); ?> -
    -
    - $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) - ]); ?> -
    -
    -

    Liste des champs

    -
    - -
    -
    -
    -
    - template::ico('plus') - ]); ?> -
    -
    -
    +
    + template::ico('plus'), + 'class' => 'buttonGreen' + ]); ?>
    +
    +
    Version n° diff --git a/module/form/view/data/data.php b/module/form/view/data/data.php index d0a22868..147548a7 100644 --- a/module/form/view/data/data.php +++ b/module/form/view/data/data.php @@ -1,25 +1,24 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    'formDataDeleteAll buttonRed', 'href' => helper::baseUrl() . $this->getUrl(0) . '/deleteall' . '/' . $_SESSION['csrf'], - 'ico' => 'cancel', - 'value' => 'Tout effacer' + 'value' => template::ico('cancel'), + 'help' => 'Effacer toutes les données' ]); ?>
    -
    +
    helper::baseUrl() . $this->getUrl(0) . '/export2csv' . '/' . $_SESSION['csrf'], - 'ico' => 'download', - 'value' => 'Export CSV' + 'value' => template::ico('download'), + 'help' => 'Exporter toutes les données' ]); ?>
    diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 6eba5cc9..c2251225 100644 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -1,67 +1,75 @@ getData(['module', $this->getUrl(0), 'input'])): ?> - - getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - $key) { - $values[$value] = trim($value); - } - ?> - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'] - ]); ?> - - 'formInput_' . $index, - 'label' => $input['name'], - 'vendor' => 'flatpickr' - ]); ?> - - - -

    - -
    -

    +
    +
    + + getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + $key) { + $values[$value] = trim($value); + } + ?> + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'] + ]); ?> + + 'formInput_' . $index, + 'label' => $input['name'], + 'vendor' => 'flatpickr' + ]); ?> + + + +

    + +
    +

    + + + getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?> +
    +
    + $this->getData(['config','connect', 'captchaStrong']), + 'type' => $this->getData(['config','connect', 'captchaType']) + ]); ?> +
    +
    - - getData(['module', $this->getUrl(0), 'config', 'captcha'])): ?>
    -
    - $this->getData(['config','connect', 'captchaStrong']), - 'type' => $this->getData(['config','connect', 'captchaType']) +
    + $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer', + 'ico' => '' ]); ?>
    - -
    -
    - $this->getData(['module', $this->getUrl(0), 'config', 'button']) ? $this->getData(['module', $this->getUrl(0), 'config', 'button']) : 'Envoyer', - 'ico' => '' - ]); ?> -
    - +
    +
    + \ No newline at end of file diff --git a/module/form/view/option/option.css b/module/form/view/option/option.css new file mode 100644 index 00000000..52709ea6 --- /dev/null +++ b/module/form/view/option/option.css @@ -0,0 +1,18 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @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 +*/ \ No newline at end of file diff --git a/module/form/view/option/option.js.php b/module/form/view/option/option.js.php new file mode 100644 index 00000000..2148e0c6 --- /dev/null +++ b/module/form/view/option/option.js.php @@ -0,0 +1,72 @@ + + + +/* +* 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(); + } +}); \ No newline at end of file diff --git a/module/form/view/option/option.php b/module/form/view/option/option.php new file mode 100644 index 00000000..fe479465 --- /dev/null +++ b/module/form/view/option/option.php @@ -0,0 +1,157 @@ + +
    +
    + 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'value' => template::ico('left') + ]); ?> +
    +
    + +
    +
    +
    +
    +
    +

    Validation du formulaire

    +
    +
    + $this->getData(['module', $this->getUrl(0), 'config', 'captcha']) + ]); ?> +
    +
    + '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']) + ]); ?> +
    +
    +
    +
    + (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) + ]); ?> +
    +
    + 'displayNone', + 'label' => 'Page du site :', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) + ]); ?> +
    +
    +
    +
    +
    +
    +
    +
    +

    Gabarit

    +
    +
    + 'Alignement du formulaire', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'align']) + ]); ?> +
    +
    +
    +
    + 'Décalage à gauche', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'offset']) + ]); ?> +
    +
    + 'Largeur', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'width']) + ]); ?> +
    +
    +
    +
    +
    +
    +
    +
    +

    Courriel

    + (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.' + ]); ?> +
    +
    +
    + 'Laissez vide afin de conserver le texte par défaut.', + 'label' => 'Sujet du mail', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject']) + ]); ?> +
    +
    + +
    +
    + 'Aux groupes à partir de', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']), + 'help' => 'Editeurs = éditeurs + administrateurs
    Membres = membres + éditeurs + administrateurs' + ]); ?> +
    +
    + 'A un membre', + 'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers) + ]); ?> +
    +
    + 'A une adresse email', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']), + 'help' => 'Un email ou une liste de diffusion' + ]); ?> +
    +
    +
    +
    + 'Sélectionner le type de signature', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature']) + ]); ?> +
    +
    + 'Sélectionnez le logo du site', + 'label' => 'Logo', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl']) + ]); ?> +
    +
    + 'Sélectionner la largeur du logo', + 'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth']) + ]); ?> +
    +
    +
    +
    + (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.' + ]); ?> +
    +
    +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/module/gallery/changes.md b/module/gallery/changes.md new file mode 100644 index 00000000..5eaca775 --- /dev/null +++ b/module/gallery/changes.md @@ -0,0 +1,2 @@ +# version 3.4 + - Changement de nom du bouton Thème devient mise en page \ No newline at end of file diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 37a8a0df..e2d99e61 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -17,7 +17,7 @@ class gallery extends common { - const VERSION = '3.3'; + const VERSION = '3.4'; const REALNAME = 'Galerie'; const DELETE = true; const UPDATE = '0.0'; @@ -346,12 +346,14 @@ 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') + 'value' => template::ico('pencil'), + 'help' => 'Configuration de la galerie ' ]), template::button('galleryConfigDelete' . $galleryId, [ 'class' => 'galleryConfigDelete buttonRed', 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId . '/' . $_SESSION['csrf'], - 'value' => template::ico('cancel') + 'value' => template::ico('cancel'), + 'help' => 'Supprimer cette galerie' ]) ]; // Tableau des id des galleries pour le drag and drop diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index 91400a98..5f1fc67f 100644 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -1,17 +1,17 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'], - 'value' => template::ico('brush','right') . 'Thème' + 'value' => template::ico('sliders'), + 'help' => 'Options de configuration' ]); ?>
    diff --git a/module/gallery/view/edit/edit.php b/module/gallery/view/edit/edit.php index df001bf7..240c85fa 100644 --- a/module/gallery/view/edit/edit.php +++ b/module/gallery/view/edit/edit.php @@ -1,14 +1,13 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    diff --git a/module/gallery/view/gallery/gallery.php b/module/gallery/view/gallery/gallery.php index 9e617583..235aac0d 100644 --- a/module/gallery/view/gallery/gallery.php +++ b/module/gallery/view/gallery/gallery.php @@ -1,10 +1,9 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    diff --git a/module/gallery/view/theme/theme.php b/module/gallery/view/theme/theme.php index 8da3639e..a66c589d 100644 --- a/module/gallery/view/theme/theme.php +++ b/module/gallery/view/theme/theme.php @@ -1,15 +1,14 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    diff --git a/module/news/changes.md b/module/news/changes.md new file mode 100644 index 00000000..ea0c25f1 --- /dev/null +++ b/module/news/changes.md @@ -0,0 +1,6 @@ +# 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 \ No newline at end of file diff --git a/module/news/news.php b/module/news/news.php index c2dbdabd..0f7a2aac 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -15,7 +15,7 @@ class news extends common { - const VERSION = '3.7'; + const VERSION = '4.0'; const REALNAME = 'News'; const DELETE = true; const UPDATE = '0.0'; @@ -23,7 +23,8 @@ class news extends common { public static $actions = [ 'add' => self::GROUP_MODERATOR, - 'config' => self::GROUP_MODERATOR, + 'config' => self::GROUP_MODERATOR, // Edition des news + 'option' => self::GROUP_MODERATOR, // paramétrage des news 'delete' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR, 'index' => self::GROUP_VISITOR, @@ -88,7 +89,8 @@ 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 @@ -189,10 +191,65 @@ 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) . ';'; @@ -217,69 +274,26 @@ class news extends common { ]]); $this->setData(['module', $this->getUrl(0), 'config',[ - '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), + '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), 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']) ]]); // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/option', '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' => 'Configuration du module', - 'view' => 'config', + 'title' => 'Options de configuration', + 'view' => 'option', 'vendor' => [ 'tinycolorpicker' ] @@ -435,8 +449,7 @@ class news extends common { $newsIds[] = $newsId; } } - // Pagination - //$pagination = helper::pagination($newsIds, $this->getUrl(),$this->getData(['config','itemsperPage'])); + // Pagination selon le layout $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']); diff --git a/module/news/view/add/add.php b/module/news/view/add/add.php index b4427b96..59e3b9da 100644 --- a/module/news/view/add/add.php +++ b/module/news/view/add/add.php @@ -1,17 +1,16 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    true, - 'value' => 'Enregistrer en brouillon' + 'value' => 'Brouillon' ]); ?> true diff --git a/module/news/view/config/config.php b/module/news/view/config/config.php index 873c9a66..5527854a 100644 --- a/module/news/view/config/config.php +++ b/module/news/view/config/config.php @@ -1,102 +1,28 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),'posts', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    + helper::baseUrl() . $this->getUrl(0) . '/option', + 'value' => template::ico('sliders'), + 'help' => 'Options de configuration' + ]); ?> +
    +
    helper::baseUrl() . $this->getUrl(0) . '/add', - 'ico' => 'plus', - 'value' => 'News' + 'value' => template::ico('plus'), + 'help' => 'Rédiger une news' ]); ?>
    -
    - -
    -
    -
    -
    -
    -

    Paramètres du module

    -
    -
    - $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), - 'help' => 'Flux limité aux articles de la première page.' - ]); ?> -
    -
    - 'Etiquette RSS', - 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) - ]); ?> -
    -
    -
    -
    - 'Nombre de colonnes', - 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']) - ]); ?> -
    -
    - 'Articles par page', - 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) - ]); ?> -
    -
    - 'Abrégé de l\'article', - 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height']) - ]); ?> -
    -
    -
    -
    -
    -
    -
    -
    -

    Thème du module

    -
    -
    - 'Bordure', - 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle']) - ]); ?> -
    -
    - 'Epaisseur', - 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth']) - ]); ?> -
    -
    - 'colorPicker', - 'help' => 'Couleur visible en l\'absence d\'une image.
    Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Couleur de la bordure', - 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor']) - ]); ?> -
    -
    - 'colorPicker', - 'help' => 'Couleur visible en l\'absence d\'une image.
    Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Couleur du fond', - 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor']) - ]); ?> -
    -
    -
    -
    + diff --git a/module/news/view/edit/edit.php b/module/news/view/edit/edit.php index 927be92d..2cc71bc0 100644 --- a/module/news/view/edit/edit.php +++ b/module/news/view/edit/edit.php @@ -4,14 +4,13 @@ 'buttonGrey', 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    true, - 'value' => 'Enregistrer en brouillon' + 'value' => 'Brouillon' ]); ?> true diff --git a/module/news/view/option/option.css b/module/news/view/option/option.css new file mode 100644 index 00000000..52709ea6 --- /dev/null +++ b/module/news/view/option/option.css @@ -0,0 +1,18 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @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 +*/ \ No newline at end of file diff --git a/module/news/view/option/option.php b/module/news/view/option/option.php new file mode 100644 index 00000000..463439ec --- /dev/null +++ b/module/news/view/option/option.php @@ -0,0 +1,95 @@ + +
    +
    + 'buttonGrey', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'value' => template::ico('left') + ]); ?> +
    +
    + +
    +
    +
    +
    +
    +

    Paramètres du module

    +
    +
    + $this->getData(['module', $this->getUrl(0), 'config', 'feeds']), + 'help' => 'Flux limité aux articles de la première page.' + ]); ?> +
    +
    + 'Etiquette RSS', + 'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel']) + ]); ?> +
    +
    +
    +
    + 'Nombre de colonnes', + 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperCol']) + ]); ?> +
    +
    + 'Articles par page', + 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage']) + ]); ?> +
    +
    + 'Abrégé de l\'article', + 'selected' => $this->getData(['module', $this->getUrl(0),'config', 'height']) + ]); ?> +
    +
    +
    +
    +
    +
    +
    +
    +

    Thème du module

    +
    +
    + 'Bordure', + 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderStyle']) + ]); ?> +
    +
    + 'Epaisseur', + 'selected' => $this->getData(['module', $this->getUrl(0),'theme', 'borderWidth']) + ]); ?> +
    +
    + 'colorPicker', + 'help' => 'Couleur visible en l\'absence d\'une image.
    Le curseur horizontal règle le niveau de transparence.', + 'label' => 'Couleur de la bordure', + 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'borderColor']) + ]); ?> +
    +
    + 'colorPicker', + 'help' => 'Couleur visible en l\'absence d\'une image.
    Le curseur horizontal règle le niveau de transparence.', + 'label' => 'Couleur du fond', + 'value' => $this->getData(['module', $this->getUrl(0),'theme', 'backgroundColor']) + ]); ?> +
    +
    +
    +
    +
    + +
    Version n° + +
    \ No newline at end of file diff --git a/module/redirection/view/config/config.php b/module/redirection/view/config/config.php index ff421b39..b786dbf1 100644 --- a/module/redirection/view/config/config.php +++ b/module/redirection/view/config/config.php @@ -1,14 +1,13 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +
    diff --git a/module/search/view/config/config.php b/module/search/view/config/config.php index 68b6ab8f..ac8bcfc5 100644 --- a/module/search/view/config/config.php +++ b/module/search/view/config/config.php @@ -1,14 +1,13 @@
    -
    +
    'buttonGrey', 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), - 'ico' => 'left', - 'value' => 'Retour' + 'value' => template::ico('left') ]); ?>
    -
    +