diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-01-07 09:39:46 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-01-07 09:41:04 -0500 |
commit | e6f5c464143eb1da3bd55d4c9c6c6037af03cce4 (patch) | |
tree | f7e8be1af06611910a3836216b71a82706775d2a /src/usr/local/www/diag_tables.php | |
parent | 06dea9aa32844d18d626854c520bab3996aeb904 (diff) | |
download | pfsense-e6f5c464143eb1da3bd55d4c9c6c6037af03cce4.zip pfsense-e6f5c464143eb1da3bd55d4c9c6c6037af03cce4.tar.gz |
Fixed #5742
Diffstat (limited to 'src/usr/local/www/diag_tables.php')
-rw-r--r-- | src/usr/local/www/diag_tables.php | 61 |
1 files changed, 29 insertions, 32 deletions
diff --git a/src/usr/local/www/diag_tables.php b/src/usr/local/www/diag_tables.php index a543f83..2c24d8c 100644 --- a/src/usr/local/www/diag_tables.php +++ b/src/usr/local/www/diag_tables.php @@ -122,22 +122,42 @@ exec("/sbin/pfctl -sT", $tables); include("head.inc"); if ($savemsg) { - print_info_box($savemsg); + print_info_box($savemsg, 'success'); } -$form = new Form('Show'); +$form = new Form(false); $section = new Form_Section('Table to display'); +$group = new Form_Group("Table"); -$section->addInput(new Form_Select( +$group->add(new Form_Select( 'type', - 'Table', + null, $tablename, array_combine($tables, $tables) )); +if ($bogons || !empty($entries)) { + if ($bogons) { + $group->add(new Form_Button( + 'Download', + 'Update' + ))->removeClass('btn-primary')->addClass('btn-success btn-sm'); + } elseif (!empty($entries)) { + $group->add(new Form_Button( + 'clearall', + 'Clear Table' + ))->removeClass('btn-primary')->addClass('btn-danger btn-sm'); + } +} + +$section->add($group); $form->add($section); print $form; + +if ($bogons || !empty($entries)) { + print_info_box(gettext("Table last updated on ") . exec('/usr/bin/grep -i -m 1 -E "^# last updated" /etc/' . escapeshellarg($tablename) . '|cut -d"(" -f2|tr -d ")" '), 'info'); +} ?> <script type="text/javascript"> @@ -159,6 +179,11 @@ events.push(function() { }, }); }); + + // Auto-submit the form on table selector change + $('#type').on('change', function() { + $('form').submit(); + }); }); //]]> </script> @@ -196,32 +221,4 @@ events.push(function() { <?php -if ($bogons || !empty($entries)) { - $form = new Form; - - $section = new Form_Section('Table Data'); - - if ($bogons) { - $last_updated = exec('/usr/bin/grep -i -m 1 -E "^# last updated" /etc/' . escapeshellarg($tablename) . '|cut -d"(" -f2|tr -d ")" '); - - $section->addInput(new Form_StaticText( - 'Last update', - $last_updated - )); - - $section->addInput(new Form_Button( - 'Download', - 'Download' - ))->setHelp('Download the latest bogon data')->addClass('btn-warning'); - } elseif (!empty($entries)) { - $section->addInput(new Form_Button( - 'clearall', - 'Clear Table' - ))->setHelp('Clear all of the entries in this table')->addClass('btn-danger'); - } - - $form->add($section); - print $form; -} - include("foot.inc"); |