diff --git a/core/core.php b/core/core.php
index 2318ca5b..3ebf8f46 100644
--- a/core/core.php
+++ b/core/core.php
@@ -45,7 +45,7 @@ class common {
// Numéro de version
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';
- const ZWII_VERSION = '11.2.00.12';
+ const ZWII_VERSION = '11.2.00.14';
const ZWII_UPDATE_CHANNEL = "test";
public static $actions = [];
diff --git a/core/layout/common.css b/core/layout/common.css
index ca13cc79..3c10102d 100755
--- a/core/layout/common.css
+++ b/core/layout/common.css
@@ -337,9 +337,13 @@ td>.col12 {
/* Notice */
.notice {
- display: block; /* au lieu de inline-block notamment dans les input file*/
+ display: inline-block;
color: #E74C3C;
}
+/* Mauvaise position dans les champs File*/
+.inputFile.notice {
+ display: block;
+}
/* Container */
.container {
diff --git a/core/module/config/config.php b/core/module/config/config.php
index 9e5f58a6..caecaf60 100644
--- a/core/module/config/config.php
+++ b/core/module/config/config.php
@@ -208,8 +208,9 @@ class config extends common {
// Valeurs en sortie
$this->addOutput([
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => $successSitemap ? 'Mises à jour des fichiers sitemap et robots.txt' : 'Echec d\'écriture, le site map n\'a pas été mis à jour',
- 'redirect' => helper::baseUrl() . 'config/advanced',
'state' => $successSitemap
]);
}
@@ -275,8 +276,9 @@ class config extends common {
}
// Valeurs en sortie
$this->addOutput([
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => $success === false ? 'Service inaccessible ou erreur d\'écriture de l\'image' : 'Image générée avec succès',
- 'redirect' => helper::baseUrl() . 'config/advanced',
'state' => $success === false ? false : true
]);
}
@@ -299,8 +301,9 @@ class config extends common {
if ($file_parts['extension'] !== 'zip') {
// Valeurs en sortie erreur
$this->addOutput([
+ 'title' => 'Restaurer',
+ 'view' => 'restore',
'notification' => 'Le fichier n\'est pas une archive valide',
- 'redirect' => helper::baseUrl() . 'config/restore',
'state' => false
]);
}
@@ -308,8 +311,9 @@ class config extends common {
if ($successOpen === FALSE) {
// Valeurs en sortie erreur
$this->addOutput([
+ 'title' => 'Restaurer',
+ 'view' => 'restore',
'notification' => 'Impossible de lire l\'archive',
- 'redirect' => helper::baseUrl() . 'config/restore',
'state' => false
]);
}
@@ -350,8 +354,9 @@ class config extends common {
} elseif ($version === 0) { // Version invalide
// Valeurs en sortie erreur
$this->addOutput([
+ 'title' => 'Restaurer',
+ 'view' => 'restore',
'notification' => 'Cette archive n\'est pas une sauvegarde valide',
- 'redirect' => helper::baseUrl() . 'config/restore',
'state' => false
]);
}
@@ -375,12 +380,13 @@ class config extends common {
}
}
// Message de notification
- $notification = $success === true ? 'Restauration effectuée avec succès' : 'Erreur inconnue';
+ $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/';
// Valeurs en sortie erreur
$this->addOutput([
+ 'title' => 'Restaurer',
+ 'view' => 'restore',
'notification' => $notification,
- 'redirect' =>$redirect,
'state' => $success
]);
}
@@ -574,7 +580,8 @@ class config extends common {
$this->generateFiles();
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . $this->getUrl(),
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Modifications enregistrées ' ,
'state' => true
]);
@@ -616,8 +623,11 @@ class config extends common {
}
// Valeurs en sortie
$this->addOutput([
- 'notification' => 'Modifications enregistrées',
- 'redirect' => helper::baseUrl() . 'config/script/'. $this->geturl(2),
+ 'title' => 'Éditeur de script dans ' . ucfirst($this->geturl(2)) ,
+ 'vendor' => [
+ 'codemirror'
+ ],
+ 'view' => 'script',
'state' => true
]);
}
@@ -677,8 +687,9 @@ class config extends common {
$this->setData(['core','baseUrl',helper::baseUrl(true,false)]);
// Valeurs en sortie
$this->addOutput([
+ 'title' => 'Restaurer',
+ 'view' => 'restore',
'notification' => $success ? $c3. ' conversion' . ($c3 > 1 ? 's' : '') . ' effectuée' . ($c3 > 1 ? 's' : '') : 'Aucune conversion',
- 'redirect' => helper::baseUrl() . 'config/restore',
'state' => $success ? true : false
]);
}
@@ -695,14 +706,16 @@ class config extends common {
file_put_contents(self::DATA_DIR . 'journal.log',$d);
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Journal réinitialisé avec succès',
'state' => true
]);
} else {
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Aucun journal à effacer',
'state' => false
]);
@@ -729,7 +742,8 @@ class config extends common {
} else {
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Aucun fichier journal à télécharger',
'state' => false
]);
@@ -765,7 +779,8 @@ class config extends common {
} else {
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Aucune liste noire à télécharger',
'state' => false
]);
@@ -781,14 +796,16 @@ class config extends common {
$this->setData(['blacklist',[]]);
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Liste noire réinitialisée avec succès',
'state' => true
]);
} else {
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Pas de liste à effacer',
'state' => false
]);
@@ -806,7 +823,8 @@ class config extends common {
$this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup' );
// Valeurs en sortie
$this->addOutput([
- 'redirect' => helper::baseUrl() . 'config/advanced',
+ 'title' => 'Configuration',
+ 'view' => 'index',
'notification' => 'Copie terminée',
'state' => true
]);
diff --git a/core/module/config/view/backup/backup.js.php b/core/module/config/view/backup/backup.js.php
index ee965554..4feddc81 100644
--- a/core/module/config/view/backup/backup.js.php
+++ b/core/module/config/view/backup/backup.js.php
@@ -12,7 +12,7 @@
$( document).ready(function() {
$("#configBackupForm").submit( function(e){
- $("#configBackupSubmit").addClass("disabled").prop("disabled", true);
+ //$("#configBackupSubmit").addClass("disabled").prop("disabled", true);
e.preventDefault();
var url = "getUrl(0); ?>/backup";
$.ajax({
@@ -29,6 +29,9 @@ $( document).ready(function() {
},
complete: function(){
$("#configBackupSubmit").removeClass("disabled").prop("disabled", false);
+ $("#configBackupSubmit").removeClass("uniqueSubmission").prop("uniqueSubmission", false);
+ $("#configBackupSubmit span").removeClass("zwiico-spin animate-spin");
+ $("#configBackupSubmit span").addClass("zwiico-check zwiico-margin-right").text("Sauvegarder");
}
});
});
diff --git a/core/module/config/view/backup/backup.php b/core/module/config/view/backup/backup.php
index 0258bd26..070ab2cd 100644
--- a/core/module/config/view/backup/backup.php
+++ b/core/module/config/view/backup/backup.php
@@ -3,14 +3,15 @@
'buttonGrey',
- 'href' => helper::baseUrl() . 'config/advanced',
+ 'href' => helper::baseUrl() . 'config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
'Sauvegarder'
+ 'value' => 'Sauvegarder',
+ 'uniqueSubmission' => true
]); ?>
diff --git a/core/module/config/view/index/index.css b/core/module/config/view/index/index.css
index 4648a078..ba9a02f7 100755
--- a/core/module/config/view/index/index.css
+++ b/core/module/config/view/index/index.css
@@ -22,26 +22,5 @@
}
.activeButton {
- filter : brightness(125%);
-}
-
-/** Div d'aide
-
-.helpDisplayContainer {
- position: sticky;
- background-color: white;
- 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;
-}
-
-/** Bouton d'aide et croix de fermeture
-
-.zwiico-cancel, .helpDisplayButton {
- cursor: pointer;
-}
-*/
\ No newline at end of file
+ filter : brightness(150%);
+}
\ No newline at end of file
diff --git a/core/module/config/view/index/index.js.php b/core/module/config/view/index/index.js.php
index e75d3842..ca058779 100644
--- a/core/module/config/view/index/index.js.php
+++ b/core/module/config/view/index/index.js.php
@@ -38,21 +38,33 @@ $( document).ready(function() {
$("#SmtpAuthParam").slideUp();
}
- /**
- * Cookie
- */
- /*
- if ($("input[name=configCookieConsent]").is(':checked')) {
- $("#cookieContainer").slideDown();
- } else {
- $("#cookieContainer").slideUp();
+ var configLayout = getCookie("configLayout");
+ if (configLayout == null) {
+ $("#localeContainer").hide();
+ $("#socialContainer").hide();
+ $("#connectContainer").hide();
+ $("#networkContainer").hide();
+ $("#setupContainer").show();
+ $("#configSetupButton").addClass("activeButton");
+ $("#configLocaleButton").removeClass("activeButton");
+ $("#configSocialButton").removeClass("activeButton");
+ $("#configConnectButton").removeClass("activeButton");
+ $("#configNetworkButton").removeClass("activeButton");
+ setCookie("configLayout","setup");
}
- */
+ $("#localeContainer").hide();
+ $("#socialContainer").hide();
+ $("#connectContainer").hide();
+ $("#networkContainer").hide();
+ $("#setupContainer").hide();
+ $("#" + configLayout + "Container" ).show();
+ $("#config" + capitalizeFirstLetter(configLayout) + "Button").addClass("activeButton");
+
+
// Gestion des événements
//---------------------------------------------------------------------------------------------------------------------
-
- /**
+ /**
* Afficher et masquer options SMTP
*/
$("input[name=SmtpEnable]").on("change", function() {
@@ -128,20 +140,20 @@ $( document).ready(function() {
$("#networkContainer").hide();
$("#setupContainer").show();
$("#configSetupButton").addClass("activeButton");
- $("#configLocalButton").removeClass("activeButton");
+ $("#configLocaleButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
setCookie("configLayout","setup");
});
- $("#configLocalButton").on("click", function() {
+ $("#configLocaleButton").on("click", function() {
$("#setupContainer").hide();
$("#socialContainer").hide();
$("#connectContainer").hide();
$("#networkContainer").hide();
$("#localeContainer").show();
$("#configSetupButton").removeClass("activeButton");
- $("#configLocalButton").addClass("activeButton");
+ $("#configLocaleButton").addClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
@@ -154,7 +166,7 @@ $( document).ready(function() {
$("#networkContainer").hide();
$("#socialContainer").show();
$("#configSetupButton").removeClass("activeButton");
- $("#configLocalButton").removeClass("activeButton");
+ $("#configLocaleButton").removeClass("activeButton");
$("#configSocialButton").addClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
@@ -167,7 +179,7 @@ $( document).ready(function() {
$("#networkContainer").hide();
$("#connectContainer").show();
$("#configSetupButton").removeClass("activeButton");
- $("#configLocalButton").removeClass("activeButton");
+ $("#configLocaleButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").addClass("activeButton");
$("#configNetworkButton").removeClass("activeButton");
@@ -180,46 +192,13 @@ $( document).ready(function() {
$("#connectContainer").hide();
$("#networkContainer").show();
$("#configSetupButton").removeClass("activeButton");
- $("#configLocalButton").removeClass("activeButton");
+ $("#configLocaleButton").removeClass("activeButton");
$("#configSocialButton").removeClass("activeButton");
$("#configConnectButton").removeClass("activeButton");
$("#configNetworkButton").addClass("activeButton");
setCookie("configLayout","network");
});
-
- /**
- * Options des cookies
- */
-/*
- $("input[name=configCookieConsent]").on("change", function() {
- if ($("input[name=configCookieConsent]").is(':checked')) {
- $("#cookieContainer").slideDown();
- } else {
- $("#cookieContainer").slideUp();
- }
- });
-*/
- var configLayout = getCookie("configLayout");
- if (configLayout == null) {
- $("#localeContainer").hide();
- $("#socialContainer").hide();
- $("#connectContainer").hide();
- $("#networkContainer").hide();
- $("#setupContainer").show();
- $("#configSetupButton").addClass("activeButton");
- $("#configLocaleButton").removeClass("activeButton");
- $("#configSocialButton").removeClass("activeButton");
- $("#configConnectButton").removeClass("activeButton");
- $("#configNetworkButton").removeClass("activeButton");
- setCookie("configLayout","setup");
- }
- $("#localeContainer").hide();
- $("#socialContainer").hide();
- $("#connectContainer").hide();
- $("#networkContainer").hide();
- $("#setupContainer").hide();
- $("#" + configLayout + "Container" ).show();
});
@@ -231,7 +210,7 @@ function setCookie(name,value,days) {
date.setTime(date.getTime() + (days*24*60*60*1000));
expires = "; expires=" + date.toUTCString();
}
- document.cookie = name + "=" + (value || "") + expires + "; path=/";
+ document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
}
function getCookie(name) {
@@ -244,3 +223,8 @@ function getCookie(name) {
}
return null;
}
+
+// Define function to capitalize the first letter of a string
+function capitalizeFirstLetter(string) {
+ return string.charAt(0).toUpperCase() + string.slice(1);
+ }
\ No newline at end of file
diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php
index 55deeaa1..3738b0e0 100644
--- a/core/module/config/view/index/index.php
+++ b/core/module/config/view/index/index.php
@@ -30,7 +30,7 @@
]); ?>
- 'Localisation'
]); ?>
diff --git a/core/module/config/view/restore/restore.php b/core/module/config/view/restore/restore.php
index e642722d..22a63cc1 100644
--- a/core/module/config/view/restore/restore.php
+++ b/core/module/config/view/restore/restore.php
@@ -3,14 +3,15 @@
'buttonGrey',
- 'href' => helper::baseUrl() . 'config/advanced',
+ 'href' => helper::baseUrl() . 'config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
'Restaurer'
+ 'value' => 'Restaurer',
+ 'uniqueSubmission' => true,
]); ?>
diff --git a/core/module/config/view/script/script.php b/core/module/config/view/script/script.php
index f53021e1..ea1ad0b3 100644
--- a/core/module/config/view/script/script.php
+++ b/core/module/config/view/script/script.php
@@ -3,7 +3,7 @@
'buttonGrey',
- 'href' => helper::baseUrl() . 'config/advanced',
+ 'href' => helper::baseUrl() . 'config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
diff --git a/core/module/page/page.php b/core/module/page/page.php
index ae3924a2..deb5c013 100644
--- a/core/module/page/page.php
+++ b/core/module/page/page.php
@@ -1,512 +1,512 @@
-
- * @copyright Copyright (C) 2008-2018, Rémi Jean
- * @author Frédéric Tempez
- * @copyright Copyright (C) 2018-2021, Frédéric Tempez
- * @license GNU General Public License, version 3
- * @link http://zwiicms.fr/
- */
-
-class page extends common {
-
- public static $actions = [
- 'add' => self::GROUP_MODERATOR,
- 'delete' => self::GROUP_MODERATOR,
- 'edit' => self::GROUP_MODERATOR,
- 'duplicate' => self::GROUP_MODERATOR
- ];
- public static $pagesNoParentId = [
- '' => 'Aucune'
- ];
- public static $pagesBarId = [
- '' => 'Aucune'
- ];
- public static $moduleIds = [];
-
- public static $typeMenu = [
- 'text' => 'Texte',
- 'icon' => 'Icône',
- 'icontitle' => 'Icône avec bulle de texte'
- ];
- // Position du module
- public static $modulePosition = [
- 'bottom' => 'En bas',
- 'top' => 'En haut',
- 'free' => 'Libre'
- ];
- public static $pageBlocks = [
- '12' => 'Page standard',
- '4-8' => 'Barre 1/3 - page 2/3',
- '8-4' => 'Page 2/3 - barre 1/3',
- '3-9' => 'Barre 1/4 - page 3/4',
- '9-3' => 'Page 3/4 - barre 1/4',
- '3-6-3' => 'Barre 1/4 - page 1/2 - barre 1/4',
- '2-7-3' => 'Barre 2/12 - page 7/12 - barre 3/12 ',
- '3-7-2' => 'Barre 3/12 - page 7/12 - barre 2/12 ',
- 'bar' => 'Barre latérale'
- ];
- public static $displayMenu = [
- 'none' => 'Aucun',
- 'parents' => 'Le menu',
- 'children' => 'Le sous-menu de la page parente'
- ];
-
-
- /**
- * Duplication
- */
- public function duplicate() {
- // Adresse sans le token
- $url = explode('&',$this->getUrl(2));
- // La page n'existe pas
- if($this->getData(['page', $url[0]]) === null) {
- // Valeurs en sortie
- $this->addOutput([
- 'access' => false
- ]);
- } // Jeton incorrect
- elseif(!isset($_GET['csrf'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Jeton invalide'
- ]);
- }
- elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Suppression non autorisée'
- ]);
- }
- // Duplication de la page
- $pageTitle = $this->getData(['page',$url[0],'title']);
- $pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
- $pageId = helper::increment($pageId, self::$coreModuleIds);
- $pageId = helper::increment($pageId, self::$moduleIds);
- $data = $this->getData([
- 'page',
- $url[0]
- ]);
- // Ecriture
- $this->setData (['page',$pageId,$data]);
- $notification = 'La page a été dupliquée';
- // Duplication du module présent
- if ($this->getData(['page',$url[0],'moduleId'])) {
- $data = $this->getData([
- 'module',
- $url[0]
- ]);
- // Ecriture
- $this->setData (['module',$pageId,$data]);
- $notification = 'La page et son module ont été dupliqués';
- }
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $pageId,
- 'notification' => $notification,
- 'state' => true
- ]);
- }
-
-
- /**
- * Création
- */
- public function add() {
- $pageTitle = 'Nouvelle page';
- $pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
- $this->setData([
- 'page',
- $pageId,
- [
- 'typeMenu' => 'text',
- 'iconUrl' => '',
- 'disable' => false,
- 'content' => $pageId . '.html',
- 'hideTitle' => false,
- 'breadCrumb' => false,
- 'metaDescription' => '',
- 'metaTitle' => '',
- 'moduleId' => '',
- 'parentPageId' => '',
- 'modulePosition' => 'bottom',
- 'position' => 0,
- 'group' => self::GROUP_VISITOR,
- 'targetBlank' => false,
- 'title' => $pageTitle,
- 'shortTitle' => $pageTitle,
- 'block' => '12',
- 'barLeft' => '',
- 'barRight' => '',
- 'displayMenu' => '0',
- 'hideMenuSide' => false,
- 'hideMenuHead' => false,
- 'hideMenuChildren' => false
- ]
- ]);
- // Creation du contenu de la page
- if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) {
- mkdir(self::DATA_DIR . self::$i18n . '/content', 0755);
- }
- //file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html', 'Contenu de votre nouvelle page.
');
- $this->setPage($pageId, 'Contenu de votre nouvelle page.
', self::$i18n);
- // Met à jour le site map
- $this->createSitemap('all');
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . $pageId,
- 'notification' => 'Nouvelle page créée',
- 'state' => true
- ]);
- }
-
- /**
- * Suppression
- */
- public function delete() {
- // $url prend l'adresse sans le token
- $url = explode('&',$this->getUrl(2));
- // La page n'existe pas
- if($this->getData(['page', $url[0]]) === null) {
- // Valeurs en sortie
- $this->addOutput([
- 'access' => false
- ]);
- } // Jeton incorrect
- elseif(!isset($_GET['csrf'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Jeton invalide'
- ]);
- }
- elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Suppression non autorisée'
- ]);
- }
- // Impossible de supprimer la page d'accueil
- elseif($url[0] === $this->getData(['locale', 'homePageId'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Impossible de supprimer la page de recherche affectée
- elseif($url[0] === $this->getData(['locale', 'searchPageId'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Impossible de supprimer la page des mentions légales affectée
- elseif($url[0] === $this->getData(['locale', 'legalPageId'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Impossible de supprimer la page des mentions légales affectée
- elseif($url[0] === $this->getData(['locale', 'page404'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Impossible de supprimer la page des mentions légales affectée
- elseif($url[0] === $this->getData(['locale', 'page403'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Impossible de supprimer la page des mentions légales affectée
- elseif($url[0] === $this->getData(['locale', 'page302'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'config',
- 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
- ]);
- }
- // Jeton incorrect
- elseif(!isset($_GET['csrf'])) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Jeton invalide'
- ]);
- }
- elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Suppression non autorisée'
- ]);
- }
- // Impossible de supprimer une page contenant des enfants
- elseif($this->getHierarchy($url[0],null)) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
- 'notification' => 'Impossible de supprimer une page contenant des enfants'
- ]);
- }
- // Suppression
- else {
-
- // Effacer le dossier du module
- $moduleId = $this->getData(['page',$url[0],'moduleId']);
- $modulesData = helper::getModules();
- if (is_dir($modulesData[$moduleId]['dataDirectory']. $url[0])) {
- $this->removeDir( $modulesData[$moduleId]['dataDirectory']. $url[0] );
- }
- // Effacer la page
- $this->deleteData(['page', $url[0]]);
- if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html')) {
- unlink(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html');
- }
- $this->deleteData(['module', $url[0]]);
- // Met à jour le site map
- $this->createSitemap('all');
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl(false),
- 'notification' => 'Page supprimée',
- 'state' => true
- ]);
- }
- }
-
-
- /**
- * Édition
- */
- public function edit() {
- // La page n'existe pas
- if($this->getData(['page', $this->getUrl(2)]) === null) {
- // Valeurs en sortie
- $this->addOutput([
- 'access' => false
- ]);
- }
- // La page existe
- else {
- // Soumission du formulaire
- if($this->isPost()) {
- // Si le Title n'est pas vide, premier test pour positionner la notification du champ obligatoire
- if( $this->getInput('pageEditTitle', helper::FILTER_ID, true) !== null && $this->getInput('pageEditTitle') !== '' ){
- // Génére l'ID si le titre de la page a changé
- if ( $this->getInput('pageEditTitle') !== $this->getData(['page',$this->getUrl(2),'title']) ) {
- $pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true);
- } else {
- $pageId = $this->getUrl(2);
- }
- // un dossier existe du même nom (erreur en cas de redirection)
- if (file_exists($pageId)) {
- $pageId = uniqid($pageId);
- }
- // Si l'id a changée
- if ($pageId !== $this->getUrl(2)) {
- // Incrémente le nouvel id de la page
- $pageId = helper::increment($pageId, $this->getData(['page']));
- $pageId = helper::increment($pageId, self::$coreModuleIds);
- $pageId = helper::increment($pageId, self::$moduleIds);
- // Met à jour les enfants
- foreach($this->getHierarchy($this->getUrl(2),null) as $childrenPageId) {
- $this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
- }
- // Change l'id de page dans les données des modules
- if ($this->getData(['module', $this->getUrl(2)]) !== null ) {
- $this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
- $this->deleteData(['module', $this->getUrl(2)]);
- // Renommer le dossier du module
- $moduleId = $this->getData(['page',$this->getUrl(2),'moduleId']);
- $modulesData = helper::getModules();
- if (is_dir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2))) {
- // Placer la feuille de style dans un dossier au nom de la nouvelle instance
- mkdir( $modulesData[$moduleId]['dataDirectory']. $pageId, 0755 );
- copy( $modulesData[$moduleId]['dataDirectory']. $this->getUrl(2), $modulesData[$moduleId]['dataDirectory']. $pageId);
- $this->removeDir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2));
- // Mettre à jour le nom de la feuille de style
- $this->setData(['module',$pageId,'theme','style', $modulesData[$moduleId]['dataDirectory']. $pageId]);
- }
- }
- // Si la page correspond à la page d'accueil, change l'id dans la configuration du site
- if($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) {
- $this->setData(['locale', 'homePageId', $pageId]);
- }
- }
- // Supprime les données du module en cas de changement de module
- if($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
- $this->deleteData(['module', $pageId]);
- }
- // Supprime l'ancienne page si l'id a changée
- if($pageId !== $this->getUrl(2)) {
- $this->deleteData(['page', $this->getUrl(2)]);
- unlink (self::DATA_DIR . self::$i18n . '/content/' . $this->getUrl(2) . '.html');
- }
- // Traitement des pages spéciales affectées dans la config :
- if ($this->getUrl(2) === $this->getData(['locale', 'legalPageId']) ) {
- $this->setData(['locale','legalPageId', $pageId]);
- }
- if ($this->getUrl(2) === $this->getData(['locale', 'searchPageId']) ) {
- $this->setData(['locale','searchPageId', $pageId]);
- }
- if ($this->getUrl(2) === $this->getData(['locale', 'page404']) ) {
- $this->setData(['locale','page404', $pageId]);
- }
- if ($this->getUrl(2) === $this->getData(['locale', 'page403']) ) {
- $this->setData(['locale','page403', $pageId]);
- }
- if ($this->getUrl(2) === $this->getData(['locale', 'page302']) ) {
- $this->setData(['locale','page302', $pageId]);
- }
- // Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
- $lastPosition = 1;
- $hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
- $position = $this->getInput('pageEditPosition', helper::FILTER_INT);
- foreach($hierarchy as $hierarchyPageId) {
- // Ignore la page en cours de modification
- if($hierarchyPageId === $this->getUrl(2)) {
- continue;
- }
- // Incrémente de +1 pour laisser la place à la position de la page en cours de modification
- if($lastPosition === $position) {
- $lastPosition++;
- }
- // Change la position
- $this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
- // Incrémente pour la prochaine position
- $lastPosition++;
- }
- if ($this->getinput('pageEditBlock') !== 'bar') {
- $barLeft = $this->getinput('pageEditBarLeft');
- $barRight = $this->getinput('pageEditBarRight');
- $hideTitle = $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN);
-
- } else {
- // Une barre ne peut pas avoir de barres
- $barLeft = "";
- $barRight = "";
- // Une barre est masquée
- $position = 0;
- $hideTitle = true;
- }
- // Modifie la page ou en crée une nouvelle si l'id a changé
- $this->setData([
- 'page',
- $pageId,
- [
- 'typeMenu' => $this->getinput('pageTypeMenu'),
- 'iconUrl' => $this->getinput('pageIconUrl'),
- 'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
- 'content' => $pageId . '.html',
- 'hideTitle' => $hideTitle,
- 'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN),
- 'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG),
- 'metaTitle' => $this->getInput('pageEditMetaTitle'),
- 'moduleId' => $this->getInput('pageEditModuleId'),
- 'modulePosition' => $this->getInput('configModulePosition'),
- 'parentPageId' => $this->getInput('pageEditParentPageId'),
- 'position' => $position,
- '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,
- 'displayMenu' => $this->getinput('pageEditDisplayMenu'),
- 'hideMenuSide' => $this->getinput('pageEditHideMenuSide', helper::FILTER_BOOLEAN),
- 'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
- 'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
- ]
- ]);
- // Creation du contenu de la page
- if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) {
- mkdir(self::DATA_DIR . self::$i18n . '/content', 0755);
- }
- $content = empty($this->getInput('pageEditContent', null)) ? '' : str_replace('', '
', $this->getInput('pageEditContent', null));
- //file_put_contents( self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html' , $content );
- $this->setPage($pageId , $content, self::$i18n);
- // Barre renommée : changement le nom de la barre dans les pages mères
- if ($this->getinput('pageEditBlock') === 'bar') {
- foreach ($this->getHierarchy() as $eachPageId=>$parentId) {
- if ($this->getData(['page',$eachPageId,'barRight']) === $this->getUrl(2)) {
- $this->setData(['page',$eachPageId,'barRight',$pageId]);
- }
- if ($this->getData(['page',$eachPageId,'barLeft']) === $this->getUrl(2)) {
- $this->setData(['page',$eachPageId,'barLeft',$pageId]);
- }
- foreach ($parentId as $childId) {
- if ($this->getData(['page',$childId,'barRight']) === $this->getUrl(2)) {
- $this->setData(['page',$childId,'barRight',$pageId]);
- }
- if ($this->getData(['page',$childId,'barLeft']) === $this->getUrl(2)) {
- $this->setData(['page',$childId,'barLeft',$pageId]);
- }
- }
- }
- }
- // Met à jour le site map
- $this->createSitemap('all');
- // Redirection vers la configuration
- if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . $pageId . '/config',
- 'state' => true
- ]);
- }
- // Redirection vers la page
- else {
- // Valeurs en sortie
- $this->addOutput([
- 'redirect' => helper::baseUrl() . $pageId,
- 'notification' => 'Modifications enregistrées',
- 'state' => true
- ]);
- }
- }
- }
- self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayCollumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
- foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
- 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']);
- }
- }
- // Mise à jour de la liste des pages pour TinyMCE
- $this->pages2Json();
- // Valeurs en sortie
- $this->addOutput([
- 'title' => $this->getData(['page', $this->getUrl(2), 'title']),
- 'vendor' => [
- 'tinymce'
- ],
- 'view' => 'edit'
- ]);
- }
- }
-}
+
+ * @copyright Copyright (C) 2008-2018, Rémi Jean
+ * @author Frédéric Tempez
+ * @copyright Copyright (C) 2018-2021, Frédéric Tempez
+ * @license GNU General Public License, version 3
+ * @link http://zwiicms.fr/
+ */
+
+class page extends common {
+
+ public static $actions = [
+ 'add' => self::GROUP_MODERATOR,
+ 'delete' => self::GROUP_MODERATOR,
+ 'edit' => self::GROUP_MODERATOR,
+ 'duplicate' => self::GROUP_MODERATOR
+ ];
+ public static $pagesNoParentId = [
+ '' => 'Aucune'
+ ];
+ public static $pagesBarId = [
+ '' => 'Aucune'
+ ];
+ public static $moduleIds = [];
+
+ public static $typeMenu = [
+ 'text' => 'Texte',
+ 'icon' => 'Icône',
+ 'icontitle' => 'Icône avec bulle de texte'
+ ];
+ // Position du module
+ public static $modulePosition = [
+ 'bottom' => 'En bas',
+ 'top' => 'En haut',
+ 'free' => 'Libre'
+ ];
+ public static $pageBlocks = [
+ '12' => 'Page standard',
+ '4-8' => 'Barre 1/3 - page 2/3',
+ '8-4' => 'Page 2/3 - barre 1/3',
+ '3-9' => 'Barre 1/4 - page 3/4',
+ '9-3' => 'Page 3/4 - barre 1/4',
+ '3-6-3' => 'Barre 1/4 - page 1/2 - barre 1/4',
+ '2-7-3' => 'Barre 2/12 - page 7/12 - barre 3/12 ',
+ '3-7-2' => 'Barre 3/12 - page 7/12 - barre 2/12 ',
+ 'bar' => 'Barre latérale'
+ ];
+ public static $displayMenu = [
+ 'none' => 'Aucun',
+ 'parents' => 'Le menu',
+ 'children' => 'Le sous-menu de la page parente'
+ ];
+
+
+ /**
+ * Duplication
+ */
+ public function duplicate() {
+ // Adresse sans le token
+ $url = explode('&',$this->getUrl(2));
+ // La page n'existe pas
+ if($this->getData(['page', $url[0]]) === null) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'access' => false
+ ]);
+ } // Jeton incorrect
+ elseif(!isset($_GET['csrf'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Jeton invalide'
+ ]);
+ }
+ elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Suppression non autorisée'
+ ]);
+ }
+ // Duplication de la page
+ $pageTitle = $this->getData(['page',$url[0],'title']);
+ $pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
+ $pageId = helper::increment($pageId, self::$coreModuleIds);
+ $pageId = helper::increment($pageId, self::$moduleIds);
+ $data = $this->getData([
+ 'page',
+ $url[0]
+ ]);
+ // Ecriture
+ $this->setData (['page',$pageId,$data]);
+ $notification = 'La page a été dupliquée';
+ // Duplication du module présent
+ if ($this->getData(['page',$url[0],'moduleId'])) {
+ $data = $this->getData([
+ 'module',
+ $url[0]
+ ]);
+ // Ecriture
+ $this->setData (['module',$pageId,$data]);
+ $notification = 'La page et son module ont été dupliqués';
+ }
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $pageId,
+ 'notification' => $notification,
+ 'state' => true
+ ]);
+ }
+
+
+ /**
+ * Création
+ */
+ public function add() {
+ $pageTitle = 'Nouvelle page';
+ $pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
+ $this->setData([
+ 'page',
+ $pageId,
+ [
+ 'typeMenu' => 'text',
+ 'iconUrl' => '',
+ 'disable' => false,
+ 'content' => $pageId . '.html',
+ 'hideTitle' => false,
+ 'breadCrumb' => false,
+ 'metaDescription' => '',
+ 'metaTitle' => '',
+ 'moduleId' => '',
+ 'parentPageId' => '',
+ 'modulePosition' => 'bottom',
+ 'position' => 0,
+ 'group' => self::GROUP_VISITOR,
+ 'targetBlank' => false,
+ 'title' => $pageTitle,
+ 'shortTitle' => $pageTitle,
+ 'block' => '12',
+ 'barLeft' => '',
+ 'barRight' => '',
+ 'displayMenu' => '0',
+ 'hideMenuSide' => false,
+ 'hideMenuHead' => false,
+ 'hideMenuChildren' => false
+ ]
+ ]);
+ // Creation du contenu de la page
+ if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) {
+ mkdir(self::DATA_DIR . self::$i18n . '/content', 0755);
+ }
+ //file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html', 'Contenu de votre nouvelle page.
');
+ $this->setPage($pageId, 'Contenu de votre nouvelle page.
', self::$i18n);
+ // Met à jour le site map
+ $this->createSitemap('all');
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . $pageId,
+ 'notification' => 'Nouvelle page créée',
+ 'state' => true
+ ]);
+ }
+
+ /**
+ * Suppression
+ */
+ public function delete() {
+ // $url prend l'adresse sans le token
+ $url = explode('&',$this->getUrl(2));
+ // La page n'existe pas
+ if($this->getData(['page', $url[0]]) === null) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'access' => false
+ ]);
+ } // Jeton incorrect
+ elseif(!isset($_GET['csrf'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Jeton invalide'
+ ]);
+ }
+ elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Suppression non autorisée'
+ ]);
+ }
+ // Impossible de supprimer la page d'accueil
+ elseif($url[0] === $this->getData(['locale', 'homePageId'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Impossible de supprimer la page de recherche affectée
+ elseif($url[0] === $this->getData(['locale', 'searchPageId'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Impossible de supprimer la page des mentions légales affectée
+ elseif($url[0] === $this->getData(['locale', 'legalPageId'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Impossible de supprimer la page des mentions légales affectée
+ elseif($url[0] === $this->getData(['locale', 'page404'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Impossible de supprimer la page des mentions légales affectée
+ elseif($url[0] === $this->getData(['locale', 'page403'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Impossible de supprimer la page des mentions légales affectée
+ elseif($url[0] === $this->getData(['locale', 'page302'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'config',
+ 'notification' => 'Désactiver la page dans la configuration avant de la supprimer'
+ ]);
+ }
+ // Jeton incorrect
+ elseif(!isset($_GET['csrf'])) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Jeton invalide'
+ ]);
+ }
+ elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Suppression non autorisée'
+ ]);
+ }
+ // Impossible de supprimer une page contenant des enfants
+ elseif($this->getHierarchy($url[0],null)) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
+ 'notification' => 'Impossible de supprimer une page contenant des enfants'
+ ]);
+ }
+ // Suppression
+ else {
+
+ // Effacer le dossier du module
+ $moduleId = $this->getData(['page',$url[0],'moduleId']);
+ $modulesData = helper::getModules();
+ if (is_dir($modulesData[$moduleId]['dataDirectory']. $url[0])) {
+ $this->removeDir( $modulesData[$moduleId]['dataDirectory']. $url[0] );
+ }
+ // Effacer la page
+ $this->deleteData(['page', $url[0]]);
+ if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html')) {
+ unlink(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html');
+ }
+ $this->deleteData(['module', $url[0]]);
+ // Met à jour le site map
+ $this->createSitemap('all');
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl(false),
+ 'notification' => 'Page supprimée',
+ 'state' => true
+ ]);
+ }
+ }
+
+
+ /**
+ * Édition
+ */
+ public function edit() {
+ // La page n'existe pas
+ if($this->getData(['page', $this->getUrl(2)]) === null) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'access' => false
+ ]);
+ }
+ // La page existe
+ else {
+ // Soumission du formulaire
+ if($this->isPost()) {
+ // Si le Title n'est pas vide, premier test pour positionner la notification du champ obligatoire
+ if( $this->getInput('pageEditTitle', helper::FILTER_ID, true) !== null && $this->getInput('pageEditTitle') !== '' ){
+ // Génére l'ID si le titre de la page a changé
+ if ( $this->getInput('pageEditTitle') !== $this->getData(['page',$this->getUrl(2),'title']) ) {
+ $pageId = $this->getInput('pageEditTitle', helper::FILTER_ID, true);
+ } else {
+ $pageId = $this->getUrl(2);
+ }
+ // un dossier existe du même nom (erreur en cas de redirection)
+ if (file_exists($pageId)) {
+ $pageId = uniqid($pageId);
+ }
+ // Si l'id a changée
+ if ($pageId !== $this->getUrl(2)) {
+ // Incrémente le nouvel id de la page
+ $pageId = helper::increment($pageId, $this->getData(['page']));
+ $pageId = helper::increment($pageId, self::$coreModuleIds);
+ $pageId = helper::increment($pageId, self::$moduleIds);
+ // Met à jour les enfants
+ foreach($this->getHierarchy($this->getUrl(2),null) as $childrenPageId) {
+ $this->setData(['page', $childrenPageId, 'parentPageId', $pageId]);
+ }
+ // Change l'id de page dans les données des modules
+ if ($this->getData(['module', $this->getUrl(2)]) !== null ) {
+ $this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]);
+ $this->deleteData(['module', $this->getUrl(2)]);
+ // Renommer le dossier du module
+ $moduleId = $this->getData(['page',$this->getUrl(2),'moduleId']);
+ $modulesData = helper::getModules();
+ if (is_dir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2))) {
+ // Placer la feuille de style dans un dossier au nom de la nouvelle instance
+ mkdir( $modulesData[$moduleId]['dataDirectory']. $pageId, 0755 );
+ copy( $modulesData[$moduleId]['dataDirectory']. $this->getUrl(2), $modulesData[$moduleId]['dataDirectory']. $pageId);
+ $this->removeDir($modulesData[$moduleId]['dataDirectory']. $this->getUrl(2));
+ // Mettre à jour le nom de la feuille de style
+ $this->setData(['module',$pageId,'theme','style', $modulesData[$moduleId]['dataDirectory']. $pageId]);
+ }
+ }
+ // Si la page correspond à la page d'accueil, change l'id dans la configuration du site
+ if($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) {
+ $this->setData(['locale', 'homePageId', $pageId]);
+ }
+ }
+ // Supprime les données du module en cas de changement de module
+ if($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
+ $this->deleteData(['module', $pageId]);
+ }
+ // Supprime l'ancienne page si l'id a changée
+ if($pageId !== $this->getUrl(2)) {
+ $this->deleteData(['page', $this->getUrl(2)]);
+ unlink (self::DATA_DIR . self::$i18n . '/content/' . $this->getUrl(2) . '.html');
+ }
+ // Traitement des pages spéciales affectées dans la config :
+ if ($this->getUrl(2) === $this->getData(['locale', 'legalPageId']) ) {
+ $this->setData(['locale','legalPageId', $pageId]);
+ }
+ if ($this->getUrl(2) === $this->getData(['locale', 'searchPageId']) ) {
+ $this->setData(['locale','searchPageId', $pageId]);
+ }
+ if ($this->getUrl(2) === $this->getData(['locale', 'page404']) ) {
+ $this->setData(['locale','page404', $pageId]);
+ }
+ if ($this->getUrl(2) === $this->getData(['locale', 'page403']) ) {
+ $this->setData(['locale','page403', $pageId]);
+ }
+ if ($this->getUrl(2) === $this->getData(['locale', 'page302']) ) {
+ $this->setData(['locale','page302', $pageId]);
+ }
+ // Si la page est une page enfant, actualise les positions des autres enfants du parent, sinon actualise les pages sans parents
+ $lastPosition = 1;
+ $hierarchy = $this->getInput('pageEditParentPageId') ? $this->getHierarchy($this->getInput('pageEditParentPageId')) : array_keys($this->getHierarchy());
+ $position = $this->getInput('pageEditPosition', helper::FILTER_INT);
+ foreach($hierarchy as $hierarchyPageId) {
+ // Ignore la page en cours de modification
+ if($hierarchyPageId === $this->getUrl(2)) {
+ continue;
+ }
+ // Incrémente de +1 pour laisser la place à la position de la page en cours de modification
+ if($lastPosition === $position) {
+ $lastPosition++;
+ }
+ // Change la position
+ $this->setData(['page', $hierarchyPageId, 'position', $lastPosition]);
+ // Incrémente pour la prochaine position
+ $lastPosition++;
+ }
+ if ($this->getinput('pageEditBlock') !== 'bar') {
+ $barLeft = $this->getinput('pageEditBarLeft');
+ $barRight = $this->getinput('pageEditBarRight');
+ $hideTitle = $this->getInput('pageEditHideTitle', helper::FILTER_BOOLEAN);
+
+ } else {
+ // Une barre ne peut pas avoir de barres
+ $barLeft = "";
+ $barRight = "";
+ // Une barre est masquée
+ $position = 0;
+ $hideTitle = true;
+ }
+ // Modifie la page ou en crée une nouvelle si l'id a changé
+ $this->setData([
+ 'page',
+ $pageId,
+ [
+ 'typeMenu' => $this->getinput('pageTypeMenu'),
+ 'iconUrl' => $this->getinput('pageIconUrl'),
+ 'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN),
+ 'content' => $pageId . '.html',
+ 'hideTitle' => $hideTitle,
+ 'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN),
+ 'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG),
+ 'metaTitle' => $this->getInput('pageEditMetaTitle'),
+ 'moduleId' => $this->getInput('pageEditModuleId'),
+ 'modulePosition' => $this->getInput('configModulePosition'),
+ 'parentPageId' => $this->getInput('pageEditParentPageId'),
+ 'position' => $position,
+ '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,
+ 'displayMenu' => $this->getinput('pageEditDisplayMenu'),
+ 'hideMenuSide' => $this->getinput('pageEditHideMenuSide', helper::FILTER_BOOLEAN),
+ 'hideMenuHead' => $this->getinput('pageEditHideMenuHead', helper::FILTER_BOOLEAN),
+ 'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
+ ]
+ ]);
+ // Creation du contenu de la page
+ if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) {
+ mkdir(self::DATA_DIR . self::$i18n . '/content', 0755);
+ }
+ $content = empty($this->getInput('pageEditContent', null)) ? '' : str_replace('', '
', $this->getInput('pageEditContent', null));
+ //file_put_contents( self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html' , $content );
+ $this->setPage($pageId , $content, self::$i18n);
+ // Barre renommée : changement le nom de la barre dans les pages mères
+ if ($this->getinput('pageEditBlock') === 'bar') {
+ foreach ($this->getHierarchy() as $eachPageId=>$parentId) {
+ if ($this->getData(['page',$eachPageId,'barRight']) === $this->getUrl(2)) {
+ $this->setData(['page',$eachPageId,'barRight',$pageId]);
+ }
+ if ($this->getData(['page',$eachPageId,'barLeft']) === $this->getUrl(2)) {
+ $this->setData(['page',$eachPageId,'barLeft',$pageId]);
+ }
+ foreach ($parentId as $childId) {
+ if ($this->getData(['page',$childId,'barRight']) === $this->getUrl(2)) {
+ $this->setData(['page',$childId,'barRight',$pageId]);
+ }
+ if ($this->getData(['page',$childId,'barLeft']) === $this->getUrl(2)) {
+ $this->setData(['page',$childId,'barLeft',$pageId]);
+ }
+ }
+ }
+ }
+ // Met à jour le site map
+ $this->createSitemap('all');
+ // Redirection vers la configuration
+ if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . $pageId . '/config',
+ 'state' => true
+ ]);
+ }
+ // Redirection vers la page
+ else {
+ // Valeurs en sortie
+ $this->addOutput([
+ 'redirect' => helper::baseUrl() . $pageId,
+ 'notification' => 'Modifications enregistrées',
+ 'state' => true
+ ]);
+ }
+ }
+ }
+ self::$moduleIds = array_merge( ['' => 'Aucun'] , helper::arrayCollumn(helper::getModules(),'realName','SORT_ASC')); // Pages sans parent
+ foreach($this->getHierarchy() as $parentPageId => $childrenPageIds) {
+ 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']);
+ }
+ }
+ // Mise à jour de la liste des pages pour TinyMCE
+ $this->pages2Json();
+ // Valeurs en sortie
+ $this->addOutput([
+ 'title' => $this->getData(['page', $this->getUrl(2), 'title']),
+ 'vendor' => [
+ 'tinymce'
+ ],
+ 'view' => 'edit'
+ ]);
+ }
+ }
+}
diff --git a/core/module/page/view/edit/edit.css b/core/module/page/view/edit/edit.css
index b6d01ef4..eed0906f 100755
--- a/core/module/page/view/edit/edit.css
+++ b/core/module/page/view/edit/edit.css
@@ -1,41 +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-2021, Frédéric Tempez
- * @license GNU General Public License, version 3
- * @link http://zwiicms.fr/
- */
-
-/** NE PAS EFFACER
-* admin.css
-*/
-
-#seo > .blockContainer,
-#advanced > .blockContainer {
- display: none;
-}
-
-#info .zwiico-minus-circled,
-#layout .zwiico-minus-circled,
-#location .zwiico-minus-circled {
- display: inline;
-}
-
-.zwiico-minus-circled,
-#info .zwiico-plus-circled,
-#layout .zwiico-plus-circled,
-#location .zwiico-plus-circled {
- display: none;
-}
-
-
-.zwiico-minus-circled,
-.zwiico-plus-circled {
- cursor: pointer;
-}
\ No newline at end of file
+/**
+ * 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-2021, Frédéric Tempez
+ * @license GNU General Public License, version 3
+ * @link http://zwiicms.fr/
+ */
+
+/** NE PAS EFFACER
+* admin.css
+*/
+
diff --git a/core/module/page/view/edit/edit.js.php b/core/module/page/view/edit/edit.js.php
index 8efa1c53..d661b02b 100644
--- a/core/module/page/view/edit/edit.js.php
+++ b/core/module/page/view/edit/edit.js.php
@@ -1,620 +1,578 @@
-/**
- * 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
- * @authorFrédéric Tempez
- * @copyright Copyright (C) 2018-2021, Frédéric Tempez
- * @license GNU General Public License, version 3
- * @link http://zwiicms.fr/
- */
-
-/**
- * Confirmation de suppression
- */
-$("#pageEditDelete").on("click", function() {
- var _this = $(this);
- return core.confirm("Confirmez-vous la suppression de cette page ?", function() {
- $(location).attr("href", _this.attr("href"));
- });
-});
-
-$("#pageEditModuleId").on("click", function() {
- protectModule();
-});
-
-function protectModule() {
- var oldModule = $("#pageEditModuleIdOld").val();
- var oldModuleText = $("#pageEditModuleIdOldText").val();
- var newModule = $("#pageEditModuleId").val();
- if ( oldModule !== "" &&
- oldModule !== newModule) {
- var _this = $(this);
- core.confirm("Les données du module " + oldModuleText + " seront effacées. Confirmez-vous ?",
- function() {
- $(location).attr("href", _this.attr("href"));
- return true;
- },
- function() {
- $("#pageEditModuleId").val(oldModule);
- return false;
- }
- );
- }
-}
-
-
-/**
-* Paramètres par défaut au chargement
-*/
-$( document ).ready(function() {
-
- /**
- * Initialisation des blocs
- */
-
- var i = ["info", "layout", "setup", "location", "advanced", "seo" ];
- $.each(i,function(e) {
- if (getCookie(i[e]) === "true") {
- $("#" + i[e]).find(".zwiico-plus-circled").hide();
- $("#" + i[e]).find(".zwiico-minus-circled").show();
- $("#" + i[e]).find(".blockContainer").show();
- }
- });
-
- /**
- * Blocs dépliants
- *
- * Sauvegarder la position des blocs
- * true = bloc déplié
- */
-
- $("div .block").click(function(e) {
- $(this).find(".zwiico-plus-circled").toggle();
- $(this).find(".zwiico-minus-circled").toggle();
- $(this).find(".blockContainer").slideToggle();
- /*
- * Sauvegarder la position des blocs
- * true = bloc déplié
- */
- document.cookie = $(this).attr('id') + "=" + $(this).find(".zwiico-minus").is(":visible") + ";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;SameSite=Lax";
- }).on("click", "span > input, input, textarea, label, option, button, a:not(.inputFile) , .blockContainer", function(e) {
- // Empêcher les déclenchements dans les blocs
- e.stopPropagation();
- });
-
-
- /*
- * Enleve le menu fixe en édition de page
- */
- $("nav").removeAttr('id');
-
- /**
- * Bloque/Débloque le bouton de configuration au changement de module
- * Affiche ou masque la position du module selon le call_user_func
- */
- if($("#pageEditModuleId").val() === "") {
- $("#pageEditModuleConfig").addClass("disabled");
- $("#pageEditContentContainer").hide();
- }
- else {
- $("#pageEditModuleConfig").removeClass("disabled");
- $("#pageEditContentContainer").hide();
- $("#pageEditBlock option[value='bar']").remove();
- }
-
- /**
- * Masquer et affiche la sélection de position du module
- */
- if( $("#pageEditModuleId").val() === "redirection" ||
- $("#pageEditModuleId").val() === "" ) {
- $("#configModulePositionWrapper").removeClass("disabled");
- $("#configModulePositionWrapper").slideUp();
- }
- else {
- $("#configModulePositionWrapper").addClass("disabled");
- $("#configModulePositionWrapper").slideDown();
- }
-
-
- /**
- * Masquer et démasquer le contenu pour les modules code et redirection
- */
- if( $("#pageEditModuleId").val() === "redirection") {
- $("#pageEditContentWrapper").removeClass("disabled");
- $("#pageEditContentWrapper").slideUp();
- } else {
- $("#pageEditContentWrapper").addClass("disabled");
- $("#pageEditContentWrapper").slideDown();
- }
- /**
- * Masquer et démasquer le masquage du titre pour le module redirection
- */
- if( $("#pageEditModuleId").val() === "redirection" ) {
- $("#pageEditHideTitleWrapper").removeClass("disabled");
- $("#pageEditHideTitleWrapper").hide();
- $("#pageEditBlockLayout").removeClass("disabled");
- $("#pageEditBlockLayout").hide();
-
- } else {
- $("#pageEditHideTitleWrapper").addClass("disabled");
- $("#pageEditHideTitleWrapper").show();
- $("#pageEditBlockLayout").addClass("disabled");
- $("#pageEditBlockLayout").show();
- }
- /**
- * Masquer et démasquer la sélection des barres
- */
- 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":
- case "2-7-3":
- case "3-7-2":
- $("#pageEditBarLeftWrapper").addClass("disabled");
- $("#pageEditBarLeftWrapper").slideDown();
- $("#pageEditBarRightWrapper").addClass("disabled");
- $("#pageEditBarRightWrapper").slideDown();
- break;
- };
- if ($("#pageEditBlock").val() === "bar") {
- $("#pageEditMenu").removeClass("disabled");
- $("#pageEditMenu").hide();
- $("#pageEditHideTitleWrapper").removeClass("disabled");
- $("#pageEditHideTitleWrapper").slideUp();
- $("#pageEditbreadCrumbWrapper").removeClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideUp();
- $("#pageEditModuleIdWrapper").removeClass("disabled");
- $("#pageEditModuleIdWrapper").slideUp();
- $("#pageEditModuleConfig").removeClass("disabled");
- $("#pageEditModuleConfig").slideUp();
- $("#pageEditDisplayMenuWrapper").addClass("disabled");
- $("#pageEditDisplayMenuWrapper").slideDown();
- $("#pageTypeMenuWrapper").removeClass("disabled");
- $("#pageTypeMenuWrapper").slideUp();
- $("#pageEditSeoWrapper").removeClass("disabled");
- $("#pageEditSeoWrapper").slideUp();
- $("#pageEditAdvancedWrapper").removeClass("disabled");
- $("#pageEditAdvancedWrapper").slideUp();
- /*
- $("#pageEditBlockLayout").removeClass("col6");
- $("#pageEditBlockLayout").addClass("col12");
- */
-
- } else {
- $("#pageEditDisplayMenuWrapper").removeClass("disabled");
- $("#pageEditDisplayMenuWrapper").slideUp();
- }
-
- /**
- * Masquer ou afficher le chemin de fer
- * Quand le titre est masqué
- */
- if ($("input[name=pageEditHideTitle]").is(':checked') ||
- $("#pageEditParentPageId").val() === "" ) {
-
- $("#pageEditbreadCrumbWrapper").removeClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideUp();
- } else {
- if ($("#pageEditParentPageId").val() !== "") {
- $("#pageEditbreadCrumbWrapper").addClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideDown();
- }
- }
-
- /**
- * Masquer ou afficher la sélection de l'icône
- */
- if ($("#pageTypeMenu").val() !== "text") {
- $("#pageIconUrlWrapper").addClass("disabled");
- $("#pageIconUrlWrapper").slideDown();
- } else {
- $("#pageIconUrlWrapper").removeClass("disabled");
- $("#pageIconUrlWrapper").slideUp();
- }
-
- /**
- * Cache les options de masquage dans les menus quand la page n'est pas affichée.
- */
- if ($("#pageEditPosition").val() === "0" ) {
- $("#pageEditHideMenuSideWrapper").removeClass("disabled");
- $("#pageEditHideMenuSideWrapper").slideUp();
- } else {
- $("#pageEditHideMenuSideWrapper").addClass("disabled");
- $("#pageEditHideMenuSideWrapper").slideDown();
- }
-
- /**
- * Cache l'option de masquage des pages enfants
- */
- if ($("#pageEditParentPageId").val() !== "") {
- $("#pageEditHideMenuChildrenWrapper").removeClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideUp();
- } else {
- $("#pageEditHideMenuChildrenWrapper").addClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideDown();
- }
-
- /**
- * Cache le l'option "ne pas afficher les pages enfants dans le menu horizontal" lorsque la page est désactivée
- */
- if ($("#pageEditDisable").is(':checked') ) {
- $("#pageEditHideMenuChildrenWrapper").removeClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideUp();
- } else {
- $("#pageEditHideMenuChildrenWrapper").addClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideDown();
- }
-
-});
-
-
-
-/**
- * Cache le l'option "ne pas afficher les pages enfants dans le menu horizontal" lorsque la page est désactivée
- */
-var pageEditDisableDOM = $("#pageEditDisable");
-pageEditDisableDOM.on("change", function() {
- if ($(this).is(':checked') ) {
- $("#pageEditHideMenuChildrenWrapper").removeClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideUp();
- $("#pageEditHideMenuChildren").prop("checked", false);
- } else {
- $("#pageEditHideMenuChildrenWrapper").addClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideDown();
- }
-});
-
-
-/**
-* Cache les options de masquage dans les menus quand la page n'est pas affichée.
-*/
-var pageEditPositionDOM = $("#pageEditPosition");
-pageEditPositionDOM.on("change", function() {
- if ($(this).val() === "0" ) {
- $("#pageEditHideMenuSideWrapper").removeClass("disabled");
- $("#pageEditHideMenuSideWrapper").slideUp();
- } else {
- $("#pageEditHideMenuSideWrapper").addClass("disabled");
- $("#pageEditHideMenuSideWrapper").slideDown();
- }
-});
-
-/**
- * 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();
- $("#pageEditBlock").append('');
- }
- else {
- $("#pageEditModuleConfig").removeClass("disabled");
- $("#pageEditContentContainer").slideUp();
- $("#pageEditBlock option[value='bar']").remove();
- }
-});
-
-
-
-/**
- * Masquer et affiche la sélection de position du module
- *
- * */
-var pageEditModuleIdDOM = $("#pageEditModuleId");
-pageEditModuleIdDOM.on("change", function() {
- if( $(this).val() === "redirection" ||
- $(this).val() === "") {
- $("#configModulePositionWrapper").removeClass("disabled");
- $("#configModulePositionWrapper").slideUp();
- }
- else {
- $("#configModulePositionWrapper").addClass("disabled");
- $("#configModulePositionWrapper").slideDown();
- }
-});
-
-
-
-
-/**
- * Masquer et démasquer le contenu pour les modules code et redirection
- */
-var pageEditModuleIdDOM = $("#pageEditModuleId");
-pageEditModuleIdDOM.on("change", function() {
- if( $(this).val() === "redirection") {
- $("#pageEditContentWrapper").removeClass("disabled");
- $("#pageEditContentWrapper").slideUp();
- }
- else {
- $("#pageEditContentWrapper").addClass("disabled");
- $("#pageEditContentWrapper").slideDown();
- }
-});
-
-
-
-/**
- * Masquer et démasquer le masquage du titre pour le module redirection
- */
-var pageEditModuleIdDOM = $("#pageEditModuleId");
-pageEditModuleIdDOM.on("change", function() {
- if( $(this).val() === "redirection") {
- $("#pageEditHideTitleWrapper").removeClass("disabled");
- $("#pageEditHideTitleWrapper").slideUp();
- $("#pageEditBlockLayout").removeClass("disabled");
- $("#pageEditBlockLayout").slideUp();
- }
- else {
- $("#pageEditHideTitleWrapper").addClass("disabled");
- $("#pageEditHideTitleWrapper").slideDown();
- $("#pageEditBlockLayout").addClass("disabled");
- $("#pageEditBlockLayout").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":
- case "2-7-3":
- case "3-7-2":
- $("#pageEditBarLeftWrapper").addClass("disabled");
- $("#pageEditBarLeftWrapper").slideDown();
- $("#pageEditBarRightWrapper").addClass("disabled");
- $("#pageEditBarRightWrapper").slideDown();
- break;
- }
- if ($(this).val() === "bar") {
- $("#pageEditMenu").removeClass("disabled");
- $("#pageEditMenu").hide();
- $("#pageEditHideTitleWrapper").removeClass("disabled");
- $("#pageEditHideTitleWrapper").slideUp();
- $("#pageTypeMenuWrapper").removeClass("disabled");
- $("#pageTypeMenuWrapper").slideUp();
- $("#pageEditSeoWrapper").removeClass("disabled");
- $("#pageEditSeoWrapper").slideUp();
- $("#pageEditAdvancedWrapper").removeClass("disabled");
- $("#pageEditAdvancedWrapper").slideUp();
- $("#pageEditbreadCrumbWrapper").removeClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideUp();
- $("#pageEditModuleIdWrapper").removeClass("disabled");
- $("#pageEditModuleIdWrapper").slideUp();
- $("#pageEditModuleConfig").removeClass("disabled");
- $("#pageEditModuleConfig").slideUp();
- $("#pageEditDisplayMenuWrapper").addClass("disabled");
- $("#pageEditDisplayMenuWrapper").slideDown();
- /*
- $("#pageEditBlockLayout").removeClass("col6");
- $("#pageEditBlockLayout").addClass("col12");
- */
- } else {
- $("#pageEditMenu").addClass("disabled");
- $("#pageEditMenu").show();
- $("#pageEditHideTitleWrapper").addClass("disabled");
- $("#pageEditHideTitleWrapper").slideDown();
- $("#pageTypeMenuWrapper").addClass("disabled");
- $("#pageTypeMenuWrapper").slideDown();
- $("#pageEditSeoWrapper").addClass("disabled");
- $("#pageEditSeoWrapper").slideDown();
- $("#pageEditAdvancedWrapper").addClass("disabled");
- $("#pageEditAdvancedWrapper").slideDown();
- $("#pageEditModuleIdWrapper").addClass("disabled");
- $("#pageEditModuleIdWrapper").slideDown();
- $("#pageEditModuleConfig").slideDown();
- $("#pageEditDisplayMenuWrapper").removeClass("disabled");
- $("#pageEditDisplayMenuWrapper").slideUp();
- if ($("#pageEditParentPageId").val() !== "") {
- $("#pageEditbreadCrumbWrapper").addClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideDown();
- }
- if ($("#pageEditModuleId").val() === "") {
- $("#pageEditModuleConfig").addClass("disabled");
- } else {
- $("#pageEditModuleConfig").removeClass("disabled");
- }
- /*
- $("#pageEditBlockLayout").removeClass("col12");
- $("#pageEditBlockLayout").addClass("col6");
- */
- }
-});
-
-
-
-/**
- * Lire un cookie s'il existe
- */
-function getCookie(name) {
- var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
- return v ? v[2] : null;
-}
-
-
-/**
- * Masquer ou afficher le chemin de fer
- * Quand le titre est masqué
- */
-var pageEditHideTitleDOM = $("#pageEditHideTitle");
-pageEditHideTitleDOM.on("change", function() {
- if ($("input[name=pageEditHideTitle]").is(':checked')) {
- $("#pageEditbreadCrumbWrapper").removeClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideUp();
- } else {
- if ($("#pageEditParentPageId").val() !== "") {
- $("#pageEditbreadCrumbWrapper").addClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideDown();
- }
- }
-});
-
-
-/**
- * Masquer ou afficher le chemin de fer
- * Quand la page n'est pas mère et que le menu n'est pas masqué
- */
-var pageEditParentPageIdDOM = $("#pageEditParentPageId");
-pageEditParentPageIdDOM.on("change", function() {
- if ($(this).val() === "" &&
- !$('input[name=pageEditHideTitle]').is(':checked') ) {
- $("#pageEditbreadCrumbWrapper").removeClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideUp();
- } else {
- $("#pageEditbreadCrumbWrapper").addClass("disabled");
- $("#pageEditbreadCrumbWrapper").slideDown();
-
- }
- if ($(this).val() !== "") {
- $("#pageEditHideMenuChildrenWrapper").removeClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideUp();
- } else {
- $("#pageEditHideMenuChildrenWrapper").addClass("disabled");
- $("#pageEditHideMenuChildrenWrapper").slideDown();
- }
-});
-
-
-
-/**
- * Masquer ou afficher la sélection de l'icône
- */
-var pageTypeMenuDOM = $("#pageTypeMenu");
-pageTypeMenuDOM.on("change", function() {
- if ($(this).val() !== "text") {
- $("#pageIconUrlWrapper").addClass("disabled");
- $("#pageIconUrlWrapper").slideDown();
- } else {
- $("#pageIconUrlWrapper").removeClass("disabled");
- $("#pageIconUrlWrapper").slideUp();
- }
-});
-
-
-
-
-/**
- * Soumission du formulaire pour éditer le module
- */
-$("#pageEditModuleConfig").on("click", function() {
- $("#pageEditModuleRedirect").val(1);
- $("#pageEditForm").trigger("submit");
-});
-
-/**
- * Affiche les pages en fonction de la page parent dans le choix de la position
- */
-var hierarchy = getHierarchy()); ?>;
-
-var pages = getData(['page'])); ?>;
-
-
-// 9.0.07 corrige une mauvaise sélection d'une page orpheline avec enfant
-var positionInitial = getData(['page',$this->getUrl(2),"position"]); ?>;
-// 9.0.07
-$("#pageEditParentPageId").on("change", function() {
- var positionDOM = $("#pageEditPosition");
- positionDOM.empty().append(
- $("
'Publier'
+ 'value' => 'Publier',
+ 'uniqueSubmission' => true
]); ?>
diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php
index 3ef8006c..e4524ca1 100644
--- a/module/blog/view/edit/edit.php
+++ b/module/blog/view/edit/edit.php
@@ -19,7 +19,8 @@
'Publier'
+ 'value' => 'Publier',
+ 'uniqueSubmission' => true,
]); ?>
diff --git a/module/news/view/add/add.php b/module/news/view/add/add.php
index b9119133..b4427b96 100644
--- a/module/news/view/add/add.php
+++ b/module/news/view/add/add.php
@@ -19,7 +19,8 @@
'Publier'
+ 'value' => 'Publier',
+ 'uniqueSubmission' => true
]); ?>
diff --git a/module/news/view/edit/edit.php b/module/news/view/edit/edit.php
index 9c739d32..927be92d 100644
--- a/module/news/view/edit/edit.php
+++ b/module/news/view/edit/edit.php
@@ -19,7 +19,8 @@
'Publier'
+ 'value' => 'Publier',
+ 'uniqueSubmission' => true
]); ?>