summaryrefslogtreecommitdiffstats
path: root/lib/viewfunctions.lua
diff options
context:
space:
mode:
authorTed Trask <ttrask01@yahoo.com>2008-07-25 19:00:03 +0000
committerTed Trask <ttrask01@yahoo.com>2008-07-25 19:00:03 +0000
commit4bf00bc98b36c0233e1ea833571acffefe2ec73b (patch)
tree13379b4d21cedc5a3137a508db94e3e243d3d6de /lib/viewfunctions.lua
parent0b933c7c8b5daf0fd62d9f9dfef973b8383250f1 (diff)
downloadacf-core-4bf00bc98b36c0233e1ea833571acffefe2ec73b.tar.bz2
acf-core-4bf00bc98b36c0233e1ea833571acffefe2ec73b.tar.xz
Modified authenticator to allow reading/writing role-based options. Modified viewfunctions to display multi values that are not in options.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@1320 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/viewfunctions.lua')
-rw-r--r--lib/viewfunctions.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/viewfunctions.lua b/lib/viewfunctions.lua
index 62a87c6..19911a0 100644
--- a/lib/viewfunctions.lua
+++ b/lib/viewfunctions.lua
@@ -116,18 +116,36 @@ function displayformitem(myitem, name, viewtype)
-- FIXME multiple select doesn't work in haserl, so use series of checkboxes
--myitem.type = "select"
--myitem.multiple = "true"
+ myitem.class = nil
local tempname = myitem.name
local tempval = myitem.value or {}
local reverseval = {}
for x,val in ipairs(tempval) do
reverseval[val] = x
end
+ local reverseopt = {}
for x,val in ipairs(myitem.option) do
+ reverseopt[val] = x
myitem.value = val
myitem.checked = reverseval[val]
myitem.name = tempname .. "." .. x
io.write(html.form.checkbox(myitem) .. val .. "<br>\n")
end
+ -- Check for values not in options
+ if myitem.errtxt then
+ myitem.class = "error"
+ io.write('<p class="error">\n')
+ end
+ for x,val in ipairs(tempval) do
+ if not reverseopt[val] then
+ myitem.value = val
+ myitem.checked = true
+ io.write(html.form.checkbox(myitem) .. val .. "<br>\n")
+ end
+ end
+ if myitem.errtxt then
+ io.write('</p>\n')
+ end
myitem.name = tempname
myitem.value = tempval
elseif myitem.type == "boolean" then