diff --git a/CHANGES.md b/CHANGES.md index 4080c35..21899a2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,11 +4,13 @@ - Modifications : - animation et réduction du panneau cookies, - édition avec Tinymce : nouveaux templates pour insérer un bloc ou une image en pleine largeur quelque soit l'écran, - - + - configuration / connexion : le captcha à la connexion est toujours de type opération, + le captcha comportemental reste disponible pour les autres usages (blog, formulaire, commentaires de page,...) - Corrections : - - Sur le site : - - + - Bonus / Modules : un nouveau module pour réaliser des questionnaires nommé 'Sondage', + - Bonus / Vidéos : module sondage. ## Version 5.0.01 de Deltacms - Modifications : diff --git a/core/class/template.class.php b/core/class/template.class.php index 4f06acd..20424cb 100644 --- a/core/class/template.class.php +++ b/core/class/template.class.php @@ -740,7 +740,7 @@ class template { // Attributs par défaut $attributes = array_merge([ 'before' => true, - 'class' => '', // editorWysiwyg et editor possible pour utiliser un éditeur (il faut également instancier les librairies) + 'class' => '', // editorWysiwyg et editorWysiwygComment possible pour utiliser un éditeur (il faut également instancier les librairies) 'classWrapper' => '', 'disabled' => false, 'noDirty' => false, @@ -772,6 +772,8 @@ class template { } $html .= self::notice($attributes['id'], $notice); // Texte long + // Limitation à maxlength + if( isset($attributes['maxlength'] ) && $attributes['maxlength'] !== '' && is_string($attributes['value']) ) $attributes['value'] = substr( $attributes['value'] , 0, (int) $attributes['maxlength']); $html .= sprintf( '', helper::sprintAttributes($attributes, ['value']), diff --git a/core/core.js.php b/core/core.js.php index e698318..03d290e 100644 --- a/core/core.js.php +++ b/core/core.js.php @@ -295,7 +295,7 @@ core.start = function() { /** * Animation du panneau des cookies */ - $('#cookieConsent').delay(2000).animate({ left: '5%' }, 1500); + $('#cookieConsent').delay(500).animate({ left: '5%' }, 1500); /** * Affiche / Cache le menu en mode responsive diff --git a/core/core.php b/core/core.php index ca42e3a..ef3d4d8 100644 --- a/core/core.php +++ b/core/core.php @@ -438,6 +438,19 @@ class common { * @param array $keys Clé(s) des données */ public function deleteData($keys) { + // Instanciation si $keys[0]='data_module' et $keys[2] ='data' avec $keys[1]= nomdelapage + if( $keys[0] === 'data_module' && $keys[2]==='data'){ + // Constructeur JsonDB + $this->dataFiles[$keys[2]] = new \Prowebcraft\JsonDb([ + 'name' => $keys[1]. '.json', + 'dir' => self::DATA_DIR. self::$i18n.'/data_module/', + 'backup' => file_exists('site/data/.backup') + ]); + unset($keys[0]); + unset($keys[1]); + $keys = array_values($keys); + + } // Descripteur $db = $this->dataFiles[$keys[0]]; // Aiguillage @@ -477,6 +490,20 @@ class common { /** * Lecture directe */ + // Instanciation si $keys[0]='data_module' et $keys[2] ='data' avec $keys[1]= nomdelapage + if( $keys[0] === 'data_module' && $keys[2]==='data'){ + // Constructeur JsonDB + $this->dataFiles[$keys[2]] = new \Prowebcraft\JsonDb([ + 'name' => $keys[1]. '.json', + 'dir' => self::DATA_DIR. self::$i18n.'/data_module/', + 'backup' => file_exists('site/data/.backup') + ]); + unset($keys[0]); + unset($keys[1]); + $keys = array_values($keys); + + } + // Descripteur $db = $this->dataFiles[$keys[0]]; switch(count($keys)) { case 1: @@ -568,9 +595,21 @@ class common { return false; } + // Instanciation si $keys[0]='data_module' et $keys[2] ='data' avec $keys[1]= nomdelapage + if( $keys[0] === 'data_module' && $keys[2]==='data'){ + // Constructeur JsonDB + $this->dataFiles[$keys[2]] = new \Prowebcraft\JsonDb([ + 'name' => $keys[1]. '.json', + 'dir' => self::DATA_DIR. self::$i18n.'/data_module/', + 'backup' => file_exists('site/data/.backup') + ]); + unset($keys[0]); + unset($keys[1]); + $keys = array_values($keys); + + } // Descripteur $db = $this->dataFiles[$keys[0]]; - // Aiguillage switch(count($keys)) { case 2: @@ -624,6 +663,12 @@ class common { if (!is_dir(self::DATA_DIR . $lang . '/content')) { mkdir(self::DATA_DIR . $lang . '/content', 0755); } + + // Dossier des données de page + if (!is_dir(self::DATA_DIR . $lang . '/data_module')) { + mkdir(self::DATA_DIR . $lang . '/data_module', 0755); + } + // Créer le jeu de pages du site de test if ($module === 'page' ) { // Site de test ou page simple diff --git a/core/include/comment.inc.php b/core/include/comment.inc.php index 9fc5aba..22fcd96 100644 --- a/core/include/comment.inc.php +++ b/core/include/comment.inc.php @@ -25,10 +25,10 @@ if( function_exists('datefmt_create') && function_exists('datefmt_format') && ex } // Création du brouillon s'il n'existe pas -if( !isset($_SESSION['draftPage'])){ - $_SESSION['draftPage'] = []; - $_SESSION['draftPage']['textarea'] = ""; - $_SESSION['draftPage']['text'] = ""; +if( !isset($_SESSION[$this->getUrl()]['draft'])){ + $_SESSION[$this->getUrl()]['draft'] = []; + $_SESSION[$this->getUrl()]['draft']['textarea'] = ""; + $_SESSION[$this->getUrl()]['draft']['text'] = ""; } // Traitement des boutons pagination @@ -75,8 +75,8 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { $valueTextarea = $this->getInput('commentPageFormInput[1]', helper::FILTER_STRING_LONG_NOSTRIP, true); // Mise à jour du brouillon - $_SESSION['draftPage']['text'] = $valueText; - $_SESSION['draftPage']['textarea'] = $valueTextarea; + $_SESSION[$this->getUrl()]['draft']['text'] = $valueText; + $_SESSION[$this->getUrl()]['draft']['textarea'] = $valueTextarea; // Préparation du contenu des données ($data) et du mail $data = []; @@ -160,9 +160,9 @@ if($this->isPost() && isset($_POST['commentPageFormSubmit']) ) { if ( $this->getData(['module', $this->getUrl(0), 'config', 'pageId']) !== '') $redirect = helper::baseUrl() . $this->getData(['module', $this->getUrl(0), 'config', 'pageId']); // Effacement des données provisoires if( self::$inputNotices === [] ){ - $_SESSION['draftPage'] = []; - $_SESSION['draftPage']['textarea'] = ""; - $_SESSION['draftPage']['text'] = ""; + $_SESSION[$this->getUrl()]['draft'] = []; + $_SESSION[$this->getUrl()]['draft']['textarea'] = ""; + $_SESSION[$this->getUrl()]['draft']['text'] = ""; } else { $sent = false; } @@ -254,12 +254,12 @@ echo template::formOpenFile('commentPageFormForm', $action); 'commentPageFormInput_0', 'label' => $this->getData(['locale', 'pageComment', 'commentName']), - 'value' => $_SESSION['draftPage']['text'] + 'value' => $_SESSION[$this->getUrl()]['draft']['text'] ]); echo template::textarea('commentPageFormInput[1]', [ 'id' => 'commentPageFormInput_1', 'label' => $this->getData(['locale', 'pageComment', 'comment']), - 'value' => $_SESSION['draftPage']['textarea'], + 'value' => $_SESSION[$this->getUrl()]['draft']['textarea'], 'class' => 'editorWysiwygComment', 'noDirty' => true ]); ?> diff --git a/core/include/update.inc.php b/core/include/update.inc.php index c00adc2..7aa9f39 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -198,6 +198,18 @@ if ($this->getData(['core', 'dataVersion']) < 5001) { $this->setData(['core', 'dataVersion', 5001]); } if ($this->getData(['core', 'dataVersion']) < 5002) { + // Nouveau dossier site/data/.../data_module + // Tableau des langues installées sauf base + $tabLanguages = []; + foreach (self::$i18nList as $key => $value) { + if ($this->getData(['config','i18n', $key]) === 'site' && $key !== $this->getData(['config','i18n', 'langBase'])) { + $tabLanguages[$key] = $value; + } + } + mkdir (self::DATA_DIR .'base/data_module', 0755); + foreach( $tabLanguages as $key => $value){ + mkdir (self::DATA_DIR .$key.'/data_module', 0755); + } $this->setData(['core', 'dataVersion', 5002]); } ?> diff --git a/core/module/page/page.php b/core/module/page/page.php index e0c7b9c..056dd40 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -97,6 +97,9 @@ class page extends common { $this->setData (['module',$pageId,$data]); $notification = $text['core_page']['duplicate'][3]; } + // Duplication des données de page + if( is_file(self::DATA_DIR . self::$i18n . '/data_module/' . $url[0] . '.json')) + copy( self::DATA_DIR . self::$i18n . '/data_module/' . $url[0] . '.json', self::DATA_DIR . self::$i18n . '/data_module/' . $pageId . '.json'); // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . 'page/edit/' . $pageId, @@ -293,6 +296,11 @@ class page extends common { if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html')) { unlink(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html'); } + // Effacer le fichier des données de page + if (file_exists(self::DATA_DIR . self::$i18n . '/data_module/' . $url[0] . '.json')) { + unlink(self::DATA_DIR . self::$i18n . '/data_module/' . $url[0] . '.json'); + } + $this->deleteData(['module', $url[0]]); // Met à jour le site map // $this->createSitemap('all'); @@ -572,6 +580,9 @@ class page extends common { $this->setData(['module',$pageId,'theme','style', $modulesData[$moduleId]['dataDirectory']. $pageId]); } } + // Change le nom du fichier des données de page dans /data_module/ + if (file_exists(self::DATA_DIR . self::$i18n . '/data_module/' . $this->getUrl(2) . '.json')) + rename(self::DATA_DIR . self::$i18n . '/data_module/' . $this->getUrl(2) . '.json', self::DATA_DIR . self::$i18n . '/data_module/' . $pageId . '.json'); // 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]); diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index ae6244d..254c6a1 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -85,6 +85,7 @@ class translate extends common { if (is_dir(self::DATA_DIR . $toCreate) === false ) { // Si le dossier est déjà créé $success = mkdir (self::DATA_DIR . $toCreate, 0755); $success = mkdir (self::DATA_DIR . $toCreate.'/content', 0755); + $success = mkdir (self::DATA_DIR . $toCreate.'/data_module', 0755); } else { $success = true; } diff --git a/core/module/user/view/login/login.js.php b/core/module/user/view/login/login.js.php index 6ff3434..4e29e6e 100644 --- a/core/module/user/view/login/login.js.php +++ b/core/module/user/view/login/login.js.php @@ -26,3 +26,4 @@ $(document).ready(function(){ $(".userOuter").css("border-radius","0px"); }); }); + diff --git a/core/vendor/tinymce/init.js b/core/vendor/tinymce/init.js index d48979b..7ddfd86 100644 --- a/core/vendor/tinymce/init.js +++ b/core/vendor/tinymce/init.js @@ -34,6 +34,16 @@ switch (lang_admin) { break; } +// Pour autoriser le menu et la barre sticky (par défaut) +if ( typeof(okSticky) == 'undefined') { + var okSticky = true; +}; + +// Pour définir la hauteur minimale +if ( typeof(tinyMiniHeight) == 'undefined') { + var tinyMiniHeight = 500; +}; + // Pour la class dans le body de l'iframe if ( typeof(bodyIframe) == 'undefined') { var bodyIframe = "editorWysiwyg"; @@ -55,6 +65,7 @@ var toolbarList = "restoredraft | undo redo | formatselect bold italic underline switch (lang_admin) { case 'fr_FR': var blocktext = "Bloc de texte"; + var blocktextnotitle = "Bloc de texte sans titre"; var blocks_text = "Blocs de texte"; var blocktexts = " blocs de texte"; var title = " avec un titre."; @@ -75,6 +86,7 @@ switch (lang_admin) { break; case 'en_GB': var blocktext = "Text Block"; + var blocktextnotitle = "Untitled block of text"; var blocks_text = "Text blocks"; var blocktexts = " text blocks"; var title = " with a title."; @@ -95,6 +107,7 @@ switch (lang_admin) { break; case 'es': var blocktext = "Bloque de texto"; + var blocktextnotitle = "Bloque de texto sin título"; var blocks_text = "Bloques de texto"; var blocktexts = " bloques de texto"; var title = " con un título."; @@ -140,6 +153,11 @@ var templatesList = [ url: baseUrl + "core/vendor/tinymce/templates/" + lang_admin + "/4blocks.html", description: "4"+ blocktexts + widthtitle }, + { + title: blocktextnotitle, + url: baseUrl + "core/vendor/tinymce/templates/" + lang_admin + "/1block-notitle.html", + description: blocktextnotitle + }, { title: colorbox, url: baseUrl + "core/vendor/tinymce/templates/" + lang_admin + "/colorbox.html", @@ -226,7 +244,7 @@ tinymce.init({ }, // Mode d'affichage de la barre d'outils toolbar_mode: 'wrap', - toolbar_sticky: true, + toolbar_sticky: okSticky, toolbar_sticky_offset: offsetToolbar, // Langue language: lang_admin, @@ -251,7 +269,7 @@ tinymce.init({ autoresize_overflow_padding: 0, autoresize_bottom_margin: 0, // Hauteur minimale en pixels de la zone d'édition - min_height: 500, + min_height: tinyMiniHeight, // CodeMirror codemirror: { indentOnInit: true, // Whether or not to indent code on init. diff --git a/core/vendor/tinymce/templates/1block-notitle.html b/core/vendor/tinymce/templates/1block-notitle.html new file mode 100644 index 0000000..d57e04b --- /dev/null +++ b/core/vendor/tinymce/templates/1block-notitle.html @@ -0,0 +1,8 @@ +
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam interdum, neque non vulputate hendrerit, arcu turpis dapibus nisl, id scelerisque metus lectus vitae nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec feugiat dolor et turpis finibus condimentum. Cras sit amet ligula sagittis justo.

+
+
+
+

Conserver jusqu'à la fin de la mise en page pour faciliter les insertions.

\ No newline at end of file diff --git a/core/vendor/tinymce/templates/en_GB/1block-notitle.html b/core/vendor/tinymce/templates/en_GB/1block-notitle.html new file mode 100644 index 0000000..efba511 --- /dev/null +++ b/core/vendor/tinymce/templates/en_GB/1block-notitle.html @@ -0,0 +1,8 @@ +
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam interdum, neque non vulputate hendrerit, arcu turpis dapibus nisl, id scelerisque metus lectus vitae nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec feugiat dolor et turpis finibus condimentum. Cras sit amet ligula sagittis justo.

+
+
+
+

Keep until the end of the layout for easier insertions.

\ No newline at end of file diff --git a/core/vendor/tinymce/templates/es/1block-notitle.html b/core/vendor/tinymce/templates/es/1block-notitle.html new file mode 100644 index 0000000..f11190f --- /dev/null +++ b/core/vendor/tinymce/templates/es/1block-notitle.html @@ -0,0 +1,8 @@ +
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam interdum, neque non vulputate hendrerit, arcu turpis dapibus nisl, id scelerisque metus lectus vitae nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec feugiat dolor et turpis finibus condimentum. Cras sit amet ligula sagittis justo.

+
+
+
+

Manténgalo hasta el final del diseño para facilitar las inserciones.

\ No newline at end of file diff --git a/core/vendor/tinymce/templates/fr_FR/1block-notitle.html b/core/vendor/tinymce/templates/fr_FR/1block-notitle.html new file mode 100644 index 0000000..d57e04b --- /dev/null +++ b/core/vendor/tinymce/templates/fr_FR/1block-notitle.html @@ -0,0 +1,8 @@ +
+
+
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam interdum, neque non vulputate hendrerit, arcu turpis dapibus nisl, id scelerisque metus lectus vitae nisi. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Donec feugiat dolor et turpis finibus condimentum. Cras sit amet ligula sagittis justo.

+
+
+
+

Conserver jusqu'à la fin de la mise en page pour faciliter les insertions.

\ No newline at end of file