summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-03-08 12:03:05 +0000
committerMika Havela <mika.havela@gmail.com>2008-03-08 12:03:05 +0000
commitd4616efbb9e02ceca5d35740f8513cf141167820 (patch)
treeb9fdb29275cd89e4e068040329cabb3d77475da9
parent1a0827a2fcd4aa16176ebc7ecd593305ab70088e (diff)
downloadacf-tinydns-d4616efbb9e02ceca5d35740f8513cf141167820.tar.bz2
acf-tinydns-d4616efbb9e02ceca5d35740f8513cf141167820.tar.xz
Added select-boxes for those fields that defines location.
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@831 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r--tinydns-controller.lua36
-rw-r--r--tinydns-model.lua4
2 files changed, 38 insertions, 2 deletions
diff --git a/tinydns-controller.lua b/tinydns-controller.lua
index 612d1c9..addc398 100644
--- a/tinydns-controller.lua
+++ b/tinydns-controller.lua
@@ -224,6 +224,42 @@ function edit_records(self,types,record,errormessage)
errtxt="This field will go away soon! It's only for debugging!"
}))
+ -- Adding select-boxes
+ local locationselectbox
+ local locationfileds = {
+ ['.']=7,
+ ['&']=7,
+ ['=']=6,
+ ['+']=6,
+ ['@']=8,
+ ['^']=6,
+ ['C']=6,
+ ['Z']=12,
+ [':']=7,
+ }
+ locationselectbox = locationfileds[prefix]
+ if (locationselectbox) then
+ local locations=self.model.getlocations(self)
+ edit[locationselectbox]["option"] = {}
+ edit[locationselectbox]["type"] = "select"
+ table.insert(edit[locationselectbox]["option"], "")
+ for v in pairs(locations or {}) do
+ table.insert(edit[locationselectbox]["option"], v)
+ end
+ -- IF the value is not one of the existing options, then warn and add this option.
+ for k,v in pairs(edit[locationselectbox]["option"]) do
+ edit[locationselectbox]["errtxt"] = "'" .. edit[locationselectbox]["value"] .. "' is defined as a location!"
+ if (tostring(v) == tostring(edit[locationselectbox]["value"])) then
+ edit[locationselectbox]["errtxt"] = ""
+ break
+ end
+ end
+ -- Now add this option to the list (just to show what it was)
+ if (#edit[locationselectbox]["errtxt"] > 0) then
+ table.insert(edit[locationselectbox]["option"], edit[locationselectbox]["value"])
+ end
+ end
+
return {
edit=edit,
option={ script=ENV["SCRIPT_NAME"],
diff --git a/tinydns-model.lua b/tinydns-model.lua
index 2d57d7d..12458bf 100644
--- a/tinydns-model.lua
+++ b/tinydns-model.lua
@@ -218,8 +218,8 @@ function check_signs(sign)
['^']={"Prefix", "PTR", "Domain name", "Time to live", "Timestamp", "Location", },
['C']={"Prefix", "Domain name", "Canonical name", "Time to live", "Timestamp", "Location", },
['Z']={"Prefix", "Unknown", "Primary name server", "Contact address", "Serial number", "Refresh time", "Retry time", "Expire time", "Minimum time", "Time to live", "Timestamp", "Location",},
- [':']={"Prefix", "Unknown", "Type of record", "Rdata", "Time to live", "Timestamp", "Location", },
- ['%']={"Prefix", "Location", "IP prefix", },
+ [':']={"Prefix", },
+ ['%']={"Prefix", },
},
}
if (sign) then