diff options
author | Zach LeBar <zach@zachlebar.com> | 2012-03-21 15:06:32 +0000 |
---|---|---|
committer | Zach LeBar <zach@zachlebar.com> | 2012-03-21 15:09:16 +0000 |
commit | 0874f88bc25066248c28b16d3bbf1ab5cd1f2611 (patch) | |
tree | 28ee52ea1b8a44eeff8453b6264953a2ab2665bd /rc-model.lua | |
parent | 6d638ac9d28eac2c144d229359b64c0edaee2b4d (diff) | |
download | acf-alpine-baselayout-0874f88bc25066248c28b16d3bbf1ab5cd1f2611.tar.bz2 acf-alpine-baselayout-0874f88bc25066248c28b16d3bbf1ab5cd1f2611.tar.xz |
Change all -controller.lua files to use new handle_form() functions found in acf_www-controller.lua instead of the controllerfunctions.lua version and also instead of redirect_to_referrer(). Made corresponding changes to vmail-model .lua to make everything work.HEADmaster
Diffstat (limited to 'rc-model.lua')
-rw-r--r-- | rc-model.lua | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/rc-model.lua b/rc-model.lua index 215d02d..1046a96 100644 --- a/rc-model.lua +++ b/rc-model.lua @@ -2,7 +2,7 @@ module (..., package.seeall) require("processinfo") require("modelfunctions") -require("fs") +fs = require("acf.fs") require("posix") local configpath = "/etc/runlevels/" @@ -30,7 +30,8 @@ status = function() return cfe({ type="structure", value=config, label="Init Runlevels" }) end -read_runlevels = function(servicename) +read_runlevels = function(clientdata) + local servicename = clientdata.servicename local value = {} value.servicename = cfe({ value=servicename or "", label="Service Name" }) value.runlevels = cfe({ type="multi", value={}, label="Service Runlevels", option=runlevels }) @@ -83,19 +84,11 @@ update_runlevels = function(service) return service end -handle_startstop = function(servicename, action) - local result = "" - local errtxt - local actions,errtxt = processinfo.daemon_actions(servicename) - if actions then - errtxt = nil - local reverseactions = {} - for i,act in ipairs(actions) do reverseactions[string.lower(act)] = i end - if reverseactions[string.lower(action)] then - result, errtxt = processinfo.daemoncontrol(servicename, action) - else - errtxt = "Unknown command!" - end - end - return cfe({ label="Start/Stop result", value=result, errtxt=errtxt }) +function get_startstop(clientdata) + return modelfunctions.get_startstop(clientdata.servicename) end + +function startstop_service(startstop) + return modelfunctions.startstop_service(startstop, clientdata.action) +end + |