added saimod_mail, implemented newsletter subscribe & contact form
This commit is contained in:
parent
fe53de42e8
commit
ee844001b5
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,3 +1,9 @@
|
||||
[submodule "lib/system"]
|
||||
path = lib/system
|
||||
url = git@github.com:webcraftmedia/system.git
|
||||
[submodule "wecker_manufaktur/sai/saimod_mail"]
|
||||
path = wecker_manufaktur/sai/saimod_mail
|
||||
url = git@github.com:webcraftmedia/saimod_mail.git
|
||||
[submodule "lib/mail_cannon"]
|
||||
path = lib/mail_cannon
|
||||
url = git@github.com:webcraftmedia/lib_mail_cannon.git
|
||||
|
||||
@ -1,2 +1,3 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__).'/system/autoload.inc';
|
||||
require_once dirname(__FILE__).'/system/autoload.inc';
|
||||
require_once dirname(__FILE__).'/mail_cannon/autoload.inc';
|
||||
1
lib/mail_cannon
Submodule
1
lib/mail_cannon
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 22e187271f60cd47746814df5e6f97f85bd5d4e9
|
||||
@ -1,2 +1,21 @@
|
||||
<?php
|
||||
class api_wecker_manufaktur extends \SYSTEM\API\api_system {}
|
||||
class api_wecker_manufaktur extends \SYSTEM\API\api_system {
|
||||
const EMAIL_WEBSITE_CONTACT = 10;
|
||||
const EMAIL_LIST_NEWSLETTER = 2;
|
||||
const EMAIL_NEWSLETTER_SUBSCRIBE = 20;
|
||||
|
||||
public static function call_send_mail($data){
|
||||
$to = 'contact@democracy-deutschland.de';
|
||||
$data['json'] = str_replace('\/', '/',json_encode($data,JSON_PRETTY_PRINT));
|
||||
\SAI\saimod_mail::contact($data['email'],null,$data['name'],'');
|
||||
\SAI\saimod_mail::send_mail($to, self::EMAIL_WEBSITE_CONTACT, null,true,$data,$data['email']);
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
|
||||
public static function call_send_subscribe($data){
|
||||
\SAI\saimod_mail::contact($data['email']);
|
||||
\SAI\saimod_mail::subscribe($data['email'], self::EMAIL_LIST_NEWSLETTER);
|
||||
\SAI\saimod_mail::send_mail($data['email'], self::EMAIL_NEWSLETTER_SUBSCRIBE, self::EMAIL_LIST_NEWSLETTER,true);
|
||||
return \SYSTEM\LOG\JsonResult::ok();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,12 +6,12 @@ $color_green_1: rgb(12,22,11);
|
||||
$color_green_2: rgb(21,26,16);
|
||||
$color_green_3: rgb(29,48,25);
|
||||
|
||||
// Paddings & Margins
|
||||
$padding_page: 100px;
|
||||
$padding_heading_top: 100px;
|
||||
$padding_heading_bottom: 50px;
|
||||
$padding_footer: 25px;
|
||||
$padding_footer_bottomline: 10px;
|
||||
// Distances
|
||||
$distance_huge: 250px;
|
||||
$distance_big: 100px;
|
||||
$distance_large: 50px;
|
||||
$distance_medium: 25px;
|
||||
$distance_small: 10px;
|
||||
|
||||
// Images
|
||||
$home_img: url(./files/img/wecker_manufaktur.jpg);
|
||||
@ -35,8 +35,8 @@ body {
|
||||
}
|
||||
|
||||
#menu {
|
||||
padding-left: $padding_page;
|
||||
padding-right: $padding_page;
|
||||
padding-left: $distance_big;
|
||||
padding-right: $distance_big;
|
||||
}
|
||||
|
||||
#home {
|
||||
@ -45,8 +45,8 @@ body {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-left: $padding_page;
|
||||
padding-right: $padding_page;
|
||||
padding-left: $distance_big;
|
||||
padding-right: $distance_big;
|
||||
|
||||
h1{
|
||||
display: flex;
|
||||
@ -71,19 +71,19 @@ body {
|
||||
#content {
|
||||
background-image: linear-gradient($color_green_1,$color_green_3);
|
||||
text-align: center;
|
||||
padding-left: $padding_page;
|
||||
padding-right: $padding_page;
|
||||
padding-left: $distance_big;
|
||||
padding-right: $distance_big;
|
||||
|
||||
#philosophy{
|
||||
h2{
|
||||
padding-top: $padding_heading_top;
|
||||
padding-bottom: $padding_heading_bottom;
|
||||
padding-top: $distance_large;
|
||||
padding-bottom: $distance_medium;
|
||||
}
|
||||
}
|
||||
|
||||
#persons{
|
||||
padding-top: $padding_heading_top;
|
||||
padding-bottom: $padding_heading_bottom;
|
||||
padding-top: $distance_large;
|
||||
padding-bottom: $distance_medium;
|
||||
|
||||
.person {
|
||||
img {
|
||||
@ -103,8 +103,8 @@ body {
|
||||
|
||||
#projects{
|
||||
h2{
|
||||
padding-top: $padding_heading_top;
|
||||
padding-bottom: $padding_heading_bottom;
|
||||
padding-top: $distance_large;
|
||||
padding-bottom: $distance_medium;
|
||||
}
|
||||
|
||||
.project{
|
||||
@ -130,11 +130,42 @@ body {
|
||||
}
|
||||
|
||||
#apply{
|
||||
padding-bottom: $distance_medium;
|
||||
|
||||
h2 {
|
||||
padding-top: $padding_heading_top;
|
||||
padding-bottom: $padding_heading_bottom;
|
||||
padding-top: $distance_large;
|
||||
padding-bottom: $distance_medium;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
background-image: linear-gradient(to right, $color_green_1,$color_green_3);
|
||||
width: 100%;
|
||||
color: $color_white;
|
||||
border: 0;
|
||||
padding: $distance_small;
|
||||
border-radius: $distance_small;
|
||||
}
|
||||
|
||||
input::placeholder, textarea::placeholder{
|
||||
color: $color_white;
|
||||
}
|
||||
|
||||
input {
|
||||
height: $distance_large;
|
||||
margin-bottom: $distance_medium;
|
||||
}
|
||||
|
||||
textarea {
|
||||
height: $distance_huge;
|
||||
}
|
||||
|
||||
#apply-send-box {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#apply-count-box {
|
||||
text-align: right;
|
||||
}
|
||||
padding-bottom: $padding_heading_bottom;
|
||||
}
|
||||
|
||||
.table-condensed {
|
||||
@ -149,16 +180,16 @@ body {
|
||||
|
||||
#footer-links {
|
||||
background-color: $color_green_2;
|
||||
padding-left: $padding_page;
|
||||
padding-right: $padding_page;
|
||||
padding-top: $padding_footer;
|
||||
padding-bottom: $padding_footer;
|
||||
padding-left: $distance_big;
|
||||
padding-right: $distance_big;
|
||||
padding-top: $distance_small;
|
||||
padding-bottom: $distance_small;
|
||||
}
|
||||
|
||||
#footer-bottomline {
|
||||
background-color: $color_black;
|
||||
padding: $padding_footer_bottomline;
|
||||
padding-left: $padding_page;
|
||||
padding-right: $padding_page;
|
||||
padding: $distance_small;
|
||||
padding-left: $distance_big;
|
||||
padding-right: $distance_big;
|
||||
text-align: center;
|
||||
}
|
||||
@ -130,6 +130,7 @@ class default_page implements \SYSTEM\PAGE\DefaultPage {
|
||||
$vars['css'] = self::css();
|
||||
$vars['_content_persons'] = self::getPersons();
|
||||
$vars['_content_projects'] = self::getProjects();
|
||||
$vars['_content_apply'] = \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/content_apply.tpl'))->SERVERPATH());
|
||||
$vars = array_merge($vars, \SYSTEM\PAGE\text::tag('wecker_manufaktur'));
|
||||
return \SYSTEM\PAGE\replace::replaceFile((new PPAGE('default_page/tpl/default_page.tpl'))->SERVERPATH(), $vars);
|
||||
}
|
||||
|
||||
@ -8,6 +8,74 @@ $(document).ready(function() {
|
||||
$('.project-link').click(function(e){showProject(e,$(this).attr('project'),false,true)})
|
||||
|
||||
$('.project-person-link').click(function(e){showPerson(e,$(this).attr('person'),true,false)})
|
||||
|
||||
$("#apply-send").click(function(e){
|
||||
e.preventDefault();
|
||||
var data = { name: $('#apply-name').val(),
|
||||
email: $('#apply-email').val(),
|
||||
message: $('#apply-message').val()};
|
||||
|
||||
if (data.name.length < 3 ){
|
||||
alert( "Bitte einen Namen eingeben");
|
||||
$("#apply-name").focus();
|
||||
return null;
|
||||
}
|
||||
if (!validateEmail(data.email)){
|
||||
alert( "Bitte einen gültige E-Mail eingeben");
|
||||
$("#apply-email").focus();
|
||||
return null;
|
||||
}
|
||||
if (data.message.length > 500 ){
|
||||
alert( "Bitte einen kürzeren Text eingeben");
|
||||
$("#apply-message").focus();
|
||||
return null;
|
||||
}
|
||||
|
||||
sendMail(data,function(data){
|
||||
if(data && data.status){
|
||||
$("#apply-message").val('')
|
||||
alert("Danke! Deine Nachricht wurde versendet.");
|
||||
} else {
|
||||
alert("Deine Nachricht konnte nicht versendet weden. Bitte versuche es später noch einmal. Danke.");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#apply-message').on('keyup',function(){
|
||||
$('#apply-count').html($(this).val().length+'/500');
|
||||
});
|
||||
|
||||
$('#footer-nl-subscribe').click(function(e){
|
||||
e.preventDefault();
|
||||
var email = $('#footer-nl-email').val();
|
||||
|
||||
if(!validateEmail(email)){
|
||||
alert( "Bitte einen gültige E-Mail eingeben");
|
||||
$('#footer-nl-email').focus()
|
||||
} else {
|
||||
$.ajax({
|
||||
async: true,
|
||||
url: './api.php',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
call: 'send_subscribe',
|
||||
data: { email: email}
|
||||
},
|
||||
success: function(data){
|
||||
if(!data.status){
|
||||
alert("Das Eintragen in den Newsletter hat leider nicht funktioniert. Bitte versuche es später noch einmal. Danke.");
|
||||
} else {
|
||||
$('#confirm').show();
|
||||
$('#formular').hide();
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
alert("Das Eintragen in den Newsletter hat leider nicht funktioniert. Bitte versuche es später noch einmal. Danke.");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function showPerson(event,subject_id,jump,toggle){
|
||||
@ -61,4 +129,28 @@ function showProject(event,subject_id,jump,toggle){
|
||||
if(!toggle || isHidden){
|
||||
$('#project-details-'+subject_id).removeClass('d-none');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function sendMail(data,callback){
|
||||
$.ajax({
|
||||
async: true,
|
||||
url: './api.php',
|
||||
type: 'GET',
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
call: 'send_mail',
|
||||
data: data
|
||||
},
|
||||
success: function(data){
|
||||
callback(data);
|
||||
},
|
||||
error: function(){
|
||||
callback(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function validateEmail(email) {
|
||||
var re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||
return re.test(String(email).toLowerCase());
|
||||
}
|
||||
17
wecker_manufaktur/page/default_page/tpl/content_apply.tpl
Normal file
17
wecker_manufaktur/page/default_page/tpl/content_apply.tpl
Normal file
@ -0,0 +1,17 @@
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<input id="apply-name" type="text" placeholder="${content_apply_name_placeholder}" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<input id="apply-email" type="email" placeholder="${content_apply_email_placeholder}" />
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<textarea id="apply-message" placeholder="${content_apply_message_placeholder}" maxlength="500"></textarea>
|
||||
</div>
|
||||
<div id="apply-send-box" class="col-6">
|
||||
<a id="apply-send" href="#">${content_apply_send}</a>
|
||||
</div>
|
||||
<div id="apply-count-box" class="col-6">
|
||||
<span id="apply-count">0/500</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -1,3 +1,4 @@
|
||||
<?php
|
||||
require_once dirname(__FILE__).'/saimod_project/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_person/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_person/autoload.inc';
|
||||
require_once dirname(__FILE__).'/saimod_mail/autoload.inc';
|
||||
1
wecker_manufaktur/sai/saimod_mail
Submodule
1
wecker_manufaktur/sai/saimod_mail
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 62e68fcb8a6871689b13859fd589d5fb54b9ce2f
|
||||
@ -3,7 +3,9 @@ namespace SQL;
|
||||
class DATA_WECKER_MANUFAKTUR extends \SYSTEM\DB\QI {
|
||||
public static function get_class(){return \get_class();}
|
||||
public static function files_mysql(){
|
||||
return array( (new \PSQL('/mysql/system_page.sql'))->SERVERPATH(),
|
||||
(new \PSQL('/mysql/system_text.sql'))->SERVERPATH());
|
||||
return array( (new \PSQL('/mysql/system_api.sql'))->SERVERPATH(),
|
||||
(new \PSQL('/mysql/system_page.sql'))->SERVERPATH(),
|
||||
(new \PSQL('/mysql/system_text.sql'))->SERVERPATH(),
|
||||
(new \PSQL('/mysql/saimod_mail.sql'))->SERVERPATH());
|
||||
}
|
||||
}
|
||||
11
wecker_manufaktur/sql/mysql/saimod_mail.sql
Normal file
11
wecker_manufaktur/sql/mysql/saimod_mail.sql
Normal file
@ -0,0 +1,11 @@
|
||||
INSERT IGNORE INTO email_list (`id`,`name`,`system_lock`) VALUES (2,'Newsletter',1);
|
||||
|
||||
|
||||
|
||||
INSERT IGNORE INTO email (`id`,`name`,`account`,`sender`,`subject`,`template_text`,`template_html`,`system_lock`) VALUES (10,'Website Contact','test@webcraft-media.de','${data_vorname} ${data_nachname} <${data_email}>','${emoji_mobile} DEMOCRACY Website: ${data_type} from ${data_email}',10,11,1);
|
||||
INSERT IGNORE INTO email_template (`id`,`type`,`name`,`value`,`system_lock`) VALUES (10,0,'Website Contact Text','Eine Nachricht ist über die Website eingegangen:\n\n${data_json}\n\nAchtung: Diese EMail ist die einzige Kopie dieser Daten',1);
|
||||
INSERT IGNORE INTO email_template (`id`,`type`,`name`,`value`,`system_lock`) VALUES (11,1,'Website Contact HTML','<style>\n table, th, td {\n border: 1px solid black;\n border-collapse: collapse;\n }\n</style>\nEine Nachricht ist über die Website eingegangen:<br>\n<br>\n<h3>Type: ${data_type}</h3>\n<table>\n <tr>\n <th>EMail</th>\n <td><a href=\"mailto:${data_email}\">${data_email}<a></td>\n </tr>\n <tr>\n <th>Name</th>\n <td>${data_vorname} ${data_nachname}</td>\n </tr>\n <tr>\n <th>Type</th>\n <td>${data_type}</td>\n </tr>\n <tr>\n <th>Text</th>\n <td><pre>${data_text}</pre></td>\n </tr>\n</table>\n<h3>Raw Data:</h3>\n<pre>${data_json}</pre>\n<br>\n<div class=\"footer\" style=\"margin-top: 3em; padding-top: 1em; border-top-width: 2px; border-top-color: #4494d3; border-top-style: solid;\">\n <p style=\"max-width: 35rem;\">\n Wir sind gespannt, welche großartigen Möglichkeiten in der Zukunft noch für unser Projekt offen stehen und verbleiben mit einem Lächeln und ganz herzlichen Grüßen,\n </p> \n <p style=\"max-width: 35rem;\">\n Ihr TEAM DEMOCRACY\n </p>\n <img class=\"logo\" alt=\"DEMOCRACY Logo\" src=\"cid:democracy_logo\" style=\"height: auto; line-height: 100%; outline: none; text-decoration: none; -ms-interpolation-mode: bicubic; border: 0 none;\" />\n <p style=\"max-width: 35rem;\">\n DEMOCRACY Deutschland e.V.<br />\n mobil +49 176 470 40 213<br />\n <a href=\"mailto:contact@democracy-deutschland.de\" style=\"color: #4f81bd; font-weight: bold;\">\n contact@democracy-deutschland.de\n </a><br />\n <a href=\"https://www.democracy-deutschland.de\" style=\"color: #4f81bd; font-weight: bold;\">\n https://www.democracy-deutschland.de\n </a><br />\n <a href=\"https://github.com/demokratie-live/\" style=\"color: #4f81bd; font-weight: bold;\">\n https://github.com/demokratie-live\n </a>\n </p>\n </div>\n',1);
|
||||
|
||||
INSERT IGNORE INTO email (`id`,`name`,`account`,`sender`,`subject`,`template_text`,`template_html`,`system_lock`) VALUES (20,'Newsletter Subscribe','test@webcraft-media.de','DEMOCRACY Deutschland e.V. <contact@democracy-deutschland.de>','${emoji_mobile} DEMOCRACY: Deine Newsletter-Anmeldung',20,21,1);
|
||||
INSERT IGNORE INTO email_template (`id`,`type`,`name`,`value`,`system_lock`) VALUES (20,0,'Newsletter Subscribe Text','Hallo liebe/r Interessierte/r,\n\nSie haben sich für unseren Newsletter eingetragen.\n\nUm sich wieder abzumelden folgen Sie bitte folgendem Link:\n${unsubscribe_link}\n\nHerzliche Grüße\nTeam DEMOCRACY',1);
|
||||
INSERT IGNORE INTO email_template (`id`,`type`,`name`,`value`,`system_lock`) VALUES (21,1,'Newsletter Subscribe HTML','Hallo liebe/r Interessierte/r,<br>\n<br>\nSie haben sich für unseren Newsletter eingetragen.<br>\n<br>\nUm sich wieder abzumelden folgen Sie bitte diesem <a href=\"${unsubscribe_link}\">Abmelde-Link</a><br>\n<br>\nHerzliche Grüße<br>\nTeam DEMOCRACY',1);
|
||||
2
wecker_manufaktur/sql/mysql/system_api.sql
Normal file
2
wecker_manufaktur/sql/mysql/system_api.sql
Normal file
@ -0,0 +1,2 @@
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (100, 0, 2, 10, 'send_mail', 'data', 'JSON');
|
||||
REPLACE INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (110, 0, 2, 10, 'send_subscribe', 'data', 'JSON');
|
||||
Loading…
x
Reference in New Issue
Block a user