1.12.08 supprime le cookie relatif au contenu de site sans passer par main.php

This commit is contained in:
Fred Tempez 2024-09-17 17:52:57 +02:00
parent 9234b76062
commit 89e6e12748
3 changed files with 72 additions and 60 deletions

View File

@ -34,8 +34,6 @@
} ?> } ?>
</head> </head>
<body> <body>
<!-- Variable transmise à TinyMCE -->
<div id="zwii_site_content" data-variable="<?php echo htmlspecialchars(isset($_SESSION['ZWII_SITE_CONTENT']) ? $_SESSION['ZWII_SITE_CONTENT'] : 'home'); ?>"></div>
<!-- Barre d'administration --> <!-- Barre d'administration -->
<?php if ($this->getUser('group') > self::GROUP_MEMBER) : ?> <?php if ($this->getUser('group') > self::GROUP_MEMBER) : ?>
<?php $layout->showBar(); ?> <?php $layout->showBar(); ?>

View File

@ -1,4 +1,6 @@
<?php echo template::formOpen('pageEditForm'); ?> <?php echo template::formOpen('pageEditForm'); ?>
<!-- Variable transmise à TinyMCE -->
<div id="zwii_site_content" data-variable="<?php echo htmlspecialchars(isset($_SESSION['ZWII_SITE_CONTENT']) ? $_SESSION['ZWII_SITE_CONTENT'] : 'home'); ?>"></div>
<div class="row"> <div class="row">
<div class="col1"> <div class="col1">
<?php echo template::button('configModulesBack', [ <?php echo template::button('configModulesBack', [

View File

@ -10,25 +10,43 @@
if (typeof (privateKey) == 'undefined') { if (typeof (privateKey) == 'undefined') {
var privateKey = null; var privateKey = null;
}; };
// Récupération du thème de l'espace
var siteContent = document.getElementById('zwii_site_content').getAttribute('data-variable');
tinymce.init({ tinymce.init({
// Classe où appliquer l'éditeur // Classe où appliquer l'éditeur
selector: ".editorWysiwyg", selector: ".editorWysiwyg",
// Aperçu dans le pied de page // Aperçu dans le pied de page
setup: function (ed) { setup: function (editor) {
ed.on('change', function (e) { // Événement 'change'
if (ed.id === 'themeFooterText') { editor.on('change', function (e) {
if (editor.id === 'themeFooterText') {
$("#footerText").html(tinyMCE.get('themeFooterText').getContent()); $("#footerText").html(tinyMCE.get('themeFooterText').getContent());
} }
if (ed.id === 'themeHeaderText') { if (editor.id === 'themeHeaderText') {
$("#featureContent").html(tinyMCE.get('themeHeaderText').getContent()); $("#featureContent").html(tinyMCE.get('themeHeaderText').getContent());
} }
});
// Événement 'init'
// Cette partie permet de récupérer l'attribut de zwii_site_content qui contient le code de l'espace ouvert stocké dans la session php
editor.on('init', function () {
var siteContent = document.getElementById('zwii_site_content').getAttribute('data-variable');
siteContent = siteContent === null ? 'home' : siteContent;
// Charger le contenu CSS avec siteContent
var newStylesheetUrls = [
baseUrl + "core/layout/common.css",
baseUrl + "core/vendor/tinymce/content.css",
baseUrl + "site/data/" + siteContent + "/theme.css",
baseUrl + "site/data/custom.css"
];
// Supprime les anciennes feuilles de style si nécessaire
newStylesheetUrls.forEach(function(url) {
editor.dom.loadCSS(url); // Charger les nouvelles feuilles de style
});
}); });
}, },
// Langue // Langue
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'), language:"fr_FR",
// Plugins // Plugins
plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap textpattern", plugins: "advlist anchor autolink autoresize autosave codemirror contextmenu colorpicker fullscreen hr image imagetools link lists media paste searchreplace tabfocus table template textcolor visualblocks nonbreaking emoticons charmap textpattern",
// Contenu du menu // Contenu du menu
@ -37,7 +55,6 @@ tinymce.init({
edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' }, edit: { title: 'Edit', items: 'undo redo | cut copy paste pastetext | selectall | searchreplace' },
view: { title: 'View', items: 'code | visualaid visualblocks | fullscreen' }, view: { title: 'View', items: 'code | visualaid visualblocks | fullscreen' },
insert: { title: 'Insert', items: 'image link media pageembed template inserttable | charmap emoticons hr | nonbreaking anchor' }, insert: { title: 'Insert', items: 'image link media pageembed template inserttable | charmap emoticons hr | nonbreaking anchor' },
//format: { title: 'Format', items: 'bold italic underline strikethrough superscript subscript codeformat | styles blocks fontfamily fontsize align lineheight | forecolor backcolor | removeformat' },
tools: { title: 'Tools', items: '' }, tools: { title: 'Tools', items: '' },
table: { title: 'Table', items: 'inserttable | cell row column | tableprops deletetable' }, table: { title: 'Table', items: 'inserttable | cell row column | tableprops deletetable' },
help: { title: 'Help', items: 'help' } help: { title: 'Help', items: 'help' }
@ -58,7 +75,6 @@ tinymce.init({
saveCursorPosition: false, // Insert caret marker saveCursorPosition: false, // Insert caret marker
config: { // CodeMirror config object config: { // CodeMirror config object
fullscreen: true, fullscreen: true,
/*mode: 'application/x-httpd-php',*/
lineNumbers: true, lineNumbers: true,
indentUnit: 4, indentUnit: 4,
mode: "htmlmixed" mode: "htmlmixed"
@ -73,12 +89,8 @@ tinymce.init({
'addon/search/searchcursor.js', 'addon/search/searchcursor.js',
'addon/search/search.js', 'addon/search/search.js',
], ],
/* width: 800,
cssFiles: [ height: 500
'theme/cobalt.css',
],*/
width: 800, // Default value is 800
height: 500 // Default value is 550
}, },
// Cibles de la target // Cibles de la target
target_list: [ target_list: [
@ -91,7 +103,7 @@ tinymce.init({
{ title: 'Une popup (Lity)', value: 'data-lity' }, { title: 'Une popup (Lity)', value: 'data-lity' },
{ title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' } { title: 'Une galerie d\'images (SimpleLightbox)', value: 'gallery' }
], ],
// Titre des image // Titre des images
image_title: true, image_title: true,
// Pages internes // Pages internes
link_list: baseUrl + "core/vendor/tinymce/links.php", link_list: baseUrl + "core/vendor/tinymce/links.php",
@ -101,7 +113,7 @@ tinymce.init({
content_css: [ content_css: [
baseUrl + "core/layout/common.css", baseUrl + "core/layout/common.css",
baseUrl + "core/vendor/tinymce/content.css", baseUrl + "core/vendor/tinymce/content.css",
baseUrl + "site/data/"+ siteContent === null ? 'home' : siteContent +"/theme.css", baseUrl + "site/data/home/theme.css", // Ceci sera mis à jour dans l'événement 'init'
baseUrl + "site/data/custom.css" baseUrl + "site/data/custom.css"
], ],
// Classe à ajouter à la balise body dans l'iframe // Classe à ajouter à la balise body dans l'iframe
@ -228,25 +240,25 @@ tinymce.init({
} }
], ],
textpattern_patterns: [ textpattern_patterns: [
{start: '*', end: '*', format: 'italic'}, { start: '*', end: '*', format: 'italic' },
{start: '**', end: '**', format: 'bold'}, { start: '**', end: '**', format: 'bold' },
{start: '#', format: 'h1'}, { start: '#', format: 'h1' },
{start: '##', format: 'h2'}, { start: '##', format: 'h2' },
{start: '###', format: 'h3'}, { start: '###', format: 'h3' },
{start: '####', format: 'h4'}, { start: '####', format: 'h4' },
{start: '#####', format: 'h5'}, { start: '#####', format: 'h5' },
{start: '######', format: 'h6'}, { start: '######', format: 'h6' },
{start: '1. ', cmd: 'InsertOrderedList'}, { start: '1. ', cmd: 'InsertOrderedList' },
{start: '* ', cmd: 'InsertUnorderedList'}, { start: '* ', cmd: 'InsertUnorderedList' },
{start: '- ', cmd: 'InsertUnorderedList'}, { start: '- ', cmd: 'InsertUnorderedList' },
{start: '* ', cmd: 'InsertUnorderedList'}, { start: '* ', cmd: 'InsertUnorderedList' },
{start: '- ', cmd: 'InsertUnorderedList'}, { start: '- ', cmd: 'InsertUnorderedList' },
{start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }}, { start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
{start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }}, { start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
{start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }}, { start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
{start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }}, { start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
{start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }}, { start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } },
{start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }} { start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } }
] ]
}); });
@ -304,7 +316,7 @@ tinymce.init({
}); });
}, },
// Langue // Langue
language: getCookie('ZWII_UI') === null ? "fr_FR" : getCookie('ZWII_UI'), language: "fr_FR",
// Plugins // Plugins
plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu hr lists paste searchreplace tabfocus template textcolor textpattern", plugins: "advlist anchor autolink autoresize autosave colorpicker contextmenu hr lists paste searchreplace tabfocus template textcolor textpattern",
// Contenu de la barre d'outils // Contenu de la barre d'outils
@ -346,25 +358,25 @@ tinymce.init({
document_base_url: baseUrl, document_base_url: baseUrl,
max_height: 200, max_height: 200,
textpattern_patterns: [ textpattern_patterns: [
{start: '*', end: '*', format: 'italic'}, { start: '*', end: '*', format: 'italic' },
{start: '**', end: '**', format: 'bold'}, { start: '**', end: '**', format: 'bold' },
{start: '#', format: 'h1'}, { start: '#', format: 'h1' },
{start: '##', format: 'h2'}, { start: '##', format: 'h2' },
{start: '###', format: 'h3'}, { start: '###', format: 'h3' },
{start: '####', format: 'h4'}, { start: '####', format: 'h4' },
{start: '#####', format: 'h5'}, { start: '#####', format: 'h5' },
{start: '######', format: 'h6'}, { start: '######', format: 'h6' },
{start: '1. ', cmd: 'InsertOrderedList'}, { start: '1. ', cmd: 'InsertOrderedList' },
{start: '* ', cmd: 'InsertUnorderedList'}, { start: '* ', cmd: 'InsertUnorderedList' },
{start: '- ', cmd: 'InsertUnorderedList'}, { start: '- ', cmd: 'InsertUnorderedList' },
{start: '* ', cmd: 'InsertUnorderedList'}, { start: '* ', cmd: 'InsertUnorderedList' },
{start: '- ', cmd: 'InsertUnorderedList'}, { start: '- ', cmd: 'InsertUnorderedList' },
{start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }}, { start: '1. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
{start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' }}, { start: '1) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'decimal' } },
{start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }}, { start: 'a. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
{start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' }}, { start: 'a) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-alpha' } },
{start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }}, { start: 'i. ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } },
{start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' }} { start: 'i) ', cmd: 'InsertOrderedList', value: { 'list-style-type': 'lower-roman' } }
] ]
}); });