89864faf by Jeff Balicki

css for email

1 parent aac7a130
......@@ -68,12 +68,12 @@ function display_page()
$type = $_POST['type'];
$title = $_POST['title'];
$sendto = $_POST['sendto'];
$executeDate = ($type == 'scheduled') ? $_POST['execute_date'] : '0000-00-00 00:00:00';
$trigger = ($type == 'scheduled') ? 'scheduled-cron-job' : $_POST['trigger'];
$executeDate = ($type == 'scheduled' || $type == 'newsletter' ) ? $_POST['execute_date'] : '0000-00-00 00:00:00';
$trigger = ($type == 'scheduled' || $type == 'newsletter' ) ? 'scheduled-cron-job' : $_POST['trigger'];
$emailData = [];
$systemMessageData = [];
$style = $_POST['email_style'];
foreach (['en', 'fr'] as $lang) {
// email
$subject = $_POST[$lang.'_subject'];
......@@ -127,8 +127,10 @@ function display_page()
'sendto' => $sendto,
'status' => $entry->details['status'],
'trigger' => $trigger,
'execute_date' => $executeDate
]
'execute_date' => $executeDate,
'style' => $style
]
);
update_post_meta($id, 'send_status', $entry->details['status']);
update_post_meta($id, 'notif_type', $type);
......@@ -138,6 +140,7 @@ function display_page()
update_post_meta($id, 'email', $emailData);
update_post_meta($id, 'system', $systemMessageData);
update_post_meta($id, 'style', $style);
$update = [];
$update['ID'] = $id;
......@@ -319,9 +322,9 @@ function create_notification()
$type = $_POST['type'];
$title = $_POST['title'];
$sendto = $_POST['sendto'];
$executeDate = ($type == 'scheduled') ? $_POST['execute_date'] : '0000-00-00 00:00:00';
$trigger = ($type == 'scheduled') ? 'scheduled-cron-job' : $_POST['trigger'];
$executeDate = ($type == 'scheduled' || $type == 'newsletter') ? $_POST['execute_date'] : '0000-00-00 00:00:00';
$trigger = ($type == 'scheduled' || $type == 'newsletter') ? 'scheduled-cron-job' : $_POST['trigger'];
$style = $_POST['email_style'];
$emailData = [];
$systemMessageData = [];
......@@ -352,7 +355,7 @@ function create_notification()
[
$lang.'_subject' => $subject,
$lang.'_text' => $text,
$lang.'_html' => $html,
$lang.'_html' => $style.$html,
$lang.'_attachments' => $attachments
]
);
......@@ -383,7 +386,8 @@ function create_notification()
'sendto' => $sendto,
'status' => 'pending',
'trigger' => $trigger,
'execute_date' => $executeDate
'execute_date' => $executeDate,
'style' => $style
]
);
update_post_meta($id, 'send_status', 'pending');
......@@ -394,6 +398,7 @@ function create_notification()
update_post_meta($id, 'trigger', $trigger);
update_post_meta($id, 'email', $emailData);
update_post_meta($id, 'style', $style);
update_post_meta($id, 'system', $systemMessageData);
$flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>";
......
......@@ -352,13 +352,16 @@ function getInputFormValues($validation, $name) {
}else if (type == "newsletter") {
$.ajax({
url : "https://"+window.location.hostname+"/wp-content/themes/cbv/assets/css/custom-editor-style.css",
url : "http://"+window.location.hostname+"/wp-content/themes/cbv/assets/css/custom-editor-style.css",
dataType: "text",
success : function (result) {
var style = '<style>'+result+'</style>';
jQuery("#tabs").append('<input type="hidden" id="email_style" name="email_style" class="wide-input-field" />');
jQuery("#email_style").val('<style>'+result+'</style>');
$(tinymce.get('en_html').getBody()).html(style +header+footer);
$(tinymce.get('fr_html').getBody()).html(style +header_fr+footer_fr);
}
});
......@@ -368,7 +371,8 @@ function getInputFormValues($validation, $name) {
jQuery(".text_verson").hide();
jQuery('.attachments').hide();
jQuery('.scheduled_sendto').show();
$(tinymce.get('en_html').getBody()).html(header+footer);
$(tinymce.get('fr_html').getBody()).html(header_fr+footer_fr);
jQuery('#execute_date').datetimepicker({
format: 'Y-m-d, H:i',
......