form 5.0 avec tinymce et textes longs
This commit is contained in:
parent
52be0a03ce
commit
ffa19c1747
|
@ -18,7 +18,7 @@
|
|||
|
||||
class form extends common {
|
||||
|
||||
const VERSION = '4.9';
|
||||
const VERSION = '5.0';
|
||||
const REALNAME = 'Formulaire';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
|
@ -445,7 +445,7 @@ class form extends common {
|
|||
$this->setData(['module', $this->getUrl(0), 'draft', 'mail', $this->getInput('formInput[' . $index . ']',helper::FILTER_MAIL)]);
|
||||
break;
|
||||
case self::TYPE_TEXTAREA:
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'textarea', $this->getInput('formInput[' . $index . ']',helper::FILTER_STRING_LONG)]);
|
||||
$this->setData(['module', $this->getUrl(0), 'draft', 'textarea', $this->getInput('formInput[' . $index . ']',helper::FILTER_STRING_LONG_NOSTRIP)]);
|
||||
break;
|
||||
case self::TYPE_DATETIME:
|
||||
$dateTime = time();
|
||||
|
@ -476,6 +476,10 @@ class form extends common {
|
|||
$content = '';
|
||||
$file_name = '';
|
||||
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
|
||||
|
||||
$filter = helper::FILTER_STRING_SHORT;
|
||||
if( $input['type'] === 'textarea') $filter = helper::FILTER_STRING_LONG_NOSTRIP;
|
||||
|
||||
$value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']);
|
||||
// premier champ email ajouté au mail en reply si option active
|
||||
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
|
||||
|
@ -558,7 +562,6 @@ class form extends common {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Préparation des données pour la création dans la base
|
||||
$data[$this->getData(['module', $this->getUrl(0), 'input', $index, 'name'])] = $value;
|
||||
// Préparation des données pour le mail
|
||||
|
@ -645,7 +648,8 @@ class form extends common {
|
|||
'redirect' => $redirect,
|
||||
'state' => ($sent === true ? true : false),
|
||||
'vendor' => [
|
||||
'flatpickr'
|
||||
'flatpickr',
|
||||
'tinymce'
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
@ -663,7 +667,8 @@ class form extends common {
|
|||
'showPageContent' => true,
|
||||
'view' => 'index',
|
||||
'vendor' => [
|
||||
'flatpickr'
|
||||
'flatpickr',
|
||||
'tinymce'
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
|
|
@ -78,6 +78,8 @@ $text['form']['index'][11] = 'The attachment is not a zip document';
|
|||
$text['form']['index'][12] = ' Fill in the Captcha ';
|
||||
// Initialisation de flatpickr
|
||||
$lang_flatpickr = 'default';
|
||||
// Langue d'administration pour tinymce
|
||||
$lang_admin = 'en_GB';
|
||||
// Selects
|
||||
$signature = [
|
||||
'text' => 'Name of the site',
|
||||
|
|
|
@ -78,6 +78,8 @@ $text['form']['index'][11] = 'El archivo adjunto no es un documento zip';
|
|||
$text['form']['index'][12] = ' Complete el Captcha ';
|
||||
// Initialisation de flatpickr
|
||||
$lang_flatpickr = 'es';
|
||||
// Langue d'administration pour tinymce
|
||||
$lang_admin = 'es';
|
||||
// Selects
|
||||
$signature = [
|
||||
'text' => 'Nombre del sitio',
|
||||
|
|
|
@ -78,6 +78,8 @@ $text['form']['index'][11] = 'La pièce jointe n\'est pas un document zip';
|
|||
$text['form']['index'][12] = ' Renseignez le Captcha ';
|
||||
// Initialisation de flatpickr
|
||||
$lang_flatpickr = 'fr';
|
||||
// Langue d'administration pour tinymce
|
||||
$lang_admin = 'fr_FR';
|
||||
// Selects
|
||||
$signature = [
|
||||
'text' => 'Nom du site',
|
||||
|
|
|
@ -13,6 +13,32 @@ if( isset( $_SESSION['langFrontEnd'])){
|
|||
$lang_flatpickr = in_array($lang_base, $arrayFlatpickr) ? $lang_base : 'default';
|
||||
?><script>var lang_flatpickr = "<?php echo $lang_flatpickr; ?>";</script><?php
|
||||
|
||||
// Adaptation de la langue dans tinymce pour la rédaction d'un message en fonction de la langue de la page, originale ou en traduction rédigée
|
||||
$lang = $this->getData(['config', 'i18n', 'langBase']);
|
||||
if ( !empty($_COOKIE["DELTA_I18N_SITE"])) {
|
||||
if( $this->getInput('DELTA_I18N_SITE') !== 'base' ) $lang = $this->getInput('DELTA_I18N_SITE');
|
||||
}
|
||||
$lang_page = $lang;
|
||||
switch ($lang) {
|
||||
case 'en' :
|
||||
$lang_page = 'en_GB';
|
||||
break;
|
||||
case 'pt' :
|
||||
$lang_page = 'pt_PT';
|
||||
break;
|
||||
case 'sv' :
|
||||
$lang_page = 'sv_SE';
|
||||
break;
|
||||
case 'fr' :
|
||||
$lang_page = 'fr_FR';
|
||||
break;
|
||||
}
|
||||
// Si la langue n'est pas supportée par Tinymce la langue d'administration est utilisée
|
||||
if( ! file_exists( 'core/vendor/tinymce/langs/'.$lang_page.'.js' )){
|
||||
$lang_page = $lang_admin;
|
||||
}
|
||||
echo '<script> var lang_admin = "'.$lang_page.'"; </script>';
|
||||
|
||||
if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
||||
<?php echo template::formOpenFile('formForm'); ?>
|
||||
<div class="humanBot">
|
||||
|
@ -45,7 +71,9 @@ if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
|||
<?php echo template::textarea('formInput[' . $index . ']', [
|
||||
'id' => 'formInput_' . $index,
|
||||
'label' => $input['name'],
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'textarea'])
|
||||
'value' => $this->getData([ 'module', $this->getUrl(0), 'draft', 'textarea']),
|
||||
'class' => 'editorWysiwygComment',
|
||||
'noDirty' => true
|
||||
]); ?>
|
||||
<?php elseif($input['type'] === $module::TYPE_DATETIME): ?>
|
||||
<?php echo template::date('formInput[' . $index . ']', [
|
||||
|
|
Loading…
Reference in New Issue