1b9bd638 by Kevin Burton

updates - not complete!

1 parent 3e2f7761
...@@ -5,6 +5,7 @@ error_reporting(E_ALL^E_DEPRECATED); ...@@ -5,6 +5,7 @@ error_reporting(E_ALL^E_DEPRECATED);
5 use Tz\WordPress\Tools; 5 use Tz\WordPress\Tools;
6 use Tz\Common; 6 use Tz\Common;
7 use Tz\WordPress\Tools\Notifications; 7 use Tz\WordPress\Tools\Notifications;
8 use Tz\WordPress\Tools\Notifications\Validation;
8 9
9 const CAPABILITY = "manage_notifications"; 10 const CAPABILITY = "manage_notifications";
10 const MANAGE_SYSTEM_NOTIFICATIONS = "create_system_notifications"; 11 const MANAGE_SYSTEM_NOTIFICATIONS = "create_system_notifications";
...@@ -21,7 +22,106 @@ function display_page() { ...@@ -21,7 +22,106 @@ function display_page() {
21 22
22 23
23 if (isset($_GET['action']) && $_GET['action']=="edit") { 24 if (isset($_GET['action']) && $_GET['action']=="edit") {
24 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'edit.php'); 25 global $wpdb;
26
27 $entry = get_post($_GET['page_id']);
28
29 $id = $entry->ID;
30
31 $details = get_post_meta($id,'details',true);
32 $email = get_post_meta($id,'email',true);
33 $system = get_post_meta($id,'system',true);
34 $sms = get_post_meta($id,'sms',true);
35
36 $entry->details = $details;
37 $entry->email = $email;
38 $entry->system = $system;
39 $entry->sms = $sms;
40
41
42
43
44 // here
45 $validation = new Notifications\Validation;
46
47 $validation->set_rules('type','Notification Type','required');
48 $validation->set_rules('title','Description','trim|required|min_length[16]');
49 $validation->set_rules('type','Notification Type','required');
50 $validation->set_rules('sendto','Send To','required');
51
52 $type_val = ($_POST && $_POST['type'] == "scheduled") ? 'required' : '';
53 $validation->set_rules('execute_date','Execute Date', $type_val);
54
55 $trigger_val = ($_POST && $_POST['type'] == "triggered") ? 'required' : '';
56 $validation->set_rules('trigger','Trigger',$trigger_val);
57
58 $validation->set_rules('subject','Subject','trim');
59 $validation->set_rules('text','Text Version','trim|min_length[16]');
60 $validation->set_rules('html','HTML Version','trim|min_length[16]');
61
62 $validation->set_rules('system','System Message','trim|min_length[16]');
63 $validation->set_rules('sms','SMS Message','trim|min_length[16]');
64
65 //details
66 if ($validation->run() == TRUE) {
67
68 $type = $_POST['type'];
69 $title = $_POST['title'];
70 $sendto = $_POST['sendto'];
71 $execute_date = ($type=="scheduled") ? $_POST['execute_date'] : "0000-00-00 00:00:00";
72 $trigger = ($type=="scheduled") ? "scheduled-cron-job" : $_POST['trigger'];
73
74 // email
75 $subject = $_POST['subject'];
76 $text = $_POST['text'];
77 $html = $_POST['html'];
78 $attachments = array();
79 $upload_dir = __DIR__ . "/uploads/";
80 fixFilesArray($_FILES['attachment']);
81 foreach ($_FILES['attachment'] as $position => $file) {
82 // should output array with indices name, type, tmp_name, error, size
83 if($file['name'] != "") {
84 move_uploaded_file($file['tmp_name'],$upload_dir . $file['name']);
85 $attachments[] = $file['name'];
86 }
87 }
88
89 // system
90 $system = $_POST['system'];
91
92 // SMS
93 $sms = $_POST['sms'];
94
95 update_post_meta($id, "details", array(
96 'type' => $type
97 , 'sendto' => $sendto
98 , 'status' => $entry->details['status']
99 , 'trigger' => $trigger
100 , 'execute_date' => $execute_date
101 ));
102
103 update_post_meta($id, "email", array(
104 'subject' => $subject
105 , 'text' => $text
106 , 'html' => $html
107 , 'attachments' => $attachments
108 ));
109 update_post_meta($id, "system", $system);
110 update_post_meta($id, "sms", $sms);
111
112 $update = array();
113 $update['ID'] = $id;
114 $update['post_title'] = $title;
115 wp_update_post($update);
116
117
118 $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>";
119 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'form.php');
120 } else {
121 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'form.php');
122 }
123
124
25 125
26 } else { 126 } else {
27 127
...@@ -131,12 +231,27 @@ function fixFilesArray(&$files) ...@@ -131,12 +231,27 @@ function fixFilesArray(&$files)
131 } 231 }
132 } 232 }
133 233
134 function create_trigger_notification() {
135 print "hello";
136 }
137 234
138 function notification_settings() { 235 function notification_settings() {
139 print "settings"; 236
237 global $wpdb;
238 $validation = new Notifications\Validation;
239 $validation->set_rules('company','Company','required|trim');
240 $validation->set_rules('address','Address','required|trim');
241 $validation->set_rules('address2','Apt/Unit/Suite','required|trim');
242 $validation->set_rules('city','City','required|trim');
243 $validation->set_rules('province','Province','required|trim');
244 $validation->set_rules('postal','POstal Code','required|trim');
245 $validation->set_rules('std_message','Standard Message','required|trim');
246 $validation->set_rules('opt_message','OPT-OUT Message','required|trim');
247
248 if ($validation->run() == TRUE) {
249 } else {
250 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'settings.php');
251 }
252
253
254
140 } 255 }
141 256
142 function create_notification() { 257 function create_notification() {
...@@ -144,7 +259,33 @@ function create_notification() { ...@@ -144,7 +259,33 @@ function create_notification() {
144 global $wpdb; 259 global $wpdb;
145 260
146 261
147 if ($_POST && isset($_POST['_POSTED_']) && $_POST['_POSTED_']=="yes") { 262 // here
263 $validation = new Notifications\Validation;
264
265 $validation->set_rules('type','Notification Type','required');
266 $validation->set_rules('title','Description','trim|required|min_length[16]');
267 $validation->set_rules('type','Notification Type','required');
268 $validation->set_rules('sendto','Send To','required');
269
270 $type_val = ($_POST && $_POST['type'] == "scheduled") ? 'required' : '';
271 $validation->set_rules('execute_date','Execute Date', $type_val);
272
273 $trigger_val = ($_POST && $_POST['type'] == "triggered") ? 'required' : '';
274 $validation->set_rules('trigger','Trigger',$trigger_val);
275
276 $validation->set_rules('subject','Subject','trim');
277 $validation->set_rules('text','Text Version','trim|min_length[16]');
278 $validation->set_rules('html','HTML Version','trim|min_length[16]');
279
280 $validation->set_rules('system','System Message','trim|min_length[16]');
281 $validation->set_rules('sms','SMS Message','trim|min_length[16]');
282
283
284 if ($_POST && (($_POST['subject']=="" || $_POST['text']) && $_POST['sms']=="" && $_POST['system']=="")) {
285 $form_error = true;
286 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php');
287 } else {
288 if ($validation->run() == TRUE) {
148 289
149 // ok, so now we need to create the notification. 290 // ok, so now we need to create the notification.
150 class postTemplate { 291 class postTemplate {
...@@ -211,12 +352,13 @@ function create_notification() { ...@@ -211,12 +352,13 @@ function create_notification() {
211 add_post_meta($id, "sms", $sms); 352 add_post_meta($id, "sms", $sms);
212 353
213 354
214 $flash = "Notification Saved Successfully!"; 355 $flash = "<strong>Notification Saved Successfully!</strong><br /><a href='/wp-admin/admin.php?page=notifications'>Click here</a> to view all notifications.</a>";
215 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); 356 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php');
216 357
217 } else { 358 } else {
218 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php'); 359 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'create.php');
219 } 360 }
361 }
220 362
221 363
222 } 364 }
...@@ -240,7 +382,7 @@ class Actions { ...@@ -240,7 +382,7 @@ class Actions {
240 public static function admin_menu() { 382 public static function admin_menu() {
241 add_menu_page('Notifications','Notifications',CAPABILITY,'notifications',__NAMESPACE__ . '\display_page' ); 383 add_menu_page('Notifications','Notifications',CAPABILITY,'notifications',__NAMESPACE__ . '\display_page' );
242 add_submenu_page('notifications','New Notification', 'New Notification',CAPABILITY,'notifications-create-new',__NAMESPACE__ . '\create_notification'); 384 add_submenu_page('notifications','New Notification', 'New Notification',CAPABILITY,'notifications-create-new',__NAMESPACE__ . '\create_notification');
243 add_submenu_page('notifications','Settings', 'Settings',CAPABILITY,'notifications-settings',__NAMESPACE__ . '\notification_settings'); 385 add_submenu_page('notifications','CAN-SPAM Settings', 'CAN-SPAM Settings',CAPABILITY,'notifications-settings',__NAMESPACE__ . '\notification_settings');
244 } 386 }
245 387
246 public function admin_init() { 388 public function admin_init() {
......
...@@ -10,6 +10,7 @@ const OPTION_NAME = "notif_options"; ...@@ -10,6 +10,7 @@ const OPTION_NAME = "notif_options";
10 call_user_func(function() { 10 call_user_func(function() {
11 Vars::$options = new Tools\WP_Option(OPTION_NAME); 11 Vars::$options = new Tools\WP_Option(OPTION_NAME);
12 if (is_admin()) { 12 if (is_admin()) {
13 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'Validation.php');
13 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'Admin.php'); 14 require_once(__DIR__ . DIRECTORY_SEPARATOR . 'Admin.php');
14 } 15 }
15 }); 16 });
......
...@@ -4,9 +4,11 @@ h3.table-caption { padding:0; margin:25px 0 0px 0; } ...@@ -4,9 +4,11 @@ h3.table-caption { padding:0; margin:25px 0 0px 0; }
4 .post-success { 4 .post-success {
5 padding:10px; 5 padding:10px;
6 font-size: 12px; 6 font-size: 12px;
7 background: #ffffcc; 7 background: #88c550;
8 color:#88c550; 8 color:#fff;
9 } 9 }
10 .post-success a { color:#fff; text-decoration: underline;}
11 .post-success a:hover { color:#3b0d32; text-decoration: none; }
10 12
11 table.expandable thead th { 13 table.expandable thead th {
12 cursor:pointer; 14 cursor:pointer;
...@@ -34,3 +36,9 @@ table.expandable thead.open th.toggle h6 { ...@@ -34,3 +36,9 @@ table.expandable thead.open th.toggle h6 {
34 #ui-timepicker-div dl{ text-align: left; } 36 #ui-timepicker-div dl{ text-align: left; }
35 #ui-timepicker-div dl dt{ height: 25px; font-size: 11px; } 37 #ui-timepicker-div dl dt{ height: 25px; font-size: 11px; }
36 #ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; font-size: 11px; } 38 #ui-timepicker-div dl dd{ margin: -25px 0 10px 65px; font-size: 11px; }
39
40 .post-errors { border:1px solid red; background: pink;}
41 .post-errors-title { padding: 8px 10px; color:#fff; background: red; font: italic 16px/18px Georgia,"Times New Roman","Bitstream Charter",Times,serif;}
42 .post-errors-content { padding:10px; color:red; margin:0;}
43
44 .lblError { font: italic 11px/16px Georgia,"Times New Roman","Bitstream Charter",Times,serif; color: red;}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -20,6 +20,14 @@ use Tz\WordPress\Tools; ...@@ -20,6 +20,14 @@ use Tz\WordPress\Tools;
20 <?php echo $flash; ?> 20 <?php echo $flash; ?>
21 </div> 21 </div>
22 <?php endif; ?> 22 <?php endif; ?>
23 <?php if($validation->validation_errors() != "" || isset($form_error)):?>
24 <div class="post-errors">
25 <div class="post-errors-title"><strong>Oops.</strong> There was an error saving your notification.</div>
26 <?php if (isset($form_error)):?>
27 <p class="post-errors-content">You must include either an Email, System or SMS message.</p>
28 <?php endif; ?>
29 </div>
30 <?php endif;?>
23 31
24 <form enctype="multipart/form-data" method="post" action="/wp-admin/admin.php?page=notifications-create-new"> 32 <form enctype="multipart/form-data" method="post" action="/wp-admin/admin.php?page=notifications-create-new">
25 33
...@@ -37,16 +45,17 @@ use Tz\WordPress\Tools; ...@@ -37,16 +45,17 @@ use Tz\WordPress\Tools;
37 <td width="150">Notification Type</td> 45 <td width="150">Notification Type</td>
38 <td> 46 <td>
39 <select name="type" id="notif_type" class="wide-input-field" onchange="updateNotificationType();"> 47 <select name="type" id="notif_type" class="wide-input-field" onchange="updateNotificationType();">
40 <option value="scheduled">Scheduled Notification</option> 48 <option value="scheduled" <?php echo ($validation->set_value('type')=="scheduled") ? 'selected="selected"' : "";?>>Scheduled Notification</option>
41 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?> 49 <?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
42 <option value="triggered">System Triggered Notification</option> 50 <option value="triggered" <?php echo ($validation->set_value('type')=="triggered") ? 'selected="selected"' : "";?>>System Triggered Notification</option>
43 <?php endif; ?> 51 <?php endif; ?>
44 </select> 52 </select>
53 <?php echo $validation->form_error('type');?>
45 </td> 54 </td>
46 </tr> 55 </tr>
47 <tr> 56 <tr>
48 <td width="150">Notification Description</td> 57 <td width="150">Notification Description</td>
49 <td><input type="text" name="title" class="wide-input-field" /></td> 58 <td><input type="text" name="title" class="wide-input-field" value="<?php echo $validation->set_value('title');?>" /><?php echo $validation->form_error('title');?></td>
50 </tr> 59 </tr>
51 <tr> 60 <tr>
52 <td>Sent To:</td> 61 <td>Sent To:</td>
...@@ -60,17 +69,18 @@ use Tz\WordPress\Tools; ...@@ -60,17 +69,18 @@ use Tz\WordPress\Tools;
60 <option value="group3">Group 3</option> 69 <option value="group3">Group 3</option>
61 </optgroup> 70 </optgroup>
62 </select> 71 </select>
72 <?php echo $validation->form_error('sendto');?>
63 </td> 73 </td>
64 </tr> 74 </tr>
65 75
66 <tr class="scheduled-extended"> 76 <tr class="scheduled-extended">
67 <td>Execute Date / Time</td> 77 <td>Execute Date / Time</td>
68 <td><input type="text" name="execute_date" id="execute_date" class="wide-input-field date-pick" readonly="readonly" /></td> 78 <td><input type="text" name="execute_date" id="execute_date" class="wide-input-field date-pick" readonly="readonly" value="<?php echo $validation->set_value('execute_date');?>" /><?php echo $validation->form_error('execute_date');?></td>
69 </tr> 79 </tr>
70 80
71 <tr class="trigger-extended"> 81 <tr class="trigger-extended">
72 <td>Trigger</td> 82 <td>Trigger</td>
73 <td><input type="text" name="trigger" id="trigger" class="wide-input-field" /></td> 83 <td><input type="text" name="trigger" id="trigger" class="wide-input-field" value="<?php echo $validation->set_value('trigger');?>" /><?php echo $validation->form_error('trigger');?></td>
74 </tr> 84 </tr>
75 85
76 </tbody> 86 </tbody>
...@@ -83,18 +93,18 @@ use Tz\WordPress\Tools; ...@@ -83,18 +93,18 @@ use Tz\WordPress\Tools;
83 <th class="action-bar">&nbsp;</th> 93 <th class="action-bar">&nbsp;</th>
84 </tr> 94 </tr>
85 </thead> 95 </thead>
86 <tbody> 96 <tbody style="<?php echo ($validation->set_value('subject')!="" || $validation->set_value('text')!="" || $validation->set_value('html')!="") ? "" : "display:none";?>;">
87 <tr> 97 <tr>
88 <td width="150">Subject Line</td> 98 <td width="150">Subject Line</td>
89 <td><input type="text" name="subject" class="wide-input-field" style="width:100%;" /></td> 99 <td><input type="text" name="subject" class="wide-input-field" style="width:100%;" value="<?php echo $validation->set_value('subject');?>" /><?php echo $validation->form_error('subject');?></td>
90 </tr> 100 </tr>
91 <tr> 101 <tr>
92 <td>Text Version</td> 102 <td>Text Version</td>
93 <td><textarea name="text" class="wide-input-field" rows="10" style="width:100%;" ></textarea></td> 103 <td><textarea name="text" class="wide-input-field" rows="10" style="width:100%;" ><?php echo $validation->set_value('text');?></textarea><?php echo $validation->form_error('text');?></td>
94 </tr> 104 </tr>
95 <tr> 105 <tr>
96 <td>HTML Version (optional)</td> 106 <td>HTML Version (optional)</td>
97 <td><textarea name="html" id="htmlversion" class="wide-input-field" rows="10" style="width:100%;"></textarea></td> 107 <td><textarea name="html" id="htmlversion" class="wide-input-field" rows="10" style="width:100%;"><?php echo $validation->set_value('html');?></textarea><?php echo $validation->form_error('html');?></td>
98 </tr> 108 </tr>
99 <tr> 109 <tr>
100 <td width="150">Attachments</td> 110 <td width="150">Attachments</td>
...@@ -118,10 +128,10 @@ use Tz\WordPress\Tools; ...@@ -118,10 +128,10 @@ use Tz\WordPress\Tools;
118 <th class="action-bar">&nbsp;</th> 128 <th class="action-bar">&nbsp;</th>
119 </tr> 129 </tr>
120 </thead> 130 </thead>
121 <tbody> 131 <tbody style="<?php echo ($validation->set_value('system')=="") ? "display:none" : "";?>;">
122 <tr> 132 <tr>
123 <td>Message (Text/HTML)</td> 133 <td>Message (Text/HTML)</td>
124 <td><textarea name="system" class="wide-input-field" rows="4" style="width:100%;" ></textarea></td> 134 <td><textarea name="system" class="wide-input-field" rows="4" style="width:100%;" ><?php echo $validation->set_value('system');?></textarea><?php echo $validation->form_error('system');?></td>
125 </tr> 135 </tr>
126 </tbody> 136 </tbody>
127 </table> 137 </table>
...@@ -133,10 +143,10 @@ use Tz\WordPress\Tools; ...@@ -133,10 +143,10 @@ use Tz\WordPress\Tools;
133 <th class="action-bar">&nbsp;</th> 143 <th class="action-bar">&nbsp;</th>
134 </tr> 144 </tr>
135 </thead> 145 </thead>
136 <tbody> 146 <tbody style="<?php echo ($validation->set_value('sms')=="") ? "display:none" : "";?>;">
137 <tr> 147 <tr>
138 <td>Text Only!</td> 148 <td>Text Only!</td>
139 <td><textarea name="sms" class="wide-input-field" rows="4" style="width:100%;" ></textarea></td> 149 <td><textarea name="sms" class="wide-input-field" rows="4" style="width:100%;" ><?php echo $validation->set_value('sms');?></textarea><?php echo $validation->form_error('sms');?></td>
140 </tr> 150 </tr>
141 </tbody> 151 </tbody>
142 </table> 152 </table>
...@@ -163,7 +173,7 @@ jQuery(document).ready(function() { ...@@ -163,7 +173,7 @@ jQuery(document).ready(function() {
163 173
164 updateNotificationType(); 174 updateNotificationType();
165 175
166 jQuery('table.expandable tbody').hide(); 176 //jQuery('table.expandable tbody').hide();
167 jQuery('table.expandable thead th').click(function() { 177 jQuery('table.expandable thead th').click(function() {
168 var $table = jQuery(this).parent().parent().parent(); 178 var $table = jQuery(this).parent().parent().parent();
169 if ( jQuery('tbody',$table).is(":visible") ) { 179 if ( jQuery('tbody',$table).is(":visible") ) {
......
1 <?php
2 use Tz\WordPress\Tools\Notifications;
3 use Tz\WordPress\Tools;
4 ?>
5
6 <!-- jQuery -->
7 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
8
9 <!-- required plugins -->
10 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/date.js', __FILE__)?>"></script>
11 <!--[if IE]><script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.bgiframe.js', __FILE__)?>"></script><![endif]-->
12
13 <!-- jquery.datePicker.js -->
14 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery.datePicker.js', __FILE__)?>"></script>
15
16 <link rel="stylesheet" href="<?php echo Tools\url('assets/css/datePicker.css', __FILE__)?>" />
17 <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" />
18
19 <div id="" class="wrap">
20
21 <h2>Notifications - Create New</h2>
22 <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam iaculis convallis nisi eu dignissim. Quisque malesuada augue in mi blandit at blandit tortor sollicitudin. Cras at justo mi, vel mollis est. Donec orci erat, blandit varius vehicula vitae, volutpat at lorem. Etiam tincidunt bibendum ante, non tincidunt purus faucibus sed. Suspendisse eget facilisis tellus. Nulla imperdiet leo placerat diam sollicitudin nec mattis neque mattis. Cras id lacus tellus. Phasellus volutpat vehicula porttitor. Praesent erat felis, pharetra mollis egestas sit amet, rhoncus eget nisl. Morbi interdum sapien vitae nibh pharetra scelerisque. Mauris porta accumsan velit ac aliquam. Sed sit amet dictum felis. Fusce tempus vulputate nulla, quis tincidunt velit mattis eu.</p>
23
24 <form method="post" action="/wp-admin/admin.php?page=notification&action=create">
25
26 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
27 <thead>
28 <tr>
29 <th width="150">Notification Details</th>
30 <th>&nbsp;</th>
31 </tr>
32 </thead>
33 <tbody>
34 <tr>
35 <td width="150">Description</td>
36 <td><input type="text" name="" class="wide-input-field" /></td>
37 </tr>
38 <tr>
39 <td>Notification Type</td>
40 <td>
41 <select name="" class="wide-input-field">
42 <option value="instant">Instant</option>
43 <option value="queued">Batch Queue</option>
44 <option value="system">System</option>
45 </select>
46 </td>
47 </tr>
48 <tr>
49 <td>Sent To:</td>
50 <td>
51 <select name="" class="wide-input-field">
52 <option value="user">Current User</option>
53 <option value="user">All Users</option>
54 <optgroup label="Groups:">
55 <option value="group1">Administrators</option>
56 <option value="group2">Group 2</option>
57 <option value="group3">Group 3</option>
58 </optgroup>
59 </select>
60 </td>
61 </tr>
62 <tr>
63 <td>Trigger/Slug</td>
64 <td><input type="text" name="" class="wide-input-field" /></td>
65 </tr>
66 <tr>
67 <td>Execute Date / Time</td>
68 <td><input type="text" name="" class="wide-input-field date-pick" /></td>
69 </tr>
70
71 </tbody>
72 </table>
73
74 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
75 <thead>
76 <tr>
77 <th width="150">Notification Content</th>
78 <th>&nbsp;</th>
79 </tr>
80 </thead>
81 <tbody>
82 <tr>
83 <td width="150">Subject Line</td>
84 <td><input type="text" name="" class="wide-input-field" style="width:100%;" /></td>
85 </tr>
86 <tr>
87 <td>Text Version</td>
88 <td><textarea class="wide-input-field" rows="10" style="width:100%;" ></textarea></td>
89 </tr>
90 <tr>
91 <td>HTML Version (optional)</td>
92 <td><textarea class="wide-input-field" rows="10" style="width:100%;"></textarea></td>
93 </tr>
94 </tbody>
95 </table>
96
97 <p>
98 <input type="submit" value=" Save " /><input type="button" value=" Cancel " onclick="document.location.href='/wp-admin/admin.php?page=notifications';" />
99 </p>
100
101 </form>
102
103 </div>
104
105 <script type="text/javascript">
106 $(function()
107 {
108 $('.date-pick').datePicker();
109 });
110 </script>
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2 use Tz\WordPress\Tools\Notifications\Settings;
3 use Tz\WordPress\Tools\Notifications;
4 use Tz\WordPress\Tools;
5
6
7 register_settings
8
9 ?>
10
11 <link type="text/css" href="<?php echo Tools\url('assets/css/smoothness/jquery-ui-1.8.4.custom.css', __FILE__)?>" rel="stylesheet" />
12 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-1.4.2.min.js', __FILE__)?>"></script>
13 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-ui-1.8.4.custom.min.js', __FILE__)?>"></script>
14 <script type="text/javascript" src="<?php echo Tools\url('assets/scripts/datetimepicker.js', __FILE__)?>"></script>
15 <link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" />
16
17 <div id="" class="wrap">
18
19 <h2>Notifications - Settings</h2>
20 <p>In order to comply with the CAN-SPAM act, each outgoing email must include the following:</p>
21
22
23 <form enctype="multipart/form-data" method="post" action="options.php">
24
25 <input type="hidden" name="_POSTED_" value="yes" />
26
27 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
28 <thead>
29 <tr>
30 <th width="150">CAN-SPAM Settings</th>
31 <th>&nbsp;</th>
32 </tr>
33 </thead>
34 <tbody>
35 <tr>
36 <td width="150">Company Name:</td>
37 <td><input type="text" name="company" class="wide-input-field" /></td>
38 </tr>
39 <tr>
40 <td width="150">Address:</td>
41 <td><input type="text" name="address" class="wide-input-field" /></td>
42 </tr>
43 <tr>
44 <td width="150">Apt/Unit/Suite:</td>
45 <td><input type="text" name="address2" class="wide-input-field" /></td>
46 </tr>
47 <tr>
48 <td width="150">City:</td>
49 <td><input type="text" name="city" class="wide-input-field" /></td>
50 </tr>
51 <tr>
52 <td width="150">Province:</td>
53 <td>
54 <select name="province" class="wide-input-field" >
55 <option value="Ontario">Ontario</option>
56 <option value="Quebec">Quebec</option>
57 <option value="Nova Scotia">Nova Scotia</option>
58 <option value="New Brunswick">New Brunswick</option>
59 <option value="Manitoba">Manitoba</option>
60 <option value="British Columbia">British Columbia</option>
61 <option value="Prince Edward Island">Prince Edward Island</option>
62 <option value="Saskatchewan">Saskatchewan</option>
63 <option value="Alberta">Alberta</option>
64 <option value="Newfoundland and Labrador">Newfoundland and Labrador</option>
65 </select>
66 </td>
67 </tr>
68 <tr>
69 <td width="150">Postal Code:</td>
70 <td><input type="text" name="postal" /></td>
71 </tr>
72 </body>
73 </table>
74
75 <table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
76 <thead>
77 <tr>
78 <th width="150">CAN-SPAM Messages</th>
79 <th>&nbsp;</th>
80 </tr>
81 </thead>
82 <tbody>
83 <tr>
84 <td width="150">Standard Message:</td>
85 <td><textarea name="std_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';">This email was sent to ({email}) because you have agreed to receive periodic emails from us. To ensure that you continue receiving our emails, please add us to your address book or safe list.</textarea></td>
86 </tr>
87 <tr>
88 <td width="150">OPT-OUT Message::</td>
89 <td><textarea name="opt_message" class="wide-input-field" rows="4" style="width:100%;color:#999" onkeydown="this.style.color = '#000000';" >If you do not wish to further receive emails from us, please opt-out by clicking here: http://cbv.wp.kb/no-emails-please.php?u={uid}.</textarea></td>
90 </tr>
91 </body>
92 </table>
93
94 <p>
95 <input type="submit" value=" Update " />
96 </p>
97 </form>
98
99 </div>
...\ No newline at end of file ...\ No newline at end of file