summaryrefslogtreecommitdiffstats
path: root/viewfunctions.lua
diff options
context:
space:
mode:
Diffstat (limited to 'viewfunctions.lua')
-rw-r--r--viewfunctions.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/viewfunctions.lua b/viewfunctions.lua
new file mode 100644
index 0000000..ed590cf
--- /dev/null
+++ b/viewfunctions.lua
@@ -0,0 +1,38 @@
+module (..., package.seeall)
+
+function informationform(myform,tags)
+ io.write("<DL>")
+ for k,v in pairs(tags) do
+ if (myform[v]) then
+ local val = myform[v]
+ io.write("\t<DT")
+ if (#val.errtxt > 0) then io.write(" class='error'") end
+ io.write(">" .. val.label .. "</DT>\n")
+
+ io.write("\t\t<DD>" .. val.value .. "\n")
+ if (val.descr) and (#val.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>\n") end
+ if (#val.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>\n") end
+ io.write("\t\t</DD>\n")
+ end
+ end
+ io.write("</DL>")
+end
+
+function configform(myform,tags)
+ io.write("<DL>")
+ for k,v in pairs(tags) do
+ if (myform[v]) then
+ local val = myform[v]
+ io.write("\t<DT")
+ if (#val.errtxt > 0) then io.write(" class='error'") end
+ io.write(">" .. val.label .. "</DT>\n")
+
+ io.write("\t\t<DD>" .. html.form[val.type](val) .. "\n")
+ if (val.descr) and (#val.descr > 0) then io.write("\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>\n") end
+ if (#val.errtxt > 0) then io.write("\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>\n") end
+ io.write("\t\t</DD>\n")
+ end
+ end
+ io.write("</DL>")
+end
+