-
Notifications
You must be signed in to change notification settings - Fork 25
/
mactrack_view_devices.php
581 lines (522 loc) · 22.8 KB
/
mactrack_view_devices.php
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2004-2024 The Cacti Group |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| Cacti: The Complete RRDTool-based Graphing Solution |
+-------------------------------------------------------------------------+
| This code is designed, written, and maintained by the Cacti Group. See |
| about.php and/or the AUTHORS file for specific developer information. |
+-------------------------------------------------------------------------+
| http://www.cacti.net/ |
+-------------------------------------------------------------------------+
*/
$guest_account = true;
chdir('../../');
include('./include/auth.php');
include_once('./plugins/mactrack/lib/mactrack_functions.php');
$title = __('Mactrack - Device Report View', 'macktrack');
if (isset_request_var('export')) {
mactrack_view_export_devices();
} else {
general_header();
mactrack_view_devices();
bottom_footer();
}
function mactrack_device_request_validation() {
/* ================= input validation and session storage ================= */
$filters = array(
'rows' => array(
'filter' => FILTER_VALIDATE_INT,
'pageset' => true,
'default' => '-1'
),
'page' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '1'
),
'filter' => array(
'filter' => FILTER_CALLBACK,
'pageset' => true,
'default' => '',
'options' => array('options' => 'sanitize_search_string')
),
'sort_column' => array(
'filter' => FILTER_CALLBACK,
'default' => 'site_name',
'options' => array('options' => 'sanitize_search_string')
),
'sort_direction' => array(
'filter' => FILTER_CALLBACK,
'default' => 'ASC',
'options' => array('options' => 'sanitize_search_string')
),
'site_id' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '-1',
'pageset' => true
),
'type_id' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '-1',
'pageset' => true
),
'status' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '-1',
'pageset' => true
),
'device_type_id' => array(
'filter' => FILTER_VALIDATE_INT,
'default' => '-1',
'pageset' => true
),
'detail' => array(
'filter' => FILTER_CALLBACK,
'default' => 'false',
'options' => array('options' => 'sanitize_search_string')
),
);
validate_store_request_vars($filters, 'sess_mtv_devices');
/* ================= input validation ================= */
}
function mactrack_view_export_devices() {
mactrack_device_request_validation();
$sql_where = '';
$devices = mactrack_view_get_device_records($sql_where, 0, false);
$xport_array = array();
array_push($xport_array, 'site_id, site_name, device_id, device_name, notes, ' .
'hostname, snmp_readstring, snmp_readstrings, snmp_version, ' .
'snmp_username, snmp_password, snmp_auth_protocol, snmp_priv_passphrase, ' .
'snmp_priv_protocol, snmp_context, snmp_engine_id, ' .
'snmp_port, snmp_timeout, snmp_retries, max_oids, snmp_sysName, snmp_sysLocation, ' .
'snmp_sysContact, snmp_sysObjectID, snmp_sysDescr, snmp_sysUptime, ' .
'ignorePorts, scan_type, disabled, ports_total, ports_active, ' .
'ports_trunk, macs_active, last_rundate, last_runduration');
if (cacti_sizeof($devices)) {
foreach($devices as $device) {
array_push($xport_array,'"' .
$device['site_id'] . '","' . $device['site_name'] . '","' .
$device['device_id'] . '","' . $device['device_name'] . '","' .
$device['notes'] . '","' . $device['hostname'] . '","' .
$device['snmp_readstring'] . '","' . $device['snmp_readstrings'] . '","' .
$device['snmp_version'] . '","' . $device['snmp_username'] . '","' .
$device['snmp_password'] . '","' . $device['snmp_auth_protocol'] . '","' .
$device['snmp_priv_passphrase'] . '","' . $device['snmp_priv_protocol'] . '","' .
$device['snmp_context'] . '","' . $device['snmp_engine_id'] . '","' .
$device['snmp_port'] . '","' . $device['snmp_timeout'] . '","' .
$device['snmp_retries'] . '","' . $device['max_oids'] . '","' .
$device['snmp_sysName'] . '","' . $device['snmp_sysLocation'] . '","' .
$device['snmp_sysContact'] . '","' . $device['snmp_sysObjectID'] . '","' .
$device['snmp_sysDescr'] . '","' . $device['snmp_sysUptime'] . '","' .
$device['ignorePorts'] . '","' . $device['scan_type'] . '","' .
$device['disabled'] . '","' . $device['ports_total'] . '","' .
$device['ports_active'] . '","' . $device['ports_trunk'] . '","' .
$device['macs_active'] . '","' . $device['last_rundate'] . '","' .
$device['last_runduration'] . '"');
}
}
header('Content-type: application/csv');
header('Content-Disposition: attachment; filename=cacti_device_xport.csv');
foreach($xport_array as $xport_line) {
print $xport_line . "\n";
}
}
function mactrack_view_get_device_records(&$sql_where, $rows, $apply_limits = true) {
$device_type_info = db_fetch_row_prepared('SELECT * FROM mac_track_device_types WHERE device_type_id = ?', array(get_request_var('device_type_id')));
/* if the device type is not the same as the type_id, then reset it */
if ((cacti_sizeof($device_type_info)) && (get_request_var('type_id') != -1)) {
if ($device_type_info['device_type'] != get_request_var('type_id')) {
$device_type_info = array();
}
} else {
if (get_request_var('device_type_id') == 0) {
$device_type_info = array('device_type_id' => 0, 'description' => __('Unknown Device Type', 'mactrack'));
}
}
/* form the 'where' clause for our main sql query */
if (get_request_var('filter') != '') {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . "(mac_track_devices.hostname LIKE '%" . get_request_var('filter') . "%' OR " .
"mac_track_devices.notes LIKE '%" . get_request_var('filter') . "%' OR " .
"mac_track_devices.device_name LIKE '%" . get_request_var('filter') . "%' OR " .
"mac_track_sites.site_name LIKE '%" . get_request_var('filter') . "%')";
}
if (cacti_sizeof($device_type_info)) {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.device_type_id=' . $device_type_info['device_type_id'] . ')';
}
if (get_request_var('status') == '-1') {
/* Show all items */
} elseif (get_request_var('status') == '-2') {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.disabled="on")';
} elseif (get_request_var('status') == '5') {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.host_id=0)';
} else {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.snmp_status=' . get_request_var('status') . ') AND (mac_track_devices.disabled = "")';
}
/* scan types matching */
if (get_request_var('type_id') == '-1') {
/* Show all items */
} else {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.scan_type=' . get_request_var('type_id') . ')';
}
/* device types matching */
if (get_request_var('device_type_id') == '-1') {
/* Show all items */
} elseif (get_request_var('device_type_id') == '-2') {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_device_types.description="")';
} else {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.device_type_id=' . get_request_var('device_type_id') . ')';
}
if (get_request_var('site_id') == '-1') {
/* Show all items */
} elseif (get_request_var('site_id') == '-2') {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_sites.site_id IS NULL)';
} elseif (!isempty_request_var('site_id')) {
$sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . '(mac_track_devices.site_id=' . get_request_var('site_id') . ')';
}
$sql_order = get_order_string();
if ($apply_limits) {
$sql_limit = ' LIMIT ' . ($rows*(get_request_var('page')-1)) . ', ' . $rows;
} else {
$sql_limit = '';
}
$sql_query = "SELECT
mac_track_devices.*,
mac_track_device_types.description AS device_type,
mac_track_sites.site_name
FROM mac_track_sites
RIGHT JOIN mac_track_devices ON (mac_track_devices.site_id=mac_track_sites.site_id)
LEFT JOIN mac_track_device_types ON (mac_track_device_types.device_type_id=mac_track_devices.device_type_id)
$sql_where
$sql_order
$sql_limit";
return db_fetch_assoc($sql_query);
}
function mactrack_view_devices() {
global $title, $report, $mactrack_search_types, $mactrack_device_types, $rows_selector, $config, $item_rows;
mactrack_device_request_validation();
if (get_request_var('rows') == -1) {
$rows = read_config_option('num_rows_table');
} elseif (get_request_var('rows') == -2) {
$rows = 999999;
} else {
$rows = get_request_var('rows');
}
$webroot = $config['url_path'] . 'plugins/mactrack/';
mactrack_tabs();
html_start_box($title, '100%', '', '3', 'center', '');
mactrack_device_filter2();
html_end_box();
$sql_where = '';
$devices = mactrack_view_get_device_records($sql_where, $rows);
$total_rows = db_fetch_cell("SELECT
COUNT(mac_track_devices.device_id)
FROM mac_track_sites
RIGHT JOIN mac_track_devices
ON mac_track_devices.site_id = mac_track_sites.site_id
LEFT JOIN mac_track_device_types
ON mac_track_device_types.device_type_id=mac_track_devices.device_type_id
$sql_where");
$display_text = array(
'nosort' => array(
'display' => __('Actions', 'mactrack')
),
'device_name' => array(
'display' => __('Device Name', 'mactrack'),
'sort' => 'ASC'
),
'site_name' => array(
'display' => __('Site Name', 'mactrack'),
'sort' => 'ASC'
),
'snmp_status' => array(
'display' => __('Status', 'mactrack'),
'sort' => 'ASC'
),
'hostname' => array(
'display' => __('Hostname', 'mactrack'),
'sort' => 'ASC'
),
'device_type' => array(
'display' => __('Device Type', 'mactrack'),
'sort' => 'ASC'
),
'ips_total' => array(
'display' => __('Total IP\'s', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'ports_total' => array(
'display' => __('User Ports', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'ports_active' => array(
'display' => __('User Ports Up', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'ports_trunk' => array(
'display' => __('Trunk Ports', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'macs_active' => array(
'display' => __('Active Macs', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'vlans_total' => array(
'display' => __('Total VLAN\'s', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
),
'last_runduration' => array(
'display' => __('Last Duration', 'mactrack'),
'align' => 'right',
'sort' => 'DESC'
)
);
$columns = cacti_sizeof($display_text);
$nav = html_nav_bar('mactrack_view_devices.php?report=devices', MAX_DISPLAY_PAGES, get_request_var('page'), $rows, $total_rows, $columns, __('Devices', 'mactrack'), 'page', 'main');
print $nav;
html_start_box('', '100%', '', '3', 'center', '');
html_header_sort($display_text, get_request_var('sort_column'), get_request_var('sort_direction'));
$i = 0;
if (cacti_sizeof($devices) > 0) {
foreach ($devices as $device) {
$hostinfo['hostname'] = $device['hostname'];
$hostinfo['user'] = $device['user_name'];
switch($device['term_type']) {
case 0:
$hostinfo['transport'] = 'none';
break;
case 1:
$hostinfo['transport'] = 'telnet';
break;
case 2:
$hostinfo['transport'] = 'ssh';
break;
case 3:
$hostinfo['transport'] = 'http';
break;
case 4:
$hostinfo['transport'] = 'https';
break;
}
if (api_user_realm_auth('mactrack_sites.php')) {
$actions = "<a class='pic' href='" . html_escape($webroot . 'mactrack_devices.php?action=edit&device_id=' . $device['device_id']) . "' title='" . __esc('Edit Device', 'mactrack') . "'><i class='mtEdit fas fa-edit'></i></a>";
ob_start();
api_plugin_hook_function('remote_link', $hostinfo);
$actions .= ob_get_clean();
if ($device['host_id']) {
$actions .= "<a class='pic' href='" . html_escape($webroot . 'mactrack_view_graphs.php?action=preview&report=graphs&style=selective&graph_list=&host_id=' . $device['host_id'] . '&graph_template_id=0&filter=') . "' title='" . __esc('View Graphs', 'mactrack') . "'><i class='mtChart fas fa-chart-line'></i></a>";
} else {
$actions .= "<i class='mcChartDisabled fas fa-chart-line' title='" . __esc('Device Not Mapped to Cacti Device', 'mactrack') . "' ></i>";
}
} else {
$actions = '';
}
$actions .= "<a class='pic' href='" . html_escape($webroot . 'mactrack_view_macs.php?report=macs&reset&device_id=-1&scan_date=3&site_id=' . get_request_var('site_id') . '&device_id=' . $device['device_id']) . "' title='" . __esc('View MAC Addresses', 'mactrack') . "'><i class='mtMacs fas fa-at'></i></a>";
$actions .= "<a class='pic' href='" . html_escape($webroot . 'mactrack_view_interfaces.php?report=interfaces&reset&site=' . get_request_var('site_id') . '&device_id=' . $device['device_id']) . "' title='" . __esc('View Interfaces', 'mactrack') . "'><i class='mtRanges fas fa-sitemap'></i></a>";
$st = $device['scan_type'];
$na = __('N/A', 'mactrack');
form_alternate_row('line' . $device['device_id']);
form_selectable_cell($actions, $device['device_id'], '1%');
form_selectable_cell(filter_value($device['device_name'], get_request_var('filter')), $device['device_id'], '', 'hyperLink');
form_selectable_cell(filter_value($device['site_name'], get_request_var('filter')), $device['device_id']);
form_selectable_cell(get_colored_device_status(($device['disabled'] == 'on' ? true : false), $device['snmp_status']), $device['device_id'], '', 'center');
form_selectable_cell(filter_value($device['hostname'], get_request_var('filter')), $device['device_id']);
form_selectable_cell($device['device_type'], $device['device_id']);
form_selectable_cell($st == '1' ? $na : number_format_i18n($device['ips_total']), $device['device_id'], '', 'right');
form_selectable_cell($st == '3' ? $na : number_format_i18n($device['ports_total']), $device['device_id'], '', 'right');
form_selectable_cell($st == '3' ? $na : number_format_i18n($device['ports_active']), $device['device_id'], '', 'right');
form_selectable_cell($st == '3' ? $na : number_format_i18n($device['ports_trunk']), $device['device_id'], '', 'right');
form_selectable_cell($st == '3' ? $na : number_format_i18n($device['macs_active']), $device['device_id'], '', 'right');
form_selectable_cell($st == '3' ? $na : number_format_i18n($device['vlans_total']), $device['device_id'], '', 'right');
form_selectable_cell(number_format($device['last_runduration'], 1), $device['device_id'], '', 'right');
form_end_row();
}
} else {
print '<tr><td colspan="10"><em>' . __('No Mactrack Devices Found', 'mactrack') . '</em></td></tr>';
}
html_end_box(false);
if (cacti_sizeof($devices)) {
print $nav;
mactrack_display_stats();
}
}
function mactrack_device_filter2() {
global $item_rows;
?>
<tr class='even'>
<td>
<form id='mactrack'>
<table class='filterTable'>
<tr>
<td>
<?php print __('Search', 'mactrack');?>
</td>
<td>
<input type='text' id='filter' size='25' value='<?php print get_request_var('filter');?>'>
</td>
<td>
<?php print __('Site', 'mactrack');?>
</td>
<td>
<select id='site_id' onChange='applyFilter()'>
<option value='-1'<?php if (get_request_var('site_id') == '-1') {?> selected<?php }?>><?php print __('All', 'mactrack');?></option>
<option value='-2'<?php if (get_request_var('site_id') == '-2') {?> selected<?php }?>><?php print __('None', 'mactrack');?></option>
<?php
$sites = db_fetch_assoc('SELECT site_id, site_name FROM mac_track_sites ORDER BY site_name');
if (cacti_sizeof($sites)) {
foreach ($sites as $site) {
print '<option value="' . $site['site_id'] . '"'; if (get_request_var('site_id') == $site['site_id']) { print ' selected'; } print '>' . $site['site_name'] . '</option>';
}
}
?>
</select>
</td>
<td>
<span class='nowrap'>
<input type='submit' id='go' value='<?php print __esc('Go', 'mactrack');?>'>
<input type='button' id='clear' value='<?php print __esc('Clear', 'mactrack');?>'>
<input type='button' id='export' value='<?php print __esc('Export', 'mactrack');?>'>
</span>
</td>
</tr>
</table>
<table class='filterTable'>
<tr>
<td>
<?php print __('Type', 'mactrack');?>
</td>
<td>
<select id='type_id' onChange='applyFilter()'>
<option value='-1'<?php if (get_request_var('type_id') == '-1') {?> selected<?php }?>><?php print __('Any', 'mactrack');?></option>
<option value='1'<?php if (get_request_var('type_id') == '1') {?> selected<?php }?>><?php print __('Hub/Switch', 'mactrack');?></option>
<option value='2'<?php if (get_request_var('type_id') == '2') {?> selected<?php }?>><?php print __('Switch/Router', 'mactrack');?></option>
<option value='3'<?php if (get_request_var('type_id') == '3') {?> selected<?php }?>><?php print __('Router', 'mactrack');?></option>
</select>
</td>
<td>
<?php print __('SubType', 'mactrack');?>
</td>
<td>
<select id='device_type_id' onChange='applyFilter()'>
<option value='-1'<?php if (get_request_var('device_type_id') == '-1') {?> selected<?php }?>><?php print __('Any', 'mactrack');?></option>
<option value='-2'<?php if (get_request_var('device_type_id') == '-2') {?> selected<?php }?>><?php print __('Not Detected', 'mactrack');?></option>
<?php
if (get_request_var('type_id') != -1) {
$device_types = db_fetch_assoc_prepared('SELECT DISTINCT
mac_track_devices.device_type_id,
mac_track_device_types.description,
mac_track_device_types.sysDescr_match
FROM mac_track_device_types
INNER JOIN mac_track_devices
ON (mac_track_device_types.device_type_id=mac_track_devices.device_type_id)
WHERE device_type = ?
ORDER BY mac_track_device_types.description', array(get_request_var('type_id')));
} else {
$device_types = db_fetch_assoc('SELECT DISTINCT
mac_track_devices.device_type_id,
mac_track_device_types.description,
mac_track_device_types.sysDescr_match
FROM mac_track_device_types
INNER JOIN mac_track_devices
ON (mac_track_device_types.device_type_id=mac_track_devices.device_type_id)
ORDER BY mac_track_device_types.description');
}
if (cacti_sizeof($device_types)) {
foreach ($device_types as $device_type) {
$display_text = $device_type['description'] . ' (' . $device_type['sysDescr_match'] . ')';
print '<option value="' . $device_type['device_type_id'] . '"'; if (get_request_var('device_type_id') == $device_type['device_type_id']) { print ' selected'; } print '>' . $display_text . '</option>';
}
}
?>
</select>
</td>
</tr>
</table>
<table class='filterTable'>
<tr>
<td>
<?php print __('Status', 'mactrack');?>
</td>
<td>
<select id='status' onChange='applyFilter()'>
<option value='-1'<?php if (get_request_var('status') == '-1') {?> selected<?php }?>><?php print __('Any', 'mactrack');?></option>
<option value='3'<?php if (get_request_var('status') == '3') {?> selected<?php }?>><?php print __('Up', 'mactrack');?></option>
<option value='-2'<?php if (get_request_var('status') == '-2') {?> selected<?php }?>><?php print __('Disabled', 'mactrack');?></option>
<option value='1'<?php if (get_request_var('status') == '1') {?> selected<?php }?>><?php print __('Down', 'mactrack');?></option>
<option value='0'<?php if (get_request_var('status') == '0') {?> selected<?php }?>><?php print __('Unknown', 'mactrack');?></option>
<option value='4'<?php if (get_request_var('status') == '4') {?> selected<?php }?>><?php print __('Error', 'mactrack');?></option>
<option value='5'<?php if (get_request_var('status') == '5') {?> selected<?php }?>><?php print __('No Cacti Link', 'mactrack');?></option>
</select>
</td>
<td>
<?php print __('Devices', 'mactrack');?>
</td>
<td>
<select id='rows' onChange='applyFilter()'>
<option value='-1'<?php if (get_request_var('rows') == '-1') {?> selected<?php }?>><?php print __('Default', 'mactrack');?></option>
<?php
if (cacti_sizeof($item_rows)) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'"; if (get_request_var('rows') == $key) { print ' selected'; } print '>' . $value . '</option>';
}
}
?>
</select>
</td>
</tr>
</table>
<input type='hidden' id='page' value='<?php print get_request_var('page');?>'>
<input type='hidden' id='report' value='devices'>
</form>
<script type='text/javascript'>
function applyFilter() {
strURL = urlPath+'plugins/mactrack/mactrack_view_devices.php?report=devices&header=false';
strURL += '&site_id=' + $('#site_id').val();
strURL += '&status=' + $('#status').val();
strURL += '&type_id=' + $('#type_id').val();
strURL += '&device_type_id=' + $('#device_type_id').val();
strURL += '&filter=' + $('#filter').val();
strURL += '&rows=' + $('#rows').val();
loadPageNoHeader(strURL);
}
function clearFilter() {
strURL = urlPath+'plugins/mactrack/mactrack_view_devices.php?report=devices&header=false&clear=true';
loadPageNoHeader(strURL);
}
function exportRows() {
strURL = urlPath+'plugins/mactrack/mactrack_view_devices.php?report=devices&export=true';
document.location = strURL;
}
$(function() {
$('#mactrack').submit(function(event) {
event.preventDefault();
applyFilter();
});
$('#clear').click(function() {
clearFilter();
});
$('#export').click(function() {
exportRows();
});
});
</script>
</td>
</tr>
<?php
}