From 10e49f14d9d219a961a414b8c346435dcfc3b95d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Fri, 5 Jun 2015 22:12:42 -0400 Subject: Use cfe.print_errtxt in htmlviewfunctions.displaycommandresults and make sure results are cfes --- app/acf_www-controller.lua | 2 +- lib/htmlviewfunctions.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua index 7fdf998..1fd16d5 100644 --- a/app/acf_www-controller.lua +++ b/app/acf_www-controller.lua @@ -179,7 +179,7 @@ local redirect_to_referrer = function(self, result) elseif self.sessiondata[self.conf.action.."result"] then -- If we don't have a result, but there's a result in the session data, -- then we're a component redirected as above. Return the last result. - result = self.sessiondata[self.conf.action.."result"] + result = cfe(self.sessiondata[self.conf.action.."result"]) self.sessiondata[self.conf.action.."result"] = nil end return result diff --git a/lib/htmlviewfunctions.lua b/lib/htmlviewfunctions.lua index 3c9f34e..16a3945 100644 --- a/lib/htmlviewfunctions.lua +++ b/lib/htmlviewfunctions.lua @@ -329,7 +329,7 @@ function mymodule.displaycommandresults(commands, session, preserveerrors) local cmdresult = {} for i,cmd in ipairs(commands) do if session[cmd.."result"] then - cmdresult[#cmdresult + 1] = session[cmd.."result"] + cmdresult[#cmdresult + 1] = cfe(session[cmd.."result"]) if not preserveerrors or not session[cmd.."result"].errtxt then session[cmd.."result"] = nil end @@ -339,7 +339,7 @@ function mymodule.displaycommandresults(commands, session, preserveerrors) io.write('

Command Result

') for i,result in ipairs(cmdresult) do if type(result.value) == "string" and result.value ~= "" then io.write('

' .. string.gsub(html.html_escape(result.value), "\n", "
") .. "

") end - mymodule.displayinfo(result) + if result.errtxt then io.write('

' .. string.gsub(html.html_escape(result:print_errtxt()), "\n", "
") .. '

') end end io.write('
') end -- cgit v1.2.3