From 06600e5d886ac3ed3ae5ee6ce04994b8c6f387f5 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 18 Apr 2012 01:58:45 +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 --- tcpproxy-controller.lua | 13 +++++-------- tcpproxy-editsmtpentry-html.lsp | 4 ++-- tcpproxy-listsmtpentries-html.lsp | 4 ++-- tcpproxy-listsmtpfiles-html.lsp | 8 ++++---- tcpproxy-model.lua | 14 +++++++++----- tcpproxy-smtpstatus-html.lsp | 8 ++++---- tcpproxy-startstop-html.lsp | 1 - 7 files changed, 26 insertions(+), 26 deletions(-) delete mode 120000 tcpproxy-startstop-html.lsp diff --git a/tcpproxy-controller.lua b/tcpproxy-controller.lua index b1b6c01..97cbaac 100644 --- a/tcpproxy-controller.lua +++ b/tcpproxy-controller.lua @@ -1,8 +1,5 @@ module(..., package.seeall) --- Load libraries -require("controllerfunctions") - default_action = "status" function status(self) @@ -10,11 +7,11 @@ function status(self) end function startstop(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 function expert(self) - return controllerfunctions.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config", "Configuration Saved") + return self.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config", "Configuration Saved") end function smtpstatus(self) @@ -26,7 +23,7 @@ function listsmtpentries(self) end function editsmtpentry(self) - return controllerfunctions.handle_form(self, function() return self.model.readsmtpentry(self.clientdata.ipaddr) end, self.model.updatesmtpentry, self.clientdata, "Save", "Edit SMTP Proxy Entry", "SMTP Proxy Entry Saved" ) + return self.handle_form(self, function() return self.model.readsmtpentry(self.clientdata.ipaddr) end, self.model.updatesmtpentry, self.clientdata, "Save", "Edit SMTP Proxy Entry", "SMTP Proxy Entry Saved" ) end function delsmtpentry(self) @@ -38,11 +35,11 @@ function listsmtpfiles(self) end function createsmtpfile(self) - return controllerfunctions.handle_form(self, self.model.getnewsmtpfile, self.model.createsmtpfile, self.clientdata, "Create", "Create New SMTP Proxy File", "SMTP Proxy File Created") + return self.handle_form(self, self.model.getnewsmtpfile, self.model.createsmtpfile, self.clientdata, "Create", "Create New SMTP Proxy File", "SMTP Proxy File Created") end function editsmtpfile(self) - return controllerfunctions.handle_form(self, function() return self.model.readsmtpfile(self.clientdata.filename) end, self.model.updatesmtpfile, self.clientdata, "Save", "Edit SMTP Proxy File", "SMTP Proxy File Saved" ) + return self.handle_form(self, function() return self.model.readsmtpfile(self.clientdata.filename) end, self.model.updatesmtpfile, self.clientdata, "Save", "Edit SMTP Proxy File", "SMTP Proxy File Saved" ) end function delsmtpfile(self) diff --git a/tcpproxy-editsmtpentry-html.lsp b/tcpproxy-editsmtpentry-html.lsp index 148a24e..807b211 100644 --- a/tcpproxy-editsmtpentry-html.lsp +++ b/tcpproxy-editsmtpentry-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info = ... -require("viewfunctions") +require("htmlviewfunctions") %>

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

@@ -7,5 +7,5 @@ require("viewfunctions") form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action form.value.ipaddr.readonly = true local order = {"ipaddr", "server", "addressonly", "domain", "optionalserver", "optionalrewritelist", "senderlistfile", "rcptlistfile"} - displayform(form, order) + htmlviewfunctions.displayform(form, order) %> diff --git a/tcpproxy-listsmtpentries-html.lsp b/tcpproxy-listsmtpentries-html.lsp index 8fdfe96..60f3532 100644 --- a/tcpproxy-listsmtpentries-html.lsp +++ b/tcpproxy-listsmtpentries-html.lsp @@ -1,8 +1,8 @@ <% local view, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"editsmtpentry", "delsmtpentry"}, session) %> +<% htmlviewfunctions.displaycommandresults({"editsmtpentry", "delsmtpentry"}, session) %>

Interface Entries

diff --git a/tcpproxy-listsmtpfiles-html.lsp b/tcpproxy-listsmtpfiles-html.lsp index 37fbd9e..3760a66 100644 --- a/tcpproxy-listsmtpfiles-html.lsp +++ b/tcpproxy-listsmtpfiles-html.lsp @@ -1,9 +1,9 @@ <% local view, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"editsmtpfile", "delsmtpfile"}, session) %> -<% displaycommandresults({"createsmtpfile"}, session, true) %> +<% htmlviewfunctions.displaycommandresults({"editsmtpfile", "delsmtpfile"}, session) %> +<% htmlviewfunctions.displaycommandresults({"createsmtpfile"}, session, true) %>

Files

@@ -33,5 +33,5 @@ require("viewfunctions")

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

<% createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createsmtpfile" - displayform(createform) + htmlviewfunctions.displayform(createform) end %> diff --git a/tcpproxy-model.lua b/tcpproxy-model.lua index 682f117..001905d 100644 --- a/tcpproxy-model.lua +++ b/tcpproxy-model.lua @@ -2,10 +2,10 @@ module(..., package.seeall) -- Load libraries require("modelfunctions") -require("validator") -require("fs") +validator = require("acf.validator") +fs = require("acf.fs") require("posix") -require("format") +format = require("acf.format") -- Set variables local configfile = "/etc/tcpproxy.conf" @@ -188,8 +188,12 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function startstop_service(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 function getstatus() diff --git a/tcpproxy-smtpstatus-html.lsp b/tcpproxy-smtpstatus-html.lsp index 143c991..a13c132 100644 --- a/tcpproxy-smtpstatus-html.lsp +++ b/tcpproxy-smtpstatus-html.lsp @@ -1,13 +1,13 @@ <% local view, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"editsmtpentry", "delsmtpentry", "editsmtpfile", "delsmtpfile"}, session) %> -<% displaycommandresults({"createsmtpfile"}, session, true) %> +<% htmlviewfunctions.displaycommandresults({"editsmtpentry", "delsmtpentry", "editsmtpfile", "delsmtpfile"}, session) %> +<% htmlviewfunctions.displaycommandresults({"createsmtpfile"}, session, true) %>

SMTP Proxy Status

-<% displayitem(view.value.version) +<% htmlviewfunctions.displayitem(view.value.version) if view.value.version and view.value.version.errtxt and viewlibrary.check_permission("apk-tools/apk/install") then %> Install diff --git a/tcpproxy-startstop-html.lsp b/tcpproxy-startstop-html.lsp deleted file mode 120000 index 0ea2627..0000000 --- a/tcpproxy-startstop-html.lsp +++ /dev/null @@ -1 +0,0 @@ -../startstop-html.lsp \ No newline at end of file -- cgit v1.2.3