diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-29 15:14:50 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2010-11-29 15:14:50 +0000 |
commit | e55f2e12a8b87db8e2da4819f0d828819b687914 (patch) | |
tree | 465a9ea929952fbe4f8f358d84c9f2060d849137 /applications/luci-ddns/luasrc/model/cbi/ddns | |
parent | 143131ea77822c3fa84a093f796aae1ee46120dc (diff) |
applications/luci-ddns: fix selection of custom update_url
Diffstat (limited to 'applications/luci-ddns/luasrc/model/cbi/ddns')
-rw-r--r-- | applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua index aa6bb04016..0deb72776f 100644 --- a/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua +++ b/applications/luci-ddns/luasrc/model/cbi/ddns/ddns.lua @@ -28,7 +28,7 @@ s.anonymous = false s:option(Flag, "enabled", translate("Enable")) svc = s:option(ListValue, "service_name", translate("Service")) -svc.rmempty = true +svc.rmempty = false local services = { } local fd = io.open("/usr/lib/ddns/services", "r") @@ -47,10 +47,27 @@ for _, v in luci.util.vspairs(services) do svc:value(v) end -svc:value("", "-- "..translate("custom").." --") +function svc.cfgvalue(...) + local v = Value.cfgvalue(...) + if not v or #v == 0 then + return "-" + else + return v + end +end + +function svc.write(self, section, value) + if value == "-" then + m.uci:delete("ddns", section, self.option) + else + Value.write(self, section, value) + end +end + +svc:value("-", "-- "..translate("custom").." --") url = s:option(Value, "update_url", translate("Custom update-URL")) -url:depends("service_name", "") +url:depends("service_name", "-") url.rmempty = true s:option(Value, "domain", translate("Hostname")).rmempty = true |