weblog-viewusagestats-html.lsp 1.57 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 17 18 19 20 21 22
<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">
	$(function(){
		$("#usage").tablesorter({headers: {0:{sorter: false}, 1:{sorter: 'text'}, 2:{sorter: 'digit'}, 3:{sorter: 'digit'}}, widgets: ['zebra']});
	});
</script>

23
<% local subdata, pagedata = htmlviewfunctions.paginate(data.value, page_info.clientdata, 100) %>
Ted Trask's avatar
Ted Trask committed
24 25 26

<H1><%= html.html_escape(data.label) %></H1>
<DL>
27
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
28 29 30 31 32 33 34
<TABLE id="usage" class="tablesorter">
<THEAD>
	<TR>
		<TH>Date</TH>
		<TH>Source</TH>
		<TH>Requests</TH>
		<TH>Blocks</TH>
Ted Trask's avatar
Ted Trask committed
35
	</TR>
36 37
</THEAD>
<TBODY>
Ted Trask's avatar
Ted Trask committed
38 39 40 41 42 43 44 45
<% for i,stat in ipairs(subdata) do %>
	<TR>
		<TD><%= html.html_escape(stat.date) %></TD>
		<TD><%= html.html_escape(stat.sourcename) %></TD>
		<TD><%= html.html_escape(stat.numrequest) %></TD>
		<TD><%= html.html_escape(stat.numblock) %></TD>
	</TR>
<% end %>
46
</TBODY>
Ted Trask's avatar
Ted Trask committed
47 48 49 50 51 52 53 54 55
</TABLE>

<% if data.errtxt then %>
<p class='error'><%= html.html_escape(data.errtxt) %></p>
<% end %>
<% if #data.value == 0 then %>
<p>No usage stats found</p>
<% end %>
</DL>