summaryrefslogtreecommitdiffstats
path: root/tinydns-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tinydns-controller.lua')
-rw-r--r--tinydns-controller.lua36
1 files changed, 36 insertions, 0 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"],