summaryrefslogtreecommitdiffstats
path: root/weblog-viewauditstats-html.lsp
blob: 6caf9af91ca8ab6826ed1fd027fe0f11c94e7bfc (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
<% 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) %>

<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Audit Parameters"}), page_info) %>
<% htmlviewfunctions.displayitem(data.value.auditstart) %>
<% htmlviewfunctions.displayitem(data.value.auditend) %>
<% htmlviewfunctions.displaysectionend(header_level) %>

<% htmlviewfunctions.displaysectionstart(data, page_info, header_level) %>
<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 %>

<% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Complete Audit", option="Complete", action="completeaudit"}), page_info, 0) %>
<% htmlviewfunctions.displaysectionend(header_level) %>