From b0f5d4a3e85032894ec394e929ffc475d685ab0c Mon Sep 17 00:00:00 2001
From: Ted Trask
Date: Wed, 18 Apr 2012 01:02:28 +0000
Subject: 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
---
dansguardian-controller.lua | 8 +++-----
dansguardian-general-html.lsp | 18 +++++++++---------
dansguardian-html.lsp | 4 ++--
dansguardian-model.lua | 14 +++++++++-----
dansguardian-startstop-html.lsp | 1 -
5 files changed, 23 insertions(+), 22 deletions(-)
delete mode 120000 dansguardian-startstop-html.lsp
diff --git a/dansguardian-controller.lua b/dansguardian-controller.lua
index 8de38b0..80dbec2 100644
--- a/dansguardian-controller.lua
+++ b/dansguardian-controller.lua
@@ -2,8 +2,6 @@
module (..., package.seeall)
-require("controllerfunctions")
-
default_action = "status"
status = function( self )
@@ -11,11 +9,11 @@ status = function( self )
end
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
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
listfiles = function( self )
@@ -27,5 +25,5 @@ listconfigfiles = function( self )
end
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
diff --git a/dansguardian-general-html.lsp b/dansguardian-general-html.lsp
index 3adff09..e83ff4c 100644
--- a/dansguardian-general-html.lsp
+++ b/dansguardian-general-html.lsp
@@ -1,5 +1,5 @@
<%
-require("viewfunctions")
+require("htmlviewfunctions")
local form, viewlibrary, page_info, session = ...
%>
@@ -10,7 +10,7 @@ end %>
Configuration
<%
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
val.name = field
end
@@ -24,8 +24,8 @@ These parameters define the interface and port that Dansguardian uses to accept
<%
- displayformitem(form.value.filterip)
- displayformitem(form.value.filterport)
+ htmlviewfunctions.displayformitem(form.value.filterip)
+ htmlviewfunctions.displayformitem(form.value.filterport)
%>
@@ -36,8 +36,8 @@ These parameters define the ip address and port that Dansguardian should forward
<%
- displayformitem(form.value.proxyip)
- displayformitem(form.value.proxyport)
+ htmlviewfunctions.displayformitem(form.value.proxyip)
+ htmlviewfunctions.displayformitem(form.value.proxyport)
%>
@@ -50,12 +50,12 @@ The author recommends 50 for "young children", 100 for "older children" and 160
<%
- displayformitem(form.value.accessdeniedaddress)
- displayformitem(form.value.naughtynesslimit)
+ htmlviewfunctions.displayformitem(form.value.accessdeniedaddress)
+ htmlviewfunctions.displayformitem(form.value.naughtynesslimit)
%>
Save Changes
-<% displayformend(form) %>
+<% htmlviewfunctions.displayformend(form) %>
diff --git a/dansguardian-html.lsp b/dansguardian-html.lsp
index ccb3274..a3d543f 100644
--- a/dansguardian-html.lsp
+++ b/dansguardian-html.lsp
@@ -1,8 +1,8 @@
<% local view, viewlibrary, page_info, session = ...
-require("viewfunctions")
+require("htmlviewfunctions")
%>
-<% displaycommandresults({"edit"}, session) %>
+<% htmlviewfunctions.displaycommandresults({"edit"}, session) %>
<% if viewlibrary and viewlibrary.dispatch_component then
viewlibrary.dispatch_component("status")
diff --git a/dansguardian-model.lua b/dansguardian-model.lua
index e048a0b..4180226 100644
--- a/dansguardian-model.lua
+++ b/dansguardian-model.lua
@@ -4,9 +4,9 @@ module (..., package.seeall)
-- Load libraries
require("modelfunctions")
require("posix")
-require("fs")
-require("format")
-require("validator")
+fs = require("acf.fs")
+format = require("acf.format")
+validator = require("acf.validator")
-- Set variables
dansguardiancfg = "/etc/dansguardian/dansguardian.conf"
@@ -82,8 +82,12 @@ get_status = function()
return modelfunctions.getstatus(processname, packagename, "Dans Guardian Status")
end
-startstop_service = function( action )
- return modelfunctions.startstop_service(processname, action)
+function get_startstop(clientdata)
+ return modelfunctions.get_startstop(processname)
+end
+
+function startstop_service(startstop, action)
+ return modelfunctions.startstop_service(startstop, action)
end
read_general_config = function()
diff --git a/dansguardian-startstop-html.lsp b/dansguardian-startstop-html.lsp
deleted file mode 120000
index 0ea2627..0000000
--- a/dansguardian-startstop-html.lsp
+++ /dev/null
@@ -1 +0,0 @@
-../startstop-html.lsp
\ No newline at end of file
--
cgit v1.2.3