create.php
9.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
use Tz\WordPress\Tools\Notifications\Settings;
use Tz\WordPress\Tools\Notifications;
use Tz\WordPress\Tools;
?>
<link type="text/css" href="<?php echo Tools\url('assets/css/smoothness/jquery-ui-1.8.4.custom.css', __FILE__)?>" rel="stylesheet" />
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-1.4.2.min.js', __FILE__)?>"></script>
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/jquery-ui-1.8.4.custom.min.js', __FILE__)?>"></script>
<script type="text/javascript" src="<?php echo Tools\url('assets/scripts/datetimepicker.js', __FILE__)?>"></script>
<link rel="stylesheet" href="<?php echo Tools\url('assets/css/notifications.css', __FILE__)?>" />
<div id="" class="wrap">
<h2>Notifications - Create New</h2>
<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>
<?php if (isset($flash) && $flash !=""): ?>
<div class="post-success">
<?php echo $flash; ?>
</div>
<?php endif; ?>
<?php if($validation->validation_errors() != "" || isset($form_error)):?>
<div class="post-errors">
<div class="post-errors-title"><strong>Oops.</strong> There was an error saving your notification.</div>
<?php if (isset($form_error)):?>
<p class="post-errors-content">You must include either an Email, System or SMS message.</p>
<?php endif; ?>
</div>
<?php endif;?>
<form enctype="multipart/form-data" method="post" action="/wp-admin/admin.php?page=notifications-create-new">
<input type="hidden" name="_POSTED_" value="yes" />
<table cellspacing="0" class="widefat post fixed" style="margin-top:15px;">
<thead>
<tr>
<th width="150">Notification Details</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td width="150">Notification Type</td>
<td>
<select name="type" id="notif_type" class="wide-input-field" onchange="updateNotificationType();">
<option value="scheduled" <?php echo ($validation->set_value('type')=="scheduled") ? 'selected="selected"' : "";?>>Scheduled Notification</option>
<?php if (current_user_can(Settings\MANAGE_SYSTEM_NOTIFICATIONS)): ?>
<option value="triggered" <?php echo ($validation->set_value('type')=="triggered") ? 'selected="selected"' : "";?>>System Triggered Notification</option>
<?php endif; ?>
</select>
<?php echo $validation->form_error('type');?>
</td>
</tr>
<tr>
<td width="150">Notification Description</td>
<td><input type="text" name="title" class="wide-input-field" value="<?php echo $validation->set_value('title');?>" /><?php echo $validation->form_error('title');?></td>
</tr>
<tr>
<td>Sent To:</td>
<td>
<select name="sendto" class="wide-input-field">
<option value="user">Current User</option>
<option value="allusers">All Users</option>
<optgroup label="Groups:">
<option value="group1">Administrators</option>
<option value="group2">Group 2</option>
<option value="group3">Group 3</option>
</optgroup>
</select>
<?php echo $validation->form_error('sendto');?>
</td>
</tr>
<tr class="scheduled-extended">
<td>Execute Date / Time</td>
<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>
</tr>
<tr class="trigger-extended">
<td>Trigger</td>
<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>
</tr>
</tbody>
</table>
<table cellspacing="0" class="widefat post fixed expandable" style="margin-top:15px;">
<thead>
<tr>
<th width="150" class="toggle"><h6>Email</h6></th>
<th class="action-bar"> </th>
</tr>
</thead>
<tbody style="<?php echo ($validation->set_value('subject')!="" || $validation->set_value('text')!="" || $validation->set_value('html')!="") ? "" : "display:none";?>;">
<tr>
<td width="150">Subject Line</td>
<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>
</tr>
<tr>
<td>Text Version</td>
<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>
</tr>
<tr>
<td>HTML Version (optional)</td>
<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>
</tr>
<tr>
<td width="150">Attachments</td>
<td><input type="file" name="attachment[]" /></td>
</tr>
<tr>
<td> </td>
<td><input type="file" name="attachment[]" /></td>
</tr>
<tr>
<td> </td>
<td><input type="file" name="attachment[]" /></td>
</tr>
</tbody>
</table>
<table cellspacing="0" class="widefat post fixed expandable" style="margin-top:15px;">
<thead>
<tr>
<th width="150" class="toggle"><h6>System Message</h6></th>
<th class="action-bar"> </th>
</tr>
</thead>
<tbody style="<?php echo ($validation->set_value('system')=="") ? "display:none" : "";?>;">
<tr>
<td>Message (Text/HTML)</td>
<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>
</tr>
</tbody>
</table>
<table cellspacing="0" class="widefat post fixed expandable" style="margin-top:15px;">
<thead>
<tr>
<th width="150" class="toggle"><h6>SMS</h6></th>
<th class="action-bar"> </th>
</tr>
</thead>
<tbody style="<?php echo ($validation->set_value('sms')=="") ? "display:none" : "";?>;">
<tr>
<td>Text Only!</td>
<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>
</tr>
</tbody>
</table>
<p>
<input type="submit" value=" Save " /><input type="button" value=" Cancel " onclick="document.location.href='/wp-admin/admin.php?page=notifications';" />
</p>
</form>
</div>
<script type="text/javascript">
jQuery(document).ready(function() {
$('#execute_date').datetimepicker({
stepMinute: 15
, dateFormat: 'yy-mm-dd'
, timeFormat: 'hh:mm:ss'
});
updateNotificationType();
//jQuery('table.expandable tbody').hide();
jQuery('table.expandable thead th').click(function() {
var $table = jQuery(this).parent().parent().parent();
if ( jQuery('tbody',$table).is(":visible") ) {
jQuery('thead',$table).removeClass("open");
jQuery('tbody',$table).fadeOut();
} else {
jQuery('thead',$table).addClass("open");
jQuery('tbody',$table).fadeIn();
}
});
});
function updateNotificationType() {
var type = jQuery('#notif_type').val();
if (type=="triggered") {
jQuery('.scheduled-extended').hide();
jQuery('.trigger-extended').show();
} else {
jQuery('.scheduled-extended').show();
jQuery('.trigger-extended').hide();
}
}
</script>