summaryrefslogtreecommitdiffstats
path: root/weblog-viewblocklog-html.lsp
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2009-05-29 11:47:59 +0200
committerNatanael Copa <natanael.copa@gmail.com>2009-05-29 11:47:59 +0200
commit290d71b1b8bba45be46087a78bdcbdd516199985 (patch)
treee7ab2c3916dc535e4db16dacbf1706ed71ac4977 /weblog-viewblocklog-html.lsp
downloadacf-weblog-290d71b1b8bba45be46087a78bdcbdd516199985.tar.bz2
acf-weblog-290d71b1b8bba45be46087a78bdcbdd516199985.tar.xz
initial commitv0.1.0
based on weblog.tar.gz ncopa got by email.
Diffstat (limited to 'weblog-viewblocklog-html.lsp')
-rw-r--r--weblog-viewblocklog-html.lsp90
1 files changed, 90 insertions, 0 deletions
diff --git a/weblog-viewblocklog-html.lsp b/weblog-viewblocklog-html.lsp
new file mode 100644
index 0000000..1bbeda2
--- /dev/null
+++ b/weblog-viewblocklog-html.lsp
@@ -0,0 +1,90 @@
+<% local data, viewlibrary, page_info, session = ... %>
+
+<% if data.value.focus.value ~= "" then %>
+<script type="text/javascript" src="/js/jquery-latest.js"></script>
+<script type="text/javascript">
+ $(function(){
+ if ($("#focus").length) {
+ var top = $("#focus").offset().top;
+ $("html,body").scrollTop(top);
+ }
+ });
+</script>
+<% end %>
+
+<H1>Search Parameters</H1>
+<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action) %>" method="POST">
+<DL>
+<DT>Start Time</DT>
+<DD><%= html.html_escape(data.value.starttime.value) %>
+<input class="text" type="text" name="starttime" value="<%= html.html_escape(data.value.starttime.value) %>" >
+</DD>
+<DT>User ID</DT>
+<DD><%= html.html_escape(data.value.clientuserid.value) %>
+<input class="text" type="text" name="clientuserid" value="<%= html.html_escape(data.value.clientuserid.value) %>" >
+</DD>
+<DT>Client IP</DT>
+<DD><%= html.html_escape(data.value.clientip.value) %>
+<input class="text" type="text" name="clientip" value="<%= html.html_escape(data.value.clientip.value) %>" >
+</DD>
+<DT>End Time</DT>
+<DD><%= html.html_escape(data.value.endtime.value) %>
+<input class="text" type="text" name="endtime" value="<%= html.html_escape(data.value.endtime.value) %>" >
+</DD>
+<DT></DT><DD><input class="submit" type="submit" name="Update" value="Update"></DD>
+</DL>
+</FORM>
+
+<H1><%= html.html_escape(data.label) %></H1>
+<TABLE>
+ <TR style="background:#eee;font-weight:bold;">
+ <TD style="padding-right:20px;white-space:nowrap;" class="header" colspan=2>Timestamp</TD>
+ <TD style="padding-right:20px;white-space:nowrap;" class="header">Client IP</TD>
+ <TD style="padding-right:20px;white-space:nowrap;" class="header">User ID</TD>
+ <TD style="white-space:nowrap;" WIDTH="90%" class="header">Size</TD>
+ </TR>
+
+<% for i,watch in ipairs(data.value.log.value) do %>
+ <% local time = {}
+ time.year, time.month, time.day, time.hour, time.min, time.sec =
+ string.match(watch.logdatetime, "(%d+)%-(%d+)-(%d+)%s+(%d+):(%d+):(%d+)")
+ time = os.time(time) %>
+ <% if data.value.focus and data.value.focus.value == watch.logdatetime then %>
+ <TR style="background:#ff0" id="focus">
+ <% else %>
+ <TR style="background:#eee">
+ <% end %>
+ <TD colspan=2><%= html.link{value = "viewweblog?clientuserid="..watch.clientuserid..
+ "&starttime="..os.date("%Y-%m-%d %H:%M:%S", time - 60*(tonumber(data.value.window.value)))..
+ "&endtime="..os.date("%Y-%m-%d %H:%M:%S", time + 60*(tonumber(data.value.window.value)))..
+ "&focus="..watch.logdatetime,
+ label=watch.logdatetime} %></TD>
+ <TD><%= html.html_escape(watch.clientip) %></TD>
+ <TD><%= html.html_escape(watch.clientuserid) %></TD>
+ <TD><%= html.html_escape(watch.bytes) %></TD>
+ </TR>
+ <TR><TD></TD><TD colspan=4><%= html.link{value = watch.uri, label=watch.uri} %></TD></TR>
+ <% if watch.reason and watch.reason ~= "" then %>
+ <TR><TD></TD><TD style="background:#f33" colspan=4><%= html.html_escape(watch.reason) %></TD></TR>
+ <% end %>
+<% end %>
+</TABLE>
+
+<% if data.errtxt then %>
+<p class="error"><%= html.html_escape(data.errtxt) %></p>
+<% end %>
+<% if #data.value.log.value == 0 then %>
+<p>No results, try adjusting search parameters</p>
+<% end %>
+
+<% if page_info.action == "viewweblog" then %>
+<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/downloadweblog") %>" method="POST">
+<input type="hidden" name="starttime" value="<%= html.html_escape(data.value.starttime.value) %>" >
+<input type="hidden" name="clientuserid" value="<%= html.html_escape(data.value.clientuserid.value) %>" >
+<input type="hidden" name="clientip" value="<%= html.html_escape(data.value.clientip.value) %>" >
+<input type="hidden" name="endtime" value="<%= html.html_escape(data.value.endtime.value) %>" >
+<DL>
+<DT>Download log</DT><DD><input class="submit" type="submit" name="Download" value="Download"></DD>
+</DL>
+</FORM>
+<% end %>