Skip to content
Code-Schnipsel Gruppen Projekte
Commit 46e70ee2 erstellt von Dominik Chrzanowski's avatar Dominik Chrzanowski
Dateien durchsuchen

feat: Added new setting (formContent) [SimpleContact] #132

Übergeordneter 38db4d61
No related branches found
No related tags found
1 Merge Request!14Feat#132
Dieser Commit ist Teil des Merge Request !14. Hier erstellte Kommentare werden im Kontext dieses Merge Request erstellt.
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
<setting name="useCaptcha" type="checkbox"> <setting name="useCaptcha" type="checkbox">
<locale group="quiqqer/bricks" var="brick.control.simpleContact.useCaptcha"/> <locale group="quiqqer/bricks" var="brick.control.simpleContact.useCaptcha"/>
</setting> </setting>
<setting name="formContent" data-qui="controls/editors/Input" type="text">
<locale group="quiqqer/bricks" var="brick.control.simpleContact.formContent"/>
</setting>
</settings> </settings>
</brick> </brick>
......
...@@ -187,6 +187,11 @@ ...@@ -187,6 +187,11 @@
<en> <en>
<![CDATA[Protect form submit from spam with a CAPTCHA (requires <b>quiqqer/captcha</b> to be installed!)]]></en> <![CDATA[Protect form submit from spam with a CAPTCHA (requires <b>quiqqer/captcha</b> to be installed!)]]></en>
</locale> </locale>
<locale name="brick.control.simpleContact.formContent">
<de><![CDATA[Inhalt des Formulars]]></de>
<en><![CDATA[Form content]]></en>
<pl><![CDATA[Zawartość formularza]]></pl>
</locale>
<locale name="brick.control.simpleContact.mail.privacyPolicy_accepted"> <locale name="brick.control.simpleContact.mail.privacyPolicy_accepted">
<de><![CDATA[Der Benutzer hat die Datenschutzbestimmungen akzeptiert.]]></de> <de><![CDATA[Der Benutzer hat die Datenschutzbestimmungen akzeptiert.]]></de>
<en><![CDATA[The user has accepted the Privacy Policy.]]></en> <en><![CDATA[The user has accepted the Privacy Policy.]]></en>
......
...@@ -25,6 +25,10 @@ ...@@ -25,6 +25,10 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
.qui-contact-formContent {
margin-bottom: 2rem;
}
/* Message & Message color /* Message & Message color
================================================================= */ ================================================================= */
......
...@@ -31,6 +31,12 @@ ...@@ -31,6 +31,12 @@
</style> </style>
</noscript> </noscript>
{if $formContent}
<div class="qui-contact-formContent default-content">
{$formContent}
</div>
{/if}
{if $this->getAttribute('labels')} {if $this->getAttribute('labels')}
<label for="qui-contact-name"> <label for="qui-contact-name">
{locale group="quiqqer/bricks" value="control.simpleContact.name"} {locale group="quiqqer/bricks" value="control.simpleContact.name"}
......
...@@ -32,7 +32,8 @@ public function __construct($attributes = []) ...@@ -32,7 +32,8 @@ public function __construct($attributes = [])
'data-brickid' => false, 'data-brickid' => false,
'mailTo' => '', // receiver email 'mailTo' => '', // receiver email
'showPrivacyPolicyCheckbox' => false, 'showPrivacyPolicyCheckbox' => false,
'useCaptcha' => false 'useCaptcha' => false,
'formContent' => ''
]); ]);
parent::__construct($attributes); parent::__construct($attributes);
...@@ -51,7 +52,7 @@ public function __construct($attributes = []) ...@@ -51,7 +52,7 @@ public function __construct($attributes = [])
} }
$this->addCSSFile( $this->addCSSFile(
dirname(__FILE__).'/SimpleContact.css' dirname(__FILE__) . '/SimpleContact.css'
); );
} }
...@@ -69,6 +70,7 @@ public function getBody() ...@@ -69,6 +70,7 @@ public function getBody()
$message = ''; $message = '';
$privacyPolicyCheckbox = $this->getAttribute('showPrivacyPolicyCheckbox'); $privacyPolicyCheckbox = $this->getAttribute('showPrivacyPolicyCheckbox');
$useCaptcha = $this->getAttribute('useCaptcha'); $useCaptcha = $this->getAttribute('useCaptcha');
$formContent = $this->getAttribute('formContent');
$error = false; $error = false;
// Is javascript disabled? // Is javascript disabled?
...@@ -127,7 +129,7 @@ public function getBody() ...@@ -127,7 +129,7 @@ public function getBody()
$label = preg_replace( $label = preg_replace(
'#\[([^\]]*)\]#i', '#\[([^\]]*)\]#i',
'<a href="'.$url.'" target="_blank">$1</a>', '<a href="' . $url . '" target="_blank">$1</a>',
$label $label
); );
...@@ -160,13 +162,14 @@ public function getBody() ...@@ -160,13 +162,14 @@ public function getBody()
} }
$Engine->assign([ $Engine->assign([
'this' => $this, 'this' => $this,
'name' => $name, 'name' => $name,
'email' => $email, 'email' => $email,
'message' => $message 'message' => $message,
'formContent' => $formContent
]); ]);
return $Engine->fetch(dirname(__FILE__).'/SimpleContact.html'); return $Engine->fetch(dirname(__FILE__) . '/SimpleContact.html');
} }
/** /**
...@@ -193,7 +196,7 @@ public function sendMail($Engine) ...@@ -193,7 +196,7 @@ public function sendMail($Engine)
} }
$receiver = $this->getAttribute('mailTo'); $receiver = $this->getAttribute('mailTo');
$url = $this->getProject()->getHost().$Site->getUrlRewritten(); $url = $this->getProject()->getHost() . $Site->getUrlRewritten();
// fallback: admin email // fallback: admin email
if (!QUI\Utils\Security\Orthos::checkMailSyntax($receiver)) { if (!QUI\Utils\Security\Orthos::checkMailSyntax($receiver)) {
...@@ -204,7 +207,7 @@ public function sendMail($Engine) ...@@ -204,7 +207,7 @@ public function sendMail($Engine)
$Mailer->addRecipient($receiver); $Mailer->addRecipient($receiver);
$Mailer->addReplyTo($_POST['email']); $Mailer->addReplyTo($_POST['email']);
$Mailer->setSubject($Site->getAttribute('title').' | '.$url); $Mailer->setSubject($Site->getAttribute('title') . ' | ' . $url);
$body = " $body = "
<span style=\"font-weight: bold;\">From:</span> {$_POST['name']}<br /> <span style=\"font-weight: bold;\">From:</span> {$_POST['name']}<br />
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren