diff --git a/core/core.php b/core/core.php
index 5dda7427..1f7c40ca 100644
--- a/core/core.php
+++ b/core/core.php
@@ -81,7 +81,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Accueil',
- 'blocks' => '100'
+ 'block' => '12'
],
'enfant' => [
'typeMenu' => 'text',
@@ -98,7 +98,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Enfant',
- 'blocks' => '12'
+ 'block' => '12'
],
'cachee' => [
'typeMenu' => 'text',
@@ -115,7 +115,7 @@ class common {
'group' => self::GROUP_MEMBER,
'targetBlank' => false,
'title' => 'Cachée',
- 'blocks' => '12'
+ 'block' => '12'
],
'mise_en_page' => [
'typeMenu' => 'text',
@@ -132,7 +132,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Mise en page',
- 'blocks' => '3-6-3'
+ 'block' => '3-6-3'
],
'blog' => [
'typeMenu' => 'text',
@@ -149,7 +149,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Blog',
- 'blocks' => '12'
+ 'block' => '12'
],
'galeries' => [
'typeMenu' => 'text',
@@ -166,7 +166,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Galeries',
- 'blocks' => '12'
+ 'block' => '12'
],
'site-de-zwii' => [
'typeMenu' => 'text',
@@ -183,7 +183,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => true,
'title' => 'Site de Zwii',
- 'blocks' => '12'
+ 'block' => '12'
],
'contact' => [
'typeMenu' => 'text',
@@ -200,7 +200,7 @@ class common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => 'Contact',
- 'blocks' => '12'
+ 'block' => '12'
],
'blockRight' => [
'typeMenu' => '',
@@ -425,7 +425,8 @@ class common {
];
private $hierarchy = [
'all' => [],
- 'visible' => []
+ 'visible' => [],
+ 'bar' => []
];
private $input = [
'_COOKIE' => [],
@@ -546,6 +547,9 @@ class common {
if($pagePosition !== 0) {
$this->hierarchy['visible'][$pageId] = [];
}
+ if($this->getData(['page', $pageId, 'block']) === 'bar') {
+ $this->hierarchy['bar'][$pageId] = [];
+ }
$this->hierarchy['all'][$pageId] = [];
}
}
@@ -570,6 +574,9 @@ class common {
if($pagePosition !== 0) {
$this->hierarchy['visible'][$parentId][] = $pageId;
}
+ if($this->getData(['page', $pageId, 'block']) === 'bar') {
+ $this->hierarchy['bar'][$pageId] = [];
+ }
$this->hierarchy['all'][$parentId][] = $pageId;
}
}
@@ -757,10 +764,12 @@ class common {
* Accède à la liste des pages parents et de leurs enfants ou aux enfants d'une page parent
* @param int $parentId Id de la page parent
* @param bool $onlyVisible Affiche seulement les pages visibles
+ * @param bool $onlyBlock Affcihe seulement les page de type barre
* @return array
*/
- public function getHierarchy($parentId = null, $onlyVisible = true) {
+ public function getHierarchy($parentId = null, $onlyVisible = true, $onlyBlock = false) {
$hierarchy = $onlyVisible ? $this->hierarchy['visible'] : $this->hierarchy['all'];
+ $hierarchy = $onlyBlock ? $this->hierarchy['bar'] : $hierarchy;
// Enfants d'un parent
if($parentId) {
if(array_key_exists($parentId, $hierarchy)) {
@@ -776,6 +785,7 @@ class common {
}
}
+
/**
* Accède à une valeur des variables http (ordre de recherche en l'absence de type : _COOKIE, _POST)
* @param string $key Clé de la valeur
@@ -1065,7 +1075,7 @@ class common {
}
// Version 9.0.0
if($this->getData(['core', 'dataVersion']) < 900) {
- $this->setData(['theme', 'site', 'blocks','100']);
+ $this->setData(['theme', 'site', 'block','12']);
if ($this->getData(['theme','menu','position']) === 'body-top') {
$this->setData(['theme','menu','position','top']);
}
@@ -1970,6 +1980,7 @@ class layout extends common {
/**
* Affiche le contenu
+ * @param Page par défaut
*/
public function showContent() {
if(
@@ -1979,11 +1990,22 @@ class layout extends common {
OR $this->getData(['page', $this->getUrl(0), 'hideTitle']) === false
)
) {
- echo '
' . $this->core->output['title'] . ' ';
+ // echo '' . $this->core->output['title'] . ' ';
+ // Chemin de fer pour le titre avec des enfants
+ echo '';
+ // Fin modif
}
echo $this->core->output['content'];
}
+
+
/**
* Affiche le copyright
*/
@@ -2217,15 +2239,11 @@ class layout extends common {
$leftItems .= 'Choisissez une page ';
$currentPageId = $this->getData(['page', $this->getUrl(0)]) ? $this->getUrl(0) : $this->getUrl(2);
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
- if ($parentPageId === 'blockLeft'
- OR $parentPageId === 'blockRight') { continue; }
$leftItems .= '' . $this->getData(['page', $parentPageId, 'title']) . ' ';
foreach($childrenPageIds as $childKey) {
$leftItems .= ' ' . $this->getData(['page', $childKey, 'title']) . ' ';
}
}
- $leftItems .= '------------------- ';
- $leftItems .= 'Édition des barres latérales ';
$leftItems .= '';
$leftItems .= '' . template::ico('plus') . ' ';
if(
diff --git a/core/layout/main.php b/core/layout/main.php
index 32cee72b..5f5ef4bd 100755
--- a/core/layout/main.php
+++ b/core/layout/main.php
@@ -127,7 +127,7 @@
getData(['page',$this->getUrl(0),'blocks']));
+ $blocks = explode('-',$this->getData(['page',$this->getUrl(0),'block']));
// Initialiser
$blockleft=$blockright="";
switch (sizeof($blocks)) {
@@ -156,9 +156,14 @@
} else {
?>
-
getData(['page','blockLeft','content']);?>
+
+ getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']);
+ ?>
showContent(); ?>
-
getData(['page','blockRight','content']);?>
+
+ getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']);
+ ?>
diff --git a/core/module/page/page.php b/core/module/page/page.php
index 501dd315..afd66ba4 100755
--- a/core/module/page/page.php
+++ b/core/module/page/page.php
@@ -8,6 +8,8 @@
*
* @author Rémi Jean
* @copyright Copyright (C) 2008-2018, Rémi Jean
+ * @author Frédéric Tempez
+ * @copyright Copyright (C) 2018-2019, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
@@ -17,12 +19,14 @@ class page extends common {
public static $actions = [
'add' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR,
- 'edit' => self::GROUP_MODERATOR,
- 'block' => self::GROUP_ADMIN
+ 'edit' => self::GROUP_MODERATOR
];
public static $pagesNoParentId = [
'' => 'Aucune'
];
+ public static $pagesBarId = [
+ '' => 'Aucune'
+ ];
public static $moduleIds = [];
public static $typeMenu = [
@@ -37,12 +41,13 @@ class page extends common {
'free' => 'Libre'
];
public static $pageBlocks = [
- '12' => 'Pleine page',
+ '12' => 'Pleine page - sans barre latérale',
'4-8' => 'Barre latérale 1/3 - Page 2/3',
'8-4' => 'Page 2/3 - Barre latérale 1/3',
'3-9' => 'Barre latérale 1/4 - Page 3/4',
'9-3' => 'Page 3/4 - Barre latérale 1/4',
- '3-6-3' => 'Barre latérale 1/4 - Page 1/2 - Barre latérale 1/4'
+ '3-6-3' => 'Barre latérale 1/4 - Page 1/2 - Barre latérale 1/4',
+ 'bar' => 'Barre latérale'
];
/**
@@ -69,7 +74,9 @@ class page extends common {
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => $pageTitle,
- 'blocks' => '100'
+ 'block' => '12',
+ 'barLeft' => '',
+ 'barRight' => ''
]
]);
// Valeurs en sortie
@@ -136,64 +143,6 @@ class page extends common {
]);
}
}
-
- /**
- * Édition des blocs
- */
- public function block () {
- if($this->isPost()) {
- $this->setData([
- 'page',
- 'blockLeft', [
- 'typeMenu' => 'text',
- 'iconUrl' => '',
- 'disable' => true,
- 'hideTitle' => false,
- 'metaDescription' => '',
- 'metaTitle' => '',
- 'moduleId' => '',
- 'parentPageId' => '',
- 'modulePosition' => 'bottom',
- 'position' => 0,
- 'group' => self::GROUP_VISITOR,
- 'targetBlank' => false,
- 'title' => 'blockLeft',
- 'content' => (empty($this->getInput('pageBlockLeftContent', null)) ? "
" : $this->getInput('pageBlockLeftContent', null))]
- ]);
- $this->setData([
- 'page',
- 'blockRight', [
- 'typeMenu' => 'text',
- 'iconUrl' => '',
- 'disable' => true,
- 'hideTitle' => false,
- 'metaDescription' => '',
- 'metaTitle' => '',
- 'moduleId' => '',
- 'parentPageId' => '',
- 'modulePosition' => 'bottom',
- 'position' => 0,
- 'group' => self::GROUP_VISITOR,
- 'targetBlank' => false,
- 'title' => 'blockRight',
- 'content' => (empty($this->getInput('pageBlockRightContent', null)) ? "
" : $this->getInput('pageBlockRightContent', null))]
- ]);
- $this->addOutput([
- 'redirect' => helper::baseUrl(),
- 'notification' => 'Modifications enregistrées',
- 'state' => true
- ]);
- }
-
- // Valeurs en sortie
- $this->addOutput([
- 'title' => 'Édition des barres latérales',
- 'vendor' => [
- 'tinymce'
- ],
- 'view' => 'block'
- ]);
- }
/**
@@ -256,7 +205,14 @@ class page extends common {
// Incrémente pour la prochaine position
$lastPosition++;
}
- // Modifie la page ou en crée une nouvelle si l'id à changée
+ if ($this->getinput('pageEditBlock') !== 'bar') {
+ $barLeft = $this->getinput('pageEditBarLeft');
+ $barRight = $this->getinput('pageEditBarRight');
+ } else {
+ $barLeft = "";
+ $barRight = "";
+ }
+ // Modifie la page ou en crée une nouvelle si l'id a changé
$this->setData([
'page',
$pageId,
@@ -275,7 +231,9 @@ class page extends common {
'group' => $this->getInput('pageEditGroup', helper::FILTER_INT),
'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN),
'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT, true),
- 'blocks' => $this->getinput('pageEditBlocks'),
+ 'block' => $this->getinput('pageEditBlock'),
+ 'barLeft' => $barLeft,
+ 'barRight' => $barRight
]
]);
// Redirection vers la configuration
@@ -312,6 +270,13 @@ class page extends common {
if($parentPageId !== $this->getUrl(2)) {
self::$pagesNoParentId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
}
+ }
+ // Pages barre latérales
+ foreach($this->getHierarchy(null,false,true) as $parentPageId => $childrenPageIds) {
+ if($parentPageId !== $this->getUrl(2) &&
+ $this->getData(['page', $parentPageId, 'block']) === 'bar') {
+ self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
+ }
}
// Valeurs en sortie
$this->addOutput([
diff --git a/core/module/page/view/edit/edit.js.php b/core/module/page/view/edit/edit.js.php
index 985520a3..6d65bbc4 100755
--- a/core/module/page/view/edit/edit.js.php
+++ b/core/module/page/view/edit/edit.js.php
@@ -22,19 +22,48 @@ $("#pageEditDelete").on("click", function() {
/**
* Bloque/Débloque le bouton de configuration au changement de module
+ * Affiche ou masque la position du module selon le call_user_func
*/
var pageEditModuleIdDOM = $("#pageEditModuleId");
pageEditModuleIdDOM.on("change", function() {
if($(this).val() === "") {
$("#pageEditModuleConfig").addClass("disabled");
- $("#pageEditContentContainer").slideDown();
+ $("#pageEditContentContainer").slideDown();
}
else {
$("#pageEditModuleConfig").removeClass("disabled");
- $("#pageEditContentContainer").slideUp();
+ $("#pageEditContentContainer").slideUp();
}
});
+/**
+ * Masquer et affiche le contenu pour les modules form et gallery
+ */
+var pageEditModuleIdDOM = $("#pageEditModuleId");
+pageEditModuleIdDOM.on("change", function() {
+ if($(this).val() === "form" ||
+ $(this).val() === "gallery") {
+ $("#configModulePositionWrapper").addClass("disabled");
+ $("#configModulePositionWrapper").slideDown();
+ }
+ else {
+ $("#configModulePositionWrapper").removeClass("disabled");
+ $("#configModulePositionWrapper").slideUp();
+ }
+});
+if($("#pageEditModuleId").val() === "form" ||
+ $("#pageEditModuleId").val() === "gallery") {
+ console.log('ok');
+ $("#configModulePositionWrapper").addClass("disabled");
+ $("#configModulePositionWrapper").slideDown();
+ }
+ else {
+ console.log('pas ok');
+ $("#configModulePositionWrapper").removeClass("disabled");
+ $("#configModulePositionWrapper").slideUp();
+}
+
+
/**
* Masquer et démasquer le contenu pour les modules code et redirection
*/
@@ -58,7 +87,7 @@ if($("#pageEditModuleId").val() === "code" ||
else {
$("#pageEditContentWrapper").addClass("disabled");
$("#pageEditContentWrapper").slideDown();
- }
+}
/**
@@ -66,7 +95,8 @@ if($("#pageEditModuleId").val() === "code" ||
*/
var pageEditModuleIdDOM = $("#pageEditModuleId");
pageEditModuleIdDOM.on("change", function() {
- if($(this).val() === "redirection") {
+ if($(this).val() === "redirection" ||
+ $(this).val() === "code") {
$("#pageEditHideTitleWrapper").removeClass("disabled");
$("#pageEditHideTitleWrapper").slideUp();
}
@@ -75,14 +105,87 @@ pageEditModuleIdDOM.on("change", function() {
$("#pageEditHideTitleWrapper").slideDown();
}
});
-if($("#pageEditModuleId").val() === "redirection") {
+if($("#pageEditModuleId").val() === "redirection" ||
+ $("#pageEditModuleId").val() === "code") {
$("#pageEditHideTitleWrapper").removeClass("disabled");
$("#pageEditHideTitleWrapper").slideUp();
}
else {
$("#pageEditHideTitleWrapper").addClass("disabled");
$("#pageEditHideTitleWrapper").slideDown();
+}
+
+/**
+ * Masquer et démasquer la sélection des barres
+ */
+
+
+var pageEditBlockDOM = $("#pageEditBlock");
+pageEditBlockDOM.on("change", function() {
+ switch ($(this).val()) {
+ case "bar":
+ case "12":
+ $("#pageEditBarLeftWrapper").removeClass("disabled");
+ $("#pageEditBarLeftWrapper").slideUp();
+ $("#pageEditBarRightWrapper").removeClass("disabled");
+ $("#pageEditBarRightWrapper").slideUp();
+ break;
+ case "3-9":
+ case "4-8":
+ $("#pageEditBarLeftWrapper").addClass("disabled");
+ $("#pageEditBarLeftWrapper").slideDown();
+ $("#pageEditBarRightWrapper").removeClass("disabled");
+ $("#pageEditBarRightWrapper").slideUp();
+ break;
+ case "9-3":
+ case "8-4":
+ $("#pageEditBarLeftWrapper").removeClass("disabled");
+ $("#pageEditBarLeftWrapper").slideUp();
+ $("#pageEditBarRightWrapper").addClass("disabled");
+ $("#pageEditBarRightWrapper").slideDown();
+ break;
+ case "3-6-3":
+ $("#pageEditBarLeftWrapper").addClass("disabled");
+ $("#pageEditBarLeftWrapper").slideDown();
+ $("#pageEditBarRightWrapper").addClass("disabled");
+ $("#pageEditBarRightWrapper").slideDown();
+ break;
}
+});
+switch ($("#pageEditBlock").val()) {
+ case "bar":
+ case "12":
+ $("#pageEditBarLeftWrapper").removeClass("disabled");
+ $("#pageEditBarLeftWrapper").slideUp();
+ $("#pageEditBarRightWrapper").removeClass("disabled");
+ $("#pageEditBarRightWrapper").slideUp();
+ break;
+ case "3-9":
+ case "4-8":
+ $("#pageEditBarLeftWrapper").addClass("disabled");
+ $("#pageEditBarLeftWrapper").slideDown();
+ $("#pageEditBarRightWrapper").removeClass("disabled");
+ $("#pageEditBarRightWrapper").slideUp();
+ break;
+ case "9-3":
+ case "8-4":
+ $("#pageEditBarLeftWrapper").removeClass("disabled");
+ $("#pageEditBarLeftWrapper").slideUp();
+ $("#pageEditBarRightWrapper").addClass("disabled");
+ $("#pageEditBarRightWrapper").slideDown();
+ break;
+ case "3-6-3":
+ $("#pageEditBarLeftWrapper").addClass("disabled");
+ $("#pageEditBarLeftWrapper").slideDown();
+ $("#pageEditBarRightWrapper").addClass("disabled");
+ $("#pageEditBarRightWrapper").slideDown();
+ break;
+};
+
+
+
+
+
/**
diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php
index b086552c..35f24736 100755
--- a/core/module/page/view/edit/edit.php
+++ b/core/module/page/view/edit/edit.php
@@ -33,7 +33,6 @@
'value' => $this->getData(['page', $this->getUrl(2), 'title'])
]); ?>
-
+
+
+ $this->getData(['page', $this->getUrl(2), 'hideTitle'])
+ ]); ?>
+
+
+
+ 'En position libre ajoutez manuellement le module en plaçant deux crochets [] à l\'endroit voulu dans votre page.',
+ 'label' => 'Position du module dans la page',
+ 'selected' => $this->getData(['page', $this->getUrl(2), 'modulePosition'])
+ ]); ?>
+
+
Mise en page
- 'Gabarit :',
- 'help' => 'Pour éditer le contenu des encarts, sélectionnez \'Édition des encarts\' dans la liste des pages.',
- 'selected' => $this->getData(['page', $this->getUrl(2) , 'blocks'])
+ 'Gabarit de page :',
+ 'help' => 'Une page définie comme barre latérale est utilisée pour la pagination d\'une page standard.',
+ 'selected' => $this->getData(['page', $this->getUrl(2) , 'block'])
]); ?>
-
+
+ getHierarchy($this->getUrl(2),false,true)): ?>
+ $this->getData(['page', $this->getUrl(2), 'barLeft'])
+ ]); ?>
+
+ 'Barre latérale gauche :',
+ 'selected' => $this->getData(['page', $this->getUrl(2), 'barLeft'])
+ ]); ?>
+
+ getHierarchy($this->getUrl(2),false,true)): ?>
+ $this->getData(['page', $this->getUrl(2), 'barRight'])
+ ]); ?>
+
+ 'Barre latérale droite :',
+ 'selected' => $this->getData(['page', $this->getUrl(2), 'barRight'])
+ ]); ?>
+
+
@@ -125,16 +160,6 @@
'maxlength' => '500',
'value' => $this->getData(['page', $this->getUrl(2), 'metaDescription'])
]); ?>
- getData(['page', $this->getUrl(2), 'moduleId']) === 'form') or ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'gallery')) {
- echo template::select('configModulePosition', $module::$modulePosition,[
- 'help' => 'En position libre ajoutez manuellement le module en plaçant deux crochets [] à l\'endroit voulu dans votre page.',
- 'label' => 'Position du module dans la page',
- 'selected' => $this->getData(['page', $this->getUrl(2), 'modulePosition'])
- ]);
- } ?>
- $this->getData(['page', $this->getUrl(2), 'hideTitle'])
- ]); ?>