dd
Showing
1 changed file
with
231 additions
and
226 deletions
| ... | @@ -3,26 +3,27 @@ use Tz\WordPress\Tools; | ... | @@ -3,26 +3,27 @@ use Tz\WordPress\Tools; |
| 3 | use Tz\WordPress\Tools\Notifications; | 3 | use Tz\WordPress\Tools\Notifications; |
| 4 | use Tz\WordPress\Tools\Notifications\Settings; | 4 | use Tz\WordPress\Tools\Notifications\Settings; |
| 5 | 5 | ||
| 6 | function getInputFormValues($validation, $name) { | 6 | function getInputFormValues($validation, $name) |
| 7 | { | ||
| 7 | return ($validation->set_value($name) != '') ? $validation->set_value($name) : (!empty($_POST[$name])) ? $_POST[$name] : ''; | 8 | return ($validation->set_value($name) != '') ? $validation->set_value($name) : (!empty($_POST[$name])) ? $_POST[$name] : ''; |
| 8 | } | 9 | } |
| 9 | 10 | ||
| 10 | ?> | 11 | ?> |
| 11 | 12 | ||
| 12 | <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>"/> | 13 | <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__) ?>" /> |
| 13 | 14 | ||
| 14 | <div class="wrap"> | 15 | <div class="wrap"> |
| 15 | <h2>Notifications - Create New</h2> | 16 | <h2>Notifications - Create New</h2> |
| 16 | 17 | ||
| 17 | <?php if (isset($flash) && $flash != ''): ?> | 18 | <?php if (isset($flash) && $flash != '') : ?> |
| 18 | <div class="post-success"> | 19 | <div class="post-success"> |
| 19 | <?php echo $flash; ?> | 20 | <?php echo $flash; ?> |
| 20 | </div> | 21 | </div> |
| 21 | <?php endif; ?> | 22 | <?php endif; ?> |
| 22 | <?php if ($validation->validation_errors() != "" || isset($form_error)): ?> | 23 | <?php if ($validation->validation_errors() != "" || isset($form_error)) : ?> |
| 23 | <div class="post-errors"> | 24 | <div class="post-errors"> |
| 24 | <div class="post-errors-title"><strong>Oops.</strong> There was an error saving your notification.</div> | 25 | <div class="post-errors-title"><strong>Oops.</strong> There was an error saving your notification.</div> |
| 25 | <?php if (isset($form_error)): ?> | 26 | <?php if (isset($form_error)) : ?> |
| 26 | <p class="post-errors-content">You must include either an Email, System or SMS message.</p> | 27 | <p class="post-errors-content">You must include either an Email, System or SMS message.</p> |
| 27 | <?php endif; ?> | 28 | <?php endif; ?> |
| 28 | </div> | 29 | </div> |
| ... | @@ -30,7 +31,7 @@ function getInputFormValues($validation, $name) { | ... | @@ -30,7 +31,7 @@ function getInputFormValues($validation, $name) { |
| 30 | 31 | ||
| 31 | <form enctype="multipart/form-data" method="post" id="notifications-create-new" action="/wp-admin/admin.php?page=notifications-create-new"> | 32 | <form enctype="multipart/form-data" method="post" id="notifications-create-new" action="/wp-admin/admin.php?page=notifications-create-new"> |
| 32 | 33 | ||
| 33 | <input type="hidden" name="_POSTED_" value="yes"/> | 34 | <input type="hidden" name="_POSTED_" value="yes" /> |
| 34 | 35 | ||
| 35 | <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> | 36 | <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;"> |
| 36 | <thead> | 37 | <thead> |
| ... | @@ -43,17 +44,16 @@ function getInputFormValues($validation, $name) { | ... | @@ -43,17 +44,16 @@ function getInputFormValues($validation, $name) { |
| 43 | <tr> | 44 | <tr> |
| 44 | <td width="150">Notification Type</td> | 45 | <td width="150">Notification Type</td> |
| 45 | <td> | 46 | <td> |
| 46 | <select name="type" id="notif_type" class="wide-input-field" | 47 | <select name="type" id="notif_type" class="wide-input-field" onchange="updateNotificationType();"> |
| 47 | onchange="updateNotificationType();"> | ||
| 48 | <option value="scheduled" <?php echo ($validation->set_value('type') == "scheduled" || $_POST['type'] == 'scheduled') | 48 | <option value="scheduled" <?php echo ($validation->set_value('type') == "scheduled" || $_POST['type'] == 'scheduled') |
| 49 | ? 'selected="selected"' : ""; ?>>Scheduled Notification | 49 | ? 'selected="selected"' : ""; ?>>Scheduled Notification |
| 50 | </option> | 50 | </option> |
| 51 | <option value="newsletter" <?php echo ($validation->set_value('type') == "newsletter" || $_POST['type'] == 'newsletter') | 51 | <option value="newsletter" <?php echo ($validation->set_value('type') == "newsletter" || $_POST['type'] == 'newsletter') |
| 52 | ? 'selected="selected"' : ""; ?>>Newsletter | 52 | ? 'selected="selected"' : ""; ?>>Newsletter |
| 53 | </option> | 53 | </option> |
| 54 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> | 54 | <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)) : ?> |
| 55 | <option value="triggered" <?php echo ($validation->set_value('type') == "triggered" || $_POST['type'] == 'triggered') | 55 | <option value="triggered" <?php echo ($validation->set_value('type') == "triggered" || $_POST['type'] == 'triggered') |
| 56 | ? 'selected="selected"' : ""; ?>>System Triggered Notification | 56 | ? 'selected="selected"' : ""; ?>>System Triggered Notification |
| 57 | </option> | 57 | </option> |
| 58 | <?php endif; ?> | 58 | <?php endif; ?> |
| 59 | </select> | 59 | </select> |
| ... | @@ -62,8 +62,7 @@ function getInputFormValues($validation, $name) { | ... | @@ -62,8 +62,7 @@ function getInputFormValues($validation, $name) { |
| 62 | </tr> | 62 | </tr> |
| 63 | <tr> | 63 | <tr> |
| 64 | <td width="150">Notification Description</td> | 64 | <td width="150">Notification Description</td> |
| 65 | <td><input type="text" name="title" class="wide-input-field" | 65 | <td><input type="text" name="title" class="wide-input-field" value="<?php echo getInputFormValues($validation, 'title'); ?>" /> |
| 66 | value="<?php echo getInputFormValues($validation, 'title'); ?>"/> | ||
| 67 | <?php echo $validation->form_error('title'); ?> | 66 | <?php echo $validation->form_error('title'); ?> |
| 68 | </td> | 67 | </td> |
| 69 | </tr> | 68 | </tr> |
| ... | @@ -72,17 +71,17 @@ function getInputFormValues($validation, $name) { | ... | @@ -72,17 +71,17 @@ function getInputFormValues($validation, $name) { |
| 72 | <td> | 71 | <td> |
| 73 | <select name="sendto" class="wide-input-field"> | 72 | <select name="sendto" class="wide-input-field"> |
| 74 | <option value="nousers" <?php echo ($validation->set_value('sendto') == "nousers") | 73 | <option value="nousers" <?php echo ($validation->set_value('sendto') == "nousers") |
| 75 | ? 'selected="selected"' : ""; ?>>No Users | 74 | ? 'selected="selected"' : ""; ?>>No Users |
| 76 | </option> | 75 | </option> |
| 77 | <option value="allusers" <?php echo ($validation->set_value('sendto') == "allusers") | 76 | <option value="allusers" <?php echo ($validation->set_value('sendto') == "allusers") |
| 78 | ? 'selected="selected"' : ""; ?>>All Users | 77 | ? 'selected="selected"' : ""; ?>>All Users |
| 79 | </option> | 78 | </option> |
| 80 | <optgroup label="By Group:"> | 79 | <optgroup label="By Group:"> |
| 81 | <?php foreach (Notifications\getGroups() as $group_id => $group_name): ?> | 80 | <?php foreach (Notifications\getGroups() as $group_id => $group_name) : ?> |
| 82 | <option value="<?php echo $group_id ?>" <?php echo ($validation->set_value( | 81 | <option value="<?php echo $group_id ?>" <?php echo ($validation->set_value( |
| 83 | 'sendto' | 82 | 'sendto' |
| 84 | ) == $group_id) ? 'selected="selected"' | 83 | ) == $group_id) ? 'selected="selected"' |
| 85 | : ""; ?>><?php echo $group_name; ?></option> | 84 | : ""; ?>><?php echo $group_name; ?></option> |
| 86 | <?php endforeach; ?> | 85 | <?php endforeach; ?> |
| 87 | </optgroup> | 86 | </optgroup> |
| 88 | </select> | 87 | </select> |
| ... | @@ -92,14 +91,12 @@ function getInputFormValues($validation, $name) { | ... | @@ -92,14 +91,12 @@ function getInputFormValues($validation, $name) { |
| 92 | 91 | ||
| 93 | <tr class="scheduled-extended"> | 92 | <tr class="scheduled-extended"> |
| 94 | <td>Execute Date / Time</td> | 93 | <td>Execute Date / Time</td> |
| 95 | <td><input type="text" name="execute_date" id="execute_date" class="wide-input-field date-pick" | 94 | <td><input type="text" name="execute_date" id="execute_date" class="wide-input-field date-pick" readonly="readonly" value="<?php echo getInputFormValues($validation, 'execute_date'); ?>" /><?php echo $validation->form_error('execute_date'); ?></td> |
| 96 | readonly="readonly" value="<?php echo getInputFormValues($validation, 'execute_date'); ?>"/><?php echo $validation->form_error('execute_date'); ?></td> | ||
| 97 | </tr> | 95 | </tr> |
| 98 | 96 | ||
| 99 | <tr class="trigger-extended"> | 97 | <tr class="trigger-extended"> |
| 100 | <td>Trigger</td> | 98 | <td>Trigger</td> |
| 101 | <td><input type="text" name="trigger" id="trigger" class="wide-input-field" | 99 | <td><input type="text" name="trigger" id="trigger" class="wide-input-field" value="<?php echo getInputFormValues($validation, 'trigger'); ?>" /> |
| 102 | value="<?php echo getInputFormValues($validation, 'trigger'); ?>"/> | ||
| 103 | <?php echo $validation->form_error('trigger'); ?></td> | 100 | <?php echo $validation->form_error('trigger'); ?></td> |
| 104 | </tr> | 101 | </tr> |
| 105 | 102 | ||
| ... | @@ -116,165 +113,164 @@ function getInputFormValues($validation, $name) { | ... | @@ -116,165 +113,164 @@ function getInputFormValues($validation, $name) { |
| 116 | </li> | 113 | </li> |
| 117 | </ul> | 114 | </ul> |
| 118 | 115 | ||
| 119 | <?php foreach (['en', 'fr'] as $index => $lang): ?> | 116 | <?php foreach (['en', 'fr'] as $index => $lang) : ?> |
| 120 | <div id="tab-<?php echo $index + 1; ?>"> | 117 | <div id="tab-<?php echo $index + 1; ?>"> |
| 121 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> | 118 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> |
| 122 | <thead> | 119 | <thead> |
| 123 | <tr> | 120 | <tr> |
| 124 | <th width="150" class="toggle"><h6>Email</h6></th> | 121 | <th width="150" class="toggle"> |
| 125 | <th class="action-bar"> </th> | 122 | <h6>Email</h6> |
| 126 | </tr> | 123 | </th> |
| 124 | <th class="action-bar"> </th> | ||
| 125 | </tr> | ||
| 127 | </thead> | 126 | </thead> |
| 128 | <tbody style="<?php echo (getInputFormValues($validation, $lang . '_subject')) || | 127 | <tbody style="<?php echo (getInputFormValues($validation, $lang . '_subject')) || |
| 129 | getInputFormValues($validation, $lang . '_text') || | 128 | getInputFormValues($validation, $lang . '_text') || |
| 130 | getInputFormValues($validation, $lang . '_html') ? '' : 'display: none;'; ?>;"> | 129 | getInputFormValues($validation, $lang . '_html') ? '' : 'display: none;'; ?>;"> |
| 131 | <tr> | ||
| 132 | <td width="150">Subject Line</td> | ||
| 133 | <td> | ||
| 134 | <input type="text" name="<?php echo $lang; ?>_subject" | ||
| 135 | class="wide-input-field" style="width: 100%;" | ||
| 136 | value="<?php echo getInputFormValues($validation, $lang . '_subject'); ?>"/> | ||
| 137 | <?php echo $validation->form_error($lang.'_subject'); ?> | ||
| 138 | </td> | ||
| 139 | </tr> | ||
| 140 | <tr class="text_verson"> | ||
| 141 | <td>Text Version</td> | ||
| 142 | <td> | ||
| 143 | <textarea name="<?php echo $lang; ?>_text" | ||
| 144 | class="wide-input-field text_verson" rows="10" | ||
| 145 | style="width: 100%;"><?php echo getInputFormValues($validation, $lang . '_text'); ?> | ||
| 146 | </textarea><?php echo $validation->form_error($lang.'_text'); ?> | ||
| 147 | </td> | ||
| 148 | </tr> | ||
| 149 | <tr> | ||
| 150 | <td>HTML Version (optional)</td> | ||
| 151 | <td> | ||
| 152 | <?php | ||
| 153 | $content = getInputFormValues($validation, $lang . '_html'); | ||
| 154 | $settings = array('textarea_name' => $lang.'_html' , "media_buttons" => true ); | ||
| 155 | wp_editor($content, $lang .'_html', $settings ); | ||
| 156 | ?><?php echo $validation->form_error($lang.'_html'); ?> | ||
| 157 | |||
| 158 | </td> | ||
| 159 | </tr> | ||
| 160 | |||
| 161 | <tr class="attachments"> | ||
| 162 | <td width="150">Attachments</td> | ||
| 163 | <td> </td> | ||
| 164 | </tr> | ||
| 165 | |||
| 166 | <?php | ||
| 167 | $attachments = $entry->email[$lang.'_attachments']; | ||
| 168 | $allowedAttachments = 3; | ||
| 169 | foreach ($attachments as $attachment): ?> | ||
| 170 | <tr> | 130 | <tr> |
| 171 | <td> </td> | 131 | <td width="150">Subject Line</td> |
| 172 | <td> | 132 | <td> |
| 173 | <?php echo $attachment; ?> (<a href="#" | 133 | <input type="text" name="<?php echo $lang; ?>_subject" class="wide-input-field" style="width: 100%;" value="<?php echo getInputFormValues($validation, $lang . '_subject'); ?>" /> |
| 174 | entry_id="<?php echo $_GET['page_id'] ?>" | 134 | <?php echo $validation->form_error($lang . '_subject'); ?> |
| 175 | class="attachment" | 135 | </td> |
| 176 | rel="<?php echo $attachment; ?>">remove</a>) | 136 | </tr> |
| 137 | <tr class="text_verson"> | ||
| 138 | <td>Text Version</td> | ||
| 139 | <td> | ||
| 140 | <textarea name="<?php echo $lang; ?>_text" class="wide-input-field text_verson" rows="10" style="width: 100%;"><?php echo getInputFormValues($validation, $lang . '_text'); ?> | ||
| 141 | </textarea><?php echo $validation->form_error($lang . '_text'); ?> | ||
| 142 | </td> | ||
| 143 | </tr> | ||
| 144 | <tr> | ||
| 145 | <td>HTML Version (optional)</td> | ||
| 146 | <td> | ||
| 147 | <?php | ||
| 148 | $content = getInputFormValues($validation, $lang . '_html'); | ||
| 149 | $settings = array('textarea_name' => $lang . '_html', "media_buttons" => true); | ||
| 150 | wp_editor($content, $lang . '_html', $settings); | ||
| 151 | ?><?php echo $validation->form_error($lang . '_html'); ?> | ||
| 152 | |||
| 177 | </td> | 153 | </td> |
| 178 | </tr> | 154 | </tr> |
| 179 | <?php | ||
| 180 | $allowedAttachments--; | ||
| 181 | endforeach; | ||
| 182 | ?> | ||
| 183 | 155 | ||
| 184 | <?php for ($a = 1; $a <= $allowedAttachments; $a++): ?> | 156 | <tr class="attachments"> |
| 185 | <tr class="attachments"> | 157 | <td width="150">Attachments</td> |
| 186 | <td> </td> | 158 | <td> </td> |
| 187 | <td><input type="file" name="<?php echo $lang; ?>_attachment[]"/></td> | ||
| 188 | </tr> | 159 | </tr> |
| 189 | <?php endfor; ?> | 160 | |
| 161 | <?php | ||
| 162 | $attachments = $entry->email[$lang . '_attachments']; | ||
| 163 | $allowedAttachments = 3; | ||
| 164 | foreach ($attachments as $attachment) : ?> | ||
| 165 | <tr> | ||
| 166 | <td> </td> | ||
| 167 | <td> | ||
| 168 | <?php echo $attachment; ?> (<a href="#" entry_id="<?php echo $_GET['page_id'] ?>" class="attachment" rel="<?php echo $attachment; ?>">remove</a>) | ||
| 169 | </td> | ||
| 170 | </tr> | ||
| 171 | <?php | ||
| 172 | $allowedAttachments--; | ||
| 173 | endforeach; | ||
| 174 | ?> | ||
| 175 | |||
| 176 | <?php for ($a = 1; $a <= $allowedAttachments; $a++) : ?> | ||
| 177 | <tr class="attachments"> | ||
| 178 | <td> </td> | ||
| 179 | <td><input type="file" name="<?php echo $lang; ?>_attachment[]" /></td> | ||
| 180 | </tr> | ||
| 181 | <?php endfor; ?> | ||
| 190 | 182 | ||
| 191 | </tbody> | 183 | </tbody> |
| 192 | </table> | 184 | </table> |
| 193 | 185 | ||
| 194 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> | 186 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> |
| 195 | <thead> | 187 | <thead> |
| 196 | <tr> | 188 | <tr> |
| 197 | <th width="150" class="toggle"><h6>System Message</h6></th> | 189 | <th width="150" class="toggle"> |
| 198 | <th class="action-bar"> </th> | 190 | <h6>System Message</h6> |
| 199 | </tr> | 191 | </th> |
| 192 | <th class="action-bar"> </th> | ||
| 193 | </tr> | ||
| 200 | </thead> | 194 | </thead> |
| 201 | <tbody style="<?php echo ($validation->set_value( | 195 | <tbody style="<?php echo ($validation->set_value( |
| 202 | $lang.'_system', | 196 | $lang . '_system', |
| 203 | $entry->system[$lang.'_message'] | 197 | $entry->system[$lang . '_message'] |
| 204 | ) == '') | 198 | ) == '') |
| 205 | ? 'display: none' | 199 | ? 'display: none' |
| 206 | : ''; ?>;"> | 200 | : ''; ?>;"> |
| 207 | <tr> | 201 | <tr> |
| 208 | <td>Message Type</td> | 202 | <td>Message Type</td> |
| 209 | <td> | 203 | <td> |
| 210 | <?php if ($lang == 'en'): ?> | 204 | <?php if ($lang == 'en') : ?> |
| 211 | <select name="system_message_type" class="wide-input-field"> | 205 | <select name="system_message_type" class="wide-input-field"> |
| 212 | <option value="none" <?php echo ($validation->set_value( | 206 | <option value="none" <?php echo ($validation->set_value( |
| 213 | 'system_message_type', | 207 | 'system_message_type', |
| 214 | $entry->system['system_message_type'] | 208 | $entry->system['system_message_type'] |
| 215 | ) == 'none') ? 'selected="selected"' : ''; ?>> | 209 | ) == 'none') ? 'selected="selected"' : ''; ?>> |
| 216 | General Message | 210 | General Message |
| 217 | </option> | 211 | </option> |
| 218 | <option value="action_required" <?php echo ($validation->set_value( | 212 | <option value="action_required" <?php echo ($validation->set_value( |
| 219 | 'system_message_type', | 213 | 'system_message_type', |
| 220 | $entry->system['system_message_type'] | 214 | $entry->system['system_message_type'] |
| 221 | ) == 'action_required') ? 'selected="selected"' : ''; ?>> | 215 | ) == 'action_required') ? 'selected="selected"' : ''; ?>> |
| 222 | Action Required | 216 | Action Required |
| 223 | </option> | 217 | </option> |
| 224 | <option value="e-flash" <?php echo ($validation->set_value( | 218 | <option value="e-flash" <?php echo ($validation->set_value( |
| 225 | 'system_message_type', | 219 | 'system_message_type', |
| 226 | $entry->system['system_message_type'] | 220 | $entry->system['system_message_type'] |
| 227 | ) == 'e-flash') ? 'selected="selected"' : ''; ?>> | 221 | ) == 'e-flash') ? 'selected="selected"' : ''; ?>> |
| 228 | E-Flash | 222 | E-Flash |
| 229 | </option> | 223 | </option> |
| 230 | <option value="new_event" <?php echo ($validation->set_value( | 224 | <option value="new_event" <?php echo ($validation->set_value( |
| 231 | 'system_message_type', | 225 | 'system_message_type', |
| 232 | $entry->system['system_message_type'] | 226 | $entry->system['system_message_type'] |
| 233 | ) == 'new_event') ? 'selected="selected"' : ''; ?>> | 227 | ) == 'new_event') ? 'selected="selected"' : ''; ?>> |
| 234 | New Event | 228 | New Event |
| 235 | </option> | 229 | </option> |
| 236 | </select> | 230 | </select> |
| 237 | <?php else: ?> | 231 | <?php else : ?> |
| 238 | <span class="system_message_type_value"></span> | 232 | <span class="system_message_type_value"></span> |
| 239 | <?php endif; ?> | 233 | <?php endif; ?> |
| 240 | </td> | 234 | </td> |
| 241 | </tr> | 235 | </tr> |
| 242 | <tr> | 236 | <tr> |
| 243 | <td>Message (Text/HTML)</td> | 237 | <td>Message (Text/HTML)</td> |
| 244 | <td> | 238 | <td> |
| 245 | <textarea name="<?php echo $lang; ?>_system" class="wide-input-field" rows="4" | 239 | <textarea name="<?php echo $lang; ?>_system" class="wide-input-field" rows="4" style="width:100%;"><?php echo $validation->set_value( |
| 246 | style="width:100%;"><?php echo $validation->set_value( | 240 | $lang . '_system', |
| 247 | $lang.'_system', | 241 | isset($entry->system[$lang . '_message']) |
| 248 | isset($entry->system[$lang.'_message']) | 242 | ? $entry->system[$lang . '_message'] |
| 249 | ? $entry->system[$lang.'_message'] | 243 | : '' |
| 250 | : '' | 244 | ); ?></textarea><?php echo $validation->form_error($lang . '_system'); ?> |
| 251 | ); ?></textarea><?php echo $validation->form_error($lang.'_system'); ?> | 245 | </td> |
| 252 | </td> | 246 | </tr> |
| 253 | </tr> | 247 | |
| 254 | |||
| 255 | </tbody> | 248 | </tbody> |
| 256 | </table> | 249 | </table> |
| 257 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> | 250 | <table cellspacing="0" class="widefat post fixed expandable" style="margin-top: 15px;"> |
| 258 | <thead> | 251 | <thead> |
| 259 | <tr> | 252 | <tr> |
| 260 | <th width="150" class="toggle"><h6>Push Notification</h6></th> | 253 | <th width="150" class="toggle"> |
| 261 | <th width="300" class="action-bar"> </th> | 254 | <h6>Push Notification</h6> |
| 262 | <th width="150"> </th> | 255 | </th> |
| 263 | </tr> | 256 | <th width="300" class="action-bar"> </th> |
| 257 | <th width="150"> </th> | ||
| 258 | </tr> | ||
| 264 | </thead> | 259 | </thead> |
| 265 | <tbody style="background-color: #f5f5f5; display: none;"> | 260 | <tbody style="background-color: #f5f5f5; display: none;"> |
| 266 | 261 | ||
| 267 | <tr class="package-row" style="vertical-align:top;width: 100% !important;background-color: #f5f5f5;"> | 262 | <tr class="package-row" style="vertical-align:top;width: 100% !important;background-color: #f5f5f5;"> |
| 268 | <td style="background-color: #f5f5f5;width:20%">Time<br/><input style="width:100%;" id="time'" type="text" name="<?php echo $lang; ?>_push_notifications_time" value="" /> | 263 | <td style="background-color: #f5f5f5;width:20%">Time<br /><input style="width:100%;" id="time'" type="text" name="<?php echo $lang; ?>_push_notifications_time" value="" /> |
| 269 | <br class="morespace"/>Title<br/><input type="text" style="width:100%;" name="<?php echo $lang; ?>_push_notifications_title" value="" /></td> | 264 | <br class="morespace" />Title<br /><input type="text" style="width:100%;" name="<?php echo $lang; ?>_push_notifications_title" value="" /></td> |
| 270 | <td style="background-color: #f5f5f5; width:50%;">Message<br/><textarea style="width: 100%;" name="<?php echo $lang; ?>_push_notifications_message" rows="4" cols="50" ></textarea></td> | 265 | <td style="background-color: #f5f5f5; width:50%;">Message<br /><textarea style="width: 100%;" name="<?php echo $lang; ?>_push_notifications_message" rows="4" cols="50"></textarea></td> |
| 271 | <td style="background-color: #f5f5f5;width:20%">Link<br/><input style="width:100%;" type="text" name="<?php echo $lang; ?>_push_notifications_link" value="" /><br/> | 266 | <td style="background-color: #f5f5f5;width:20%">Link<br /><input style="width:100%;" type="text" name="<?php echo $lang; ?>_push_notifications_link" value="" /><br /> |
| 272 | <input type="hidden" name="<?php echo $lang; ?>_push_notifications_status" value="pending" /><input type="hidden" name="<?php echo $lang; ?>_push_notifications_id" value="" /></p></td> | 267 | <input type="hidden" name="<?php echo $lang; ?>_push_notifications_status" value="pending" /><input type="hidden" name="<?php echo $lang; ?>_push_notifications_id" value="" /></p> |
| 273 | </tr> | 268 | </td> |
| 274 | <?php echo $validation->form_error($lang.'_push'); ?> | 269 | </tr> |
| 275 | 270 | <?php echo $validation->form_error($lang . '_push'); ?> | |
| 276 | </tbody> | 271 | |
| 277 | </table> | 272 | </tbody> |
| 273 | </table> | ||
| 278 | 274 | ||
| 279 | 275 | ||
| 280 | 276 | ||
| ... | @@ -282,66 +278,65 @@ function getInputFormValues($validation, $name) { | ... | @@ -282,66 +278,65 @@ function getInputFormValues($validation, $name) { |
| 282 | <?php endforeach; ?> | 278 | <?php endforeach; ?> |
| 283 | </div> | 279 | </div> |
| 284 | <p> | 280 | <p> |
| 285 | <input type="submit" value=" Save "/> | 281 | <input type="submit" value=" Save " /> |
| 286 | <input type="button" value=" Cancel " | 282 | <input type="button" value=" Cancel " onclick="document.location.href='/wp-admin/admin.php?page=notifications';" /> |
| 287 | onclick="document.location.href='/wp-admin/admin.php?page=notifications';"/> | ||
| 288 | </p> | 283 | </p> |
| 289 | </form> | 284 | </form> |
| 290 | </div> | 285 | </div> |
| 291 | 286 | ||
| 292 | <script> | 287 | <script> |
| 293 | jQuery(document).ready(function ($) { | 288 | jQuery(document).ready(function($) { |
| 294 | 289 | ||
| 295 | var codeCleaned = false; | 290 | var codeCleaned = false; |
| 296 | 291 | ||
| 297 | $("#notifications-create-new").on("submit", function(e){ | 292 | $("#notifications-create-new").on("submit", function(e) { |
| 298 | if (!codeCleaned) { | 293 | if (!codeCleaned) { |
| 299 | 294 | ||
| 300 | e.preventDefault(); | 295 | e.preventDefault(); |
| 301 | 296 | ||
| 302 | $('#fr_html_ifr').contents().find('td:last-child').each(function(){ | 297 | $('#fr_html_ifr').contents().find('td:last-child').each(function() { |
| 303 | $(this).addClass('tdlast-child'); | 298 | $(this).addClass('tdlast-child'); |
| 304 | |||
| 305 | }); | ||
| 306 | 299 | ||
| 307 | $('#fr_html_ifr').contents().find('tr:last-child').each(function(){ | 300 | }); |
| 301 | |||
| 302 | $('#fr_html_ifr').contents().find('tr:last-child').each(function() { | ||
| 308 | $(this).addClass('trlast-child'); | 303 | $(this).addClass('trlast-child'); |
| 309 | 304 | ||
| 310 | }); | 305 | }); |
| 311 | 306 | ||
| 312 | $('#en_html_ifr').contents().find('td:last-child').each(function(){ | 307 | $('#en_html_ifr').contents().find('td:last-child').each(function() { |
| 313 | $(this).addClass('tdlast-child'); | 308 | $(this).addClass('tdlast-child'); |
| 314 | |||
| 315 | }); | ||
| 316 | 309 | ||
| 317 | $('#en_html_ifr').contents().find('tr:last-child').each(function(){ | 310 | }); |
| 311 | |||
| 312 | $('#en_html_ifr').contents().find('tr:last-child').each(function() { | ||
| 318 | $(this).addClass('trlast-child'); | 313 | $(this).addClass('trlast-child'); |
| 319 | 314 | ||
| 320 | }); | 315 | }); |
| 321 | 316 | ||
| 322 | codeCleaned = true; | 317 | codeCleaned = true; |
| 323 | // $(this).trigger('submit'); | 318 | // $(this).trigger('submit'); |
| 324 | } | 319 | } |
| 325 | }); | 320 | }); |
| 326 | 321 | ||
| 327 | 322 | ||
| 328 | $('#tabs').tabs(); | 323 | $('#tabs').tabs(); |
| 329 | 324 | ||
| 330 | // Update system message type clone when changing the message type | 325 | // Update system message type clone when changing the message type |
| 331 | $('[name="system_message_type"]').change(function () { | 326 | $('[name="system_message_type"]').change(function() { |
| 332 | $('.system_message_type_value').text($(this).find(':selected').text()); | 327 | $('.system_message_type_value').text($(this).find(':selected').text()); |
| 333 | }).change(); | 328 | }).change(); |
| 334 | 329 | ||
| 335 | // | 330 | // |
| 336 | // jQuery('#execute_date').datetimepicker({ | 331 | // jQuery('#execute_date').datetimepicker({ |
| 337 | //stepMinute: 05, | 332 | //stepMinute: 05, |
| 338 | //dateFormat: 'yy-mm-dd', | 333 | //dateFormat: 'yy-mm-dd', |
| 339 | // timeFormat: 'hh:mm:ss' | 334 | // timeFormat: 'hh:mm:ss' |
| 340 | // }); | 335 | // }); |
| 341 | 336 | ||
| 342 | updateNotificationType(); | 337 | updateNotificationType(); |
| 343 | 338 | ||
| 344 | $('.attachment').live('click', function (e) { | 339 | $('.attachment').live('click', function(e) { |
| 345 | e.preventDefault(); | 340 | e.preventDefault(); |
| 346 | var $link = $(this); | 341 | var $link = $(this); |
| 347 | var options = { | 342 | var options = { |
| ... | @@ -361,7 +356,7 @@ function getInputFormValues($validation, $name) { | ... | @@ -361,7 +356,7 @@ function getInputFormValues($validation, $name) { |
| 361 | type: 'POST', | 356 | type: 'POST', |
| 362 | dataType: 'json', | 357 | dataType: 'json', |
| 363 | 358 | ||
| 364 | success: function (data) { | 359 | success: function(data) { |
| 365 | if (data.success == "true") { | 360 | if (data.success == "true") { |
| 366 | $link.parent().html(file_element); | 361 | $link.parent().html(file_element); |
| 367 | } | 362 | } |
| ... | @@ -372,7 +367,7 @@ function getInputFormValues($validation, $name) { | ... | @@ -372,7 +367,7 @@ function getInputFormValues($validation, $name) { |
| 372 | return false; | 367 | return false; |
| 373 | }); | 368 | }); |
| 374 | 369 | ||
| 375 | jQuery('table.expandable thead th').click(function () { | 370 | jQuery('table.expandable thead th').click(function() { |
| 376 | var $table = jQuery(this).parent().parent().parent(); | 371 | var $table = jQuery(this).parent().parent().parent(); |
| 377 | if (jQuery('tbody', $table).is(':visible')) { | 372 | if (jQuery('tbody', $table).is(':visible')) { |
| 378 | jQuery('thead', $table).removeClass('open'); | 373 | jQuery('thead', $table).removeClass('open'); |
| ... | @@ -383,47 +378,57 @@ function getInputFormValues($validation, $name) { | ... | @@ -383,47 +378,57 @@ function getInputFormValues($validation, $name) { |
| 383 | } | 378 | } |
| 384 | }); | 379 | }); |
| 385 | }); | 380 | }); |
| 386 | 381 | ||
| 387 | 382 | ||
| 388 | 383 | ||
| 389 | function updateNotificationType() { | 384 | function updateNotificationType() { |
| 390 | var type = jQuery('#notif_type').val(); | 385 | var type = jQuery('#notif_type').val(); |
| 391 | var date = new Date().toLocaleDateString("en-US", {year: 'numeric', month: 'long', day: 'numeric'}); | 386 | var date = new Date().toLocaleDateString("en-US", { |
| 392 | 387 | year: 'numeric', | |
| 393 | // var header ='<div><span style="font-size: 9.5pt;">If you are unable to clearly view the below E-Flash, please click<b><a><span style="font-weight: normal;"> here</span></a></b></span><hr /><img class="alignnone" src="https://cbvinstitute.com/wp-content/uploads/2019/02/email_logo.png" alt="Logo" width="81" height="57" align="left" /><span style="font-size: 9.5pt; line-height: 115%; float: right;">'+date+'</span></div><br/><br/>'; | 388 | month: 'long', |
| 394 | // | 389 | day: 'numeric' |
| 395 | // var footer ='<div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><p class="footer"><strong><span style="font-family: GothamLight; font-size: 12px;"> To opt out, please:<br />1. Log in to cicbv.ca<br />2. Click on your name<br />3. From the drop down menu select profile<br />4. Edit E-flash settings<br />If you have any questions, please contact us: admin@cicbv.ca<br /></span></strong></p>'; | 390 | }); |
| 396 | // | 391 | |
| 397 | // var header_fr ='<div class="content"><div><span style="font-size: 9.5pt;">If you are unable to clearly view the below E-Flash, please click<b><a><span style="font-weight: normal;"> here</span></a></b></span><hr /><img class="alignnone" src="https://cbvinstitute.com/wp-content/uploads/2019/02/email_logo_fr.png" alt="Logo" width="81" height="57" align="left" /><span style="font-size: 9.5pt; line-height: 115%; float: right;">'+date+'</span></div>><br/><br/>'; | 392 | // var header ='<div><span style="font-size: 9.5pt;">If you are unable to clearly view the below E-Flash, please click<b><a><span style="font-weight: normal;"> here</span></a></b></span><hr /><img class="alignnone" src="https://cbvinstitute.com/wp-content/uploads/2019/02/email_logo.png" alt="Logo" width="81" height="57" align="left" /><span style="font-size: 9.5pt; line-height: 115%; float: right;">'+date+'</span></div><br/><br/>'; |
| 398 | // | 393 | // |
| 399 | // var footer_fr ='</div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><p class="footer"><strong><span style="font-family: GothamLight; font-size: 12px;"> To opt out, please:<br />1. Log in to cicbv.ca<br />2. Click on your name<br />3. From the drop down menu select profile<br />4. Edit E-flash settings<br />If you have any questions, please contact us: admin@cicbv.ca<br /></span></strong></p>'; | 394 | // var footer ='<div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><p class="footer"><strong><span style="font-family: GothamLight; font-size: 12px;"> To opt out, please:<br />1. Log in to cicbv.ca<br />2. Click on your name<br />3. From the drop down menu select profile<br />4. Edit E-flash settings<br />If you have any questions, please contact us: admin@cicbv.ca<br /></span></strong></p>'; |
| 400 | 395 | // | |
| 401 | 396 | // var header_fr ='<div class="content"><div><span style="font-size: 9.5pt;">If you are unable to clearly view the below E-Flash, please click<b><a><span style="font-weight: normal;"> here</span></a></b></span><hr /><img class="alignnone" src="https://cbvinstitute.com/wp-content/uploads/2019/02/email_logo_fr.png" alt="Logo" width="81" height="57" align="left" /><span style="font-size: 9.5pt; line-height: 115%; float: right;">'+date+'</span></div>><br/><br/>'; | |
| 397 | // | ||
| 398 | // var footer_fr ='</div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><div> </div><p class="footer"><strong><span style="font-family: GothamLight; font-size: 12px;"> To opt out, please:<br />1. Log in to cicbv.ca<br />2. Click on your name<br />3. From the drop down menu select profile<br />4. Edit E-flash settings<br />If you have any questions, please contact us: admin@cicbv.ca<br /></span></strong></p>'; | ||
| 399 | |||
| 400 | |||
| 402 | 401 | ||
| 403 | if (type == "triggered") { | 402 | if (type == "triggered") { |
| 404 | jQuery('.scheduled-extended').hide(); | 403 | jQuery('.scheduled-extended').hide(); |
| 405 | jQuery('.scheduled_sendto').hide(); | 404 | jQuery('.scheduled_sendto').hide(); |
| 406 | jQuery('.trigger-extended').show(); | 405 | jQuery('.trigger-extended').show(); |
| 407 | }else if (type == "newsletter") { | 406 | } else if (type == "newsletter") { |
| 407 | |||
| 408 | 408 | ||
| 409 | 409 | jQuery("#tabs").append('<input type="hidden" id="email_style" name="email_style" class="wide-input-field" />'); | |
| 410 | jQuery("#tabs").append('<input type="hidden" id="email_style" name="email_style" class="wide-input-field" />'); | 410 | jQuery("#email_style").val('newsletter'); |
| 411 | jQuery("#email_style").val('newsletter'); | 411 | jQuery('.scheduled-extended').show(); |
| 412 | jQuery('.scheduled-extended').show(); | ||
| 413 | jQuery('.trigger-extended').hide(); | 412 | jQuery('.trigger-extended').hide(); |
| 414 | jQuery(".text_verson").hide(); | 413 | jQuery(".text_verson").hide(); |
| 415 | jQuery('.attachments').hide(); | 414 | jQuery('.attachments').hide(); |
| 416 | jQuery('.scheduled_sendto').show(); | 415 | jQuery('.scheduled_sendto').show(); |
| 417 | //$(tinymce.get('en_html').getBody()).html(header+footer); | 416 | //$(tinymce.get('en_html').getBody()).html(header+footer); |
| 418 | //$(tinymce.get('fr_html').getBody()).html(header_fr+footer_fr); | 417 | //$(tinymce.get('fr_html').getBody()).html(header_fr+footer_fr); |
| 418 | $(tinymce.get('en_html').getBody()).html('<div id="newsletter"><p><img class="header-img alignnone wp-image-125416 size-full" src="https://cbvinstitute.com/wp-content/uploads/2019/02/image001.png" alt="" width="1691" height="441" /></p>' + | ||
| 419 | '<div class="content-block-header"><h2><span style="font-family: MyanmarMN;"><strong><span style="color: #ffffff;">BREAKING</span> <span style="color: #6ac9c8;">NEWS</span></strong></span></h2>'); | ||
| 420 | |||
| 421 | $(tinymce.get('fr_html').getBody()).html('<div id="newsletter"><p><img class="header-img alignnone wp-image-125416 size-full" src="https://cbvinstitute.com/wp-content/uploads/2019/02/image002.png" alt="" width="1691" height="441" /></p>' + | ||
| 422 | '<div class="content-block-header"><h2><span style="font-family: MyanmarMN;"><strong><span style="color: #ffffff;">DERNIÈRES</span> <span style="color: #6ac9c8;">NOUVELLES</span></strong></span></h2>'); | ||
| 423 | |||
| 419 | jQuery('#execute_date').datetimepicker({ | 424 | jQuery('#execute_date').datetimepicker({ |
| 420 | format: 'Y-m-d, H:i', | 425 | format: 'Y-m-d, H:i', |
| 421 | defaultDate: new Date() | 426 | defaultDate: new Date() |
| 422 | }).on('dp.change', function(e){ | 427 | }).on('dp.change', function(e) { |
| 423 | jQuery('#time').val(e.date); | 428 | jQuery('#time').val(e.date); |
| 424 | console.log('changed'); | 429 | console.log('changed'); |
| 425 | }); | 430 | }); |
| 426 | 431 | ||
| 427 | } else { | 432 | } else { |
| 428 | jQuery('.scheduled-extended').show(); | 433 | jQuery('.scheduled-extended').show(); |
| 429 | jQuery('.trigger-extended').hide(); | 434 | jQuery('.trigger-extended').hide(); |
| ... | @@ -431,10 +436,10 @@ function getInputFormValues($validation, $name) { | ... | @@ -431,10 +436,10 @@ function getInputFormValues($validation, $name) { |
| 431 | jQuery('#execute_date').datetimepicker({ | 436 | jQuery('#execute_date').datetimepicker({ |
| 432 | format: 'Y-m-d, H:i', | 437 | format: 'Y-m-d, H:i', |
| 433 | defaultDate: new Date() | 438 | defaultDate: new Date() |
| 434 | }).on('dp.change', function(e){ | 439 | }).on('dp.change', function(e) { |
| 435 | jQuery('#time').val(e.date); | 440 | jQuery('#time').val(e.date); |
| 436 | console.log('changed'); | 441 | console.log('changed'); |
| 437 | }); | 442 | }); |
| 438 | } | 443 | } |
| 439 | } | 444 | } |
| 440 | </script> | 445 | </script> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment