mirror of
https://github.com/sruupl/batflat.git
synced 2026-01-17 11:12:04 +01:00
Add an optional checkbox to contact form in connection with the GPRD
This commit is contained in:
@@ -34,6 +34,11 @@ class Admin extends AdminModule
|
||||
$assign['email'] = $value['email'];
|
||||
}
|
||||
|
||||
$assign['checkbox'] = [
|
||||
'switch' => $value['checkbox.switch'],
|
||||
'content' => $this->tpl->noParse($value['checkbox.content']),
|
||||
];
|
||||
|
||||
$assign['driver'] = $value['driver'];
|
||||
$assign['phpmailer'] = [
|
||||
'server' => $value['phpmailer.server'],
|
||||
@@ -50,6 +55,8 @@ class Admin extends AdminModule
|
||||
{
|
||||
$update = [
|
||||
'email' => ($_POST['user'] > 0 ? $_POST['user'] : $_POST['email']),
|
||||
'checkbox.switch' => $_POST['checkbox']['switch'],
|
||||
'checkbox.content' => $_POST['checkbox']['content'],
|
||||
'driver' => $_POST['driver'],
|
||||
'phpmailer.server' => $_POST['phpmailer']['server'],
|
||||
'phpmailer.port' => $_POST['phpmailer']['port'],
|
||||
|
||||
@@ -13,8 +13,8 @@ return [
|
||||
'name' => $core->lang['contact']['module_name'],
|
||||
'description' => $core->lang['contact']['module_desc'],
|
||||
'author' => 'Sruu.pl',
|
||||
'version' => '1.1',
|
||||
'compatibility' => '1.3.*',
|
||||
'version' => '1.2',
|
||||
'compatibility' => '1.3.*',
|
||||
'icon' => 'envelope',
|
||||
|
||||
'install' => function () use ($core) {
|
||||
@@ -27,7 +27,9 @@ return [
|
||||
('contact', 'phpmailer.port', '587'),
|
||||
('contact', 'phpmailer.username', 'login@example.com'),
|
||||
('contact', 'phpmailer.name', 'Batflat contact'),
|
||||
('contact', 'phpmailer.password', 'yourpassword')");
|
||||
('contact', 'phpmailer.password', 'yourpassword'),
|
||||
('contact', 'checkbox.switch', '0'),
|
||||
('contact', 'checkbox.content', 'I agree to the processing of personal data...')");
|
||||
},
|
||||
'uninstall' => function () use ($core) {
|
||||
$core->db()->pdo()->exec("DELETE FROM `settings` WHERE `module` = 'contact'");
|
||||
|
||||
@@ -43,7 +43,12 @@ class Site extends SiteModule
|
||||
|
||||
private function _insertForm()
|
||||
{
|
||||
return $this->draw('form.html');
|
||||
return $this->draw('form.html', [
|
||||
'checkbox' => [
|
||||
'switch' => $this->settings('contact', 'checkbox.switch'),
|
||||
'content' => $this->settings('contact', 'checkbox.content'),
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
private function _initDriver()
|
||||
|
||||
@@ -9,6 +9,9 @@ save_success = "Contact data saved."
|
||||
save_failure = "Failed to save contact data."
|
||||
info = "Place this tag in website template"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Sorry, I can't find PHPMailer class. Please, execute <code>composer require phpmailer/phpmailer</code> in your project terminal."
|
||||
|
||||
driver = "Mail driver"
|
||||
|
||||
@@ -9,6 +9,9 @@ save_success = "Datos de contacto guardados."
|
||||
save_failure = "Fallo al guardar los datos de contacto."
|
||||
info = "Ponga esta etiqueta en la plantilla del sitio"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Disculpas, pero no encuento la clase PHPMailer. Por favor, ejecute <code>composer require phpmailer/phpmailer</code> en su terminal."
|
||||
|
||||
driver = "Mail driver"
|
||||
|
||||
@@ -6,7 +6,6 @@ save_success = "La configuration du mode de contact a été sauvegardée.
|
||||
save_failure = "Echec de sauvegarde de la configuration."
|
||||
info = "Placez cette balise dans le modèle su site"
|
||||
|
||||
|
||||
recipient = "Destinataire"
|
||||
custom = "-- Adresse email personnelle --"
|
||||
or_mail = "ou adresse email personnelle"
|
||||
@@ -15,6 +14,9 @@ save_success = "La configuration du mode de contact a été sauvegardée.
|
||||
save_failure = "Echec de sauvegarde de la configuration."
|
||||
info = "Placez cette balise dans le modèle su site"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Sorry, I can't find PHPMailer class. Please, execute <code>composer require phpmailer/phpmailer</code> in your project terminal."
|
||||
|
||||
driver = "Mail driver"
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
module_name = "Contatti"
|
||||
module_desc = "Visualizza il modulo di contatto nella pagina."
|
||||
recipient = "Destinatario"
|
||||
custom = "-- Indirizzo e-mail personalizzato --"
|
||||
or_mail = "o indirizzo e-mail personalizzato"
|
||||
example = "Esempio: contact@johndoe.com"
|
||||
save_success = "Dati di contatto salvati"
|
||||
save_failure = "Impossibile salvare i dati di contatto."
|
||||
info = "Inserisci questo tag nel template"
|
||||
phpmailer_error = "Spiacente, non riesco a trovare la classe PHPMailer. Per favore, esegui <code>composer require phpmailer/phpmailer</code> nel tuo terminale di progetto."
|
||||
driver = "Servizio E-mail"
|
||||
mail = "mail() (default)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Server"
|
||||
port = "Porta"
|
||||
username = "Username"
|
||||
password = "Password"
|
||||
name = "Nome mittente"
|
||||
module_name = "Contatti"
|
||||
module_desc = "Visualizza il modulo di contatto nella pagina."
|
||||
|
||||
recipient = "Destinatario"
|
||||
custom = "-- Indirizzo e-mail personalizzato --"
|
||||
or_mail = "o indirizzo e-mail personalizzato"
|
||||
example = "Esempio: contact@johndoe.com"
|
||||
save_success = "Dati di contatto salvati"
|
||||
save_failure = "Impossibile salvare i dati di contatto."
|
||||
info = "Inserisci questo tag nel template"
|
||||
phpmailer_error = "Spiacente, non riesco a trovare la classe PHPMailer. Per favore, esegui <code>composer require phpmailer/phpmailer</code> nel tuo terminale di progetto."
|
||||
driver = "Servizio E-mail"
|
||||
mail = "mail() (default)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Server"
|
||||
port = "Porta"
|
||||
username = "Username"
|
||||
password = "Password"
|
||||
name = "Nome mittente"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
@@ -9,6 +9,9 @@ save_success = "Contactgegevens opgeslagen."
|
||||
save_failure = "Kan contactgegevens niet opslaan."
|
||||
info = "Plaats deze tag in een website sjabloon"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Sorry, ik kan de PHPMailer-klasse niet vinden. Voer alsjeblieft <code>composer require phpmailer/phpmailer</code> uit in je projectterminal."
|
||||
|
||||
driver = "Mail driver"
|
||||
|
||||
@@ -9,6 +9,9 @@ save_success = "Pomyślnie zaktualizowano dane kontaktowe."
|
||||
save_failure = "Nie udało się zaktualizować danych kontaktowych."
|
||||
info = "Aby wyświetlić formularz na stronie, wklej tag"
|
||||
|
||||
checkbox = "Obowiązkowe pole typu checkbox"
|
||||
checkbox_content = "Treść do zaakceptowania"
|
||||
|
||||
phpmailer_error = "Klasa PHPMailer nie jest zainstalowana. Użyj <code>composer require phpmailer/phpmailer</code> aby zainstalować dodatkowy pakiet."
|
||||
|
||||
driver = "Wybierz sterownik do wysyłania wiadomości"
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
module_name = "Контакты"
|
||||
module_desc = "Отображать контактную форму на странице."
|
||||
recipient = "Получатель"
|
||||
custom = "-- Свой e-mail --"
|
||||
or_mail = "или свой e-mail "
|
||||
example = "Пример: contact@johndoe.com"
|
||||
save_success = "Данные контактной формы сохранены."
|
||||
save_failure = "Ошибка сохранения."
|
||||
info = "Поместите этот код на страницу сайта"
|
||||
phpmailer_error = "Извините, не могу найти класс PHPMailer. Пожалуйста, выполните <code>composer require phpmailer/phpmailer</code> в вашем терминале."
|
||||
driver = "Почтовая служба"
|
||||
mail = "mail() (по умолчанию)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Сервер"
|
||||
port = "Порт"
|
||||
username = "Имя пользователя"
|
||||
password = "Пароль"
|
||||
name = "Имя отправителя"
|
||||
module_name = "Контакты"
|
||||
module_desc = "Отображать контактную форму на странице."
|
||||
|
||||
recipient = "Получатель"
|
||||
custom = "-- Свой e-mail --"
|
||||
or_mail = "или свой e-mail "
|
||||
example = "Пример: contact@johndoe.com"
|
||||
save_success = "Данные контактной формы сохранены."
|
||||
save_failure = "Ошибка сохранения."
|
||||
info = "Поместите этот код на страницу сайта"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Извините, не могу найти класс PHPMailer. Пожалуйста, выполните <code>composer require phpmailer/phpmailer</code> в вашем терминале."
|
||||
|
||||
driver = "Почтовая служба"
|
||||
mail = "mail() (по умолчанию)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Сервер"
|
||||
port = "Порт"
|
||||
username = "Имя пользователя"
|
||||
password = "Пароль"
|
||||
name = "Имя отправителя"
|
||||
@@ -9,6 +9,9 @@ save_success = "Kontaktinformationen sparades korrekt."
|
||||
save_failure = "Misslyckades att spara kontaktinformationen."
|
||||
info = "Placera denna kod i webbplatsens mall."
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Ledsen, kan inte hitta PHPMailer class. Vänligen, aktivera <code>composer require phpmailer/phpmailer</code> i din projektmapp."
|
||||
|
||||
driver = "Drivrutin för e-post"
|
||||
|
||||
@@ -1,18 +1,24 @@
|
||||
module_name = "İletişim"
|
||||
module_desc = "Ekrana iletişim formu getirir."
|
||||
recipient = "Alıcı"
|
||||
custom = "-- Özel e-posta adresi --"
|
||||
or_mail = "veya özel e-posta adresi."
|
||||
example = "Örnek: contact@johndoe.com"
|
||||
save_success = "İletişim bilgisi kaydedildi."
|
||||
save_failure = "İletişim bilgisi kaydedilemedi."
|
||||
info = "Bu etiketi site şablonu içerisine yerleştirin"
|
||||
phpmailer_error = "Üzgünüm, PHPMailer sınıfı bulunamadı. Lütfen terminal ekranında <code>composer require phpmailer/phpmailer</code> kodunu çalıştırın."
|
||||
driver = "Posta sürücüsü"
|
||||
mail = "mail() (öntanımlı)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Sunucu"
|
||||
port = "Port"
|
||||
username = "Kullanıcı"
|
||||
password = "Parola"
|
||||
name = "Gönderici adı"
|
||||
module_name = "İletişim"
|
||||
module_desc = "Ekrana iletişim formu getirir."
|
||||
|
||||
recipient = "Alıcı"
|
||||
custom = "-- Özel e-posta adresi --"
|
||||
or_mail = "veya özel e-posta adresi."
|
||||
example = "Örnek: contact@johndoe.com"
|
||||
save_success = "İletişim bilgisi kaydedildi."
|
||||
save_failure = "İletişim bilgisi kaydedilemedi."
|
||||
info = "Bu etiketi site şablonu içerisine yerleştirin"
|
||||
|
||||
checkbox = "Required checkbox field"
|
||||
checkbox_content = "Content to accept"
|
||||
|
||||
phpmailer_error = "Üzgünüm, PHPMailer sınıfı bulunamadı. Lütfen terminal ekranında <code>composer require phpmailer/phpmailer</code> kodunu çalıştırın."
|
||||
|
||||
driver = "Posta sürücüsü"
|
||||
mail = "mail() (öntanımlı)"
|
||||
phpmailer = "PHPMailer (SMTP)"
|
||||
server = "Sunucu"
|
||||
port = "Port"
|
||||
username = "Kullanıcı"
|
||||
password = "Parola"
|
||||
name = "Gönderici adı"
|
||||
@@ -15,15 +15,37 @@
|
||||
</div>
|
||||
<div class="form-group collapse" id="mail">
|
||||
<label>{$lang.contact.or_mail}</label>
|
||||
<input class="form-control" type="email" name="email" value="{$contact.email|e}" placeholder="{$lang.contact.example}" />
|
||||
</div>
|
||||
<input class="form-control" type="email" name="email" value="{$contact.email|e}" placeholder="{$lang.contact.example}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{$lang.contact.checkbox}</label>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="checkbox[switch]" value="0" {if: !$contact.checkbox.switch}checked{/if}> {$lang.general.say_no}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="checkbox[switch]" value="1" {if: $contact.checkbox.switch}checked{/if}> {$lang.general.say_yes}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group collapse" id="checkbox">
|
||||
<label>{$lang.contact.checkbox_content}</label>
|
||||
<textarea class="form-control" name="checkbox[content]" rows="4">{$contact.checkbox.content|e}</textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{$lang.contact.driver}</label>
|
||||
<p>
|
||||
<label style="font-weight:normal;"><input type="radio" name="driver" value="mail" {if: $contact.driver == 'mail'}checked{/if}/> {$lang.contact.mail}</label>
|
||||
<br />
|
||||
<label style="font-weight:normal;"><input type="radio" name="driver" value="phpmailer" {if: $contact.driver == 'phpmailer'}checked{/if}/> {$lang.contact.phpmailer}</label>
|
||||
</p>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="driver" value="mail" {if: $contact.driver == 'mail'}checked{/if}> {$lang.contact.mail}
|
||||
</label>
|
||||
</div>
|
||||
<div class="radio">
|
||||
<label>
|
||||
<input type="radio" name="driver" value="phpmailer" {if: $contact.driver == 'phpmailer'}checked{/if}> {$lang.contact.phpmailer}
|
||||
</label>
|
||||
</div>
|
||||
<div id="phpmailer" class="well well-sm clearfix collapse" style="margin: 15px 0 0 0;">
|
||||
{if: !class_exists("PHPMailer")}
|
||||
<div class="alert alert-danger">{$lang.contact.phpmailer_error}</div>
|
||||
@@ -32,29 +54,29 @@
|
||||
<div class="row">
|
||||
<div class="col-xs-10">
|
||||
<label>{$lang.contact.server}</label>
|
||||
<input type="text" class="form-control" name="phpmailer[server]" value="{$contact.phpmailer.server}" />
|
||||
<input type="text" class="form-control" name="phpmailer[server]" value="{$contact.phpmailer.server}">
|
||||
</div>
|
||||
<div class="col-xs-2">
|
||||
<label>{$lang.contact.port}</label>
|
||||
<input type="text" class="form-control" name="phpmailer[port]" value="{$contact.phpmailer.port}" />
|
||||
<input type="text" class="form-control" name="phpmailer[port]" value="{$contact.phpmailer.port}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{$lang.contact.name}</label>
|
||||
<input type="text" class="form-control" name="phpmailer[name]" value="{$contact.phpmailer.name}" />
|
||||
<input type="text" class="form-control" name="phpmailer[name]" value="{$contact.phpmailer.name}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{$lang.contact.username}</label>
|
||||
<input type="text" class="form-control" name="phpmailer[username]" value="{$contact.phpmailer.username}" />
|
||||
<input type="text" class="form-control" name="phpmailer[username]" value="{$contact.phpmailer.username}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{$lang.contact.password}</label>
|
||||
<input type="password" class="form-control" name="phpmailer[password]" value="{$contact.phpmailer.password}" />
|
||||
<input type="password" class="form-control" name="phpmailer[password]" value="{$contact.phpmailer.password}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" name="save" class="btn btn-primary" value="{$lang.general.save}" />
|
||||
<input type="submit" name="save" class="btn btn-primary" value="{$lang.general.save}">
|
||||
</form>
|
||||
<div class="well well-sm clearfix" style="margin: 15px 0 0 0;">
|
||||
{$lang.contact.info} <strong>{noparse}{$contact.form}{/noparse}</strong>.
|
||||
@@ -66,21 +88,30 @@
|
||||
</article>
|
||||
|
||||
<script>
|
||||
$("form select[name='user']").change(function()
|
||||
$('form select[name="user"]').change(function()
|
||||
{
|
||||
var page = $(this).find("option:selected").val();
|
||||
if(page > 0)
|
||||
if($(this).find('option:selected').val() > 0)
|
||||
$('form #mail').slideUp();
|
||||
else
|
||||
$('form #mail').slideDown();
|
||||
}).change();
|
||||
$("form input[name='driver']").change(function()
|
||||
|
||||
$('form input[name="checkbox[switch]"]').change(function()
|
||||
{
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
var val = $(this).val();
|
||||
console.log(val);
|
||||
if(val == "phpmailer")
|
||||
if(this.value == 0)
|
||||
$('form #checkbox').slideUp();
|
||||
else
|
||||
$('form #checkbox').slideDown();
|
||||
}
|
||||
}).change();
|
||||
|
||||
$('form input[name="driver"]').change(function()
|
||||
{
|
||||
if($(this).is(':checked'))
|
||||
{
|
||||
if(this.value == 'phpmailer')
|
||||
$('form #phpmailer').slideDown();
|
||||
else
|
||||
$('form #phpmailer').slideUp();
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
<label for="inputMessage">{$lang.contact.message}</label>
|
||||
<textarea rows="5" id="inputMessage" class="form-control" name="message" placeholder="{$lang.contact.message}" required></textarea>
|
||||
</div>
|
||||
{if: $checkbox.switch > 0}
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="agreement" required> <small>{$checkbox.content}</small>
|
||||
</label>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- antispam field -->
|
||||
<div class="form-group" id="antispam">
|
||||
@@ -22,7 +29,7 @@
|
||||
</div>
|
||||
<script>
|
||||
(function () {
|
||||
var e = document.getElementById("antispam");
|
||||
var e = document.getElementById('antispam');
|
||||
e.parentNode.removeChild(e);
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user