diff options
-rwxr-xr-x | tinydns-config-html.lsp | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/tinydns-config-html.lsp b/tinydns-config-html.lsp new file mode 100755 index 0000000..eea9f6e --- /dev/null +++ b/tinydns-config-html.lsp @@ -0,0 +1,70 @@ +<? local form = ... ?> +<? +--[[ DEBUG INFORMATION +io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") +io.write(html.cfe_unpack(form)) +io.write("</span>") +--]] +?> +<? +function displayinfo(myform,tags,viewonly) + io.write("<DL>") + for k,v in pairs(tags) do + if (myform[v]) and (myform[v]["value"]) then + local val = myform[v] + io.write("\t<DT") + if (#val.errtxt > 0) then + val.class = "error" + io.write(" class='error'") + end + io.write(">" .. val.label .. "</DT>\n") + if (viewonly) then + io.write("\t\t<DD>" .. val.value .. "\n") + else + io.write("\t\t<DD>" .. html.form[val.type](val) .. "\n") + end + 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 +?> + +<H1>SYSTEM INFO</H1> +<? +local myform = form.status +local tags = { "status", "version", } +displayinfo(myform,tags,"viewonly") +?> + +<H1>CONFIG</H1> +<H2>General settings</H2> +<? +local myform = form.config +local tags = { "listen", } +displayinfo(myform,tags) +?> + +<? ---[[ ?> +<H1>DEGUGGING</H1> +<? +local myform = form.debug +local tags = {} +for k,v in pairs(myform) do + table.insert(tags,k) +end +displayinfo(myform,tags) +?> +<? --]] ?> + + +<? +--[[ DEBUG INFORMATION +io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>") +io.write(html.cfe_unpack(form)) +io.write("</span>") +--]] +?> + |