mise à jour de form 5.1

This commit is contained in:
Deltacms 2024-01-07 18:20:05 +01:00
parent 26a6d16dae
commit 2b82f5c4a5
7 changed files with 30 additions and 20 deletions

View File

@ -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.

View File

@ -86,7 +86,7 @@
"logoUrl": "",
"logoWidth": "40",
"maxSizeUpload": "500000",
"versionData": "5.0",
"versionData": "5.1",
"uploadJpg": true,
"uploadPng": true,
"uploadPdf": false,

View File

@ -118,7 +118,7 @@
"logoUrl": "",
"logoWidth": "40",
"maxSizeUpload": "500000",
"versionData": "5.0",
"versionData": "5.1",
"uploadJpg": true,
"uploadPng": true,
"uploadPdf": false,

View File

@ -86,7 +86,7 @@
"logoUrl": "",
"logoWidth": "40",
"maxSizeUpload": "1000000",
"versionData": "5.0",
"versionData": "5.1",
"uploadJpg": true,
"uploadPng": true,
"uploadPdf": false,

View File

@ -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.',

View File

@ -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"]) ]);

View File

@ -42,7 +42,8 @@ echo '<script> var lang_admin = "'.$lang_page.'"; </script>';
if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<?php echo template::formOpenFile('formForm'); ?>
<div class="humanBot">
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php $textIndex=0; $selectIndex=0; $checkboxIndex=0;
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
<?php if($input['type'] === $module::TYPE_MAIL): ?>
<?php echo template::mail('formInput[' . $index . ']', [
'id' => 'formInput_' . $index,
@ -59,14 +60,16 @@ if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
<?php echo template::select('formInput[' . $index . ']', $values, [
'id' => '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++; ?>
<?php elseif($input['type'] === $module::TYPE_TEXT): ?>
<?php echo template::text('formInput[' . $index . ']', [
'id' => '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++; ?>
<?php elseif($input['type'] === $module::TYPE_TEXTAREA): ?>
<?php echo template::textarea('formInput[' . $index . ']', [
'id' => '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'])
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX): ?>
<?php echo template::checkbox('formInput[' . $index . ']', true, $input['name'], [
'checked' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox'])
]); ?>
<?php elseif($input['type'] === $module::TYPE_CHECKBOX):
echo template::checkbox('formInput[' . $index . ']', true, $input['name'], [
'before' => false,
'checked' => false // Problème non solutionné avec $this->getData([ 'module', $this->getUrl(0), 'draft', 'checkbox', $checkboxIndex])
]);
$checkboxIndex++; ?>
<?php elseif($input['type'] === $module::TYPE_FILE): ?>
<label class='formLabel'> <?php echo $input['name']; ?> </label>
<div class="formInputFile">