From 7a58a33cdd8bb51e1b7a9f52ad1dbf87221642b2 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 18 Apr 2012 01:10:15 +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 --- dnscache-config-html.lsp | 4 ++-- dnscache-controller.lua | 15 ++++++--------- dnscache-editdomain-html.lsp | 4 ++-- dnscache-listdomains-html.lsp | 6 +++--- dnscache-model.lua | 16 ++++++++++------ dnscache-startstop-html.lsp | 1 - 6 files changed, 23 insertions(+), 23 deletions(-) delete mode 120000 dnscache-startstop-html.lsp diff --git a/dnscache-config-html.lsp b/dnscache-config-html.lsp index 4b9c75a..c5234ca 100644 --- a/dnscache-config-html.lsp +++ b/dnscache-config-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> <% if viewlibrary and viewlibrary.dispatch_component then @@ -9,5 +9,5 @@ end %>

Config

<% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action - displayform(form) + htmlviewfunctions.displayform(form) %> diff --git a/dnscache-controller.lua b/dnscache-controller.lua index f14d4aa..978b3b3 100644 --- a/dnscache-controller.lua +++ b/dnscache-controller.lua @@ -1,8 +1,5 @@ module(..., package.seeall) --- Load libraries -require("controllerfunctions") - default_action = "status" function status(self) @@ -10,19 +7,19 @@ 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 config(self) - return controllerfunctions.handle_form(self, self.model.getconfig, self.model.setconfig, self.clientdata, "Save", "Edit Config", "Configuration Set") + return self.handle_form(self, self.model.getconfig, self.model.setconfig, self.clientdata, "Save", "Edit Config", "Configuration Set") end function expert(self) - return controllerfunctions.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config File", "Configuration File Set") + return self.handle_form(self, self.model.getconfigfile, self.model.setconfigfile, self.clientdata, "Save", "Edit Config File", "Configuration File Set") end function editips(self) - return controllerfunctions.handle_form(self, self.model.getIPs, self.model.setIPs, self.clientdata, "Save", "Edit IP List", "IP List Set") + return self.handle_form(self, self.model.getIPs, self.model.setIPs, self.clientdata, "Save", "Edit IP List", "IP List Set") end function listdomains(self) @@ -30,11 +27,11 @@ function listdomains(self) end function createdomain(self) - return controllerfunctions.handle_form(self, self.model.getNewDomain, self.model.setNewDomain, self.clientdata, "Create", "Create New Domain", "New Domain Created") + return self.handle_form(self, self.model.getNewDomain, self.model.setNewDomain, self.clientdata, "Create", "Create New Domain", "New Domain Created") end function editdomain(self) - return controllerfunctions.handle_form(self, function(form) return self.model.getDomain(self.clientdata.domain) end, + return self.handle_form(self, function(form) return self.model.getDomain(self.clientdata.domain) end, self.model.setDomain, self.clientdata, "Save", "Edit Domain Entry", "Domain Saved") end diff --git a/dnscache-editdomain-html.lsp b/dnscache-editdomain-html.lsp index e0fbb11..dd1ee4e 100644 --- a/dnscache-editdomain-html.lsp +++ b/dnscache-editdomain-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.domain.readonly = true local order = { "domain", "iplist" } - displayform(form, order) + htmlviewfunctions.displayform(form, order) %> diff --git a/dnscache-listdomains-html.lsp b/dnscache-listdomains-html.lsp index 347738b..993e58c 100644 --- a/dnscache-listdomains-html.lsp +++ b/dnscache-listdomains-html.lsp @@ -1,9 +1,9 @@ <% local data, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"editdomain", "deletedomain"}, session) %> -<% displaycommandresults({"createdomain"}, session, true) %> +<% htmlviewfunctions.displaycommandresults({"editdomain", "deletedomain"}, session) %> +<% htmlviewfunctions.displaycommandresults({"createdomain"}, session, true) %>

Configuration

Edit/View DNS server entries

diff --git a/dnscache-model.lua b/dnscache-model.lua index 1febc4f..5e02a1e 100644 --- a/dnscache-model.lua +++ b/dnscache-model.lua @@ -1,11 +1,11 @@ module(..., package.seeall) -- Load libraries -require("modelfunctions") -require("fs") -require("format") require("posix") -require("validator") +require("modelfunctions") +fs = require("acf.fs") +format = require("acf.format") +validator = require("acf.validator") -- Set variables local configfile = "/etc/conf.d/dnscache" @@ -59,8 +59,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/dnscache-startstop-html.lsp b/dnscache-startstop-html.lsp deleted file mode 120000 index 0ea2627..0000000 --- a/dnscache-startstop-html.lsp +++ /dev/null @@ -1 +0,0 @@ -../startstop-html.lsp \ No newline at end of file -- cgit v1.2.3