summaryrefslogtreecommitdiffstats
path: root/openntpd-status-html.lsp
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-02-29 15:52:45 +0000
committerMika Havela <mika.havela@gmail.com>2008-02-29 15:52:45 +0000
commitfffd98587d8467dfe8254689e43383031ca42b66 (patch)
tree95c172315175ceceb3cd27410450cda7341d0e5f /openntpd-status-html.lsp
parentae2b0e0d008d64568c91a578a6090dd44860e2ae (diff)
downloadacf-openntpd-fffd98587d8467dfe8254689e43383031ca42b66.tar.bz2
acf-openntpd-fffd98587d8467dfe8254689e43383031ca42b66.tar.xz
Changed so that everything uses acf instead.
Now every keypress reports back status for previous action. Information is presented next to the button recently pressed. git-svn-id: svn://svn.alpinelinux.org/acf/openntpd/trunk@782 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'openntpd-status-html.lsp')
-rw-r--r--openntpd-status-html.lsp74
1 files changed, 43 insertions, 31 deletions
diff --git a/openntpd-status-html.lsp b/openntpd-status-html.lsp
index f983398..69065af 100644
--- a/openntpd-status-html.lsp
+++ b/openntpd-status-html.lsp
@@ -1,37 +1,49 @@
-<? local view = ... ?>
-
-<h1>SYSTEM INFO</h1>
+<? 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>")
+--]]
+?>
-<dl>
-<dt>Program status</dt>
-<DD><? if (view.status.enabled) then io.write('Enabled') else io.write('Disabled') end ?></DD>
+<?
+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
+?>
-<dt>Program version</dt>
-<dd><?= view.status.version ?></dd>
-</dl>
+<H1>SYSTEM INFO</H1>
+<?
+local myform = form.status
+local tags = { "status", "version", }
+displayinfo(myform,tags,"viewonly")
+?>
<H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2>
-
-<dl>
-<? --[[ ?>
-<dt>Configured as server (listens)</dt>
-<dd><? io.write(view.status.listenstate) ?></dd>
-<? --]] ?>
-
-<dt>Sets time directly at startup</dt>
-<dd><? if (view.status.setstimeonstartup) then io.write("Yes") else io.write("No") end ?></dd>
-
-<dt>Current time</dt>
-<dd><? io.write(view.status.date) ?></dd>
-
-<dt>Previous time adjustment</dt>
-<dd><? io.write(view.status.timechanged) ?></dd>
-</dl>
-
-<?
---[[ DEBUG INFORMATION
-require("debugs")
-io.write(debugs.variables(view))
---]]
+<?
+local myform = form.status
+local tags = { "setstimeonstartup", "date", "timechanged", }
+displayinfo(myform,tags,"viewonly")
?>