diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-07-04 13:31:13 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-07-04 13:31:13 +0000 |
commit | ed164e591fcd52f77c66f629ff00c216e4278f86 (patch) | |
tree | 7af2d09c720ce3717949833a5137fa585f352daf | |
parent | 060b3f4716e38a69d85ce104abbc21e384fb70a5 (diff) | |
download | acf-core-ed164e591fcd52f77c66f629ff00c216e4278f86.tar.bz2 acf-core-ed164e591fcd52f77c66f629ff00c216e4278f86.tar.xz |
Fixed expert page to work when prefix or controller has magic characters. Added public getenabled function to modelfunctions and made controllerfunctions work with it.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1273 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | app/expert-html.lsp | 3 | ||||
-rw-r--r-- | lib/controllerfunctions.lua | 2 | ||||
-rw-r--r-- | lib/modelfunctions.lua | 15 |
3 files changed, 10 insertions, 10 deletions
diff --git a/app/expert-html.lsp b/app/expert-html.lsp index c4a76cd..3639f11 100644 --- a/app/expert-html.lsp +++ b/app/expert-html.lsp @@ -6,7 +6,8 @@ end ?> <? -local func = haserl.loadfile(page_info.viewfile:gsub(page_info.prefix..page_info.controller..".*$", "/") .. "filedetails-html.lsp") +local pattern = string.gsub(page_info.prefix..page_info.controller, "[%(%)%.%%%+%-%*%?%[%]%^%$]", "%%%1") +local func = haserl.loadfile(page_info.viewfile:gsub(pattern..".*$", "/") .. "filedetails-html.lsp") func(form, viewlibrary, page_info, session) ?> diff --git a/lib/controllerfunctions.lua b/lib/controllerfunctions.lua index 53ef927..298eac6 100644 --- a/lib/controllerfunctions.lua +++ b/lib/controllerfunctions.lua @@ -47,7 +47,7 @@ function handle_startstop(self, startstopfunction, getstatusfunction, clientdata result = self:redirect_to_referrer(result) local status = getstatusfunction() - status = status.value.status + if status.value.status then status = status.value.status end return cfe({ type="group", value={status=status, result=result} }) end diff --git a/lib/modelfunctions.lua b/lib/modelfunctions.lua index 84c690b..0648f23 100644 --- a/lib/modelfunctions.lua +++ b/lib/modelfunctions.lua @@ -5,13 +5,15 @@ require("procps") require("daemoncontrol") require("processinfo") -local function process_status_text(procname) - local t = procps.pidof(procname) +function getenabled(processname) + local result = cfe({ label = "Program status" }) + local t = procps.pidof(processname) if (t) and (#t > 0) then - return "Enabled" + result.value = "Enabled" else - return "Disabled" + result.value = "Disabled" end + return result end function startstop_service(processname, action) @@ -30,10 +32,7 @@ function getstatus(processname, packagename, label) errtxt=errtxt, }) - status.status = cfe({ - label="Program status", - value=process_status_text(processname), - }) + status.status = getenabled(processname) local autostart_sequence, autostart_errtxt = processinfo.process_botsequence(processname) status.autostart = cfe({ |