Commit 77544fd4 authored by Ted Trask's avatar Ted Trask

Create HTML views for update/create/delete tableentry to group null and...

Create HTML views for update/create/delete tableentry to group null and default checkboxes with the value
parent 18d3f4a3
<% local form, viewlibrary, page_info, session = ... %>
<% htmlviewfunctions = require("htmlviewfunctions") %>
<% html = require("acf.html") %>
<%
local header_level = htmlviewfunctions.displaysectionstart(form, page_info)
local header_level2 = htmlviewfunctions.incrementheader(header_level)
htmlviewfunctions.displayformstart(form, page_info)
htmlviewfunctions.displayformitem(form.value.connection, "connection", header_level2)
htmlviewfunctions.displayformitem(form.value.table, "table", header_level2)
htmlviewfunctions.displaysectionstart(form.value.fields, nil, header_level2)
htmlviewfunctions.displayinfo(form.value.fields)
local order = {}
local tmporder = {}
for name,item in pairs(form.value.fields.value) do
if tonumber(item.seq) then
tmporder[#tmporder+1] = {seq=tonumber(item.seq), name=name}
end
end
if #tmporder>0 then
table.sort(tmporder, function(a,b) if a.seq ~= b.seq then return a.seq < b.seq else return a.name < b.name end end)
for i,val in ipairs(tmporder) do
order[#order+1] = val.name
end
end
for x,name in ipairs(order) do
--htmlviewfunctions.displayformitem(form.value.fields.value[name], name, header_level2, "fields")
local myitem = form.value.fields.value[name]
-- Set the id so the label 'for' can point to it
myitem.id = "fields."..name
header_level = htmlviewfunctions.displayitemstart(myitem, nil, header_level2)
if 0 <= header_level then
io.write(html.html_escape(myitem.label))
end
htmlviewfunctions.displayitemmiddle(myitem, nil, header_level2)
htmlviewfunctions.displayformitem(myitem, name, -1, "fields")
if not myitem.readonly and form.value.defaults and form.value.defaults.value[name] then
form.value.defaults.value[name].descr = "Default"
htmlviewfunctions.displayformitem(form.value.defaults.value[name], name, -1, "defaults")
end
if not myitem.readonly and form.value.nulls and form.value.nulls.value[name] then
form.value.nulls.value[name].descr = "Null"
htmlviewfunctions.displayformitem(form.value.nulls.value[name], name, -1, "nulls")
end
htmlviewfunctions.displayitemend(myitem, nil, header_level2)
end
htmlviewfunctions.displaysectionend(header_level2)
htmlviewfunctions.displayformend(form, header_level2)
htmlviewfunctions.displaysectionend(header_level)
%>
db-createtableentry-html.lsp
\ No newline at end of file
db-createtableentry-html.lsp
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment