From 2b82f5c4a52ad971dca1131ff2225bdef88f4ed1 Mon Sep 17 00:00:00 2001 From: Deltacms Date: Sun, 7 Jan 2024 18:20:05 +0100 Subject: [PATCH] =?UTF-8?q?mise=20=C3=A0=20jour=20de=20form=205.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 3 ++- .../ressource/database_en/base/module.json | 2 +- .../ressource/database_es/base/module.json | 2 +- .../ressource/database_fr/base/module.json | 2 +- core/module/install/ressource/defaultdata.php | 2 +- module/form/form.php | 16 ++++++++----- module/form/view/index/index.php | 23 +++++++++++-------- 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2f8b47f..ce8f2e7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,7 +6,8 @@ - News 4.8 : en configuration paramétrage des couleurs pour le texte, les titres, les liens et la signature, - Captcha : polices truetype pour compatibilité avec d'anciennes compilations d'une librairie PHP - Corrections : - - News 4.8 : en édition des news les couleurs paramétrées sont visibles dans l'éditeur Tinymce. + - News 4.8 : en édition des news les couleurs paramétrées sont visibles dans l'éditeur Tinymce, + - Form 5.1 : le brouillon peut mémoriser et restituer plusieurs champs texte et sélection. - Sur le site : - Bonus / Module : livre d'or (guestbook) nouveau module. diff --git a/core/module/install/ressource/database_en/base/module.json b/core/module/install/ressource/database_en/base/module.json index d816205..756a9e5 100644 --- a/core/module/install/ressource/database_en/base/module.json +++ b/core/module/install/ressource/database_en/base/module.json @@ -86,7 +86,7 @@ "logoUrl": "", "logoWidth": "40", "maxSizeUpload": "500000", - "versionData": "5.0", + "versionData": "5.1", "uploadJpg": true, "uploadPng": true, "uploadPdf": false, diff --git a/core/module/install/ressource/database_es/base/module.json b/core/module/install/ressource/database_es/base/module.json index d216204..783690f 100644 --- a/core/module/install/ressource/database_es/base/module.json +++ b/core/module/install/ressource/database_es/base/module.json @@ -118,7 +118,7 @@ "logoUrl": "", "logoWidth": "40", "maxSizeUpload": "500000", - "versionData": "5.0", + "versionData": "5.1", "uploadJpg": true, "uploadPng": true, "uploadPdf": false, diff --git a/core/module/install/ressource/database_fr/base/module.json b/core/module/install/ressource/database_fr/base/module.json index 9db6fb5..a0af91e 100644 --- a/core/module/install/ressource/database_fr/base/module.json +++ b/core/module/install/ressource/database_fr/base/module.json @@ -86,7 +86,7 @@ "logoUrl": "", "logoWidth": "40", "maxSizeUpload": "1000000", - "versionData": "5.0", + "versionData": "5.1", "uploadJpg": true, "uploadPng": true, "uploadPdf": false, diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index f77221d..96ec2c2 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -93,7 +93,7 @@ class init extends common { 'administratorLabel' => 'Administrateur', 'metaDescription' => 'DeltaCMS est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.', 'title' => 'DeltaCMS', - 'captchaSimpleText' => 'Je ne suis pas un robot', + 'captchaSimpleText' => 'Je suis un humain', 'captchaSimpleHelp' => 'Cochez cette case pour prouver que vous êtes humain', 'cookies' => [ 'cookiesDeltaText' => 'Ce site utilise des cookies nécessaires à son fonctionnement, ils permettent de fluidifier son fonctionnement par exemple en mémorisant les données de connexion, la langue que vous avez choisie ou la validation de ce message.', diff --git a/module/form/form.php b/module/form/form.php index 36b8f1e..db32d4e 100644 --- a/module/form/form.php +++ b/module/form/form.php @@ -18,7 +18,7 @@ class form extends common { - const VERSION = '5.0'; + const VERSION = '5.1'; const REALNAME = 'Formulaire'; const DELETE = true; const UPDATE = '0.0'; @@ -84,8 +84,8 @@ class form extends common { $this->setData(['module', $this->getUrl(0), 'config', 'uploadTxt',false]); $this->setData(['module', $this->getUrl(0), 'config', 'versionData','4.1']); } - if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.0', '<') ){ - $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.0']); + if( version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '5.1', '<') ){ + $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '5.1']); } } @@ -439,6 +439,7 @@ class form extends common { ]); } // Mise à jour du brouillon + $textIndex = 0; $selectIndex=0; $checkboxIndex=0; for( $index = 0; $index <= count($this->getData(['module', $this->getUrl(0), 'input'])); $index++){ switch ($this->getData(['module', $this->getUrl(0), 'input', $index, 'type'])){ case self::TYPE_MAIL: @@ -453,13 +454,16 @@ class form extends common { $this->setData(['module', $this->getUrl(0), 'draft', 'datetime', $dateTime]); break; case self::TYPE_CHECKBOX: - //$this->setData(['module', $this->getUrl(0), 'draft', 'checkbox', $this->getInput('formInput[' . $index . ']',helper::FILTER_BOOLEAN)]); + $this->setData(['module', $this->getUrl(0), 'draft', 'checkbox', $checkboxIndex, $this->getInput('formInput[' . $index . ']',helper::FILTER_BOOLEAN)]); + $checkboxIndex++; break; case self::TYPE_SELECT: - $this->setData(['module', $this->getUrl(0), 'draft', 'select', $this->getInput('formInput[' . $index . ']')]); + $this->setData(['module', $this->getUrl(0), 'draft', 'select', $selectIndex, $this->getInput('formInput[' . $index . ']')]); + $selectIndex++; break; case self::TYPE_TEXT: - $this->setData(['module', $this->getUrl(0), 'draft', 'text', $this->getInput('formInput[' . $index . ']')]); + $this->setData(['module', $this->getUrl(0), 'draft', 'text', $textIndex, $this->getInput('formInput[' . $index . ']')]); + $textIndex++; break; case self::TYPE_FILE: $this->setData(['module', $this->getUrl(0), 'draft', 'file', basename($_FILES["fileToUpload"]["name"]) ]); diff --git a/module/form/view/index/index.php b/module/form/view/index/index.php index 76ee8aa..3ee09b1 100644 --- a/module/form/view/index/index.php +++ b/module/form/view/index/index.php @@ -42,7 +42,8 @@ echo ''; if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
- getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> + getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?> 'formInput_' . $index, @@ -59,14 +60,16 @@ if($this->getData(['module', $this->getUrl(0), 'input'])): ?> 'formInput_' . $index, 'label' => $input['name'], - 'selected' => $values[$this->getData([ 'module', $this->getUrl(0), 'draft', 'select'])] - ]); ?> + 'selected' => $values[$this->getData([ 'module', $this->getUrl(0), 'draft', 'select', $selectIndex])] + ]); + $selectIndex++; ?> 'formInput_' . $index, 'label' => $input['name'], - 'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'text']) - ]); ?> + 'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'text', $textIndex]) + ]); + $textIndex++; ?> 'formInput_' . $index, @@ -81,10 +84,12 @@ if($this->getData(['module', $this->getUrl(0), 'input'])): ?> 'label' => $input['name'], 'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'datetime']) ]); ?> - - $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox']) - ]); ?> + false, + 'checked' => false // Problème non solutionné avec $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox', $checkboxIndex]) + ]); + $checkboxIndex++; ?>