summaryrefslogtreecommitdiffstats
path: root/weblog-viewauditstats-html.lsp
blob: dfee34578b54aee5bf16473fc8beb814b2c3e431 (plain)
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
<% local data, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>

<script type="text/javascript">
	if (typeof jQuery == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"><\/script>');
	}
</script>

<script type="text/javascript">
	if (typeof $.tablesorter == 'undefined') {
		document.write('<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"><\/script>');
	}
</script>

<script type="text/javascript">
	$(document).ready(function() {
		<% if data.value.groupby.value == "clientip" then %>
		$("#audit").tablesorter({headers: {0:{sorter:'ipAddress'}, 1:{sorter:'digit'}, 2:{sorter:'digit'}, 3:{sorter:'digit'}, 4:{sorter:'digit'}, 5:{sorter:'digit'}, 6:{sorter:'digit'}}, widgets: ['zebra']});
		<% else %>
		$("#audit").tablesorter({widgets: ['zebra']});
		<% end %>
	});
</script>

<% htmlviewfunctions.displaycommandresults({"completeaudit"}, session) %>

<h1>Audit Parameters</h1>
<% htmlviewfunctions.displayitem(data.value.auditstart) %>
<% htmlviewfunctions.displayitem(data.value.auditend) %>

<h1><%= html.html_escape(data.label) %></h1>
<table id="audit" class="tablesorter"><thead>
	<tr>
		<th><% if data.value.groupby.value == "clientip" then %>Client IP<% else %>User ID<% end %></th>
		<th>Total Requests</th>
		<th>Flagged Requests</th>
		<th>Total Score</th>
		<th>Blocked</th>
		<th>Overridden</th>
		<th>Maximum Score</th>
	</tr>
</thead><tbody>
<% for i,stat in ipairs(data.value.stats.value) do %>
	<tr><td><%= html.link{value = "viewweblog?"..data.value.groupby.value.."="..stat[data.value.groupby.value], label=stat[data.value.groupby.value]} %></td>
	<td><%= html.html_escape(stat.numrecords) %></td>
	<td><%= html.html_escape(stat.numflagged) %></td>
	<td><%= html.html_escape(stat.numhits) %></td>
	<td><%= html.html_escape(stat.numdenied) %></td>
	<td><%= html.html_escape(stat.numbypassed) %></td>
	<td><%= html.html_escape(stat.maxscore) %></td></tr>
<% end %>
</tbody></table>

<% if data.errtxt then %>
<p class='error'><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value.stats.value == 0 then %>
<p>No flagged records, try adjusting the audit dates</p>
<% end %>

<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/completeaudit") %>">
<div class='item'><p class='left'>Complete Audit</p>
<div class='right'>
<input class="submit" type="submit" name="submit" value="Complete">
</div></div><!-- end .item -->
</form>