1b9bd638 by Kevin Burton

updates - not complete!

1 parent 3e2f7761
...@@ -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;
...@@ -33,4 +35,10 @@ table.expandable thead.open th.toggle h6 { ...@@ -33,4 +35,10 @@ table.expandable thead.open th.toggle h6 {
33 #ui-timepicker-div { margin: 0px 10px; } 35 #ui-timepicker-div { margin: 0px 10px; }
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; }
...\ No newline at end of file ...\ No newline at end of file
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