summaryrefslogtreecommitdiffstats
path: root/squid-controller.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-08-12 14:06:46 +0000
committerTed Trask <ttrask01@yahoo.com>2008-08-12 14:06:46 +0000
commit9c32f7047c8d3b3f19f451149b291ee74ef64062 (patch)
tree47d2fc85994bf4b920b09ad456c52c3937b197b7 /squid-controller.lua
parentc9683570fd9a648a80713b4fef357f2cb7d5021b (diff)
downloadacf-squid-9c32f7047c8d3b3f19f451149b291ee74ef64062.tar.bz2
acf-squid-9c32f7047c8d3b3f19f451149b291ee74ef64062.tar.xz
Modified squid to use new status, startstop, and expert (replaced advanced) actions.
git-svn-id: svn://svn.alpinelinux.org/acf/squid/trunk@1379 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'squid-controller.lua')
-rw-r--r--squid-controller.lua121
1 files changed, 12 insertions, 109 deletions
diff --git a/squid-controller.lua b/squid-controller.lua
index ee1b778..b16bbd8 100644
--- a/squid-controller.lua
+++ b/squid-controller.lua
@@ -2,6 +2,8 @@
module (..., package.seeall)
+require("controllerfunctions")
+
default_action = "status"
dep = function( self )
@@ -21,47 +23,16 @@ dep = function( self )
end
status = function( self )
+ return self.model.getstatus()
+end
- local info = {
- status=self.model.get_status(),
- version = self.model.get_squid_version(),
- autostart = self.model.get_autostart(),
- srvctrl = { value = srvctrl}
- }
-
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
-
- return ( cfe ({ option = option, info = info }) )
+startstop = function( self )
+ return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.model.getstatus, self.clientdata)
end
basic = function( self )
local service = {}
- if self.clientdata.srvcmd then
- local srvcmd = self.clientdata.srvcmd
- if srvcmd == "start" or srvcmd == "stop" or srvcmd == "restart" then
- service.srvcmdresult, service.message = self.model.service_control( srvcmd )
- end
- end
-
- local info = {
- status=self.model.get_status(),
- version = self.model.get_squid_version(),
- autostart = self.model.get_autostart(),
- srvctrl = { value = srvctrl}
- }
-
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
if not self.model.dependancy_ok() then
redirect(self, "dep")
@@ -86,35 +57,14 @@ basic = function( self )
end
end
- service.status = self.model.get_status()
service.config, service.error = self.model.get_basic_config()
- return ( cfe ({ option = option, service = service, info = info }) )
+ return ( cfe ({ service = service }) )
end
authentication = function( self )
local service = {}
- if self.clientdata.srvcmd then
- local srvcmd = self.clientdata.srvcmd
- if srvcmd == "start" or srvcmd == "stop" or srvcmd == "restart" then
- service.srvcmdresult, service.message = self.model.service_control( srvcmd )
- end
- end
-
- local info = {
- status=self.model.get_status(),
- version = self.model.get_squid_version(),
- autostart = self.model.get_autostart(),
- srvctrl = { value = srvctrl}
- }
-
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
if self.clientdata.inout then
local newauth = ""
@@ -137,57 +87,17 @@ authentication = function( self )
self.model.upd_authmethod(newauth)
end
- service.status = self.model.get_status()
service.config, service.error = self.model.get_basic_config()
- return ( cfe ({ option = option, service = service, info = info, mdebug=self.clientdata }) )
+ return ( cfe ({ service = service }) )
end
-advanced = function( self )
-
- local service = {}
- if self.clientdata.srvcmd then
- local srvcmd = self.clientdata.srvcmd
- if srvcmd == "start" or srvcmd == "stop" or srvcmd == "restart" then
- service.srvcmdresult, service.message = self.model.service_control( srvcmd )
- end
- end
-
- local info = {
- status=self.model.get_status(),
- version = self.model.get_squid_version(),
- autostart = self.model.get_autostart(),
- srvctrl = { value = srvctrl}
- }
-
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
-
- if self.clientdata.cmd then
- if self.clientdata.cmd == "save" then
- service.message = self.model.update_adv_config( self.clientdata.config )
- end
- end
-
- service.status = self.model.get_status()
- service.config = self.model.get_adv_config()
-
- return ( cfe ({ option = option, service = service, info = info }) )
+expert = function( self )
+ return controllerfunctions.handle_form(self, self.model.get_configfile, self.model.update_configfile, self.clientdata, "Save", "Edit Config", "Configuration Set")
end
digest = function( self )
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
-
local service = { message="", status="", config="" }
if self.clientdata.cmd then
@@ -198,18 +108,11 @@ digest = function( self )
service.config = self.model.get_digest_userlist()
- return ( cfe ({ option = option, service = service }) )
+ return ( cfe ({ service = service }) )
end
saccess = function( self )
- local option = { script = self.conf.script,
- prefix = self.conf.prefix,
- controller = self.conf.controller,
- action = self.conf.action,
- extra = ""
- }
-
local service = { message="", status="", config="" }
if self.clientdata.cmd then
@@ -224,7 +127,7 @@ saccess = function( self )
service.config = self.model.get_saccess()
- return ( cfe ({ option = option, service = service }) )
+ return ( cfe ({ service = service }) )
end