diff options
author | Zach LeBar <zach@zachlebar.com> | 2012-03-30 20:54:16 +0000 |
---|---|---|
committer | Zach LeBar <zach@zachlebar.com> | 2012-03-30 20:54:16 +0000 |
commit | 94d2fdb5e7dc424efa0409d2617d3241e4daaa35 (patch) | |
tree | f822bf61b370eb76a5bfe05de1e63a3cc2ef680e /chrony-model.lua | |
parent | c2efa6165c6ea2b1a8cf0a8bd7995d2094164d7a (diff) | |
download | acf-chrony-94d2fdb5e7dc424efa0409d2617d3241e4daaa35.tar.bz2 acf-chrony-94d2fdb5e7dc424efa0409d2617d3241e4daaa35.tar.xz |
Fixing acf-chrony to work with changes made to acf-core.
Removing the use of controllerfunctions.lua and using the new 'handle_form()' found in acf_www-controller.lua. Also using 'handle_form()' in place of 'redirect_to_referrer()'.
Diffstat (limited to 'chrony-model.lua')
-rw-r--r-- | chrony-model.lua | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/chrony-model.lua b/chrony-model.lua index 84b9aaa..3f3f9ed 100644 --- a/chrony-model.lua +++ b/chrony-model.lua @@ -2,9 +2,10 @@ module(..., package.seeall) -- Load libraries require("modelfunctions") -require("format") -require("fs") -require("validator") +format = require("acf.format") +fs = require("acf.fs") +validator = require("acf.validator") +processinfo = require("acf.processinfo") -- Set variables local configfile = "/etc/chrony/chrony.conf" @@ -66,7 +67,15 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function startstop_service(action) +function get_startstop(clientdata) + return modelfunctions.get_startstop(processname) +end + +function startstop_service(startstop, action) + return modelfunctions.startstop_service(startstop, action) +end + +function old_startstop_service(action) local result = modelfunctions.startstop_service(processname, action) table.insert(result.value.actions.value, "Online") table.insert(result.value.actions.value, "Offline") @@ -211,22 +220,25 @@ function update_keyfiledetails(filedetails) return get_keyfilestatus(modelfunctions.setfiledetails(filedetails, {keyfile})) end -function enable_keyfile() - local result = cfe({ value="Enabled key file", label="Enable Key file result" }) +function get_enable_keyfile() + local result = {} + return cfe({ type="group", value=result, label="Enable Key File" }) +end + +function enable_keyfile(enablerequest) local config = get_config() config.value.keyfile.value = keyfile config = update_config(config) if config.errtxt then - result.value = "" - result.errtxt = {config.errtxt} + enablerequest.errtxt = {config.errtxt} for name,val in pairs(config.value) do if val.errtxt then - table.insert(result.errtxt, name.." - "..val.errtxt) + table.insert(enablerequest.errtxt, name.." - "..val.errtxt) end end - result.errtxt = table.concat(result.errtxt, "\n") + enablerequest.errtxt = table.concat(enablerequest.errtxt, "\n") end - return result + return enablerequest end function get_filedetails() |