summaryrefslogtreecommitdiffstats
path: root/lib/viewfunctions.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2011-10-17 13:03:47 +0000
committerTed Trask <ttrask01@yahoo.com>2011-10-17 13:29:46 +0000
commit262ed0ee86af10c83e4878f67c167de9f29188a0 (patch)
tree207b5a031afc72c707aae64afb46358b49107f94 /lib/viewfunctions.lua
parent133d79d79dd73f573256905b90895163a9948688 (diff)
downloadacf-core-262ed0ee86af10c83e4878f67c167de9f29188a0.tar.bz2
acf-core-262ed0ee86af10c83e4878f67c167de9f29188a0.tar.xz
Added logrotate script for acf.log
(cherry picked from commit aa581098ea396d65680e4ccee0db6e323c3c0ba2)
Diffstat (limited to 'lib/viewfunctions.lua')
-rw-r--r--lib/viewfunctions.lua40
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index 5f923f5..67f839b 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -20,6 +20,46 @@ function getlabel(myitem, value)
return value
end
+function displayitemcustom(myitem, header_level)
+ if not myitem then return end
+ if myitem.type == "group" then
+ header_level = header_level or 2
+ io.write("<H"..tostring(header_level)..">"..html.html_escape(myitem.label).."</H"..tostring(header_level)..">")
+ if myitem.descr then io.write('<P CLASS="descr">' .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
+ if myitem.errtxt then io.write('<P CLASS="error">' .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
+ local seqorder = {}
+ local order = {}
+ for name,item in pairs(myitem.value) do
+ if tonumber(item.seq) then
+ seqorder[#seqorder+1] = {seq=tonumber(item.seq), name=name}
+ else
+ order[#order+1] = name
+ end
+ end
+ table.sort(seqorder, function(a,b) if a.seq ~= b.seq then return a.seq > b.seq else return a.name > b.name end end)
+ table.sort(order)
+ for i,val in ipairs(seqorder) do
+ table.insert(order, 1, val.name)
+ end
+ for x,name in ipairs(order) do
+ if myitem.value[name] then
+ displayitemcustom(myitem.value[name], tonumber(header_level)+1)
+ end
+ end
+ elseif myitem.type ~= "hidden" then
+ io.write("<DT")
+ if myitem.errtxt then
+ myitem.class = "error"
+ io.write(' class="error"')
+ end
+ io.write(">" .. html.html_escape(myitem.label) .. "</DT>\n")
+ io.write("<DD>")
+ io.write(string.gsub(html.html_escape(tostring(myitem.value)), "\n", "<BR>") .. "\n")
+ if myitem.descr then io.write("<P CLASS='descr'>" .. string.gsub(html.html_escape(myitem.descr), "\n", "<BR>") .. "</P>\n") end
+ if myitem.errtxt then io.write("<P CLASS='error'>" .. string.gsub(html.html_escape(myitem.errtxt), "\n", "<BR>") .. "</P>\n") end
+ io.write("</DD>\n")
+ end
+end
function displayitem(myitem)
if not myitem then return end
io.write("<DT")