summaryrefslogtreecommitdiffstats
path: root/lib/controllerfunctions.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-10-22 18:50:22 +0000
committerTed Trask <ttrask01@yahoo.com>2008-10-22 18:50:22 +0000
commit8997f1f6dc27262042a30c35266a95672e4406d4 (patch)
tree548e8a666a7aa8f6e39e76e47b0c150d44dd92f1 /lib/controllerfunctions.lua
parent7106e09511f1b873eaae17d2a6ae8bf008d06446 (diff)
downloadacf-core-8997f1f6dc27262042a30c35266a95672e4406d4.tar.bz2
acf-core-8997f1f6dc27262042a30c35266a95672e4406d4.tar.xz
Modified viewfunctions to split displayform, creating displayformstart and displayformend, to provide flexibility while still using the library. Also added support for hidden fields - including a common redir field. Removed redirectOnSuccess from controllerfunctions handle_form, and replaced it with the redir field. Removed redirectOnSuccess from controllers that used it and added handlecommandresults and redir entries to links and forms throughout many views. This will cause a redirect to the originating view when a form is successfully completed. acf_www-controller now includes orig_action in page_info to report the original action launched by the user.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1560 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/controllerfunctions.lua')
-rw-r--r--lib/controllerfunctions.lua15
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/controllerfunctions.lua b/lib/controllerfunctions.lua
index 5c3e559..90d31a4 100644
--- a/lib/controllerfunctions.lua
+++ b/lib/controllerfunctions.lua
@@ -43,7 +43,7 @@ function handle_clientdata(form, clientdata)
end
end
-function handle_form(self, getFunction, setFunction, clientdata, option, label, descr, redirectOnSuccess)
+function handle_form(self, getFunction, setFunction, clientdata, option, label, descr)
local form = getFunction()
if clientdata[option] then
@@ -53,11 +53,20 @@ function handle_form(self, getFunction, setFunction, clientdata, option, label,
if not form.errtxt and descr then
form.descr = descr
end
+
+ if clientdata.redir then
+ form.value.redir = cfe({ type="hidden", value=clientdata.redir, label="" })
+ end
form = self:redirect_to_referrer(form)
- if redirectOnSuccess and not form.errtxt then
- self:redirect(redirectOnSuccess)
+ if clientdata.redir and not form.errtxt then
+ form.value = form.descr -- make it a command result
+ form.descr = nil
+ self:redirect(clientdata.redir, form)
end
else
+ if clientdata.redir then
+ form.value.redir = cfe({ type="hidden", value=clientdata.redir, label="" })
+ end
form = self:redirect_to_referrer() or form
end