diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-09-03 13:51:14 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-09-03 13:51:14 +0000 |
commit | eb36e4c9737dee9dd3aaef56abcfcf6c407bd100 (patch) | |
tree | f823409966cb2c8152747236a312cbfe80c7e608 /logfiles-tail-html.lsp | |
parent | 3f22a6dd4d2336bf0c3409c400faa9f5488f0e32 (diff) | |
download | acf-alpine-baselayout-eb36e4c9737dee9dd3aaef56abcfcf6c407bd100.tar.bz2 acf-alpine-baselayout-eb36e4c9737dee9dd3aaef56abcfcf6c407bd100.tar.xz |
Added javascript tail functionality to logfiles.
git-svn-id: svn://svn.alpinelinux.org/acf/alpine-baselayout/trunk@1441 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'logfiles-tail-html.lsp')
-rw-r--r-- | logfiles-tail-html.lsp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/logfiles-tail-html.lsp b/logfiles-tail-html.lsp new file mode 100644 index 0000000..5b5d767 --- /dev/null +++ b/logfiles-tail-html.lsp @@ -0,0 +1,46 @@ +<% local form, viewlibrary, page_info = ... %> +<% require("viewfunctions") %> + +<script type="text/javascript" src="/js/jquery-latest.js"></script> +<script type="text/javascript"> + var currentoffset = -1024 + var ID + function Update(){ + $.getJSON( + '<%= page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action %>', + {name:'<%= form.value.filename.value %>', offset:currentoffset}, + function(data) { + data.value.filecontent.value = data.value.filecontent.value.split("\n").join("<br>\n"); + $("#filecontent").append(data.value.filecontent.value).scrollTop(999999999); + currentoffset = data.value.filesize.value; + $("DT:contains('File size')").next().text(currentoffset); + } + ); + ID=window.setTimeout("Update();", 1000); + } + $(function(){ + $("#Start").attr("disabled","disabled"); + <% if not form.value.filename.errtxt then %> + Update(); + <% else %> + $("#Stop").attr("disabled","disabled"); + <% end %> + }); +</script> + +<H1>Tail File</H1> +<DL> +<% +displayitem(form.value.filename) +displayitem(form.value.filesize) +%> +</DL> +<textarea id="filecontent"> +</textarea> +<DL> +<DT>Start / Stop tailing file</DT> +<DD> +<input TYPE="button" ID="Start" VALUE="Start" onClick='Update(); $("#Start").attr("disabled","disabled");$("#Stop").removeAttr("disabled");'> +<input TYPE="button" ID="Stop" VALUE="Stop" onClick='window.clearTimeout(ID); $("#Stop").attr("disabled","disabled");$("#Start").removeAttr("disabled");'> +</DD> +</DL> |