summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-01-23 21:46:16 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-01-23 21:46:16 -0500
commitdb35a716bc4330caa95ad7bbdb99d87eeffbee0b (patch)
treee76d2c4539804f22365bc02cb238168a65d866ca /src/usr
parent697281c8f95df388f402e6cdd6f20c0166ec1cb7 (diff)
parent5330a2380839f1dd53d5ba7e553b6e2d2e42f584 (diff)
downloadpfsense-db35a716bc4330caa95ad7bbdb99d87eeffbee0b.zip
pfsense-db35a716bc4330caa95ad7bbdb99d87eeffbee0b.tar.gz
Merge pull request #2520 from NOYB/Status_/_System_Logs_-_Filter_Refinements
Diffstat (limited to 'src/usr')
-rwxr-xr-xsrc/usr/local/www/status_logs.php36
-rw-r--r--src/usr/local/www/status_logs_common.inc48
-rw-r--r--src/usr/local/www/status_logs_filter.php36
-rwxr-xr-xsrc/usr/local/www/status_logs_filter_dynamic.php23
-rw-r--r--src/usr/local/www/status_logs_vpn.php30
5 files changed, 118 insertions, 55 deletions
diff --git a/src/usr/local/www/status_logs.php b/src/usr/local/www/status_logs.php
index 5fb1da1..8894b44 100755
--- a/src/usr/local/www/status_logs.php
+++ b/src/usr/local/www/status_logs.php
@@ -149,24 +149,14 @@ filter_form_system();
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
- if ($filterlogentries_submit) {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
- } else {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext);
- }
+ system_log_filter();
?>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ((!$filtertext) && (!$filterfieldsarray)) {
- printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- } else {
- printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- }
-
- printf(" (" . gettext("Maximum %d") . ")", $nentries);
+ print(system_log_table_panel_title());
?>
</h2>
</div>
@@ -216,7 +206,13 @@ if (!$rawfilter) {
} else {
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
+ <div class="panel-heading">
+ <h2 class="panel-title">
+<?php
+ print(system_log_table_panel_title());
+?>
+ </h2>
+ </div>
<div class="table table-responsive">
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
<thead>
@@ -233,11 +229,7 @@ if (!$rawfilter) {
$inverse = null;
}
- if ($filtertext) {
- $rows = dump_clog($logfile_path, $nentries, true, array("$filtertext"), $inverse);
- } else {
- $rows = dump_clog($logfile_path, $nentries, true, array(), $inverse);
- }
+ system_log_filter();
?>
</tbody>
</table>
@@ -259,4 +251,12 @@ if (!$system_logs_manage_log_form_hidden) {
}
?>
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+ $("#count").html(<?=$rows?>);
+});
+//]]>
+</script>
+
<?php include("foot.inc"); ?>
diff --git a/src/usr/local/www/status_logs_common.inc b/src/usr/local/www/status_logs_common.inc
index efeeaf5..0636064 100644
--- a/src/usr/local/www/status_logs_common.inc
+++ b/src/usr/local/www/status_logs_common.inc
@@ -153,6 +153,54 @@ function tab_array_logs_common() {
}
+// Log Table header
+function system_log_table_panel_title() {
+ global $rawfilter, $filtersubmit, $filterlogentries_submit, $filterlog, $nentries;
+ global $allowed_logs, $logfile;
+
+ $rtnstr = '';
+
+ if ($rawfilter) {
+ if (($filtersubmit) || ($filterlogentries_submit)) {
+ $rtnstr .= sprintf(gettext("%s matched %s log entries."), "<span id='count'>_ _</span>", gettext($allowed_logs[$logfile]["name"]));
+ } else {
+ $rtnstr .= sprintf(gettext("Last %s %s log entries."), "<span id='count'>_ _</span>", gettext($allowed_logs[$logfile]["name"]));
+ }
+ } else {
+ if (($filtersubmit) || ($filterlogentries_submit)) {
+ $rtnstr .= sprintf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+ } else {
+ $rtnstr .= sprintf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
+ }
+ }
+
+ $rtnstr .= sprintf(" (" . gettext("Maximum %d") . ")", $nentries);
+
+ return $rtnstr;
+}
+
+
+// Log Filter
+function system_log_filter() {
+ global $rawfilter, $filtersubmit, $filterlogentries_submit, $filterlog, $nentries;
+ global $logfile_path, $filtertext, $filterfieldsarray, $interfacefilter, $inverse, $rows;
+
+ if ($rawfilter) {
+ if (($filtersubmit) || ($filterlogentries_submit)) {
+ $rows = dump_clog($logfile_path, $nentries, true, array("$filtertext"), $inverse);
+ } else {
+ $rows = dump_clog($logfile_path, $nentries, true, array(), $inverse);
+ }
+ } else {
+ if (($filtersubmit) || ($filterlogentries_submit)) {
+ $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
+ } else {
+ $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext, $interfacefilter);
+ }
+ }
+}
+
+
// Log Filter Submit - System
function log_filter_form_system_submit() {
diff --git a/src/usr/local/www/status_logs_filter.php b/src/usr/local/www/status_logs_filter.php
index 2a2f008..f655a18 100644
--- a/src/usr/local/www/status_logs_filter.php
+++ b/src/usr/local/www/status_logs_filter.php
@@ -163,24 +163,14 @@ if (!$rawfilter) {
$interfacefilter = $iflist[$interfacefilter];
}
- if ($filterlogentries_submit) {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
- } else {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext, $interfacefilter);
- }
+ system_log_filter();
?>
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ((!$filtertext) && (!$filterfieldsarray)) {
- printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- } else {
- printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- }
-
- printf(" (" . gettext("Maximum %d") . ")", $nentries);
+ print(system_log_table_panel_title());
?>
</h2>
</div>
@@ -325,7 +315,13 @@ if (!$rawfilter) {
} else {
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
+ <div class="panel-heading">
+ <h2 class="panel-title">
+<?php
+ print(system_log_table_panel_title());
+?>
+ </h2>
+ </div>
<div class="table table-responsive">
<table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable>
<thead>
@@ -336,11 +332,7 @@ if (!$rawfilter) {
</thead>
<tbody>
<?php
- if ($filtertext) {
- $rows = dump_clog($logfile_path, $nentries, true, array("$filtertext"));
- } else {
- $rows = dump_clog($logfile_path, $nentries, true, array());
- }
+ system_log_filter();
?>
</tbody>
</table>
@@ -449,5 +441,13 @@ events.push(function() {
//]]>
</script>
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+ $("#count").html(<?=$rows?>);
+});
+//]]>
+</script>
+
<?php include("foot.inc");
?>
diff --git a/src/usr/local/www/status_logs_filter_dynamic.php b/src/usr/local/www/status_logs_filter_dynamic.php
index 92e95dc..7c6085b 100755
--- a/src/usr/local/www/status_logs_filter_dynamic.php
+++ b/src/usr/local/www/status_logs_filter_dynamic.php
@@ -132,15 +132,12 @@ if ($system_logs_manage_log_form_hidden) {
// Log Filter Submit - Firewall
+$rawfilter = false;
filter_form_firewall();
// Now the forms are complete we can draw the log table and its controls
-if ($filterlogentries_submit) {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
-} else {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext, $interfacefilter);
-}
+system_log_filter();
?>
<script type="text/javascript">
@@ -369,6 +366,8 @@ function update_table_rows(data) {
rows[i].className = i % 2 == 0 ? 'listMRodd' : 'listMReven';
}
+ $("#count").html(rows.length);
+
$('.fa').tooltip();
}
@@ -404,7 +403,11 @@ function toggleListDescriptions() {
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title">
- <?=gettext('Last ') . $nentries . gettext(' records. ') . gettext('Pause ')?><input type="checkbox" onclick="javascript:toggle_pause();" />
+<?php
+ $rawfilter = true;
+ print(system_log_table_panel_title());
+?>
+<?=" " . gettext('Pause') . " "?><input type="checkbox" onclick="javascript:toggle_pause();" />
</h2>
</div>
<div class="panel-body">
@@ -510,4 +513,12 @@ events.push(function() {
//]]>
</script>
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+ $("#count").html(<?=count($filterlog);?>);
+});
+//]]>
+</script>
+
<?php include("foot.inc");
diff --git a/src/usr/local/www/status_logs_vpn.php b/src/usr/local/www/status_logs_vpn.php
index 111e00a..df430d1 100644
--- a/src/usr/local/www/status_logs_vpn.php
+++ b/src/usr/local/www/status_logs_vpn.php
@@ -139,11 +139,7 @@ filter_form_vpn();
// Now the forms are complete we can draw the log table and its controls
if (!$rawfilter) {
- if ($filterlogentries_submit) {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filterfieldsarray);
- } else {
- $filterlog = conv_log_filter($logfile_path, $nentries, $nentries + 100, $filtertext);
- }
+ system_log_filter();
// Remove those not of the selected vpn type (poes / l2tp).
if ($logfile == "vpn") {
@@ -159,13 +155,7 @@ if (!$rawfilter) {
<div class="panel-heading">
<h2 class="panel-title">
<?php
- if ((!$filtertext) && (!$filterfieldsarray)) {
- printf(gettext("Last %d %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- } else {
- printf(gettext("%d matched %s log entries."), count($filterlog), gettext($allowed_logs[$logfile]["name"]));
- }
-
- printf(" (" . gettext("Maximum %d") . ")", $nentries);
+ print(system_log_table_panel_title());
?>
</h2>
</div>
@@ -260,7 +250,13 @@ if (!$rawfilter) {
} else {
?>
<div class="panel panel-default">
- <div class="panel-heading"><h2 class="panel-title"><?=gettext("Last ")?><?=$nentries?> <?=gettext($allowed_logs[$logfile]["name"])?><?=gettext(" log entries")?></h2></div>
+ <div class="panel-heading">
+ <h2 class="panel-title">
+<?php
+ print(system_log_table_panel_title());
+?>
+ </h2>
+ </div>
<div class="panel-body">
<pre><?php
$rows = dump_clog_no_table($logfile_path, $nentries, true, array($filtertext));
@@ -520,4 +516,12 @@ function filter_form_vpn() {
}
?>
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+ $("#count").html(<?=$rows?>);
+});
+//]]>
+</script>
+
<?php include("foot.inc"); ?>
OpenPOWER on IntegriCloud