summaryrefslogtreecommitdiffstats
path: root/tinydns-controller.lua
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-03-03 17:02:17 +0000
committerMika Havela <mika.havela@gmail.com>2008-03-03 17:02:17 +0000
commit1c2f8cc575dfd808e69487cb586c27d5b46a532c (patch)
treee6bb2514a6e96bfce2ae7d042d9c8471bf4b954f /tinydns-controller.lua
parentf5c7e2c77336d274e40b38407395c40e83149ae8 (diff)
downloadacf-tinydns-1c2f8cc575dfd808e69487cb586c27d5b46a532c.tar.bz2
acf-tinydns-1c2f8cc575dfd808e69487cb586c27d5b46a532c.tar.xz
Saving work for today. Filtering is starting to take shape.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@797 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'tinydns-controller.lua')
-rw-r--r--tinydns-controller.lua98
1 files changed, 70 insertions, 28 deletions
diff --git a/tinydns-controller.lua b/tinydns-controller.lua
index 122470d..a5f804d 100644
--- a/tinydns-controller.lua
+++ b/tinydns-controller.lua
@@ -68,72 +68,97 @@ function status(self)
value=locations,
})
----[[
local prefix = "."
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.nsourdomain = cfe ({
name="nsourdomain",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "&"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.nsdomain = cfe ({
name="nsdomain",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "="
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.host = cfe ({
name="host",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "+"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.alias = cfe ({
name="alias",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "@"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.mx = cfe ({
name="mx",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "^"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.ptr = cfe ({
name="ptr",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "C"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.cname = cfe ({
name="cname",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = "Z"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.soa = cfe ({
name="soa",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
+ end
local prefix = ":"
+ local domainoptions = self.model.getconfigobjects(self,prefix)
+ if (#domainoptions > 0) then
config.settings.generic = cfe ({
name="generic",
label=availablesigns[prefix],
- value=self.model.getconfigobjects(self,prefix),
+ value=domainoptions,
})
-
---]]
+ end
--[[
+ -- This could be used for DEBUGGING
config.settings.all = cfe ({
name="generic",
label="All available records",
@@ -152,8 +177,6 @@ function config(self)
local config = self.model.getconfig(self)
local debug = self.model.getdebug(self)
local availablesigns = self.model.check_signs("prefix")
--- local debug = self..status(self)
--- debug = self
-- LISTEN _________________________________________________________
-- Add button
@@ -207,7 +230,7 @@ function config(self)
type="select",
label=availablesigns[prefix],
option=domainopts,
- descr="Above records look like '.fqdn:ip:x:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '.fqdn:ip:x:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.nsourdomain.option, "[New]")
@@ -238,12 +261,8 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like '&fqdn:ip:x:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '&fqdn:ip:x:ttl:timestamp:lo' when they are in the config-file.",
})
- -- Add options
--- for n in pairs(locations) do
--- table.insert(config.nsdomain.option, n)
--- end
-- Add a [New] record to the options
table.insert(config.nsdomain.option, "[New]")
-- Set size of the inputbox
@@ -274,7 +293,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like '=fqdn:ip:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '=fqdn:ip:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.host.option, "[New]")
@@ -306,7 +325,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like '+fqdn:ip:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '+fqdn:ip:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.alias.option, "[New]")
@@ -338,7 +357,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like '@fqdn:ip:x:dist:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '@fqdn:ip:x:dist:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.mx.option, "[New]")
@@ -370,7 +389,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like '^fqdn:p:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like '^fqdn:p:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.ptr.option, "[New]")
@@ -402,7 +421,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like 'Cfqdn:p:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like 'Cfqdn:p:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.cname.option, "[New]")
@@ -434,7 +453,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like 'Zfqdn:mname:rname:ser:ref:ret:exp:min:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like 'Zfqdn:mname:rname:ser:ref:ret:exp:min:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.soa.option, "[New]")
@@ -466,7 +485,7 @@ function config(self)
label=availablesigns[prefix],
type="select",
option=domainopts,
- descr="Above records look like ':fqdn:n:rdata:ttl:timestamp:lo' when they are in the config-file.",
+-- descr="Above records look like ':fqdn:n:rdata:ttl:timestamp:lo' when they are in the config-file.",
})
-- Add a [New] record to the options
table.insert(config.generic.option, "[New]")
@@ -487,12 +506,35 @@ function config(self)
})
+ -- DEBUGGING
+ local level1 = {}
+ local level2 = {}
+ local level3 = {}
+ local domainoptions = self.model.getconfigobjects(self)
+ for k1,v1 in pairs(domainoptions) do
+ table.insert(level1, v1.label)
+ for k2,v2 in pairs(v1) do
+ table.insert(level2, v2.label)
+ if (type(v2) == "table") then
+ for k3,v3 in pairs(v2) do
+ table.insert(level3, v3.label)
+ end
+ end
+ end
+ end
+
+ config.debuglevels = cfe ({
+ name="debuglevels",
+ label="Level1",
+ type="select",
+ option=domainoptions,
+ })
+
return ({
status=getstatus(self),
config=config,
--- debug=debug,
})
end