summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-02 19:37:37 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-02 19:37:37 +0000
commitbc8c34d81a8e90a9d9de22cb313a8738c86bb15c (patch)
tree5dfc604f959bfcf65936899a7ac8b148f747cca6
parent997b4dcd33463841aa8f1ca6d59dea7bc9d38ae9 (diff)
downloadacf-core-bc8c34d81a8e90a9d9de22cb313a8738c86bb15c.tar.bz2
acf-core-bc8c34d81a8e90a9d9de22cb313a8738c86bb15c.tar.xz
Changed interfaces to use controllerfunctions.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1268 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--lib/controllerfunctions.lua5
-rw-r--r--lib/viewfunctions.lua17
2 files changed, 21 insertions, 1 deletions
diff --git a/lib/controllerfunctions.lua b/lib/controllerfunctions.lua
index 23e57d4..53ef927 100644
--- a/lib/controllerfunctions.lua
+++ b/lib/controllerfunctions.lua
@@ -1,6 +1,6 @@
module(..., package.seeall)
-function handle_form(self, getFunction, setFunction, clientdata, option, label, descr)
+function handle_form(self, getFunction, setFunction, clientdata, option, label, descr, redirectOnSuccess)
local form = getFunction()
if clientdata[option] then
@@ -25,6 +25,9 @@ function handle_form(self, getFunction, setFunction, clientdata, option, label,
form.descr = descr
end
form = self:redirect_to_referrer(form)
+ if redirectOnSuccess and not form.errtxt then
+ self:redirect(redirectOnSuccess)
+ end
else
form = self:redirect_to_referrer() or form
end
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index 27320a6..45701d6 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -171,3 +171,20 @@ function displayform(myform, order)
io.write('</DL>\n')
io.write('</FORM>')
end
+
+function displaycommandresults(commands, session)
+ local cmdresult = {}
+ for i,cmd in ipairs(commands) do
+ if session[cmd.."result"] then
+ cmdresult[#cmdresult + 1] = session[cmd.."result"]
+ session[cmd.."result"] = nil
+ end
+ end
+ if #cmdresult > 0 then
+ io.write("<H1>Command Result</H1>\n<DL>\n")
+ for i,result in ipairs(cmdresult) do
+ io.write(result.value:gsub("\n", "<BR>") .. "\n")
+ end
+ io.write("</DL>\n")
+ end
+end