From f1e2dd41fb3b71f2f0e5082cc057ad33a7c6a0d0 Mon Sep 17 00:00:00 2001 From: Mika Havela Date: Wed, 13 Feb 2008 18:36:50 +0000 Subject: First view shows some basic information git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@717 ab2d0c66-481e-0410-8bed-d214d4d58bed --- tinydns-model.lua | 18 +----------------- tinydns-status-html.lsp | 39 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 20 deletions(-) diff --git a/tinydns-model.lua b/tinydns-model.lua index 176da46..223ce44 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -11,7 +11,7 @@ local configfile = "???" local function get_version() local cmd = "/sbin/apk_version -vs " .. processname .." 2>/dev/null" local f = io.popen( cmd ) - local cmd_output_result = f:read("*l") + local cmd_output_result = string.match(f:read("*l"),"^%S*") or "Unknown" f:close() return cmd_output_result end @@ -20,7 +20,6 @@ end -- PUBLIC FUNCTIONS function getstatus() --- local opts = getconfig() local status = {} status.version = cfe({ name = "version", label="Program version", @@ -30,21 +29,6 @@ function getstatus() label="Program status", value=procps.pidof(processname), }) - ---[[ - if (opts["remotelogging"]) and not ((opts["remotelogging"]["value"] ~= "") and not (opts["localandnetworklog"]["value"])) then - status.logfile = cfe({ name="logfile", - label="Locally logging to", - value=opts["logfile"]["value"], - }) - end - if (opts["SYSLOGD_OPTS"]) and (opts["SYSLOGD_OPTS"]["-R"]) and (opts["SYSLOGD_OPTS"]["-R"] ~= "") then - status.remote = cfe({ name="remotelogging", - label="Remote logging to", - value=opts["SYSLOGD_OPTS"]["-R"], - }) - end ---]] return status end diff --git a/tinydns-status-html.lsp b/tinydns-status-html.lsp index 2a9ac66..20b5dcc 100644 --- a/tinydns-status-html.lsp +++ b/tinydns-status-html.lsp @@ -1,14 +1,47 @@ DEBUGGING

DEBUG INFO: CFE

") io.write(html.cfe_unpack(form)) io.write("
") --]] ?> - ") + for k,v in pairs(tags) do + if (myform[v]) then + local val = myform[v] + io.write("\t 0) then io.write(" class='error'") end + io.write(">" .. val.label .. "\n") + + io.write("\t\t
" .. val.value .. "\n") + if (val.descr) and (#val.descr > 0) then io.write("\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

\n") end + if (#val.errtxt > 0) then io.write("\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

\n") end + io.write("\t\t
\n") + end + end + io.write("") +end + +function configform(myform,tags) + io.write("
") + for k,v in pairs(tags) do + if (myform[v]) then + local val = myform[v] + io.write("\t 0) then io.write(" class='error'") end + io.write(">" .. val.label .. "\n") + + io.write("\t\t
" .. html.form[val.type](val) .. "\n") + if (val.descr) and (#val.descr > 0) then io.write("\t\t

" .. string.gsub(val.descr, "\n", "
") .. "

\n") end + if (#val.errtxt > 0) then io.write("\t\t

" .. string.gsub(val.errtxt, "\n", "
") .. "

\n") end + io.write("\t\t
\n") + end + end + io.write("
") +end ?>

SYSTEM INFO

-- cgit v1.2.3