summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-02-22 18:36:16 +0000
committerMika Havela <mika.havela@gmail.com>2008-02-22 18:36:16 +0000
commitc9b0ebbd3f0a467f253606a385235f1a8a1304d0 (patch)
treeba636f178b5344a4d963487f05325e7e7d5eb956
parent800060937ee9a859baa2157e4912a1e064ee6ca2 (diff)
downloadacf-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
-rwxr-xr-xsampleconfig.conf1
-rw-r--r--tinydns-controller.lua78
-rw-r--r--tinydns-model.lua445
-rw-r--r--tinydns-status-html.lsp117
-rw-r--r--tinydns.menu2
5 files changed, 372 insertions, 271 deletions
diff --git a/sampleconfig.conf b/sampleconfig.conf
index a3f3c07..e3e7b7f 100755
--- a/sampleconfig.conf
+++ b/sampleconfig.conf
@@ -19,7 +19,6 @@ Zme.org:ns3.you.org.iseng.me.org:2007082204:1200:2048:864000:3600:::
=www.me.org:208.74.141.33:3600::
=me.org:208.74.141.33:3600::
=test.me.org:208.74.141.33:3600::
-=levelseven.levelsix.levelfive.levelfour.levelthree.leveltwo.levelone:208.74.141.33:3600::
=www.test.me.org:208.74.141.33:3600::
Cdownload.me.org:download.me.org.google.com:3600::
diff --git a/tinydns-controller.lua b/tinydns-controller.lua
index 43d6038..8021ae3 100644
--- a/tinydns-controller.lua
+++ b/tinydns-controller.lua
@@ -25,11 +25,85 @@ local function getstatus(self)
end
function status(self)
- return { status=getstatus(self) }
+ local config = {}
+ local locations=self.model.getlocations(self)
+ local availablesigns = self.model.check_signs("prefix")
+
+ config.locations = cfe ({
+ name="locations",
+ label="Locations",
+ value=locations,
+ })
+
+ local prefix = "."
+ config.nsourdomain = cfe ({
+ name="nsourdomain",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "&"
+ config.nsdomain = cfe ({
+ name="nsdomain",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "="
+ config.host = cfe ({
+ name="host",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "+"
+ config.alias = cfe ({
+ name="alias",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "@"
+ config.mx = cfe ({
+ name="mx",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "^"
+ config.ptr = cfe ({
+ name="ptr",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "C"
+ config.cname = cfe ({
+ name="cname",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = "Z"
+ config.soa = cfe ({
+ name="soa",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+ local prefix = ":"
+ config.generic = cfe ({
+ name="generic",
+ label=availablesigns[prefix],
+ value=self.model.getconfigobjects(self,prefix),
+ })
+
+
+ return { status=getstatus(self), config=config }
end
function config(self)
- local config = self.model.getconfig(self)
+ local config = self.model.getconfigobjects(self)
local debug = self.model.getdebug(self)
return ({
status=getstatus(self),
diff --git a/tinydns-model.lua b/tinydns-model.lua
index a466f6b..286689f 100644
--- a/tinydns-model.lua
+++ b/tinydns-model.lua
@@ -21,6 +21,8 @@ else
datafile = "/var/cache/data"
end
+--configdir = "hidden for the moment - This row is here only for debug purpose"
+
-- ################################################################################
-- LOCAL FUNCTIONS
@@ -38,26 +40,6 @@ local function get_version()
return cmd_output_result,cmd_output_error
end
--- This function could be used to check that valid parameters are used in different places
-local function check_signs(sign)
- local output = {}
- local output = {prefix={
- ['.']="Name server for your domain",
- ['&']="Name server",
- ['=']="Host",
- ['+']="Alias",
- ['@']="Mail exchanger",
- ['=']="Host",
- ['^']="PTR record",
- ['C']="Canonical Name",
- ['Z']="SOA record",
- [':']="Generic record",
- ['%']="Client location",
- }}
- output = output[sign]
- return output
-end
-
-- Return a table with the config-content of a file
-- Commented/Blank lines are ignored
local function get_value_from_file(file)
@@ -101,12 +83,6 @@ local function split_config_items(orgitem)
output = format.string_to_table(string.sub(orgitem,1,1) .. ":" .. string.sub(orgitem,2),delimiter)
output.type = check_signs("prefix")
output.type = output.type[string.sub(orgitem,1,1)] or "unknown"
--- for k,v in pairs(cnffile) do
--- local configcontent = get_value_from_file(v)
--- if (configcontent) then
--- table.insert(configfiles, v)
--- end
--- end
return output
end
@@ -122,7 +98,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()
@@ -147,17 +123,9 @@ end
local function recursedomains(t,array,maxn,currnum)
if not (currnum) then currnum = maxn + 1 end
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)
@@ -214,11 +182,30 @@ end
-- ################################################################################
-- PUBLIC FUNCTIONS
+-- This function could be used to check that valid parameters are used in different places
+function check_signs(sign)
+ local output = {}
+ local output = {prefix={
+ ['.']="Name server for your domain",
+ ['&']="Name server",
+ ['=']="Host",
+ ['+']="Alias",
+ ['@']="Mail exchanger",
+ ['=']="Host",
+ ['^']="PTR record",
+ ['C']="Canonical Name",
+ ['Z']="SOA record",
+ [':']="Generic record",
+ ['%']="Client location",
+ }}
+ output = output[sign]
+ return output
+end
+
-- Present some general status
function getstatus()
local status = {}
local version,versionerrtxt = get_version()
- local config = getconfig()
status.version = cfe({ name = "version",
label="Program version",
value=version,
@@ -229,29 +216,20 @@ function getstatus()
value=procps.pidof(processname),
})
- status.locations = config.locations
- status.domains = config.domains
-
return status
end
-- Return config-information
-function getconfig()
+function getlocations(self,filter_type)
local config = {}
local configobjects = {}
local locations = {}
- local domains = {}
local debug
local version,versionerrtxt = get_version()
local listenaddr = getopts.getoptsfromfile_onperline(configfile,"IP") or {}
- config.listen = cfe({
- name = "listen",
- label="IP address to listen on",
- value=listenaddr.IP or "",
- })
- --Loop through all available configfiles
+ -- Loop through all available configfiles
for k,v in pairs(configfiles) do
local filecontent, fileresult
fileresult, filecontent = get_value_from_file(v)
@@ -275,14 +253,52 @@ function getconfig()
end
table.insert(locations[filecontent_table[2]], filecontent_table[3])
end
+ end
+ end
+
+ return locations
+end
+
+function getconfig(self,filter_type)
+ local config = {}
+ local listenaddr = getopts.getoptsfromfile_onperline(configfile,"IP") or {}
+
+ config.listen = cfe({
+ name = "listen",
+ label="IP address to listen on",
+ value=listenaddr.IP or "",
+ })
+
+ return config
+end
+
+-- If you enter 'filter_type' (this should be one of the options found in local function check_signs() ) then
+-- the output will be filtered to only contain this type of data.
+function getconfigobjects(self,filter_type)
+ local domains = {}
+
+ --Loop through all available configfiles
+ for k,v in pairs(configfiles) do
+ local filecontent, fileresult
+ fileresult, filecontent = get_value_from_file(v)
+ for kk,vv in pairs(filecontent) do
+ local domaindetails = {}
+ local filecontent_table = split_config_items(vv)
-- Create domain information tables
local domain, level1, level2, level3, level4, level5, level6, levels
- if (filecontent_table[1] == "&") then
- local descr=check_signs("prefix")
- domain = format.string_to_table(filecontent_table[2], "%.")
- if (domain[#domain] ~= "arpa") then
+ -- * START * COMMONT SETTINGS ***************************************************************************************
+ local descr=check_signs("prefix")
+ -- Use only configs that has a valid prefix
+ -- We filter away location-definitions
+ -- If function is called with some filter options... then show only the filtered values
+ if ( not (filter_type) or
+ ( (filter_type) and (filter_type == filecontent_table[1]))) and
+ (descr[filecontent_table[1]]) and not
+ (filecontent_table[1] == "%") then
+
+ domain = format.string_to_table(filecontent_table[2], "%.")
-- 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]
@@ -290,156 +306,235 @@ function getconfig()
-- This is the main information on each object
domaindetails = cfe ({
- name=filecontent_table[4],
- label=filecontent_table[4],
+ name=filecontent_table[2],
+ label=filecontent_table[2],
})
+
-- Add details to the previous object
table.insert(domaindetails, cfe ({
- name=type,
- label="Type:",
+ 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,":"),
- }))
+ -- Set values and labels for field #3
+ local name = "ip"
+ local label = "IP address"
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == "^") or (filecontent_table[1] == "C") then
+ name = "pointdomain"
+ label = "Domain"
+ end
+ if (filecontent_table[1] == "Z") then
+ name = "mname"
+ label = "Primary nameserver"
+ end
+ if (filecontent_table[1] == ":") then
+ name = "rectype"
+ label = "Type of record"
+ end
+ if (filecontent_table[3]) and (#filecontent_table[3]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[3],
+ }))
end
- end
+ -- Set values and labels for field #4
+ local name = "nameserver"
+ local label = "Name server"
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == "=") or (filecontent_table[1] == "+") then
+ name = "ttl"
+ label = "Time to live"
+ end
+ if (filecontent_table[1] == "@") then
+ name = "mx"
+ label = "Mail exchanger"
+ end
+ if (filecontent_table[4]) and (#filecontent_table[4]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[4],
+ }))
+ end
- local value = filecontent_table[2]
- local currenttable
- if (type(domain) == "table") then
- currenttable = recursedomains(domain, domains, table.maxn(domain))
- end
+ -- Set values and labels for field #5
+ local name = nil
+ local label = nil
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == ".") or (filecontent_table[1] == "&") then
+ name = "ttl"
+ label = "Time to live"
+ end
+ if (filecontent_table[1] == "=") or (filecontent_table[1] == "+") then
+ name = "timestamp"
+ label = "Time stamp"
+ end
+ if (filecontent_table[1] == "@") then
+ name = "dist"
+ label = "Distance"
+ end
+ if (filecontent_table[5]) and (#filecontent_table[5]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[5],
+ }))
+ end
- -- FIXME: This is where we should put the information into the table!
- if (domaindetails.value) then
- table.insert (currenttable , domaindetails)
- end
+ -- Set values and labels for field #6
+ local name = nil
+ local label = nil
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == ".") or (filecontent_table[1] == "&") then
+ name = "ttl"
+ label = "Time to live"
+ end
+ if (filecontent_table[1] == "=") or (filecontent_table[1] == "+") then
+ name = "timestamp"
+ label = "Time stamp"
+ end
+ if (filecontent_table[1] == "@") then
+ name = "dist"
+ label = "Distance"
+ end
+ if (filecontent_table[1] == "Z") then
+ name = "ser"
+ label = "Serial number"
+ end
---[[
- if (type(domain) == "table") then
- levels = table.maxn(domain)
- level1 = domain[levels]
-
+ if (filecontent_table[6]) and (#filecontent_table[6]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[6],
+ }))
+ end
- if (level1) then
- level2 = (domain[levels-1] or "unknown") .. "."
+ -- Set values and labels for field #7
+ local name = nil
+ local label = nil
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == ".") or (filecontent_table[1] == "&") then
+ name = "timestamp"
+ label = "Time stamp"
end
- if (level2) and (domain[levels-2]) then
- level3 = domain[levels-2] .. "." .. level2
+ if (filecontent_table[1] == "=") or (filecontent_table[1] == "+") or
+ (filecontent_table[1] == "-") or (filecontent_table[1] == "^") or
+ (filecontent_table[1] == "C") then
+ name = "location"
+ label = "Location"
end
- if (level3) and (domain[levels-3]) then
- level4 = domain[levels-3] .. "." .. level3
+ if (filecontent_table[1] == "@") then
+ name = "ttl"
+ label = "Time to live"
end
- if (level4) and (domain[levels-4]) then
- level5 = domain[levels-4] .. "." .. level4
+ if (filecontent_table[1] == "Z") then
+ name = "ref"
+ label = "Refresh time"
end
- if (level5) and (domain[levels-5]) then
- level6 = domain[levels-5] .. "." .. level5
+ if (filecontent_table[7]) and (#filecontent_table[7]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[7],
+ }))
end
- if (level6) and (domain[levels-6]) then
- level7 = domain[(levels-6)] .. "." .. level6
+
+ -- Set values and labels for field #8
+ local name = nil
+ local label = nil
+ -- Some configs uses third column in some other way
+ if (filecontent_table[1] == ".") or (filecontent_table[1] == "&") then
+ name = "timestamp"
+ label = "Time stamp"
end
- end
- if (level1 ) and (#level1 > 0) and not (domain[levels] == "arpa") then
- if not (domains[level1]) then
- domains[level1] = {}
+ if (filecontent_table[1] == "=") or (filecontent_table[1] == "+") or
+ (filecontent_table[1] == "-") or (filecontent_table[1] == "^") or
+ (filecontent_table[1] == "C") then
+ name = "location"
+ label = "Location"
+ end
+ if (filecontent_table[1] == "@") then
+ name = "ttl"
+ label = "Time to live"
+ end
+ if (filecontent_table[1] == "Z") then
+ name = "ref"
+ label = "Refresh time"
end
- if (level2) and (#level2 > 0) then
- if not (domains[level1][level2]) then
- domains[level1][level2] = {}
+ if (filecontent_table[8]) and (#filecontent_table[8]> 0) and (name) then
+ table.insert(domaindetails, cfe ({
+ name=name,
+ label=label,
+ value=filecontent_table[8],
+ }))
+ end
+
+ -- Set values and labels for field #9-12
+ if (filecontent_table[1] == "Z") then
+ if (filecontent_table[9]) and (#filecontent_table[9]> 0) then
+ table.insert(domaindetails, cfe ({
+ name="min",
+ label="Minimum time",
+ value=filecontent_table[9],
+ }))
+ end
+ if (filecontent_table[10]) and (#filecontent_table[10]> 0) then
+ table.insert(domaindetails, cfe ({
+ name="ttl",
+ label="Time to live",
+ value=filecontent_table[10],
+ }))
+ end
+ if (filecontent_table[11]) and (#filecontent_table[11]> 0) then
+ table.insert(domaindetails, cfe ({
+ name="timestamp",
+ label="Time stamp",
+ value=filecontent_table[11],
+ }))
+ end
+ if (filecontent_table[12]) and (#filecontent_table[12]> 0) then
+ table.insert(domaindetails, cfe ({
+ name="location",
+ label="Location",
+ value=filecontent_table[12],
+ }))
end
- if (level3) and (#level3 > 0) then
- if not (domains[level1][level2][level3]) then
- domains[level1][level2][level3] = {}
- end
- if (level4) and (#level4 > 0) then
- if not (domains[level1][level2][level3][level4]) then
- domains[level1][level2][level3][level4] = {}
- end
- if (level5) and (#level5 > 0) then
- if not (domains[level1][level2][level3][level4][level5]) then
- domains[level1][level2][level3][level4][level5] = {}
- end
- if (level6) and (#level6 > 0) then
- if not (domains[level1][level2][level3][level4][level5][level6]) then
- domains[level1][level2][level3][level4][level5][level6] = {}
- end
- if (level7) and (#level7 > 0) then
- if not (domains[level1][level2][level3][level4][level5][level6][level7]) then
- domains[level1][level2][level3][level4][level5][level6][level7] = {}
- domains[level1][level2][level3][level4][level5][level6][level7] = {}
- end
- else
- table.insert(domains[level1][level2][level3][level4][level5][level6], filecontent_table[4])
- end --level7
- else
- table.insert(domains[level1][level2][level3][level4][level5], filecontent_table[4])
- end --level6
- else
- table.insert(domains[level1][level2][level3][level4], filecontent_table[4])
- end --level5
- else
- table.insert(domains[level1][level2][level3], filecontent_table[4])
- end --level4
- else
- table.insert(domains[level1][level2], filecontent_table[4])
- end --level3
- else
- table.insert(domains[level1], filecontent_table[4])
- end --level2
- end --level1
+ end
+
+
+--[[
+ table.insert(domaindetails, cfe ({
+ name="debug",
+ label="Debug",
+ value=filter_type,
+ }))
--]]
+ end
+ -- * END * COMMONT SETTINGS ***************************************************************************************
+
+ -- Inject the previous data into the right table
+ local value = filecontent_table[2]
+ local currenttable
+ if (type(domain) == "table") then
+ currenttable = recursedomains(domain, domains, table.maxn(domain))
+ end
+
+ if (domaindetails.value) then
+ table.insert (currenttable , domaindetails)
+ end
end
end
- config.locations = cfe({
- name="locations",
- label="Locations",
- value=locations,
- })
-
- config.domains = cfe({
- name="domains",
- label="Domains",
- value=domains,
- })
--- config.domains = debug
----[[
- config.configitems = cfe({
- name = "configitems",
- label="Config items",
- value=configobjects,
- })
---]]
- return config
+ -- TODO: Sort the domains table!
+
+ return domains
end
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>")
---]==]
?>
<?
diff --git a/tinydns.menu b/tinydns.menu
index 705c58b..de2ee2c 100644
--- a/tinydns.menu
+++ b/tinydns.menu
@@ -1,3 +1,3 @@
#CAT GROUP/DESC TAB ACTION
Networking 10DNS Status status
-Networking 10DNS Config config
+#Networking 10DNS Config config