forked from ZwiiCMS-Team/ZwiiCMS
Form 3.0 WIP
This commit is contained in:
parent
0e3c9e779b
commit
18a17e5576
@ -16,7 +16,7 @@
|
||||
|
||||
class form extends common {
|
||||
|
||||
const VERSION = '2.11';
|
||||
const VERSION = '3.0';
|
||||
const REALNAME = 'Formulaire';
|
||||
const DELETE = true;
|
||||
const UPDATE = '0.0';
|
||||
@ -24,6 +24,7 @@ class form extends common {
|
||||
|
||||
public static $actions = [
|
||||
'config' => self::GROUP_MODERATOR,
|
||||
'layout' => self::GROUP_MODERATOR,
|
||||
'data' => self::GROUP_MODERATOR,
|
||||
'delete' => self::GROUP_MODERATOR,
|
||||
'deleteall' => self::GROUP_MODERATOR,
|
||||
@ -38,6 +39,9 @@ class form extends common {
|
||||
|
||||
public static $pagination;
|
||||
|
||||
// Nombre d'articles dans la page de config:
|
||||
public static $itemperPage = 20;
|
||||
|
||||
|
||||
// Objets
|
||||
const TYPE_MAIL = 'mail';
|
||||
@ -75,38 +79,31 @@ class form extends common {
|
||||
'100' => '100%'
|
||||
];
|
||||
|
||||
public static $formOffset = [
|
||||
'none' => 'Aucune',
|
||||
'1' => 'Une colonne',
|
||||
'2' => 'Deux colonnes',
|
||||
'3' => 'Trois colonnes',
|
||||
'4' => 'Quatre colonnes',
|
||||
];
|
||||
|
||||
public static $formWidth = [
|
||||
'6' => 'Six colonne',
|
||||
'7' => 'Sept colonnes',
|
||||
'8' => 'Huit colonnes',
|
||||
'9' => 'Neuf colonnes',
|
||||
'10' => 'Dix colonnes',
|
||||
'11' => 'Onze colonnes',
|
||||
'12' => 'Douze colonnes',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function config() {
|
||||
// Liste des utilisateurs
|
||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
self::$listUsers [] = '';
|
||||
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
||||
self::$listUsers [] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Configuration
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'button' => $this->getInput('formConfigButton'),
|
||||
'captcha' => $this->getInput('formConfigCaptcha', helper::FILTER_BOOLEAN),
|
||||
'group' => $this->getInput('formConfigGroup', helper::FILTER_INT),
|
||||
'user' => self::$listUsers [$this->getInput('formConfigUser', helper::FILTER_INT)],
|
||||
'mail' => $this->getInput('formConfigMail') ,
|
||||
'pageId' => $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '',
|
||||
'subject' => $this->getInput('formConfigSubject'),
|
||||
'replyto' => $this->getInput('formConfigMailReplyTo', helper::FILTER_BOOLEAN),
|
||||
'signature' => $this->getInput('formConfigSignature'),
|
||||
'logoUrl' => $this->getInput('formConfigLogo'),
|
||||
'logoWidth' => $this->getInput('formConfigLogoWidth')
|
||||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
@ -148,6 +145,66 @@ class form extends common {
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function layout() {
|
||||
// Liste des utilisateurs
|
||||
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
||||
ksort($userIdsFirstnames);
|
||||
self::$listUsers [] = '';
|
||||
foreach ($userIdsFirstnames as $userId => $userFirstname) {
|
||||
self::$listUsers [] = $userId;
|
||||
}
|
||||
// Soumission du formulaire
|
||||
if ($this->isPost()) {
|
||||
// Configuration
|
||||
$this->setData([
|
||||
'module',
|
||||
$this->getUrl(0),
|
||||
'config',
|
||||
[
|
||||
'button' => $this->getInput('formLayoutButton'),
|
||||
'captcha' => $this->getInput('formLayoutCaptcha', helper::FILTER_BOOLEAN),
|
||||
'group' => $this->getInput('formLayoutGroup', helper::FILTER_INT),
|
||||
'user' => self::$listUsers [$this->getInput('formLayoutUser', helper::FILTER_INT)],
|
||||
'mail' => $this->getInput('formLayoutMail') ,
|
||||
'pageId' => $this->getInput('formLayoutPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formLayoutPageId', helper::FILTER_ID) : '',
|
||||
'subject' => $this->getInput('formLayoutSubject'),
|
||||
'replyto' => $this->getInput('formLayoutMailReplyTo', helper::FILTER_BOOLEAN),
|
||||
'signature' => $this->getInput('formLayoutSignature'),
|
||||
'logoUrl' => $this->getInput('formLayoutLogo'),
|
||||
'logoWidth' => $this->getInput('formLayoutLogoWidth')
|
||||
]
|
||||
]);
|
||||
// Génération des données vides
|
||||
if ($this->getData(['module', $this->getUrl(0), 'data']) === null) {
|
||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
// Liste des pages
|
||||
foreach($this->getHierarchy(null, false) as $parentPageId => $childrenPageIds) {
|
||||
self::$pages[$parentPageId] = $this->getData(['page', $parentPageId, 'title']);
|
||||
foreach($childrenPageIds as $childKey) {
|
||||
self::$pages[$childKey] = ' ' . $this->getData(['page', $childKey, 'title']);
|
||||
}
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Paramètres',
|
||||
'vendor' => [
|
||||
'html-sortable',
|
||||
'flatpickr'
|
||||
],
|
||||
'view' => 'layout'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Données enregistrées
|
||||
*/
|
||||
@ -155,7 +212,7 @@ class form extends common {
|
||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||
if($data) {
|
||||
// Pagination
|
||||
$pagination = helper::pagination($data, $this->getUrl(),self::ITEMSPAGE);
|
||||
$pagination = helper::pagination($data, $this->getUrl(), self::$itemsperPages);
|
||||
// Liste des pages
|
||||
self::$pages = $pagination['pages'];
|
||||
// Inverse l'ordre du tableau
|
||||
|
@ -54,6 +54,15 @@ function add(inputUid, input) {
|
||||
position();
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher/cacher les options supplémentaires
|
||||
*/
|
||||
$(document).on("click", ".formConfigMoreToggle", function() {
|
||||
|
||||
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
|
||||
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Calcul des positions
|
||||
*/
|
||||
@ -76,14 +85,6 @@ if(inputs) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Afficher/cacher les options supplémentaires
|
||||
*/
|
||||
$(document).on("click", ".formConfigMoreToggle", function() {
|
||||
|
||||
$(this).parents(".formConfigInput").find(".formConfigMore").slideToggle();
|
||||
$(this).parents(".formConfigInput").find(".formConfigMoreLabel").slideToggle();
|
||||
});
|
||||
|
||||
/**
|
||||
* Crée un nouveau champ à partir des champs cachés
|
||||
@ -96,6 +97,12 @@ $("#formConfigAdd").on("click", function() {
|
||||
/**
|
||||
* Actions sur les champs
|
||||
*/
|
||||
|
||||
// Validation auto après ajout d'un champ
|
||||
$("a#formConfigAdd.button").click(function () {
|
||||
$("#formConfigForm").submit();
|
||||
});
|
||||
|
||||
// Tri entre les champs
|
||||
sortable("#formConfigInputs", {
|
||||
forcePlaceholderSize: true,
|
||||
@ -143,73 +150,3 @@ $("#formConfigInputs")
|
||||
});
|
||||
// Simule un changement de type au chargement de la page
|
||||
$(".formConfigType").trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher du mail
|
||||
*/
|
||||
$("#formConfigMailOptionsToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigMailOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formConfigMailOptions").slideUp(function() {
|
||||
$("#formConfigGroup").val("");
|
||||
$("#formConfigSubject").val("");
|
||||
$("#formConfigMail").val("");
|
||||
$("#formConfigUser").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher de la redirection
|
||||
*/
|
||||
$("#formConfigPageIdToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigPageIdWrapper").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formConfigPageIdWrapper").slideUp(function() {
|
||||
$("#formConfigPageId").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Paramètres par défaut au chargement
|
||||
*/
|
||||
$( document ).ready(function() {
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
if ($("#formConfigSignature").val() !== "text") {
|
||||
$("#formConfigLogoWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideDown();
|
||||
$("#formConfigLogoWidthWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formConfigLogoWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideUp();
|
||||
$("#formConfigLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
var formConfigSignatureDOM = $("#formConfigSignature");
|
||||
formConfigSignatureDOM.on("change", function() {
|
||||
if ($(this).val() !== "text") {
|
||||
$("#formConfigLogoWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideDown();
|
||||
$("#formConfigLogoWidthWrapper").addClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formConfigLogoWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWrapper").slideUp();
|
||||
$("#formConfigLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formConfigLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
@ -49,140 +49,48 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formOpen('formConfigForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('formConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('formConfigData', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||
'value' => 'Gérer les données'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('formConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset4">
|
||||
<?php echo template::button('formConfigData', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
||||
'value' => 'Données'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::button('formConfigLayout', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/layout',
|
||||
'value' => 'Paramètres',
|
||||
'ico' => 'cog-alt'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('formConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Liste des champs</h4>
|
||||
<div id="formConfigNoInput">
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
</div>
|
||||
<div id="formConfigInputs"></div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<?php echo template::text('formConfigButton', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Texte du bouton de soumission',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
|
||||
]); ?>
|
||||
<?php echo template::checkbox('formConfigMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
|
||||
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saississez un email. Votre serveur doit autoriser les envois de mail.'
|
||||
]); ?>
|
||||
<div id="formConfigMailOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col11 offset1">
|
||||
<?php echo template::text('formConfigSubject', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Sujet du mail',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Element 0 quand aucun membre a été sélectionné
|
||||
$groupMembers = [''] + $module::$groupNews;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col3 offset1">
|
||||
<?php echo template::select('formConfigGroup', $groupMembers, [
|
||||
'label' => 'Aux groupes à partir de',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('formConfigUser', $module::$listUsers, [
|
||||
'label' => 'A un membre',
|
||||
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('formConfigMail', [
|
||||
'label' => 'A une adresse email',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
|
||||
'help' => 'Un email ou une liste de diffusion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6 offset1">
|
||||
<?php echo template::checkbox('formConfigMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
|
||||
'help' => 'Cette option permet de réponse drectement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formConfigSignature', $module::$signature, [
|
||||
'label' => 'Sélectionner le type de signature',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::file('formConfigLogo', [
|
||||
'help' => 'Sélectionnez le logo du site',
|
||||
'label' => 'Logo',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formConfigLogoWidth', $module::$logoWidth, [
|
||||
'label' => 'Sélectionner la largeur du logo',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formConfigPageIdToggle', true, 'Redirection après soumission du formulaire', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col5">
|
||||
<?php echo template::select('formConfigPageId', $module::$pages, [
|
||||
'classWrapper' => 'displayNone',
|
||||
'label' => 'Sélectionner une page du site :',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::checkbox('formConfigCaptcha', true, 'Valider un captcha afin de soumettre le formulaire.', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="block">
|
||||
<h4>Liste des champs</h4>
|
||||
<div id="formConfigNoInput">
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
</div>
|
||||
<div id="formConfigInputs"></div>
|
||||
<div class="row">
|
||||
<div class="col1 offset11">
|
||||
<?php echo template::button('formConfigAdd', [
|
||||
'value' => template::ico('plus')
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col1 offset11">
|
||||
<?php echo template::button('formConfigAdd', [
|
||||
'value' => template::ico('plus'),
|
||||
'class' => 'buttonGreen'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'input'])): ?>
|
||||
<div class="col10 offset1">
|
||||
<?php echo template::formOpen('formForm'); ?>
|
||||
<?php foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input): ?>
|
||||
<?php if($input['type'] === $module::TYPE_MAIL): ?>
|
||||
@ -61,6 +62,7 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Le formulaire ne contient aucun champ.'); ?>
|
||||
|
18
module/form/view/layout/layout.css
Normal file
18
module/form/view/layout/layout.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
72
module/form/view/layout/layout.js.php
Normal file
72
module/form/view/layout/layout.js.php
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Affiche/cache les options de la case à cocher du mail
|
||||
*/
|
||||
$("#formLayoutMailOptionsToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formLayoutMailOptions").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formLayoutMailOptions").slideUp(function() {
|
||||
$("#formLayoutGroup").val("");
|
||||
$("#formLayoutSubject").val("");
|
||||
$("#formLayoutMail").val("");
|
||||
$("#formLayoutUser").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Affiche/cache les options de la case à cocher de la redirection
|
||||
*/
|
||||
$("#formLayoutPageIdToggle").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formLayoutPageIdWrapper").slideDown();
|
||||
}
|
||||
else {
|
||||
$("#formLayoutPageIdWrapper").slideUp(function() {
|
||||
$("#formLayoutPageId").val("");
|
||||
});
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
/**
|
||||
* Paramètres par défaut au chargement
|
||||
*/
|
||||
$( document ).ready(function() {
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
if ($("#formLayoutSignature").val() !== "text") {
|
||||
$("#formLayoutLogoWrapper").addClass("disabled");
|
||||
$("#formLayoutLogoWrapper").slideDown();
|
||||
$("#formLayoutLogoWidthWrapper").addClass("disabled");
|
||||
$("#formLayoutLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formLayoutLogoWrapper").removeClass("disabled");
|
||||
$("#formLayoutLogoWrapper").slideUp();
|
||||
$("#formLayoutLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formLayoutLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Masquer ou afficher la sélection du logo
|
||||
*/
|
||||
var formLayoutSignatureDOM = $("#formLayoutSignature");
|
||||
formLayoutSignatureDOM.on("change", function() {
|
||||
if ($(this).val() !== "text") {
|
||||
$("#formLayoutLogoWrapper").addClass("disabled");
|
||||
$("#formLayoutLogoWrapper").slideDown();
|
||||
$("#formLayoutLogoWidthWrapper").addClass("disabled");
|
||||
$("#formLayoutLogoWidthWrapper").slideDown();
|
||||
} else {
|
||||
$("#formLayoutLogoWrapper").removeClass("disabled");
|
||||
$("#formLayoutLogoWrapper").slideUp();
|
||||
$("#formLayoutLogoWidthWrapper").removeClass("disabled");
|
||||
$("#formLayoutLogoWidthWrapper").slideUp();
|
||||
}
|
||||
});
|
144
module/form/view/layout/layout.php
Normal file
144
module/form/view/layout/layout.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?php echo template::formOpen('formLayoutForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('formLayoutBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('formLayoutSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Validation du formulaire</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formLayoutCaptcha', true, 'Captcha', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'captcha'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::text('formLayoutButton', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Etiquette du bouton de soumission',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'button'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formLayoutPageIdToggle', true, 'Redirection après soumission du formulaire', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col5">
|
||||
<?php echo template::select('formLayoutPageId', $module::$pages, [
|
||||
'classWrapper' => 'displayNone',
|
||||
'label' => 'Page du site :',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'pageId'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Courriel</h4>
|
||||
<?php echo template::checkbox('formLayoutMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
|
||||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
|
||||
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saisissez un email. Votre serveur doit autoriser les envois de mail.'
|
||||
]); ?>
|
||||
<div id="formLayoutMailOptions" class="displayNone">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('formLayoutSubject', [
|
||||
'help' => 'Laissez vide afin de conserver le texte par défaut.',
|
||||
'label' => 'Sujet du mail',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'subject'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
// Element 0 quand aucun membre a été sélectionné
|
||||
$groupMembers = [''] + $module::$groupNews;
|
||||
?>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formLayoutGroup', $groupMembers, [
|
||||
'label' => 'Aux groupes à partir de',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formLayoutUser', $module::$listUsers, [
|
||||
'label' => 'A un membre',
|
||||
'selected' => array_search($this->getData(['module', $this->getUrl(0), 'config', 'user']),$module::$listUsers)
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('formLayoutMail', [
|
||||
'label' => 'A une adresse email',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'mail']),
|
||||
'help' => 'Un email ou une liste de diffusion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('formLayoutSignature', $module::$signature, [
|
||||
'label' => 'Sélectionner le type de signature',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'signature'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::file('formLayoutLogo', [
|
||||
'help' => 'Sélectionnez le logo du site',
|
||||
'label' => 'Logo',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'logoUrl'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('formLayoutLogoWidth', $module::$logoWidth, [
|
||||
'label' => 'Sélectionner la largeur du logo',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'logoWidth'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('formLayoutMailReplyTo', true, 'Répondre à l\'expéditeur depuis le mail de notification', [
|
||||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'replyto']),
|
||||
'help' => 'Cette option permet de réponse directement à l\'expéditeur du message si celui-ci a indiqué un email valide.'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Gabarit</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
|
||||
</div>
|
||||
<div class="col6">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user