<% local form, viewlibrary, page_info, session = ... require("htmlviewfunctions") html = require("acf.html") format = require("acf.format") require("json") %> <% if page_info.action == "editdefinition" then %> <% end %> <% if form.descr then session.didresult = form.descr form.descr = nil end %> <% if session.didresult or form.errtxt then %>

Last Result

<% if form.errtxt then io.write('

' .. string.gsub(html.html_escape(form.errtxt), "\n", "
") .. " " .. html.html_escape(form.value.did.value) .. "
\n") for name,val in pairs(form.value) do if val.errtxt then io.write(string.gsub(html.html_escape(val.errtxt), "\n", "
").."
\n") end end io.write("

\n") form.errtxt = nil else %>

<%= string.gsub(html.html_escape(session.didresult), "\n", "
") %>

<% end %>
<% end %>

<%= html.html_escape(form.label) %>

<% htmlviewfunctions.displayformstart(form, page_info) %> <% local order = {"did", "description", "identification", "department", "rules", "lastchange", "available", "type"} if page_info.action ~= "createdefinition" then form.value.did.readonly = true form.value.lastchange.readonly = true form.value.available.type = "hidden" else form.value.lastchange.type = "hidden" end if page_info.action == "editdefinition" then form.value.rules.type = "hidden" elseif page_info.action == "editdefinitionextension" then form.value.rules.label = "Extension" form.value.rules.descr = nil form.value.rules.type = "text" form.value.rules.value = string.gsub(form.value.rules.value, ",.*", "") form.value.type.type = "hidden" end for i,name in ipairs(order) do htmlviewfunctions.displayformitem(form.value[name], name) end %> <% if page_info.action == "editdefinition" then %>

Rules

Rules are listed from least specific to most specific:

<% if form.value.rules.errtxt then %>

<%= string.gsub(html.html_escape(form.value.rules.errtxt), "\n", "
") %>

<% end %>

Save Changes

<% end %> <% htmlviewfunctions.displayformend(form) %>