From 0779284c5f8516e673086e9e50e28116e989973f Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 4 Nov 2021 13:55:23 +0100 Subject: [PATCH] Titres courts --- CHANGES.md | 2 + core/core.php | 59 +++++++++---------- core/include/update.inc.php | 11 ++++ core/module/install/ressource/defaultdata.php | 27 +++++++-- core/module/page/page.php | 4 ++ core/module/page/view/edit/edit.php | 18 +++--- 6 files changed, 79 insertions(+), 42 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 205247e1..b5bab638 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,7 +3,9 @@ ## Version 11.2.00 - Modifications : - Disposition des options de configuration du site. + - Pages : il est désormais possible de donner un nom de page court qui sera utilisé dans le menu du site, dans les abrres latérales et dans les sélecteurs de page (éditeur / lien). En revanche le nom de la page affiché en haut de celle-ci est inchangé. Dans la plupart des cas le titre court sera identique au titre. - Les écrans d'aide renvoient vers le site doc.zwiicms.fr + - Mise en évidence du statut des pages dans la liste de la barre d'administration. Rouge italique : page orpheline ; Orange gras page inactive. ## Version 11.1.01 - Corrections : diff --git a/core/core.php b/core/core.php index 56ba8b8a..08805477 100644 --- a/core/core.php +++ b/core/core.php @@ -800,23 +800,23 @@ class common { if ($this->getData(['page', $parentId, 'block']) !== 'bar' ) { // Boucler sur les enfants et récupérer le tableau children avec la liste des enfants foreach($childIds as $childId) { - $children [] = [ 'title' => ' » '. html_entity_decode($this->getData(['page', $childId, 'title']), ENT_QUOTES) , + $children [] = [ 'title' => ' » '. html_entity_decode($this->getData(['page', $childId, 'shortTitle']), ENT_QUOTES) , 'value'=> $rewrite.$childId ]; } // Traitement if (empty($childIds)) { // Pas d'enfant, uniquement l'entrée du parent - $parents [] = ['title' => html_entity_decode($this->getData(['page', $parentId, 'title']), ENT_QUOTES) , + $parents [] = ['title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES) , 'value'=> $rewrite.$parentId ]; } else { // Des enfants, on ajoute la page parent en premier - array_unshift ($children , ['title' => html_entity_decode($this->getData(['page', $parentId, 'title']), ENT_QUOTES) , + array_unshift ($children , ['title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES) , 'value'=> $rewrite.$parentId ]); // puis on ajoute les enfants au parent - $parents [] = ['title' => html_entity_decode($this->getData(['page', $parentId, 'title']), ENT_QUOTES) , + $parents [] = ['title' => html_entity_decode($this->getData(['page', $parentId, 'shortTitle']), ENT_QUOTES) , 'value'=> $rewrite.$parentId , 'menu' => $children ]; @@ -1584,24 +1584,24 @@ class common { switch ($this->getData(['page', $parentPageId, 'typeMenu'])) { case '' : - $itemsLeft .= $this->getData(['page', $parentPageId, 'title']); + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); break; case 'text' : - $itemsLeft .= $this->getData(['page', $parentPageId, 'title']); + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); break; case 'icon' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; } else { - $itemsLeft .= $this->getData(['page', $parentPageId, 'title']); + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); } break; case 'icontitle' : if ($this->getData(['page', $parentPageId, 'iconUrl']) != "") { - $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'titlshortTitlee']).''; } else { - $itemsLeft .= $this->getData(['page', $parentPageId, 'title']); + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); } break; } @@ -1644,32 +1644,32 @@ class common { switch ($this->getData(['page', $childKey, 'typeMenu'])) { case '' : - $itemsLeft .= $this->getData(['page', $childKey, 'title']); + $itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']); break; case 'text' : - $itemsLeft .= $this->getData(['page', $childKey, 'title']); + $itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']); break; case 'icon' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; } else { - $itemsLeft .= $this->getData(['page', $parentPageId, 'title']); + $itemsLeft .= $this->getData(['page', $parentPageId, 'shortTitle']); } break; case 'icontitle' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'title']).''; + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; } else { - $itemsLeft .= $this->getData(['page', $childKey, 'title']); + $itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']); } break; case 'icontext' : if ($this->getData(['page', $childKey, 'iconUrl']) != "") { - $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'title']).''; - $itemsLeft .= $this->getData(['page', $childKey, 'title']); + $itemsLeft .= ''.$this->getData(['page', $parentPageId, 'shortTitle']).''; + $itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']); } else { - $itemsLeft .= $this->getData(['page', $childKey, 'title']); + $itemsLeft .= $this->getData(['page', $childKey, 'shortTitle']); } break; } @@ -1757,7 +1757,7 @@ class common { } else { $items .= ''; } - $items .= $this->getData(['page', $parentPageId, 'title']); + $items .= $this->getData(['page', $parentPageId, 'shortTitle']); $items .= ''; } $itemsChildren = ''; @@ -1780,7 +1780,7 @@ class common { $itemsChildren .= ''; } - $itemsChildren .= $this->getData(['page', $childKey, 'title']); + $itemsChildren .= $this->getData(['page', $childKey, 'shortTitle']); $itemsChildren .= ''; } // Concatène les items enfants @@ -1844,7 +1844,6 @@ class common { $notificationClass = 'notificationSuccess'; } if(common::$inputNotices) { - var_dump ( common::$inputNotices ); $notification = 'Impossible de soumettre le formulaire, car il contient des erreurs'; $notificationClass = 'notificationError'; } @@ -1898,22 +1897,22 @@ class common { helper::baseUrl() . $parentPageId . '"' . ($parentPageId === $currentPageId ? ' selected' : false) . - 'class="' . + ' class="' . ($this->getData(['page', $parentPageId, 'disable']) === true ? 'pageInactive' : '') . ($this->getData(['page', $parentPageId, 'position']) === 0 ? ' pageHidden' : '') . '">' . - $this->getData(['page', $parentPageId, 'title']) . + $this->getData(['page', $parentPageId, 'shortTitle']) . ''; foreach($childrenPageIds as $childKey) { $leftItems .= ''; } } @@ -1922,9 +1921,9 @@ class common { // Afficher les barres $leftItems .= ''; foreach($this->getHierarchy(null, false,true) as $parentPageId => $childrenPageIds) { - $leftItems .= ''; + $leftItems .= ''; foreach($childrenPageIds as $childKey) { - $leftItems .= ''; + $leftItems .= ''; } } $leftItems .= ''; diff --git a/core/include/update.inc.php b/core/include/update.inc.php index dd14a012..de14e258 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -681,6 +681,17 @@ if ($this->getData(['core', 'dataVersion']) < 11200) { $this->setData(['config', 'connect', 'autoDisconnect', $this->getData(['config', 'autoDisconnect'])]); $this->deleteData(['config', 'autoDisconnect']); + // Ajout de la variable shortTitle basée sur Title + foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) { + $pageList [] = $parentKey; + foreach ($parentValue as $childKey) { + $pageList [] = $childKey; + } + } + foreach ($pageList as $parentKey => $parent) { + $this->setData(['page', $parent, 'shortTitle', $this->getData(['page', $parent, 'title']) ]); + } + // Mise à jour $this->setData(['core', 'dataVersion', 11200]); } diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 3bad20ea..6bba5c74 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -92,6 +92,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Accueil', + 'shortTitle' => 'Accueil', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -245,6 +246,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Accueil', + 'shortTitle' => 'Accueil', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -267,7 +269,8 @@ class init extends common { 'position' => 1, 'group' => self::GROUP_VISITOR, 'targetBlank' => false, - 'title' => 'Enfant', + 'title' => 'Page Enfant', + 'shortTitle' => 'Enfant', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -290,7 +293,8 @@ class init extends common { 'position' => 2, 'group' => self::GROUP_MEMBER, 'targetBlank' => false, - 'title' => 'Privée', + 'title' => 'Page privée', + 'shortTitle' => 'Privée', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -314,6 +318,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Mise en page', + 'shortTitle' => 'Mise en page', 'block' => '4-8', 'barLeft' => 'barre', 'barRight' => '', @@ -336,7 +341,8 @@ class init extends common { 'position' => 3, 'group' => self::GROUP_VISITOR, 'targetBlank' => false, - 'title' => 'Menu latéral', + 'title' => 'Barre latérale avec menu', + 'shortTitle' => 'Menu latéral', 'block' => '9-3', 'barLeft' => '', 'barRight' => 'barrelateraleavecmenu', @@ -360,6 +366,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Blog', + 'shortTitle' => 'Blog', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -382,7 +389,8 @@ class init extends common { 'position' => 4, 'group' => self::GROUP_VISITOR, 'targetBlank' => false, - 'title' => 'Galeries', + 'title' => 'Galeries d\'images', + 'shortTitle' => 'Galeries', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -407,6 +415,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => true, 'title' => 'Site de Zwii', + 'shortTitle' => 'Site de Zwii', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -430,6 +439,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Contact', + 'shortTitle' => 'Contact', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -453,6 +463,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Barre latérale', + 'shortTitle' => 'Barre latérale', 'block' => 'bar', 'barLeft' => '', 'barRight' => '', @@ -476,6 +487,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Barre latérale avec menu', + 'shortTitle' => 'Barre latérale avec menu', 'block' => 'bar', 'barLeft' => '', 'barRight' => '', @@ -499,6 +511,7 @@ class init extends common { 'group' => 0, 'targetBlank' => false, 'title' => 'Mentions légales', + 'shortTitle' => 'Mentions légales', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -523,6 +536,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Maintenance en cours', + 'shortTitle' => 'Maintenance en cours', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -547,6 +561,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Erreur 403', + 'shortTitle' => 'Erreur 403', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -570,6 +585,7 @@ class init extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => 'Erreur 404', + 'shortTitle' => 'Erreur 404', 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -592,7 +608,8 @@ class init extends common { 'position' => 7, 'group' => self::GROUP_VISITOR, 'targetBlank' => false, - 'title' => 'Recherche', + 'title' => 'Recherche dans le site', + 'shortTitle' => 'Rechercher', 'block' => '12', 'barLeft' => '', 'barRight' => '', diff --git a/core/module/page/page.php b/core/module/page/page.php index 3ba16329..86011daa 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -142,6 +142,7 @@ class page extends common { 'group' => self::GROUP_VISITOR, 'targetBlank' => false, 'title' => $pageTitle, + 'shortTitle' => $pageTitle, 'block' => '12', 'barLeft' => '', 'barRight' => '', @@ -426,6 +427,7 @@ class page extends common { 'group' => $this->getinput('pageEditBlock') !== 'bar' ? $this->getInput('pageEditGroup', helper::FILTER_INT) : 0, 'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN), 'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT), + 'shortTitle' => $this->getInput('pageEditShortTitle', helper::FILTER_STRING_SHORT, true), 'block' => $this->getinput('pageEditBlock'), 'barLeft' => $barLeft, 'barRight' => $barRight, @@ -495,6 +497,8 @@ class page extends common { self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); } } + // Mise à jour de la liste des pages pour TinyMCE + $this->pages2Json(); // Valeurs en sortie $this->addOutput([ 'title' => $this->getData(['page', $this->getUrl(2), 'title']), diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index d3e855f5..b30039a1 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -1,9 +1,6 @@ -pages2Json(); ?> +
-
+
getUrl(2); ?> getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
-
+
+ 'Titre Court', + 'value' => $this->getData(['page', $this->getUrl(2), 'shortTitle']), + 'help' => 'Le titre court est affiché dans les menus. Il peut être identique au titre de la page.' + ]); ?> +
+
'Aspect du lien', 'selected' => $this->getData(['page', $this->getUrl(2), 'typeMenu']) ]); ?>
-
+
'Sélectionnez une image ou une icône de petite dimension', 'label' => 'Icône',