summaryrefslogtreecommitdiffstats
path: root/shorewall-check-html.lsp
diff options
context:
space:
mode:
Diffstat (limited to 'shorewall-check-html.lsp')
-rw-r--r--shorewall-check-html.lsp91
1 files changed, 20 insertions, 71 deletions
diff --git a/shorewall-check-html.lsp b/shorewall-check-html.lsp
index 3bd8831..7cfe4bf 100644
--- a/shorewall-check-html.lsp
+++ b/shorewall-check-html.lsp
@@ -1,51 +1,22 @@
-<? local form = ... ?>
-
-<?
-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
+<? local form = ...
+require("viewfunctions")
?>
<?
-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
+--[[ DEBUG INFORMATION
+io.write("<H1>DEBUGGING</H1><span style='color:red'><H2>DEBUG INFO: CFE</H2>")
+io.write(html.cfe_unpack(view))
+io.write("</span>")
+--]]
?>
-
<H1>SYSTEM INFO</H1>
+<DL>
<?
local myform = form.status
local tags = { "status", "version", "autostart", }
-informationform(myform,tags)
+displayinfo(myform,tags,"viewonly")
?>
+</DL>
<H1>CONFIGURATION</H1>
<? local myform = form.config ?>
@@ -55,37 +26,15 @@ informationform(myform,tags)
io.write(html.form[form.config.checkresult.type](form.config.checkresult))
?>
-
-<?
-local cmdform = form.management
-local tags = { "restart" }
-if (cmdform) and (cmdform[tags[1]]) then
-?>
- <form name="management" action="" method="POST">
- <H1>MANAGEMENT</H1>
- <dl>
- <dt><?= cmdform[tags[1]]["label"] ?></dt>
- <dd>
- <? for k,v in pairs(tags) do ?>
- <? if (cmdform[v]) then ?>
- <? io.write(html.form[cmdform[v].type](cmdform[v])) ?>
- <? end ?>
- <? end ?>
- </dd>
-
- <? if (form.cmdmanagement) and (#form.cmdmanagement.descr > 0) then ?>
- <dt>Previous action result</dt>
- <dd><pre><?= form.cmdmanagement.descr ?></pre></dd>
- <? end ?>
- </dl>
- </form>
-
-<? end ?>
-
+<form name="management" action="" method="POST">
<?
---[[ 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>")
---]]
+-- Management buttons
+local myform = form.management
+local tags = { "restart" }
+if (myform) then
+ io.write("<H1>MANAGEMENT</H1>\n<DL>")
+ displaymanagement(myform,tags)
+ io.write("</DL>")
+end
?>
+</form>