From fb7ce759c1045daf20e416547e6111f796030b60 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Thu, 17 Apr 2014 00:55:44 +0000 Subject: Started changes to use new htmlviewfunctions functions Still work to do to remove styling and long messy links --- weblog-adhocquery-html.lsp | 38 +++++++++++++++++++------------------- weblog-listfiles-html.lsp | 21 ++++++++++++++++----- weblog-listsources-html.lsp | 35 +++++++++++++---------------------- weblog-status-html.lsp | 40 ++++++++++++++++++++-------------------- weblog-viewactivitylog-html.lsp | 8 ++++---- weblog-viewauditstats-html.lsp | 13 +++++-------- weblog-viewusagestats-html.lsp | 3 ++- weblog-viewweblog-html.lsp | 12 ++++++++---- 8 files changed, 87 insertions(+), 83 deletions(-) diff --git a/weblog-adhocquery-html.lsp b/weblog-adhocquery-html.lsp index 7c3d804..0e381da 100644 --- a/weblog-adhocquery-html.lsp +++ b/weblog-adhocquery-html.lsp @@ -39,7 +39,7 @@ end <% if form.value.result then %> -

<%= html.html_escape(form.value.result.label) %>

+ <% local header_level = htmlviewfunctions.displaysectionstart(form.value.result, page_info) %> <% if #form.value.result.value == 0 then %>

No results, try adjusting query

<% else %> @@ -63,32 +63,26 @@ end <% if viewlibrary.check_permission("downloadadhocquery") then %> -
- - -

Download query result

-
- -
-
+ <% local query = cfe({ type="hidden", value=form.value.query.value }) %> + <% local viewtype = cfe({ type="hidden", value="stream" }) %> + <% htmlviewfunctions.displayitem(cfe({type="form", value={query=query, viewtype=viewtype}, label="Download query result", option="Download", action="downloadadhocquery" }), page_info, 0) %> <% end %> <% end %> + <% htmlviewfunctions.displaysectionend(header_level) %> <% end %> -

<%= html.html_escape(form.label) %>

-<% htmlviewfunctions.displayformstart(form, page_info) %> +<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %>

This form accepts a Postgresql SELECT statement and displays the results. Examples:

The available database tables and descriptions are listed below.

-<% htmlviewfunctions.displayformitem(form.value.query, "query") %> -<% htmlviewfunctions.displayformend(form) %> +<% htmlviewfunctions.displayform(form, page_info, htmlviewfunctions.incrementheader(header_level)) %> -

Available Database Tables

-

pubweblog and pubweblog_history

+<% local header_level2 = htmlviewfunctions.displaysectionstart(cfe({label="Available Database Tables"}), page_info, htmlviewfunctions.incrementheader(header_level)) %> +<% local header_level3 = htmlviewfunctions.displaysectionstart(cfe({label="pubweblog and pubweblog_history"}), page_info, htmlviewfunctions.incrementheader(header_level2)) %>

These tables contain the pre-purge and historical access logs respectively. The definition of the table is as follows:

 (
@@ -110,8 +104,9 @@ The available database tables and descriptions are listed below.

id int, )
+<% htmlviewfunctions.displaysectionend(header_level3) %> -

dbhistlog

+<% htmlviewfunctions.displaysectionstart(cfe({label="dbhistlog"}), page_info, header_level3) %>

This table contains the database history, including such information as which log files were loaded and how many entries they contained. The definition of the table is as follows:

 (
@@ -119,8 +114,9 @@ The available database tables and descriptions are listed below.

msgtext text )
+<% htmlviewfunctions.displaysectionend(header_level3) %> -

source

+<% htmlviewfunctions.displaysectionstart(cfe({label="source"}), page_info, header_level3) %>

This table contains the list of log file sources. The definition of the table is as follows:

 (
@@ -133,8 +129,9 @@ The available database tables and descriptions are listed below.

enabled boolean )
+<% htmlviewfunctions.displaysectionend(header_level3) %> -

usagestat

+<% htmlviewfunctions.displaysectionstart(cfe({label="usagestat"}), page_info, header_level3) %>

This table contains a historical record of pages requested and blocked by hour. The definition of the table is as follows:

 (
@@ -144,3 +141,6 @@ The available database tables and descriptions are listed below.

numblock integer )
+<% htmlviewfunctions.displaysectionend(header_level3) %> +<% htmlviewfunctions.displaysectionend(header_level2) %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-listfiles-html.lsp b/weblog-listfiles-html.lsp index ea2ab2c..a5f28b8 100644 --- a/weblog-listfiles-html.lsp +++ b/weblog-listfiles-html.lsp @@ -31,21 +31,32 @@ end <% htmlviewfunctions.displaycommandresults({"editfile"}, session) %> -

File List

+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %> + - <% for k,v in ipairs( view.value ) do - io.write( "\n" ) - end %> + +<% local filename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> +<% for i,file in ipairs( view.value ) do %> + <% filename.value = file.filename %> + + + + + + +<% end %>
Action File Size Last Modified
" .. html.html_escape(v.filename) .. ''..convertsize(v.size).."b" .. html.html_escape(v.size) .."" .. html.html_escape(v.mtime) .."
<% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editfile"}), page_info, -1) %><%= html.html_escape(file.filename) %><%= convertsize(file.size) %>b<%= html.html_escape(file.size) %><%= html.html_escape(file.mtime) %>
+<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-listsources-html.lsp b/weblog-listsources-html.lsp index 11682a3..090962b 100644 --- a/weblog-listsources-html.lsp +++ b/weblog-listsources-html.lsp @@ -23,7 +23,7 @@ html = require("acf.html") <% htmlviewfunctions.displaycommandresults({"deletesource", "editsource", "testsource", "createsource", "importlogs"}, session) %> -

<%= html.html_escape(data.label) %>

+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> @@ -33,13 +33,17 @@ html = require("acf.html") - +<% local sourcename = cfe({ type="hidden", value="" }) %> +<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %> <% for i,source in ipairs(data.value) do %> @@ -50,25 +54,12 @@ html = require("acf.html")
ActionMethod
- <%= html.link{value = "editsource?sourcename=" .. source.sourcename.."&redir="..page_info.orig_action, label="Edit "} %> - <%= html.link{value = "deletesource?submit=true&sourcename=" .. source.sourcename, label="Delete "} %> - <%= html.link{value = "testsource?submit=true&sourcename=" .. source.sourcename, label="Test "} %> + <% + sourcename.value = source.sourcename + htmlviewfunctions.displayitem(cfe({type="link", value={sourcename=sourcename, redir=redir}, label="", option="Edit", action="editsource"}), page_info, -1) + htmlviewfunctions.displayitem(cfe({type="form", value={sourcename=sourcename}, label="", option="Delete", action="deletesource" }), page_info, -1) + htmlviewfunctions.displayitem(cfe({type="form", value={sourcename=sourcename}, label="", option="Test", action="testsource" }), page_info, -1) + %> <%= html.html_escape(source.sourcename) %> <%= html.html_escape(tostring(source.enabled)) %>
-<% if data.errtxt then %> -

<%= html.html_escape(data.errtxt) %>

-<% end %> <% if #data.value == 0 then %>

No sources found

<% end %> +<% htmlviewfunctions.displayinfo(data) %> +<% htmlviewfunctions.displayitem(cfe({type="link", value={redir=redir}, label="Create New Source", option="Create", action="createsource"}), page_info, 0) %> +<% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Import Logs", option="Import", action="importlogs" }), page_info, 0) %> -
"> -

Create New Source

-
- - -
-
- -
"> -

Import Logs

-
- -
-
+<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-status-html.lsp b/weblog-status-html.lsp index 2eb2fb5..56f0ff9 100644 --- a/weblog-status-html.lsp +++ b/weblog-status-html.lsp @@ -4,7 +4,7 @@ htmlviewfunctions = require("htmlviewfunctions") <% htmlviewfunctions.displaycommandresults({"createdatabase"}, session, true) %> -

Weblog Database Status

+<% local header_level = htmlviewfunctions.displaysectionstart(cfe({label="Weblog Database Status"}), page_info) %> <% local status if viewlibrary and viewlibrary.dispatch_component then if viewlibrary.check_permission("postgresql/postgresql/status") then @@ -12,27 +12,27 @@ if viewlibrary and viewlibrary.dispatch_component then end end %> -

Database status

-

-<% if status then %> -<% if status.value.status.errtxt then - print(status.value.status.errtxt) +<% +local statuscfe = cfe({ label="Database status" }) +if status then + statuscfe.value = status.value.status.errtxt or status.value.status.value else - print(status.value.status.value) -end %> -<% else %> -Unknown -<% end %> -

+ statuscfe.value = "Unknown" +end +htmlviewfunctions.displayitem(statuscfe) +%> + +<% +local databasecfe = cfe({ label="Weblog Database" }) +if data.value then + databasecfe.value = "Present" +else + databasecfe.value = "Missing" +end +htmlviewfunctions.displayitem(databasecfe) +%> -

Weblog Database

-

-<% if data.value then %> -Present -<% else %> -Missing -<% end %> -

+<% htmlviewfunctions.displaysectionend(header_level) %> <% if not data.value and viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("createdatabase") diff --git a/weblog-viewactivitylog-html.lsp b/weblog-viewactivitylog-html.lsp index f7fb0ba..f1a9171 100644 --- a/weblog-viewactivitylog-html.lsp +++ b/weblog-viewactivitylog-html.lsp @@ -22,7 +22,7 @@ <% local subdata, pagedata = htmlviewfunctions.paginate(data.value, page_info.clientdata, 100) %> -

<%= html.html_escape(data.label) %>

+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> <% htmlviewfunctions.displaypagination(pagedata, page_info) %> @@ -38,9 +38,9 @@ <% end %>
-<% if data.errtxt then %> -

<%= html.html_escape(data.errtxt) %>

-<% end %> <% if #data.value == 0 then %>

No history found

<% end %> +<% htmlviewfunctions.displayinfo(data) %> + +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-viewauditstats-html.lsp b/weblog-viewauditstats-html.lsp index dfee345..6caf9af 100644 --- a/weblog-viewauditstats-html.lsp +++ b/weblog-viewauditstats-html.lsp @@ -26,11 +26,12 @@ <% htmlviewfunctions.displaycommandresults({"completeaudit"}, session) %> -

Audit Parameters

+<% 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) %> -

<%= html.html_escape(data.label) %>

+<% htmlviewfunctions.displaysectionstart(data, page_info, header_level) %> @@ -60,9 +61,5 @@

No flagged records, try adjusting the audit dates

<% end %> -"> -

Complete Audit

-
- -
- +<% htmlviewfunctions.displayitem(cfe({type="form", value={}, label="Complete Audit", option="Complete", action="completeaudit"}), page_info, 0) %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-viewusagestats-html.lsp b/weblog-viewusagestats-html.lsp index 7bea2f9..93a09b1 100644 --- a/weblog-viewusagestats-html.lsp +++ b/weblog-viewusagestats-html.lsp @@ -22,7 +22,7 @@ <% local subdata, pagedata = htmlviewfunctions.paginate(data.value, page_info.clientdata, 100) %> -

<%= html.html_escape(data.label) %>

+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> <% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<% if data.value.groupby.value == "clientip" then %>Client IP<% else %>User ID<% end %>
@@ -51,3 +51,4 @@ <% if #data.value == 0 then %>

No usage stats found

<% end %> +<% htmlviewfunctions.displaysectionend(header_level) %> diff --git a/weblog-viewweblog-html.lsp b/weblog-viewweblog-html.lsp index 061d8b0..0310f46 100644 --- a/weblog-viewweblog-html.lsp +++ b/weblog-viewweblog-html.lsp @@ -117,15 +117,17 @@ end } -

Search Parameters

<% -- Display the form, but skip log, window, and focus fields +local label = data.label +data.label = "Search Parameters" local log = data.value.log data.value.log = nil local window = data.value.window data.value.window = nil local focus = data.value.focus data.value.focus = nil -htmlviewfunctions.displayform(data, nil, nil, page_info, 2) +htmlviewfunctions.displayitem(data, page_info) +data.label = label data.value.log = log data.value.window = window data.value.focus = focus @@ -141,8 +143,8 @@ if data.value.clientip.value ~= "" then end %> +<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %> <% htmlviewfunctions.displaypagination(pagedata, page_info) %> -

<%= html.html_escape(data.label) %>

@@ -217,6 +219,7 @@ end %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %> +<% htmlviewfunctions.displaysectionend(header_level) %> <% if data.errtxt then %>

<%= html.html_escape(data.errtxt) %>

@@ -226,6 +229,7 @@ end %> <% end %> <% if viewlibrary.check_permission("downloadweblog") then +data.label = "Download Results" data.action = "downloadweblog" data.option = "Download" data.value.log = nil @@ -236,5 +240,5 @@ for n,v in pairs(data.value) do v.type = "hidden" v.checked = nil end -htmlviewfunctions.displayform(data, nil, nil, page_info, 2) +htmlviewfunctions.displayitem(data, page_info, 0) end %> -- cgit v1.2.3