Commit b0f5d4a3 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 startstop functionality and deleted view
Updated for viewfunctions to htmlviewfunctions and modified require statements for acf libraries
parent b621e263
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
module (..., package.seeall) module (..., package.seeall)
require("controllerfunctions")
default_action = "status" default_action = "status"
status = function( self ) status = function( self )
...@@ -11,11 +9,11 @@ status = function( self ) ...@@ -11,11 +9,11 @@ status = function( self )
end end
startstop = function( self ) startstop = function( self )
return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata) return self.handle_form(self, self.model.get_startstop, self.model.startstop_service, self.clientdata)
end end
general = function( self ) general = function( self )
return controllerfunctions.handle_form(self, self.model.read_general_config, self.model.update_general_config, self.clientdata, "Save", "Edit General Configuration", "General Configuration Set") return self.handle_form(self, self.model.read_general_config, self.model.update_general_config, self.clientdata, "Save", "Edit General Configuration", "General Configuration Set")
end end
listfiles = function( self ) listfiles = function( self )
...@@ -27,5 +25,5 @@ listconfigfiles = function( self ) ...@@ -27,5 +25,5 @@ listconfigfiles = function( self )
end end
edit = function( self ) edit = function( self )
return controllerfunctions.handle_form(self, function() return self.model.get_file(self.clientdata.filename) end, self.model.update_file, self.clientdata, "Save", "Edit File", "File Saved") return self.handle_form(self, function() return self.model.get_file(self.clientdata.filename) end, self.model.update_file, self.clientdata, "Save", "Edit File", "File Saved")
end end
<% <%
require("viewfunctions") require("htmlviewfunctions")
local form, viewlibrary, page_info, session = ... local form, viewlibrary, page_info, session = ...
%> %>
...@@ -10,7 +10,7 @@ end %> ...@@ -10,7 +10,7 @@ end %>
<h1>Configuration</h1> <h1>Configuration</h1>
<% <%
form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action
displayformstart(form) htmlviewfunctions.displayformstart(form)
for field,val in pairs(form.value) do for field,val in pairs(form.value) do
val.name = field val.name = field
end end
...@@ -24,8 +24,8 @@ These parameters define the interface and port that Dansguardian uses to accept ...@@ -24,8 +24,8 @@ These parameters define the interface and port that Dansguardian uses to accept
</p> </p>
<% <%
displayformitem(form.value.filterip) htmlviewfunctions.displayformitem(form.value.filterip)
displayformitem(form.value.filterport) htmlviewfunctions.displayformitem(form.value.filterport)
%> %>
</dl> </dl>
...@@ -36,8 +36,8 @@ These parameters define the ip address and port that Dansguardian should forward ...@@ -36,8 +36,8 @@ These parameters define the ip address and port that Dansguardian should forward
</p> </p>
<% <%
displayformitem(form.value.proxyip) htmlviewfunctions.displayformitem(form.value.proxyip)
displayformitem(form.value.proxyport) htmlviewfunctions.displayformitem(form.value.proxyport)
%> %>
</dl> </dl>
...@@ -50,12 +50,12 @@ The author recommends 50 for "young children", 100 for "older children" and 160 ...@@ -50,12 +50,12 @@ The author recommends 50 for "young children", 100 for "older children" and 160
</p> </p>
<% <%
displayformitem(form.value.accessdeniedaddress) htmlviewfunctions.displayformitem(form.value.accessdeniedaddress)
displayformitem(form.value.naughtynesslimit) htmlviewfunctions.displayformitem(form.value.naughtynesslimit)
%> %>
</dl> </dl>
<h2>Save Changes</h2> <h2>Save Changes</h2>
<DL> <DL>
<% displayformend(form) %> <% htmlviewfunctions.displayformend(form) %>
</DL> </DL>
<% local view, viewlibrary, page_info, session = ... <% local view, viewlibrary, page_info, session = ...
require("viewfunctions") require("htmlviewfunctions")
%> %>
<% displaycommandresults({"edit"}, session) %> <% htmlviewfunctions.displaycommandresults({"edit"}, session) %>
<% if viewlibrary and viewlibrary.dispatch_component then <% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("status") viewlibrary.dispatch_component("status")
......
...@@ -4,9 +4,9 @@ module (..., package.seeall) ...@@ -4,9 +4,9 @@ module (..., package.seeall)
-- Load libraries -- Load libraries
require("modelfunctions") require("modelfunctions")
require("posix") require("posix")
require("fs") fs = require("acf.fs")
require("format") format = require("acf.format")
require("validator") validator = require("acf.validator")
-- Set variables -- Set variables
dansguardiancfg = "/etc/dansguardian/dansguardian.conf" dansguardiancfg = "/etc/dansguardian/dansguardian.conf"
...@@ -82,8 +82,12 @@ get_status = function() ...@@ -82,8 +82,12 @@ get_status = function()
return modelfunctions.getstatus(processname, packagename, "Dans Guardian Status") return modelfunctions.getstatus(processname, packagename, "Dans Guardian Status")
end end
startstop_service = function( action ) function get_startstop(clientdata)
return modelfunctions.startstop_service(processname, action) return modelfunctions.get_startstop(processname)
end
function startstop_service(startstop, action)
return modelfunctions.startstop_service(startstop, action)
end end
read_general_config = function() read_general_config = function()
......
../startstop-html.lsp
\ No newline at end of file
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