summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2014-04-17 00:55:44 +0000
committerTed Trask <ttrask01@yahoo.com>2014-04-17 00:55:44 +0000
commitfb7ce759c1045daf20e416547e6111f796030b60 (patch)
treefdc449de923b3e925d3f686e082d6454e519df10
parentd77bf9609380d27301abeba31e467039517cb8d5 (diff)
downloadacf-weblog-fb7ce759c1045daf20e416547e6111f796030b60.tar.bz2
acf-weblog-fb7ce759c1045daf20e416547e6111f796030b60.tar.xz
Started changes to use new htmlviewfunctions functions
Still work to do to remove styling and long messy links
-rw-r--r--weblog-adhocquery-html.lsp38
-rw-r--r--weblog-listfiles-html.lsp21
-rw-r--r--weblog-listsources-html.lsp35
-rw-r--r--weblog-status-html.lsp40
-rw-r--r--weblog-viewactivitylog-html.lsp8
-rw-r--r--weblog-viewauditstats-html.lsp13
-rw-r--r--weblog-viewusagestats-html.lsp3
-rw-r--r--weblog-viewweblog-html.lsp12
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
</script>
<% if form.value.result then %>
- <h1><%= html.html_escape(form.value.result.label) %></h1>
+ <% local header_level = htmlviewfunctions.displaysectionstart(form.value.result, page_info) %>
<% if #form.value.result.value == 0 then %>
<p>No results, try adjusting query</p>
<% else %>
@@ -63,32 +63,26 @@ end
</table>
<% if viewlibrary.check_permission("downloadadhocquery") then %>
- <form action="/cgi-bin/acf/weblog/weblog/downloadadhocquery" method="post">
- <input class="hidden" type="hidden" name="query" value="<%= html.html_escape(form.value.query.value) %>" >
- <input class="hidden" type="hidden" name="viewtype" value="stream" >
- <div class='item'><p class='left'>Download query result</p>
- <div class='right'>
- <input class="submit" type="submit" name="submit" value="Download">
- </div></div><!-- end .item -->
- </form>
+ <% 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 %>
-<h1><%= html.html_escape(form.label) %></h1>
-<% htmlviewfunctions.displayformstart(form, page_info) %>
+<% local header_level = htmlviewfunctions.displaysectionstart(form, page_info) %>
<p>This form accepts a Postgresql SELECT statement and displays the results. Examples:
<ul>
<li>This statement will return the total bytes transferred by each user for the pre-purge weblog history<pre>SELECT clientuserid, sum(bytes) AS total FROM pubweblog GROUP BY clientuserid ORDER BY total DESC</pre>
-<li>This statement limits the above statement to a specific range of dates (just yesterday)<pre>SELECT clientuserid, sum(bytes) AS total FROM pubweblog WHERE logdatetime >= 'yesterday' and logdatetime < 'today' GROUP BY clientuserid ORDER BY total DESC</pre>
+<li>This statement limits the above statement to a specific range of dates (just yesterday)<pre>SELECT clientuserid, sum(bytes) AS total FROM pubweblog WHERE logdatetime >= 'yesterday' and logdatetime &lt; 'today' GROUP BY clientuserid ORDER BY total DESC</pre>
<li>This statement will return the number of requests and blocks by hour over the course of the entire usage history<pre>SELECT extract(hour from date) AS hour, sum(numrequest) AS numrequest, sum(numblock) AS numblock FROM usagestat GROUP BY extract(hour from date) ORDER BY hour</pre>
</ul>
The available database tables and descriptions are listed below.</p>
-<% htmlviewfunctions.displayformitem(form.value.query, "query") %>
-<% htmlviewfunctions.displayformend(form) %>
+<% htmlviewfunctions.displayform(form, page_info, htmlviewfunctions.incrementheader(header_level)) %>
-<h2>Available Database Tables</h2>
-<h3>pubweblog and pubweblog_history</h3>
+<% 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)) %>
<p>These tables contain the pre-purge and historical access logs respectively. The definition of the table is as follows:</p>
<pre>
(
@@ -110,8 +104,9 @@ The available database tables and descriptions are listed below.</p>
id int,
)
</pre>
+<% htmlviewfunctions.displaysectionend(header_level3) %>
-<h3>dbhistlog</h3>
+<% htmlviewfunctions.displaysectionstart(cfe({label="dbhistlog"}), page_info, header_level3) %>
<p>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:</p>
<pre>
(
@@ -119,8 +114,9 @@ The available database tables and descriptions are listed below.</p>
msgtext text
)
</pre>
+<% htmlviewfunctions.displaysectionend(header_level3) %>
-<h3>source</h3>
+<% htmlviewfunctions.displaysectionstart(cfe({label="source"}), page_info, header_level3) %>
<p>This table contains the list of log file sources. The definition of the table is as follows:</p>
<pre>
(
@@ -133,8 +129,9 @@ The available database tables and descriptions are listed below.</p>
enabled boolean
)
</pre>
+<% htmlviewfunctions.displaysectionend(header_level3) %>
-<h3>usagestat</h3>
+<% htmlviewfunctions.displaysectionstart(cfe({label="usagestat"}), page_info, header_level3) %>
<p>This table contains a historical record of pages requested and blocked by hour. The definition of the table is as follows:</p>
<pre>
(
@@ -144,3 +141,6 @@ The available database tables and descriptions are listed below.</p>
numblock integer
)
</pre>
+<% 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
<script type="text/javascript">
$(document).ready(function() {
- $("#files").tablesorter({headers: {1:{sorter: 'digit'}, 2:{sorter: 'usLongDate'}}, widgets: ['zebra']});
+ $("#files").tablesorter({headers: {0:{sorter: false}}, widgets: ['zebra']});
});
</script>
<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %>
-<h1>File List</h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(view, page_info) %>
<table id="files" class="tablesorter"><thead>
<tr>
+ <th>Action</th>
<th>File</th>
<th>Size</th>
<th>Last Modified</th>
</tr>
</thead><tbody>
- <% for k,v in ipairs( view.value ) do
- io.write( "<tr><td><a href=\"" .. html.html_escape(page_info.script .. page_info.prefix .. page_info.controller) .. "/editfile?filename=" .. html.html_escape(v.filename) .. "&redir=" .. html.html_escape(page_info.orig_action) .. "\">" .. html.html_escape(v.filename) .. '</a></td><td><span style="display:none">'..convertsize(v.size).."b</span>" .. html.html_escape(v.size) .."</td><td>" .. html.html_escape(v.mtime) .."</td></tr>\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 %>
+ <tr>
+ <td><% htmlviewfunctions.displayitem(cfe({type="link", value={filename=filename, redir=redir}, label="", option="Edit", action="editfile"}), page_info, -1) %></td>
+ <td><%= html.html_escape(file.filename) %></td>
+ <td><span style="display:none"><%= convertsize(file.size) %>b</span><%= html.html_escape(file.size) %></td>
+ <td><%= html.html_escape(file.mtime) %></td>
+ </tr>
+<% end %>
</tbody></table>
+<% 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) %>
-<h1><%= html.html_escape(data.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %>
<table id="sources" class="tablesorter"><thead>
<tr>
<th>Action</th>
@@ -33,13 +33,17 @@ html = require("acf.html")
<th>Method</th>
</tr>
</thead><tbody>
-
+<% local sourcename = cfe({ type="hidden", value="" }) %>
+<% local redir = cfe({ type="hidden", value=page_info.orig_action }) %>
<% for i,source in ipairs(data.value) do %>
<tr>
<td>
- <%= 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)
+ %>
</td>
<td><%= html.html_escape(source.sourcename) %></td>
<td><%= html.html_escape(tostring(source.enabled)) %></td>
@@ -50,25 +54,12 @@ html = require("acf.html")
</tbody>
</table>
-<% if data.errtxt then %>
-<p class='error'><%= html.html_escape(data.errtxt) %></p>
-<% end %>
<% if #data.value == 0 then %>
<p>No sources found</p>
<% 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) %>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/createsource") %>">
-<div class='item'><p class='left'>Create New Source</p>
-<div class='right'>
-<input class="hidden" type="hidden" name="redir" value="<%= html.html_escape(page_info.orig_action) %>" >
-<input class="submit" type="submit" value="Create">
-</div></div><!-- end .item -->
-</form>
-
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/importlogs") %>">
-<div class='item'><p class='left'>Import Logs</p>
-<div class='right'>
-<input class="submit" type="submit" name="submit" value="Import">
-</div></div><!-- end .item -->
-</form>
+<% 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) %>
-<h1>Weblog Database Status</h1>
+<% 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 %>
-<div class='item'><p class='left'>Database status</p>
-<div class='right'><p>
-<% 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 %>
-</p></div></div><!-- end .item -->
+ 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)
+%>
-<div class='item'><p class='left'>Weblog Database</p>
-<div class='right'><p>
-<% if data.value then %>
-Present
-<% else %>
-Missing
-<% end %>
-</p></div></div><!-- end .item -->
+<% 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) %>
-<h1><%= html.html_escape(data.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<table id="activity" class="tablesorter"><thead>
<tr>
@@ -38,9 +38,9 @@
<% end %>
</tbody></table>
-<% if data.errtxt then %>
-<p class='error'><%= html.html_escape(data.errtxt) %></p>
-<% end %>
<% if #data.value == 0 then %>
<p>No history found</p>
<% 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) %>
-<h1>Audit Parameters</h1>
+<% 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) %>
-<h1><%= html.html_escape(data.label) %></h1>
+<% htmlviewfunctions.displaysectionstart(data, page_info, header_level) %>
<table id="audit" class="tablesorter"><thead>
<tr>
<th><% if data.value.groupby.value == "clientip" then %>Client IP<% else %>User ID<% end %></th>
@@ -60,9 +61,5 @@
<p>No flagged records, try adjusting the audit dates</p>
<% end %>
-<form action="<%= html.html_escape(page_info.script .. page_info.prefix .. page_info.controller .. "/completeaudit") %>">
-<div class='item'><p class='left'>Complete Audit</p>
-<div class='right'>
-<input class="submit" type="submit" name="submit" value="Complete">
-</div></div><!-- end .item -->
-</form>
+<% 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) %>
-<h1><%= html.html_escape(data.label) %></h1>
+<% local header_level = htmlviewfunctions.displaysectionstart(data, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<table id="usage" class="tablesorter">
<thead>
@@ -51,3 +51,4 @@
<% if #data.value == 0 then %>
<p>No usage stats found</p>
<% 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
}
</style>
-<h1>Search Parameters</h1>
<% -- 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) %>
-<h1><%= html.html_escape(data.label) %></h1>
<table id="loglist" class="tablesorter">
<thead>
<tr>
@@ -217,6 +219,7 @@ end %>
</tbody>
</table>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
+<% htmlviewfunctions.displaysectionend(header_level) %>
<% if data.errtxt then %>
<p class="error"><%= html.html_escape(data.errtxt) %></p>
@@ -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 %>