weblog-viewauditstats-html.lsp 2.64 KB
Newer Older
Ted Trask's avatar
Ted Trask committed
1
<% local data, viewlibrary, page_info, session = ... %>
2
<% htmlviewfunctions = require("htmlviewfunctions") %>
3
<% html = require("acf.html") %>
Ted Trask's avatar
Ted Trask committed
4

5 6 7 8 9 10 11 12 13 14 15 16
<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>

Ted Trask's avatar
Ted Trask committed
17 18
<script type="text/javascript">
	$(document).ready(function() {
Ted Trask's avatar
Ted Trask committed
19
		<% if data.value.groupby.value == "clientip" then %>
20
		$("#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']});
Ted Trask's avatar
Ted Trask committed
21
		<% else %>
22
		$("#audit").tablesorter({widgets: ['zebra']});
Ted Trask's avatar
Ted Trask committed
23
		<% end %>
Ted Trask's avatar
Ted Trask committed
24 25 26
	});
</script>

27
<% htmlviewfunctions.displaycommandresults({"completeaudit"}, session) %>
Ted Trask's avatar
Ted Trask committed
28

29
<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Audit Parameters"}), page_info) %>
30 31
<% htmlviewfunctions.displayitem(data.value.auditstart) %>
<% htmlviewfunctions.displayitem(data.value.auditend) %>
32
<% htmlviewfunctions.displaysectionend(header_level) %>
Ted Trask's avatar
Ted Trask committed
33

34
<% htmlviewfunctions.displaysectionstart(data, page_info, header_level) %>
35 36 37 38 39 40 41 42 43 44 45
<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>
Ted Trask's avatar
Ted Trask committed
46
<% for i,stat in ipairs(data.value.stats.value) do %>
47 48 49 50 51 52 53
	<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>
Ted Trask's avatar
Ted Trask committed
54
<% end %>
55
</tbody></table>
Ted Trask's avatar
Ted Trask committed
56 57 58 59 60

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

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