Commit 68a8022f authored by Ted Trask's avatar Ted Trask

Started work on updating for acf-core-0.15

Removed controllerfunctions library (still needs more work and corresponding work in model)
Updated for viewfunctions to htmlviewfunctions and modified require statements for acf libraries
parent d9fa806c
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<style type="text/css">
......@@ -45,7 +45,7 @@ require("viewfunctions")
<% end %>
<H1><%= html.html_escape(form.label) %></H1>
<% displayformstart(form, page_info) %>
<% htmlviewfunctions.displayformstart(form, page_info) %>
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>
......@@ -53,8 +53,8 @@ This form accepts a Postgresql SELECT statement and displays the results. Exampl
<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.
<% displayformitem(form.value.query, "query") %>
<% displayformend(form) %>
<% htmlviewfunctions.displayformitem(form.value.query, "query") %>
<% htmlviewfunctions.displayformend(form) %>
<H2>Available Database Tables</H2>
<H3>pubweblog and pubweblog_history</H3>
......
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
<%
displayform(form, nil, nil, page_info, 2)
htmlviewfunctions.displayform(form, nil, nil, page_info, 2)
%>
module(..., package.seeall)
-- Load libraries
require("controllerfunctions")
default_action = "viewauditstats"
function config(self)
return controllerfunctions.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
return self.handle_form(self, self.model.getconfig, self.model.updateconfig, self.clientdata, "Save", "Edit Configuration", "Configuration Saved")
end
function listsources(self)
......@@ -14,7 +11,7 @@ function listsources(self)
end
function createsource(self)
return controllerfunctions.handle_form(self, self.model.getnewsource, self.model.createsource, self.clientdata, "Create", "Create new source", "New source created")
return self.handle_form(self, self.model.getnewsource, self.model.createsource, self.clientdata, "Create", "Create new source", "New source created")
end
function deletesource(self)
......@@ -22,7 +19,7 @@ function deletesource(self)
end
function editsource(self)
return controllerfunctions.handle_form(self, function() return self.model.getsource(self.clientdata.sourcename) end, self.model.updatesource, self.clientdata, "Save", "Edit Source", "Source Saved")
return self.handle_form(self, function() return self.model.getsource(self.clientdata.sourcename) end, self.model.updatesource, self.clientdata, "Save", "Edit Source", "Source Saved")
end
function testsource(self)
......@@ -38,10 +35,10 @@ function viewactivitylog(self)
end
function viewweblog(self)
local retval = controllerfunctions.handle_form(self, self.model.getweblogparameters, self.model.getweblog, self.clientdata, "Update", "Display Weblog")
local retval = self.handle_form(self, self.model.getweblogparameters, self.model.getweblog, self.clientdata, "Update", "Display Weblog")
-- We want to get the weblog even if form wasn't submitted
if not self.clientdata.Update then
controllerfunctions.handle_clientdata(retval, self.clientdata)
self.handle_clientdata(retval, self.clientdata)
retval = self.model.getweblog(retval)
end
return retval
......@@ -61,7 +58,7 @@ function downloadweblog(self)
end
function updateselected(self)
return controllerfunctions.handle_form(self, self.model.geteditselected, self.model.editselected, self.clientdata, "Submit", "Submit select update", "Select fields updated")
return self.handle_form(self, self.model.geteditselected, self.model.editselected, self.clientdata, "Submit", "Submit select update", "Select fields updated")
end
function clearselected(self)
......@@ -81,13 +78,13 @@ function completeaudit(self)
end
function adhocquery(self)
return controllerfunctions.handle_form(self, self.model.getnewadhocquery, self.model.adhocquery, self.clientdata, "Submit", "Submit ad-hoc query")
return self.handle_form(self, self.model.getnewadhocquery, self.model.adhocquery, self.clientdata, "Submit", "Submit ad-hoc query")
end
function downloadadhocquery(self)
self.conf.viewtype = "stream"
local retval = self.model.getnewadhocquery()
controllerfunctions.handle_clientdata(retval, self.clientdata)
self.handle_clientdata(retval, self.clientdata)
retval = self.model.adhocquery(retval)
local file = cfe({ type="longtext", value="", label="weblogadhocquery.tab" })
......@@ -115,7 +112,7 @@ function status(self)
end
function createdatabase(self)
return controllerfunctions.handle_form(self, self.model.getnewdatabase, self.model.create_database, self.clientdata, "Create", "Create New Database", "Database Created")
return self.handle_form(self, self.model.getnewdatabase, self.model.create_database, self.clientdata, "Create", "Create New Database", "Database Created")
end
function listfiles(self)
......@@ -123,5 +120,5 @@ function listfiles(self)
end
function editfile(self)
return controllerfunctions.handle_form(self, function() return self.model.readfile(self.clientdata.filename) end, self.model.updatefile, self.clientdata, "Save", "Edit Weblog File", "Weblog File Saved" )
return self.handle_form(self, function() return self.model.readfile(self.clientdata.filename) end, self.model.updatefile, self.clientdata, "Save", "Edit Weblog File", "Weblog File Saved" )
end
<% local form, viewlibrary, page_info = ... %>
<% require("viewfunctions") %>
<% require("htmlviewfunctions") %>
<H1><%= html.html_escape(form.label) %></H1>
<%
form.value.password.type = "password"
form.value.password_confirm.type = "password"
local order = { "password", "password_confirm" }
displayform(form, order, nil, page_info)
htmlviewfunctions.displayform(form, order, nil, page_info)
%>
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
<%
local order = {"clientuserid", "expiredatetime"}
displayform(form, order, nil, page_info)
htmlviewfunctions.displayform(form, order, nil, page_info)
%>
<% local form, viewlibrary, page_info = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<H1><%= html.html_escape(form.label) %></H1>
......@@ -10,5 +10,5 @@ require("viewfunctions")
form.value.sourcename.readonly = true
end
local order = {"sourcename", "enabled", "source", "method", "userid", "passwd"}
displayform(form, order)
htmlviewfunctions.displayform(form, order)
%>
<% local view, viewlibrary, page_info, session = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<% displaycommandresults({"editfile"}, session) %>
<% htmlviewfunctions.displaycommandresults({"editfile"}, session) %>
<H1>File List</H1>
<DL>
......
<% local data, viewlibrary, page_info, session = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<% displaycommandresults({"deletesource", "editsource", "testsource", "createsource", "importlogs"}, session) %>
<% htmlviewfunctions.displaycommandresults({"deletesource", "editsource", "testsource", "createsource", "importlogs"}, session) %>
<h1><%= html.html_escape(data.label) %></h1>
<DL>
......
......@@ -2,9 +2,9 @@ module(..., package.seeall)
-- Load libraries
require("modelfunctions")
require("fs")
require("format")
require("validator")
fs = require("acf.fs")
format = require("acf.format")
validator = require("acf.validator")
require("luasql.postgres")
local DatabaseName = "webproxylog"
......
<% local data, viewlibrary, page_info, session = ...
require("viewfunctions")
require("htmlviewfunctions")
%>
<% displaycommandresults({"createdatabase"}, session, true) %>
<% htmlviewfunctions.displaycommandresults({"createdatabase"}, session, true) %>
<H1>Weblog Database Status</H1>
<DL>
......
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<% require("htmlviewfunctions") %>
<% local subdata, pagedata = paginate(data.value, page_info.clientdata, 100) %>
<% local subdata, pagedata = htmlviewfunctions.paginate(data.value, page_info.clientdata, 100) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<% displaypagination(pagedata, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<TABLE>
<TR class="header">
<TD style="padding-right:20px;white-space:nowrap;" class="header">Date</TD>
......
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<% require("htmlviewfunctions") %>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery-latest.js"></script>
<script type="text/javascript" src="<%= html.html_escape(page_info.wwwprefix) %>/js/jquery.tablesorter.js"></script>
......@@ -13,12 +13,12 @@
});
</script>
<% displaycommandresults({"completeaudit"}, session) %>
<% htmlviewfunctions.displaycommandresults({"completeaudit"}, session) %>
<H1>Audit Parameters</H1>
<DL>
<% displayitem(data.value.auditstart) %>
<% displayitem(data.value.auditend) %>
<% htmlviewfunctions.displayitem(data.value.auditstart) %>
<% htmlviewfunctions.displayitem(data.value.auditend) %>
</DL>
<H1><%= html.html_escape(data.label) %></H1>
......
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<% require("htmlviewfunctions") %>
<% local subdata, pagedata = paginate(data.value, page_info.clientdata, 100) %>
<% local subdata, pagedata = htmlviewfunctions.paginate(data.value, page_info.clientdata, 100) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<% displaypagination(pagedata, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<TABLE>
<TR style="background:#eee;font-weight:bold;">
<TD style="padding-right:20px;white-space:nowrap;" class="header">Date</TD>
......
<% local data, viewlibrary, page_info, session = ... %>
<% require("viewfunctions") %>
<% require("htmlviewfunctions") %>
<%
-- Insert a string into another string
......@@ -82,7 +82,7 @@ end
});
</script>
<% local subdata, pagedata = paginate(data.value.log.value, page_info.clientdata, 200) %>
<% local subdata, pagedata = htmlviewfunctions.paginate(data.value.log.value, page_info.clientdata, 200) %>
<style type="text/css">
#content table { border-collapse: collapse; width: 100%; }
......@@ -118,7 +118,7 @@ if data.value.clientip.value ~= "" then
end
%>
<% displaypagination(pagedata, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<H1><%= html.html_escape(data.label) %></H1>
<DL>
<TABLE id="loglist" class="tablesorter">
......@@ -193,7 +193,7 @@ end %>
<% end %>
</TBODY>
</TABLE>
<% displaypagination(pagedata, page_info) %>
<% htmlviewfunctions.displaypagination(pagedata, page_info) %>
<% if data.errtxt then %>
<p class="error"><%= html.html_escape(data.errtxt) %></p>
......@@ -212,6 +212,6 @@ for n,v in pairs(data.value) do
v.type = "hidden"
v.checked = nil
end
displayform(data, nil, nil, page_info, 2)
htmlviewfunctions.displayform(data, nil, nil, page_info, 2)
end %>
</DL>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment