diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-02-22 18:36:16 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-02-22 18:36:16 +0000 |
commit | c9b0ebbd3f0a467f253606a385235f1a8a1304d0 (patch) | |
tree | ba636f178b5344a4d963487f05325e7e7d5eb956 /tinydns-status-html.lsp | |
parent | 800060937ee9a859baa2157e4912a1e064ee6ca2 (diff) | |
download | acf-tinydns-c9b0ebbd3f0a467f253606a385235f1a8a1304d0.tar.bz2 acf-tinydns-c9b0ebbd3f0a467f253606a385235f1a8a1304d0.tar.xz |
The status-tab is starting to take shape. We need to figure out howto section the data and howto sort it.
I have some ide of filtering data based on hostname... but thats not working for now.
Hidden config-tab for now because its not working.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@766 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'tinydns-status-html.lsp')
-rw-r--r-- | tinydns-status-html.lsp | 117 |
1 files changed, 25 insertions, 92 deletions
diff --git a/tinydns-status-html.lsp b/tinydns-status-html.lsp index 024bb13..03767d1 100644 --- a/tinydns-status-html.lsp +++ b/tinydns-status-html.lsp @@ -41,21 +41,21 @@ displayinfo(myform,tags,"viewonly") <H2>PROGRAM SPECIFIC OPTIONS/INFORMATION</H2> <? -local myform = form.status.locations +local myform = form.config.locations --displayinfo(myform,tags) io.write("<DL>") --for k,v in pairs(tags) do if (myform) and (myform.value) then local val = myform - io.write("\t<DT") + io.write("\n\t<DT") if (#val.errtxt > 0) then -- val.class = "error" io.write(" class='error'") end - io.write(">" .. val.label .. "</DT>\n") + io.write(">" .. val.label .. "</DT>") - io.write("\t\t<DD>\n") + io.write("\n\t\t<DD>") for k,v in pairs(myform.value) do io.write("<IMG SRC='/static/tango/16x16/places/start-here.png' width='16' height='16' alt> <B>" .. tostring(k) .. "</B>") for kk,vv in pairs(v) do @@ -64,9 +64,9 @@ if (myform) and (myform.value) then io.write("<BR>") 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") + if (val.descr) and (#val.descr > 0) then io.write("\n\t\t<P CLASS='descr'>" .. string.gsub(val.descr, "\n", "<BR>") .. "</P>") end + if (#val.errtxt > 0) then io.write("\n\t\t<P CLASS='error'>" .. string.gsub(val.errtxt, "\n", "<BR>") .. "</P>") end + io.write("\n\t\t</DD>") end --end io.write("</DL>") @@ -79,19 +79,19 @@ local function recurseoutput(table,cnt) cnt = cnt + 1 for k,v in pairs(table or {}) do if (type(v["name"]) == "string") then - io.write("<IMG SRC='/static/tango/16x16/devices/computer.png' width='16' height='16' alt STYLE='margin-left:"..cnt.. - "0px'><SPAN STYLE='font-weight:bold;'> ".. tostring(v["label"]) .. "</SPAN><BR>") + io.write("\n\t\t\t<IMG SRC='/static/tango/16x16/devices/computer.png' width='16' height='16' alt STYLE='margin-left:"..cnt.. + "0px'><SPAN STYLE=''> ".. tostring(v["label"]) .. "</SPAN><BR>") if (#v > 0) then - io.write("<TABLE STYLE='margin-left:"..( cnt + 3).."0px;'>") + io.write("\n\t\t\t<TABLE STYLE='margin-left:90px;'>") for i=1,#v do if (type(v[i]["label"]) == "string") then - io.write("<TR><TD STYLE='padding-right:20px;font-weight:bold;'>".. tostring(v[i]["label"]) .. "</TD><TD WIDTH='99%'>".. tostring(v[i]["value"]) .."</TD></TR>") + io.write("\n\t\t\t\t<TR>\n\t\t\t\t\t<TD WIDTH='160px' STYLE=''>".. tostring(v[i]["label"]) .. ":</TD>\n\t\t\t\t\t<TD>".. tostring(v[i]["value"]) .."</TD>\n\t\t\t\t</TR>") end end - io.write("</TABLE>") + io.write("\n\t\t\t</TABLE>") end else - io.write("<SPAN STYLE='margin-left:"..cnt.."0px;font-weight:bold;'> ".. + io.write("\n\t\t\t<SPAN STYLE='margin-left:"..cnt.."0px;font-weight:bold;'> ".. tostring(k) .. "</SPAN><BR>") recurseoutput(v,cnt) end @@ -100,90 +100,23 @@ end ?> <? -local myform = form.status.domains -if (myform) and (myform.value) then - io.write("\t<DT") - io.write(">" .. myform.label .. "</DT>\n") - io.write("\t\t<DD>\n") - - for k,v in pairs(myform.value) do - recurseoutput(v) - end - ---[[ -local function recursedir(path, filearray) - local k,v - for k,v in pairs(posix.dir(path) or {}) do - -- Ignore files that begins with a '.' - if not string.match(v, "^%.") then - local f = path .. "/" .. v - -- If subfolder exists, list files in this subfolder - if (posix.stat(f).type == "directory") then - recursedir(f, filearray) - else - table.insert(filearray, f) - end - end - end -end ---]] +local tags = {"nsourdomain", "nsdomain", "host", "alias", "mx", "ptr", "cname", "soa", "generic" } +local myform = form.config +io.write("<DL>") +for k,v in pairs(tags) do + local myform = myform[v] + if (myform) and (myform.value) then + io.write("\n\t<DT") + io.write(">" .. myform.label .. "</DT>") + io.write("\n\t\t<DD>") ---[[ - local output = k - io.write("<SPAN STYLE='margin-left:10px;font-weight:bold;'>".. k .. "</SPAN><BR>") - if (#v == 0) then - for k1,v1 in pairs(v) do - output = k1 .. "." .. output - io.write("<SPAN STYLE='margin-left:20px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - if (#v1 == 0) then - for k2,v2 in pairs(v1) do - output = k2 .. "." .. output - io.write("<SPAN STYLE='margin-left:30px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - if (#v2 == 0) then - for k3,v3 in pairs(v2) do - output = k3 .. "." .. output - io.write("<SPAN STYLE='margin-left:40px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - if (#v3 == 0) then - for k4,v4 in pairs(v3) do - output = k4 .. "." .. output - io.write("<SPAN STYLE='margin-left:50px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - if (#v4 == 0) then - for k5,v5 in pairs(v4) do - output = k5 .. "." .. output - io.write("<SPAN STYLE='margin-left:60px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - if (#v5 == 0) then - for k6,v6 in pairs(v5) do - output = k6 .. "." .. output - io.write("<SPAN STYLE='margin-left:70px;font-weight:normal;font-weight:bold;'>".. output .. "</SPAN><BR>") - end - else - computer(output,7) - end - end - else - computer(output,6) - end - end - else - computer(output,5) - end - end - else - computer(output,5) - end - end - else - computer(output,5) - end - end - else - computer(output,4) + for k,v in pairs(myform.value) do + recurseoutput(v) end + io.write("\n\t\t</DD>") end - --]] end io.write("</DL>") ---]==] ?> <? |