From a041164aca00a7a365674361390a26ffa00d8242 Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Wed, 18 Apr 2012 01:58:05 +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 --- squid-config-html.lsp | 4 ++-- squid-controller.lua | 16 +++++++--------- squid-digest-html.lsp | 6 +++--- squid-listfiles-html.lsp | 8 ++++---- squid-model.lua | 14 +++++++++----- squid-startstop-html.lsp | 1 - 6 files changed, 25 insertions(+), 24 deletions(-) delete mode 120000 squid-startstop-html.lsp diff --git a/squid-config-html.lsp b/squid-config-html.lsp index 750718b..30203e8 100644 --- a/squid-config-html.lsp +++ b/squid-config-html.lsp @@ -1,5 +1,5 @@ <% local form, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> <% if viewlibrary and viewlibrary.dispatch_component then @@ -10,5 +10,5 @@ end %> <% form.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action local order = {"httpports", "accesslog", "diskcache", "authmethod"} - displayform(form, order) + htmlviewfunctions.displayform(form, order) %> diff --git a/squid-controller.lua b/squid-controller.lua index e99345f..3174f61 100644 --- a/squid-controller.lua +++ b/squid-controller.lua @@ -2,8 +2,6 @@ module (..., package.seeall) -require("controllerfunctions") - default_action = "status" status = function( self ) @@ -11,15 +9,15 @@ 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 config = function( self ) - return controllerfunctions.handle_form(self, self.model.read_config, self.model.update_config, self.clientdata, "Save", "Edit Config", "Configuration Set") + return self.handle_form(self, self.model.read_config, self.model.update_config, self.clientdata, "Save", "Edit Config", "Configuration Set") end digest = function( self ) - return controllerfunctions.handle_form(self, self.model.read_digest_userlist, self.model.update_digest_userlist, self.clientdata, "Save", "Edit User List", "User List Set") + return self.handle_form(self, self.model.read_digest_userlist, self.model.update_digest_userlist, self.clientdata, "Save", "Edit User List", "User List Set") end enabledigestlist = function( self ) @@ -27,7 +25,7 @@ enabledigestlist = function( self ) end expert = function( self ) - return controllerfunctions.handle_form(self, self.model.get_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Config", "Configuration Set") + return self.handle_form(self, self.model.get_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Config", "Configuration Set") end --[[ saccess = function( self ) @@ -54,7 +52,7 @@ listacls = function( self ) end editacl = function( self ) - return controllerfunctions.handle_form(self, function() return self.model.read_acl(self.clientdata.linenum) end, self.model.update_acl, self.clientdata, "Save", "Edit ACL", "ACL Saved") + return self.handle_form(self, function() return self.model.read_acl(self.clientdata.linenum) end, self.model.update_acl, self.clientdata, "Save", "Edit ACL", "ACL Saved") end deleteacl = function( self ) @@ -67,11 +65,11 @@ function listfiles(self) end function createfile(self) - return controllerfunctions.handle_form(self, self.model.getnewfile, self.model.createfile, self.clientdata, "Create", "Create New Squid File", "Squid File Created") + return self.handle_form(self, self.model.getnewfile, self.model.createfile, self.clientdata, "Create", "Create New Squid File", "Squid File Created") 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 Squid File", "Squid File Saved" ) + return self.handle_form(self, function() return self.model.readfile(self.clientdata.filename) end, self.model.updatefile, self.clientdata, "Save", "Edit Squid File", "Squid File Saved" ) end function deletefile(self) diff --git a/squid-digest-html.lsp b/squid-digest-html.lsp index e02c6aa..104a9f2 100644 --- a/squid-digest-html.lsp +++ b/squid-digest-html.lsp @@ -1,12 +1,12 @@ <% local form, viewlibrary, page_info, session = ... %> -<% require("viewfunctions") %> +<% require("htmlviewfunctions") %> -<% displaycommandresults({"enabledigestlist"}, session) %> +<% htmlviewfunctions.displaycommandresults({"enabledigestlist"}, session) %>

Digest User List Status

<% - displayitem(form.value.status) + htmlviewfunctions.displayitem(form.value.status) if form.value.status.errtxt then %>
">
diff --git a/squid-listfiles-html.lsp b/squid-listfiles-html.lsp index aff271b..7287e99 100644 --- a/squid-listfiles-html.lsp +++ b/squid-listfiles-html.lsp @@ -1,9 +1,9 @@ <% local view, viewlibrary, page_info, session = ... -require("viewfunctions") +require("htmlviewfunctions") %> -<% displaycommandresults({"editfile", "deletefile"}, session) %> -<% displaycommandresults({"createfile"}, session, true) %> +<% htmlviewfunctions.displaycommandresults({"editfile", "deletefile"}, session) %> +<% htmlviewfunctions.displaycommandresults({"createfile"}, session, true) %> <% if viewlibrary and viewlibrary.dispatch_component then viewlibrary.dispatch_component("status") @@ -37,5 +37,5 @@ end %>

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

<% createform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/createfile" - displayform(createform) + htmlviewfunctions.displayform(createform) end %> diff --git a/squid-model.lua b/squid-model.lua index 2523462..0ad6d2f 100644 --- a/squid-model.lua +++ b/squid-model.lua @@ -3,9 +3,9 @@ module (..., package.seeall) -- Load libraries require("modelfunctions") -require("validator") -require("format") -require("fs") +validator = require("acf.validator") +format = require("acf.format") +fs = require("acf.fs") -- Set variables local squidconf = "/etc/squid/squid.conf" @@ -38,8 +38,12 @@ getstatus = function() return modelfunctions.getstatus(processname, packagename, "Squid status") end -startstop_service = function(action) - return modelfunctions.startstop_service(processname, action, {"Start", "Stop", "Restart", "Reload", "Rotate"}) +function get_startstop(clientdata) + return modelfunctions.get_startstop(processname) +end + +function startstop_service(startstop, action) + return modelfunctions.startstop_service(startstop, action) end get_configfile = function() diff --git a/squid-startstop-html.lsp b/squid-startstop-html.lsp deleted file mode 120000 index 0ea2627..0000000 --- a/squid-startstop-html.lsp +++ /dev/null @@ -1 +0,0 @@ -../startstop-html.lsp \ No newline at end of file -- cgit v1.2.3