diff options
author | Ted Trask <ttrask01@yahoo.com> | 2008-10-22 20:36:29 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2008-10-22 20:36:29 +0000 |
commit | bf06405854b19097e4aa1d3981f5e78727331d8c (patch) | |
tree | 2f9659d15071723d342c435aeeb5d92bfd0b691e /lib/viewfunctions.lua | |
parent | 8997f1f6dc27262042a30c35266a95672e4406d4 (diff) | |
download | acf-core-bf06405854b19097e4aa1d3981f5e78727331d8c.tar.bz2 acf-core-bf06405854b19097e4aa1d3981f5e78727331d8c.tar.xz |
Modified viewfunctions displaycommandresults to not delete the error results of a form so the form can still display it. Modified a bunch of views to display the results of component forms. Also added code to displayform and displayformstart to automatically generate the action if passed page_info.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1561 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/viewfunctions.lua')
-rw-r--r-- | lib/viewfunctions.lua | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua index c3e4b6a..693b3d8 100644 --- a/lib/viewfunctions.lua +++ b/lib/viewfunctions.lua @@ -165,8 +165,11 @@ function displayformitem(myitem, name, viewtype) io.write("</DD>\n") end -function displayformstart(myform) +function displayformstart(myform, page_info) if not myform then return end + if not myform.action and page_info then + myform.action = page_info.script .. page_info.prefix .. page_info.controller .. "/" .. page_info.action + end if myform.descr then io.write('<P CLASS="descr">' .. string.gsub(myform.descr, "\n", "<BR>") .. "</P>\n") end if myform.errtxt then io.write('<P CLASS="error">' .. string.gsub(myform.errtxt, "\n", "<BR>") .. "</P>\n") end io.write('<form action="' .. (myform.action or "") .. '" method="POST">\n') @@ -175,9 +178,9 @@ function displayformstart(myform) end end -function displayform(myform, order, finishingorder) +function displayform(myform, order, finishingorder, page_info) if not myform then return end - displayformstart(myform) + displayformstart(myform, page_info) io.write('<DL>\n') local reverseorder= {["redir"]=0} if order then @@ -221,12 +224,14 @@ function displayformend(myform) io.write('</FORM>') end -function displaycommandresults(commands, session) +function displaycommandresults(commands, session, preserveerrors) local cmdresult = {} for i,cmd in ipairs(commands) do if session[cmd.."result"] then cmdresult[#cmdresult + 1] = session[cmd.."result"] - session[cmd.."result"] = nil + if not preserveerrors or not session[cmd.."result"].errtxt then + session[cmd.."result"] = nil + end end end if #cmdresult > 0 then |