Tidy up "log" widget XHTML

Add CDATA section to scripts
Close INPUT tag
Deprecate HTML boolean operators SELECTED and CHECKED
Removed duplicate class
Added summary to table
Moved norwap to class definition
This commit is contained in:
Colin Fleming 2013-03-05 18:25:37 +00:00
parent bcab1b076d
commit 59261d32ac

View File

@ -58,7 +58,9 @@ if($_POST['filterlogentries']) {
$filename = $_SERVER['HTTP_REFERER'];
if(headers_sent($file, $line)){
echo '<script type="text/javascript">';
echo '//<![CDATA[';
echo 'window.location.href="'.$filename.'";';
echo '//]]>';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url='.$filename.'" />';
@ -86,7 +88,8 @@ handle_ajax($nentries, $nentries + 20);
?>
<script language="javascript">
<script type="text/javascript">
//<![CDATA[
lastsawtime = '<?php echo time(); ?>';
var lines = Array();
var timer;
@ -104,11 +107,11 @@ else
/* Called by the AJAX updater */
function format_log_line(row) {
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 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; ?>";
@ -121,16 +124,17 @@ function format_log_line(row) {
return line;
}
//]]>
</script>
<script src="/javascript/filter_log.js" type="text/javascript"></script>
<input type="hidden" id="log-config" name="log-config" value="">
<input type="hidden" id="log-config" name="log-config" value="" />
<div id="log-settings" name="log-settings" class="widgetconfigdiv" style="display:none;">
<div id="log-settings" class="widgetconfigdiv" style="display:none;">
<form action="/widgets/widgets/log.widget.php" method="post" name="iforma">
Number of lines to display:
<select name="filterlogentries" class="formfld unknown" id="filterlogentries">
<?php for ($i = 0; $i <= 20; $i++) { ?>
<option value="<?php if ($i > 0) echo $i; else echo ' ';?>" <?php if ($nentries == $i) echo "SELECTED";?>><?php if ($i > 0) echo ' ' . $i; else echo ' ';?></option>
<option value="<?php if ($i > 0) echo $i; else echo ' ';?>" <?php if ($nentries == $i) echo "selected=\"selected\"";?>><?php if ($i > 0) echo ' ' . $i; else echo ' ';?></option>
<?php } ?>
</select>
@ -138,19 +142,19 @@ function format_log_line(row) {
$Include_Act = explode(",", str_replace(" ", ",", $nentriesacts));
if ($nentriesinterfaces == "All") $nentriesinterfaces = "";
?>
<input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked"; ?> /> Pass
<input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked"; ?> /> Block
<input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked"; ?> /> Reject
<input id="actpass" name="actpass" type="checkbox" value="Pass" <?php if (in_arrayi('Pass', $Include_Act)) echo "checked=\"checked\""; ?> /> Pass
<input id="actblock" name="actblock" type="checkbox" value="Block" <?php if (in_arrayi('Block', $Include_Act)) echo "checked=\"checked\""; ?> /> Block
<input id="actreject" name="actreject" type="checkbox" value="Reject" <?php if (in_arrayi('Reject', $Include_Act)) echo "checked=\"checked\""; ?> /> Reject
<br/>
Interfaces:
<input id="filterlogentriesinterfaces" name="filterlogentriesinterfaces" class="formfld unknown" type="text" size="20" class="formfld unknown" value="<?= $nentriesinterfaces ?>" />
&nbsp &nbsp &nbsp
<input id="filterlogentriesinterfaces" name="filterlogentriesinterfaces" class="formfld unknown" type="text" size="20" value="<?= $nentriesinterfaces ?>" />
&nbsp; &nbsp; &nbsp;
<input id="submita" name="submita" type="submit" class="formbtn" value="Save" />
</form>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="table-layout: fixed;" summary="logs">
<colgroup>
<col style='width: 8%;' />
<col style='width: 10%;' />
@ -180,22 +184,24 @@ function format_log_line(row) {
<img border="0" src="<?php echo find_action_image($filterent['act']);?>" width="11" height="11" 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>
<td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['interface']);?>"><?php echo htmlspecialchars($filterent['interface']);?></td>
<td class="listMRr ellipsis nowrap" title="<?php echo htmlspecialchars($filterent['src']);?>"><?php echo htmlspecialchars($filterent['src']);?></td>
<td class="listMRr ellipsis 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>
<td class="listMRr ellipsis 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">
<script type="text/javascript">
//<![CDATA[
selectIntLink = "log-configure";
textlink = document.getElementById(selectIntLink);
textlink.style.display = "inline";
//]]>
</script>