summaryrefslogtreecommitdiffstats
path: root/interfaces-update-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'interfaces-update-html.lsp')
-rw-r--r--interfaces-update-html.lsp48
1 files changed, 38 insertions, 10 deletions
diff --git a/interfaces-update-html.lsp b/interfaces-update-html.lsp
index 09743f3..228e8e0 100644
--- a/interfaces-update-html.lsp
+++ b/interfaces-update-html.lsp
@@ -1,11 +1,45 @@
<? 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>Update Interface <?= form.value.name.value ?></h1>
<form action="<?= form.option.script .. "/" .. form.option.prefix ..
form.option.controller .. "/" .. form.option.action ..
form.option.extra ?>" method="POST">
-<? local myform = form.value
+<?
-- We redefine the list of tags from the model (iface_tags) because
-- the VIEW can choose the order to display the data. The Controller
@@ -14,15 +48,9 @@
-- In this case, we don't show "name" - since its already known
local tags = { "comment", "method", "address", "netmask", "gateway",
"hostname", "provider", "pre-up", "up", "down", "post-down", "cmd" }
+local myform = form.value
+displayinfo(myform,tags)
-for i,v in pairs(tags) do
- local val = myform[v] ?>
-<dt><? if (val.label) then io.write(val.label) else io.write (v) end ?></dt>
- <? if val.name == "" then
- val.name = v
- end
- ?>
- <dd><?= html.form[val.type](val) ?></dd>
-<? end ?>
+?>
</form>