Suppression du cookie pageLayouts

This commit is contained in:
Fred Tempez 2024-09-18 19:01:47 +02:00
parent c8be7f84a4
commit ecd0f5827a
6 changed files with 43 additions and 43 deletions

View File

@ -11,6 +11,7 @@
- Augmente la dimension des miniatures après le transfert dans RFM. - Augmente la dimension des miniatures après le transfert dans RFM.
- Search 3.3 n'effectue qu'une seule lecture du fichier module.json en prévention des bots agressifs. - Search 3.3 n'effectue qu'une seule lecture du fichier module.json en prévention des bots agressifs.
- Modification du contenu de robots.txt afin de n'autoriser que les moteurs de recherche et d'interdire les bots. - Modification du contenu de robots.txt afin de n'autoriser que les moteurs de recherche et d'interdire les bots.
- Suppression des cookies mémorisant le dernier onglet affiché dans l'édition de la page et dans la configuration du site. Cette information est désormais stockée dans la fiche de l'utilisateur connecté.
**Corrections : ** **Corrections : **
- Change les paramètres du cookie de consentement. - Change les paramètres du cookie de consentement.

View File

@ -1,4 +1,4 @@
# ZwiiCMS 13.3.05 # ZwiiCMS 13.4.00 version de test
Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation. Zwii est un CMS sans base de données (flat-file) qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.

View File

@ -1,4 +1,4 @@
# ZwiiCMS 13.4.00 version de test # ZwiiCMS 13.4.00 test version
Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge. Zwii is a database-less (flat-file) CMS that allows you to easily create and manage a web site without any programming knowledge.

View File

@ -23,7 +23,8 @@ class page extends common
'edit' => self::GROUP_EDITOR, 'edit' => self::GROUP_EDITOR,
'duplicate' => self::GROUP_EDITOR, 'duplicate' => self::GROUP_EDITOR,
'jsEditor' => self::GROUP_EDITOR, 'jsEditor' => self::GROUP_EDITOR,
'cssEditor' => self::GROUP_EDITOR 'cssEditor' => self::GROUP_EDITOR,
'register' => self::GROUP_EDITOR,
]; ];
public static $pagesNoParentId = [ public static $pagesNoParentId = [
'' => 'Aucune' '' => 'Aucune'
@ -714,4 +715,24 @@ class page extends common
}, $p); }, $p);
return json_encode($d); return json_encode($d);
} }
/**
* Stocke la variable dans les paramètres de l'utilisateur pour activer la tab à sa prochaine visite
* @return never
*/
public function register(): void
{
$this->setData([
'user',
$this->getUser('id'),
'view',
[
'page' => $this->getUrl(2)
]
]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $this->getUrl(3) . '/' . self::$siteContent,
]);
}
} }

View File

@ -15,7 +15,7 @@
/** /**
* Confirmation de suppression * Confirmation de suppression
*/ */
$("#pageEditDelete").on("click", function() { $("#pageEditDelete").on("click", function() {
var _this = $(this); var _this = $(this);
var message_delete = "<?php echo helper::translate('Confirmer la suppression de la page'); ?>"; var message_delete = "<?php echo helper::translate('Confirmer la suppression de la page'); ?>";
return core.confirm(message_delete, function() { return core.confirm(message_delete, function() {
@ -67,16 +67,18 @@ $( document ).ready(function() {
/** /**
* Sélection des onglets * Sélection des onglets
*/ */
var pageLayout = getCookie("pageLayout"); var pageLayout = "<?php echo $this->getData(['user', $this->getUser('id'), 'view', 'page']);?>";
if (pageLayout == null) { // Non défini, valeur par défaut
pageLayout = "content"; if (pageLayout == null) {
setCookie("pageLayout", "content"); pageLayout = "content";
} }
// Tout cacher
$("#pageEditContentContainer").hide(); $("#pageEditContentContainer").hide();
$("#pageEditExtensionContainer").hide(); $("#pageEditExtensionContainer").hide();
$("#pageEditPositionContainer").hide(); $("#pageEditPositionContainer").hide();
$("#pageEditLayoutContainer").hide(); $("#pageEditLayoutContainer").hide();
$("#pageEditPermissionContainer").hide(); $("#pageEditPermissionContainer").hide();
// Afficher la bonne tab
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Container").show(); $("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Container").show();
$("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Button").addClass("activeButton"); $("#pageEdit" + capitalizeFirstLetter(pageLayout) + "Button").addClass("activeButton");
@ -295,7 +297,6 @@ $( document ).ready(function() {
$("#PageEditPositionButton").removeClass("activeButton"); $("#PageEditPositionButton").removeClass("activeButton");
$("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton");
$("#pageEditPermissionButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton");
setCookie("pageLayout", "content");
}); });
$("#pageEditExtensionButton").on("click", function () { $("#pageEditExtensionButton").on("click", function () {
$("#pageEditContentContainer").hide(); $("#pageEditContentContainer").hide();
@ -308,7 +309,6 @@ $( document ).ready(function() {
$("#PageEditPositionButton").removeClass("activeButton"); $("#PageEditPositionButton").removeClass("activeButton");
$("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton");
$("#pageEditPermissionButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton");
setCookie("pageLayout", "extension");
}); });
$("#PageEditPositionButton").on("click", function () { $("#PageEditPositionButton").on("click", function () {
$("#pageEditContentContainer").hide(); $("#pageEditContentContainer").hide();
@ -321,7 +321,6 @@ $( document ).ready(function() {
$("#PageEditPositionButton").addClass("activeButton"); $("#PageEditPositionButton").addClass("activeButton");
$("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton");
$("#pageEditPermissionButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton");
setCookie("pageLayout", "position");
}); });
$("#pageEditLayoutButton").on("click", function () { $("#pageEditLayoutButton").on("click", function () {
$("#pageEditContentContainer").hide(); $("#pageEditContentContainer").hide();
@ -334,7 +333,6 @@ $( document ).ready(function() {
$("#PageEditPositionButton").removeClass("activeButton"); $("#PageEditPositionButton").removeClass("activeButton");
$("#pageEditLayoutButton").addClass("activeButton"); $("#pageEditLayoutButton").addClass("activeButton");
$("#pageEditPermissionButton").removeClass("activeButton"); $("#pageEditPermissionButton").removeClass("activeButton");
setCookie("pageLayout", "layout");
}); });
$("#pageEditPermissionButton").on("click", function () { $("#pageEditPermissionButton").on("click", function () {
$("#pageEditContentContainer").hide(); $("#pageEditContentContainer").hide();
@ -347,7 +345,6 @@ $( document ).ready(function() {
$("#pageEditPositionButton").removeClass("activeButton"); $("#pageEditPositionButton").removeClass("activeButton");
$("#pageEditLayoutButton").removeClass("activeButton"); $("#pageEditLayoutButton").removeClass("activeButton");
$("#pageEditPermissionButton").addClass("activeButton"); $("#pageEditPermissionButton").addClass("activeButton");
setCookie("pageLayout", "permission");
}); });
/** /**
@ -722,30 +719,6 @@ function buildPagesList(extraPosition) {
positionDOM.val(positionSelected); positionDOM.val(positionSelected);
}; };
/**
* Cookies
*/
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/; samesite=lax";
}
function getCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
// Define function to capitalize the first letter of a string // Define function to capitalize the first letter of a string
function capitalizeFirstLetter(string) { function capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1); return string.charAt(0).toUpperCase() + string.slice(1);

View File

@ -31,23 +31,28 @@
<div class="tab"> <div class="tab">
<?php echo template::button('pageEditContentButton', [ <?php echo template::button('pageEditContentButton', [
'value' => 'Contenu', 'value' => 'Contenu',
'class' => 'buttonTab' 'class' => 'buttonTab',
'href' => helper::baseUrl() . 'page/register/content/' . $this->geturl(2)
]); ?> ]); ?>
<?php echo template::button('PageEditPositionButton', [ <?php echo template::button('pageEditPositionButton', [
'value' => 'Menu', 'value' => 'Menu',
'class' => 'buttonTab' 'class' => 'buttonTab',
'href' => helper::baseUrl() . 'page/register/position/' . $this->geturl(2)
]); ?> ]); ?>
<?php echo template::button('pageEditExtensionButton', [ <?php echo template::button('pageEditExtensionButton', [
'value' => 'Extension', 'value' => 'Extension',
'class' => 'buttonTab' 'class' => 'buttonTab',
'href' => helper::baseUrl() . 'page/register/extension/' . $this->geturl(2)
]); ?> ]); ?>
<?php echo template::button('pageEditLayoutButton', [ <?php echo template::button('pageEditLayoutButton', [
'value' => 'Mise en page', 'value' => 'Mise en page',
'class' => 'buttonTab' 'class' => 'buttonTab',
'href' => helper::baseUrl() . 'page/register/layout/' . $this->geturl(2)
]); ?> ]); ?>
<?php echo template::button('pageEditPermissionButton', [ <?php echo template::button('pageEditPermissionButton', [
'value' => 'Permission', 'value' => 'Permission',
'class' => 'buttonTab' 'class' => 'buttonTab',
'href' => helper::baseUrl() . 'page/register/permission/' . $this->geturl(2)
]); ?> ]); ?>
</div> </div>