Bug page parent orpheline

This commit is contained in:
fredtempez 2022-01-11 13:35:26 +01:00
parent 3681fe6f30
commit 87cfd5bd15
2 changed files with 49 additions and 31 deletions

View File

@ -1,9 +1,10 @@
# Changelog # Changelog
## Version 11.2.03 ## Version 11.2.03
- Correction : - Corrections :
- Thème ; pied de page ; option pied de page fixe inopérante. - Thème ; pied de page ; option pied de page fixe inopérante.
- Modification : - Edition des pages orphelines : "Ne pas afficher" une page contenant des sous-pages provoquait un bug d'affichage dans le menu, la page était malgré tout affichée en fin de menu. Ce problème était causé par les pages enfants dont l'affichage n'était pas modifié. Le correctif cascade l'option "Ne pas afficher" aux sous-pages. La réciproque n'est pas appliquée, il faudra rendre visible les sous-pages d'une page parente qui devient à nouveau visible.
- Modifications :
- Thème ; pied de page ; options pied de page fixe et alignement avec le contenu déplacées dans les paramètres. - Thème ; pied de page ; options pied de page fixe et alignement avec le contenu déplacées dans les paramètres.
- Mise à jour en ligne, contrôle de la clé MD5 de l'archive update.tar.gz. - Mise à jour en ligne, contrôle de la clé MD5 de l'archive update.tar.gz.

View File

@ -407,6 +407,39 @@ class page extends common {
$position = 0; $position = 0;
$hideTitle = true; $hideTitle = true;
} }
// Une page parent devient orpheline, les pages enfants le devienne pour éviter une incohérence
if (
$position === 0 &&
$position !== $this->getData(['page', $this->getUrl(2), 'position']) &&
$this->getinput('pageEditBlock') !== 'bar'
) {
foreach ($this->getHierarchy($pageId) as $parentId=>$childId) {
if ($this->getData(['page',$childId,'parentPageId']) === $pageId) {
$this->setData(['page',$childId,'position', 0]);
}
}
}
// La page est une barre latérale qui a été renommée : changer le nom de la barre dans les pages qui l'utilisent
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]);
}
}
}
}
// Modifie la page ou en crée une nouvelle si l'id a changé // Modifie la page ou en crée une nouvelle si l'id a changé
$this->setData([ $this->setData([
'page', 'page',
@ -437,44 +470,28 @@ class page extends common {
'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN), 'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN),
] ]
]); ]);
// Creation du contenu de la page // Creation du contenu de la page
if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) {
mkdir(self::DATA_DIR . self::$i18n . '/content', 0755); mkdir(self::DATA_DIR . self::$i18n . '/content', 0755);
} }
$content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p>&nbsp;</p>', $this->getInput('pageEditContent', null)); $content = empty($this->getInput('pageEditContent', null)) ? '<p></p>' : str_replace('<p></p>', '<p>&nbsp;</p>', $this->getInput('pageEditContent', null));
//file_put_contents( self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html' , $content );
$this->setPage($pageId , $content, self::$i18n); $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 // Met à jour le site map
$this->createSitemap('all'); $this->createSitemap('all');
// Redirection vers la configuration // Redirection vers la configuration
if($this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)) { if(
// Valeurs en sortie $this->getInput('pageEditModuleRedirect', helper::FILTER_BOOLEAN)
$this->addOutput([ ) {
'redirect' => helper::baseUrl() . $pageId . '/config', // Valeurs en sortie
'state' => true $this->addOutput([
]); 'redirect' => helper::baseUrl() . $pageId . '/config',
} 'state' => true
// Redirection vers la page ]);
else { // Redirection vers la page
} else {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . $pageId, 'redirect' => helper::baseUrl() . $pageId,