diff options
-rw-r--r-- | tinydns-model.lua | 58 | ||||
-rw-r--r-- | tinydns-status-html.lsp | 19 |
2 files changed, 68 insertions, 9 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index 4d08a57..a466f6b 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -122,7 +122,7 @@ local function searchforconfigfiles() end -- Debug option (adds the sampleconfig content) - table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") +-- table.insert(configfiles, "/usr/share/acf/app/tinydns/sampleconfig.conf") end searchforconfigfiles() @@ -149,7 +149,15 @@ local function recursedomains(t,array,maxn,currnum) currnum = currnum - 1 -- FIXME: The current level should hold information on previous level too! if not (currnum == 0) then + +-- if (array) and (type(array[t[currnum]]) == "table") then +-- local k,v = pairs(array[t[currnum]]) do +-- end +-- end + if not (array[t[currnum]]) then +-- if not (array[(table.concat(t,"."))]) then +-- array[t[currnum]] = {} array[t[currnum]] = {} end recursedomains(t,array[t[currnum]],maxn,currnum) @@ -273,11 +281,53 @@ function getconfig() if (filecontent_table[1] == "&") then local descr=check_signs("prefix") domain = format.string_to_table(filecontent_table[2], "%.") + + if (domain[#domain] ~= "arpa") then + -- We rebuild the table and add previous level-information to the current level + for i = table.maxn(domain),2,-1 do + domain[i-1] = domain[i-1] .. "." .. domain[i] + end + + -- This is the main information on each object domaindetails = cfe ({ - name=filecontent_table[2], - label=descr[filecontent_table[1]], - value=filecontent_table[2], + name=filecontent_table[4], + label=filecontent_table[4], }) + -- Add details to the previous object + table.insert(domaindetails, cfe ({ + name=type, + label="Type:", + value=descr[filecontent_table[1]], + })) + table.insert(domaindetails, cfe ({ + name=domain, + label="Domain:", + value=filecontent_table[2], + })) + table.insert(domaindetails, cfe ({ + name=ip, + label="IP address:", + value=filecontent_table[3], + })) + table.insert(domaindetails, cfe ({ + name=ns, + label="Name server:", + value=filecontent_table[4], + })) + table.insert(domaindetails, cfe ({ + name=ttl, + label="TimeToLive:", + value=filecontent_table[5], + })) + + + table.insert(domaindetails, cfe ({ + name=debug, + label="Debug:", + value=table.concat(filecontent_table,":"), + })) + end + end local value = filecontent_table[2] diff --git a/tinydns-status-html.lsp b/tinydns-status-html.lsp index 5d5bd1d..024bb13 100644 --- a/tinydns-status-html.lsp +++ b/tinydns-status-html.lsp @@ -1,6 +1,6 @@ <? local form = ... ?> <? ----[[ DEBUG INFORMATION +--[[ 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>") @@ -78,11 +78,20 @@ local function recurseoutput(table,cnt) if not (cnt) then cnt=0 end cnt = cnt + 1 for k,v in pairs(table or {}) do - if (type(v) == "string") then - io.write("<IMG SRC='/static/tango/16x16/devices/computer.png' width='16' height='16' alt STYLE='margin-left:"..cnt.."0px'> ".. - tostring(v) .. "</SPAN><BR>") + 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>") + if (#v > 0) then + io.write("<TABLE STYLE='margin-left:"..( cnt + 3).."0px;'>") + 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>") + end + end + io.write("</TABLE>") + end else - io.write("<SPAN STYLE='margin-left:"..cnt.."0px;font-wegith:strong;'> ".. + io.write("<SPAN STYLE='margin-left:"..cnt.."0px;font-weight:bold;'> ".. tostring(k) .. "</SPAN><BR>") recurseoutput(v,cnt) end |