diff options
-rw-r--r-- | tinydns-controller.lua | 36 | ||||
-rw-r--r-- | tinydns-model.lua | 4 |
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 |