Project

General

Profile

Bug #2763 » dynamic_log.diff

John Bayly, 01/18/2013 06:03 AM

View differences:

/usr/local/www/diag_logs_filter_dynamic.php 2013-01-18 11:47:06.000000000 +0000
?>
/* Called by the AJAX updater */
function format_log_line(row) {
var line = '';
line = ' <span class="log-action" nowrap>' + row[0] + '</span>';
line += ' <span class="log-time" nowrap>' + row[1] + '</span>';
line += ' <span class="log-interface" nowrap>' + row[2] + '</span>';
line += ' <span class="log-source" nowrap>' + row[3] + '</span>';
line += ' <span class="log-destination" nowrap>' + row[4] + '</span>';
line += ' <span class="log-protocol" nowrap>' + row[5] + '</span>';
var i = 0;
var line = '<td class="listMRlr" nowrap="nowrap" align="center">' + row[i++] + '</td>';
while (i < 6) {
line += '<td class="listMRr" nowrap="nowrap">' + row[i++] + '</td>';
}
return line;
}
</script>
......
$tab_array[] = array(gettext("Load Balancer"), false, "diag_logs_relayd.php");
$tab_array[] = array(gettext("OpenVPN"), false, "diag_logs_openvpn.php");
$tab_array[] = array(gettext("NTP"), false, "diag_logs_ntpd.php");
$tab_array[] = array(gettext("Wireless"), false, "diag_logs_wireless.php");
$tab_array[] = array(gettext("Settings"), false, "diag_logs_settings.php");
display_top_tabs($tab_array);
?>
......
<tr>
<td>
<div id="mainarea">
<div class="tabcont">
<a href="diag_logs_filter.php"><?=gettext("Normal View");?></a> | <?=gettext("Dynamic View");?> | <a href="diag_logs_filter_summary.php"><?=gettext("Summary View");?></a>
</div>
<div class="listtopic">
<?php printf(gettext("Last %s records"),$nentries);?>; <?=gettext("Pause:");?><input valign="middle" type="checkbox" onClick="javascript:toggle_pause();">
</div>
<div id="log">
<div class="log-header">
<span class="log-action"><?=gettext("Act");?></span>
<span class="log-time"><?=gettext("Time");?></span>
<span class="log-interface"><?=gettext("If");?></span>
<span class="log-source"><?=gettext("Source");?></span>
<span class="log-destination"><?=gettext("Destination");?></span>
<span class="log-protocol"><?=gettext("Proto");?></span>
</div>
<?php $counter=0; foreach ($filterlog as $filterent): ?>
<div class="log-entry"<?php echo is_first_row($counter, count($filterlog)); ?>>
<span class="log-action" nowrap><a href="#" onClick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);">
<img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="absmiddle" alt="<?php echo $filterent['act'];?>" title="<?php echo $filterent['act'];?>" /></a></span>
<span class="log-time" ><?php echo htmlspecialchars($filterent['time']);?></span>
<span class="log-interface" ><?php echo htmlspecialchars($filterent['interface']);?></span>
<span class="log-source" ><?php echo htmlspecialchars($filterent['src']);?></span>
<span class="log-destination" ><?php echo htmlspecialchars($filterent['dst']);?></span>
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
<thead>
<tr>
<td colspan="6" align"left" valign="middle">
<a href="diag_logs_filter.php"><?=gettext("Normal View");?></a> | <?=gettext("Dynamic View");?> | <a href="diag_logs_filter_summary.php"><?=gettext("Summary View");?></a>
<br/><br/>
</td>
</tr>
<tr>
<td colspan="6" class="listtopic">
<?php printf(gettext("Last %s records"),$nentries);?>; <?=gettext("Pause:");?><input valign="middle" type="checkbox" onClick="javascript:toggle_pause();">
</td>
</tr>
<tr>
<td width="10%" class="listhdrr"><?=gettext("Act");?></ td>
<td width="10%" class="listhdrr"><?=gettext("Time");?></ td>
<td width="15%" class="listhdrr"><?=gettext("If");?></ td>
<td width="25%" class="listhdrr"><?=gettext("Source");?></ td>
<td width="25%" class="listhdrr"><?=gettext("Destination");?></ td>
<td width="15%" class="listhdrr"><?=gettext("Proto");?></ td>
</tr>
</thead>
<tbody id="filter-log-entries">
<?php
$rowIndex = 0;
foreach ($filterlog as $filterent):
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
$rowIndex++;?>
<tr class="<?=$evenRowClass?>">
<td class="listMRlr" nowrap="nowrap" align="center">
<a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);">
<img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'];?>" title="<?php echo $filterent['act'];?>" />
</a>
</td>
<td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['time']);?></td>
<td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['interface']);?></td>
<td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['src']);?></td>
<td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['dst']);?></td>
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
?>
<span class="log-protocol" ><?php echo htmlspecialchars($filterent['proto']);?></span>
</div>
<?php $counter++; endforeach; ?>
</div>
<td class="listMRr" nowrap="nowrap"><?php echo htmlspecialchars($filterent['proto']);?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</td>
</tr>
</table>
<p><span class="vexpl"><a href="http://doc.pfsense.org/index.php/What_are_TCP_Flags%3F"><?=gettext("TCP Flags"); ?></a>: F - FIN, S - SYN, A or . - ACK, R - RST, P - PSH, U - URG, E - ECE, C - CWR</span></p>
<?php include("fend.inc"); ?>
</body>
</html>
-- /usr/local/www/javascript/filter_log.js.orig 2013-01-08 10:27:09.000000000 +0000
++ /usr/local/www/javascript/filter_log.js 2013-01-18 11:18:42.000000000 +0000
......
new_data_to_add[new_data_to_add.length] = tmp;
}
update_div_rows(new_data_to_add);
update_table_rows(new_data_to_add);
isBusy = false;
}
......
return false;
}
function update_div_rows(data) {
function update_table_rows(data) {
if(isPaused)
return;
......
}
data = data.slice(startat, data.length);
var rows = jQuery('.log-entry-mini');
if (jQuery(rows).length == 0) {
rows = jQuery('.log-entry');
}
var rows = jQuery('#filter-log-entries>tr');
for(var x=0; x<data.length; x++) {
/* if reverse logging is enabled we need to show the
* records in a reverse order with new items appearing
* on the top
*/
if(isReverse == false) {
for (var i = 1; i < jQuery(rows).length; i++) {
jQuery(rows[i-1]).html(jQuery(rows[i]).html());
// Number of rows to move by
var move = rows.length + data.length - nentries;
if (move < 0)
move = 0;
if (isReverse == false) {
for (var i = move; i < rows.length; i++) {
jQuery(rows[i - move]).html(jQuery(rows[i]).html());
}
var tbody = jQuery('#filter-log-entries');
for (var i = 0; i < data.length; i++) {
var rowIndex = rows.length - move + i;
if (rowIndex < rows.length) {
jQuery(rows[rowIndex]).html(data[i]);
} else {
jQuery(tbody).append('<tr>' + data[i] + '</tr>');
}
} else {
for (var i = jQuery(rows).length - 1; i > 0; i--) {
jQuery(rows[i]).html(jQuery(rows[i-1]).html());
}
} else {
for (var i = rows.length - 1; i >= move; i--) {
jQuery(rows[i]).html(jQuery(rows[i - move]).html());
}
var tbody = jQuery('#filter-log-entries');
for (var i = 0; i < data.length; i++) {
var rowIndex = move - 1 - i;
if (rowIndex >= 0) {
jQuery(rows[rowIndex]).html(data[i]);
} else {
jQuery(tbody).prepend('<tr>' + data[i] + '</tr>');
}
}
jQuery('#firstrow').html(data[x]);
}
// Much easier to go through each of the rows once they've all be added.
rows = jQuery('#filter-log-entries>tr');
for (var i = 0; i < rows.length; i++) {
rows[i].className = i % 2 == 0 ? 'listMRodd' : 'listMReven';
}
}
......
}
}
}
}
}
-- /usr/local/www/widgets/widgets/log.widget.php.orig 2013-01-08 10:27:10.000000000 +0000
++ /usr/local/www/widgets/widgets/log.widget.php 2013-01-18 10:00:44.000000000 +0000
......
/* Called by the AJAX updater */
function format_log_line(row) {
var line = '';
line = ' <span class="log-action-mini" nowrap>&nbsp;' + row[0] + '&nbsp;</span>';
line += ' <span class="log-interface-mini" nowrap>' + row[2] + '</span>';
line += ' <span class="log-source-mini" nowrap>' + row[3] + '</span>';
line += ' <span class="log-destination-mini" nowrap>' + row[4] + '</span>';
line += ' <span class="log-protocol-mini" nowrap>' + row[5] + '</span>';
var line = '<td class="listMRlr" align="center">' + row[0] + '</td>' +
'<td class="listMRr ellipsis" title="' + row[2] + '">' + row[2] + '</td>' +
'<td class="listMRr ellipsis" title="' + row[3] + '">' + row[3] + '</td>' +
'<td class="listMRr ellipsis" title="' + row[4] + '">' + row[4] + '</td>' +
'<td class="listMRr ellipsis" title="' + row[5] + '">' + row[5] + '</td>';
var nentriesacts = "<?php echo $nentriesacts; ?>";
var nentriesinterfaces = "<?php echo $nentriesinterfaces; ?>";
......
</form>
</div>
<div class="log-header">
<span class="log-action-mini-header">Act</span>
<span class="log-interface-mini-header">IF</span>
<span class="log-source-mini-header">Source</span>
<span class="log-destination-mini-header">Destination</span>
<span class="log-protocol-mini-header">Prot</span>
</div>
<?php $counter=0; foreach ($filterlog as $filterent): ?>
<div class="log-entry-mini" <?php echo is_first_row($counter, count($filterlog)); ?> style="clear:both;">
<span class="log-action-mini" nowrap>
&nbsp;<a href="#" onClick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);"><img border="0" src="<?php echo find_action_image($filterent['act']);?>" alt="<?php echo $filterent['act'];?>" title="<?php echo $filterent['act'];?>" /></a>&nbsp;</span>
<span class="log-interface-mini"><?php echo htmlspecialchars($filterent['interface']);?>&nbsp;</span>
<span class="log-source-mini"><?php echo htmlspecialchars($filterent['src']);?>&nbsp;</span>
<span class="log-destination-mini"><?php echo (strlen($filterent['dst']) < 19 ? htmlspecialchars($filterent['dst']) : htmlspecialchars(substr($filterent['dst'],0,18))."..."); ?>&nbsp;</span>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<colgroup>
<col style='width: 6%;' />
<col style='width: 8%;' />
<col style='width: 31%;' />
<col style='width: 31%;' />
<col style='width: 8%;' />
</colgroup>
<thead>
<tr>
<td class="listhdrr"><?=gettext("Act");?></td>
<td class="listhdrr"><?=gettext("IF");?></td>
<td class="listhdrr"><?=gettext("Source");?></td>
<td class="listhdrr"><?=gettext("Destination");?></td>
<td class="listhdrr"><?=gettext("Prot");?></td>
</tr>
</head>
<tbody id='filter-log-entries'>
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
$rowIndex = 0;
foreach ($filterlog as $filterent):
$evenRowClass = $rowIndex % 2 ? " listMReven" : " listMRodd";
$rowIndex++;
?>
<span class="log-protocol-mini"><?php echo htmlspecialchars($filterent['proto']);?>&nbsp;</span>
</div>
<?php $counter++; endforeach; ?>
<tr class="<?=$evenRowClass?>">
<td class="listMRlr" nowrap="nowrap" align="center">
<a href="#" onclick="javascript:getURL('diag_logs_filter.php?getrulenum=<?php echo "{$filterent['rulenum']},{$filterent['act']}"; ?>', outputrule);">
<img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" align="middle" alt="<?php echo $filterent['act'];?>" title="<?php echo $filterent['act'];?>" />
</a>
</td>
<td class="listMRr ellipsis" nowrap="nowrap" title="<?php echo htmlspecialchars($filterent['interface']);?>"><?php echo htmlspecialchars($filterent['interface']);?></td>
<td class="listMRr ellipsis" nowrap="nowrap" title="<?php echo htmlspecialchars($filterent['src']);?>"><?php echo htmlspecialchars($filterent['src']);?></td>
<td class="listMRr ellipsis" nowrap="nowrap" title="<?php echo htmlspecialchars($filterent['dst']);?>"><?php echo htmlspecialchars($filterent['dst']);?></td>
<?php
if ($filterent['proto'] == "TCP")
$filterent['proto'] .= ":{$filterent['tcpflags']}";
?>
<td class="listMRr ellipsis" nowrap="nowrap" title="<?php echo htmlspecialchars($filterent['proto']);?>"><?php echo htmlspecialchars($filterent['proto']);?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<!-- needed to display the widget settings menu -->
<script language="javascript" type="text/javascript">
-- /usr/local/www/css/table.css.orig 2013-01-08 10:27:09.000000000 +0000
++ /usr/local/www/css/table.css 2013-01-18 09:50:58.000000000 +0000
......
border-left: none;
border-bottom: 2px solid #999999;
}
.ellipsis {
overflow: hidden;
text-overflow: ellipsis;
}
(1-1/5)