css for email
Showing
2 changed files
with
24 additions
and
15 deletions
| ... | @@ -68,12 +68,12 @@ function display_page() | ... | @@ -68,12 +68,12 @@ function display_page() |
| 68 | $type = $_POST['type']; | 68 | $type = $_POST['type']; |
| 69 | $title = $_POST['title']; | 69 | $title = $_POST['title']; |
| 70 | $sendto = $_POST['sendto']; | 70 | $sendto = $_POST['sendto']; |
| 71 | $executeDate = ($type == 'scheduled') ? $_POST['execute_date'] : '0000-00-00 00:00:00'; | 71 | $executeDate = ($type == 'scheduled' || $type == 'newsletter' ) ? $_POST['execute_date'] : '0000-00-00 00:00:00'; |
| 72 | $trigger = ($type == 'scheduled') ? 'scheduled-cron-job' : $_POST['trigger']; | 72 | $trigger = ($type == 'scheduled' || $type == 'newsletter' ) ? 'scheduled-cron-job' : $_POST['trigger']; |
| 73 | 73 | ||
| 74 | $emailData = []; | 74 | $emailData = []; |
| 75 | $systemMessageData = []; | 75 | $systemMessageData = []; |
| 76 | 76 | $style = $_POST['email_style']; | |
| 77 | foreach (['en', 'fr'] as $lang) { | 77 | foreach (['en', 'fr'] as $lang) { |
| 78 | 78 | ||
| 79 | $subject = $_POST[$lang.'_subject']; | 79 | $subject = $_POST[$lang.'_subject']; |
| ... | @@ -127,8 +127,10 @@ function display_page() | ... | @@ -127,8 +127,10 @@ function display_page() |
| 127 | 'sendto' => $sendto, | 127 | 'sendto' => $sendto, |
| 128 | 'status' => $entry->details['status'], | 128 | 'status' => $entry->details['status'], |
| 129 | 'trigger' => $trigger, | 129 | 'trigger' => $trigger, |
| 130 | 'execute_date' => $executeDate | 130 | 'execute_date' => $executeDate, |
| 131 | ] | 131 | 'style' => $style |
| 132 | |||
| 133 | ] | ||
| 132 | ); | 134 | ); |
| 133 | update_post_meta($id, 'send_status', $entry->details['status']); | 135 | update_post_meta($id, 'send_status', $entry->details['status']); |
| 134 | update_post_meta($id, 'notif_type', $type); | 136 | update_post_meta($id, 'notif_type', $type); |
| ... | @@ -138,6 +140,7 @@ function display_page() | ... | @@ -138,6 +140,7 @@ function display_page() |
| 138 | 140 | ||
| 139 | update_post_meta($id, 'email', $emailData); | 141 | update_post_meta($id, 'email', $emailData); |
| 140 | update_post_meta($id, 'system', $systemMessageData); | 142 | update_post_meta($id, 'system', $systemMessageData); |
| 143 | update_post_meta($id, 'style', $style); | ||
| 141 | 144 | ||
| 142 | $update = []; | 145 | $update = []; |
| 143 | $update['ID'] = $id; | 146 | $update['ID'] = $id; |
| ... | @@ -319,9 +322,9 @@ function create_notification() | ... | @@ -319,9 +322,9 @@ function create_notification() |
| 319 | $type = $_POST['type']; | 322 | $type = $_POST['type']; |
| 320 | $title = $_POST['title']; | 323 | $title = $_POST['title']; |
| 321 | $sendto = $_POST['sendto']; | 324 | $sendto = $_POST['sendto']; |
| 322 | $executeDate = ($type == 'scheduled') ? $_POST['execute_date'] : '0000-00-00 00:00:00'; | 325 | $executeDate = ($type == 'scheduled' || $type == 'newsletter') ? $_POST['execute_date'] : '0000-00-00 00:00:00'; |
| 323 | $trigger = ($type == 'scheduled') ? 'scheduled-cron-job' : $_POST['trigger']; | 326 | $trigger = ($type == 'scheduled' || $type == 'newsletter') ? 'scheduled-cron-job' : $_POST['trigger']; |
| 324 | 327 | $style = $_POST['email_style']; | |
| 325 | $emailData = []; | 328 | $emailData = []; |
| 326 | $systemMessageData = []; | 329 | $systemMessageData = []; |
| 327 | 330 | ||
| ... | @@ -352,7 +355,7 @@ function create_notification() | ... | @@ -352,7 +355,7 @@ function create_notification() |
| 352 | [ | 355 | [ |
| 353 | $lang.'_subject' => $subject, | 356 | $lang.'_subject' => $subject, |
| 354 | $lang.'_text' => $text, | 357 | $lang.'_text' => $text, |
| 355 | $lang.'_html' => $html, | 358 | $lang.'_html' => $style.$html, |
| 356 | $lang.'_attachments' => $attachments | 359 | $lang.'_attachments' => $attachments |
| 357 | ] | 360 | ] |
| 358 | ); | 361 | ); |
| ... | @@ -383,7 +386,8 @@ function create_notification() | ... | @@ -383,7 +386,8 @@ function create_notification() |
| 383 | 'sendto' => $sendto, | 386 | 'sendto' => $sendto, |
| 384 | 'status' => 'pending', | 387 | 'status' => 'pending', |
| 385 | 'trigger' => $trigger, | 388 | 'trigger' => $trigger, |
| 386 | 'execute_date' => $executeDate | 389 | 'execute_date' => $executeDate, |
| 390 | 'style' => $style | ||
| 387 | ] | 391 | ] |
| 388 | ); | 392 | ); |
| 389 | update_post_meta($id, 'send_status', 'pending'); | 393 | update_post_meta($id, 'send_status', 'pending'); |
| ... | @@ -394,6 +398,7 @@ function create_notification() | ... | @@ -394,6 +398,7 @@ function create_notification() |
| 394 | update_post_meta($id, 'trigger', $trigger); | 398 | update_post_meta($id, 'trigger', $trigger); |
| 395 | 399 | ||
| 396 | update_post_meta($id, 'email', $emailData); | 400 | update_post_meta($id, 'email', $emailData); |
| 401 | update_post_meta($id, 'style', $style); | ||
| 397 | update_post_meta($id, 'system', $systemMessageData); | 402 | update_post_meta($id, 'system', $systemMessageData); |
| 398 | 403 | ||
| 399 | $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>"; | 404 | $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) { | ... | @@ -352,13 +352,16 @@ function getInputFormValues($validation, $name) { |
| 352 | }else if (type == "newsletter") { | 352 | }else if (type == "newsletter") { |
| 353 | 353 | ||
| 354 | $.ajax({ | 354 | $.ajax({ |
| 355 | url : "https://"+window.location.hostname+"/wp-content/themes/cbv/assets/css/custom-editor-style.css", | 355 | url : "http://"+window.location.hostname+"/wp-content/themes/cbv/assets/css/custom-editor-style.css", |
| 356 | dataType: "text", | 356 | dataType: "text", |
| 357 | success : function (result) { | 357 | success : function (result) { |
| 358 | var style = '<style>'+result+'</style>'; | 358 | |
| 359 | jQuery("#tabs").append('<input type="hidden" id="email_style" name="email_style" class="wide-input-field" />'); | ||
| 360 | jQuery("#email_style").val('<style>'+result+'</style>'); | ||
| 361 | |||
| 362 | |||
| 359 | 363 | ||
| 360 | $(tinymce.get('en_html').getBody()).html(style +header+footer); | 364 | |
| 361 | $(tinymce.get('fr_html').getBody()).html(style +header_fr+footer_fr); | ||
| 362 | } | 365 | } |
| 363 | }); | 366 | }); |
| 364 | 367 | ||
| ... | @@ -368,7 +371,8 @@ function getInputFormValues($validation, $name) { | ... | @@ -368,7 +371,8 @@ function getInputFormValues($validation, $name) { |
| 368 | jQuery(".text_verson").hide(); | 371 | jQuery(".text_verson").hide(); |
| 369 | jQuery('.attachments').hide(); | 372 | jQuery('.attachments').hide(); |
| 370 | jQuery('.scheduled_sendto').show(); | 373 | jQuery('.scheduled_sendto').show(); |
| 371 | 374 | $(tinymce.get('en_html').getBody()).html(header+footer); | |
| 375 | $(tinymce.get('fr_html').getBody()).html(header_fr+footer_fr); | ||
| 372 | 376 | ||
| 373 | jQuery('#execute_date').datetimepicker({ | 377 | jQuery('#execute_date').datetimepicker({ |
| 374 | format: 'Y-m-d, H:i', | 378 | format: 'Y-m-d, H:i', | ... | ... |
-
Please register or sign in to post a comment