all: change most translate statements to new format, some need manual cleanup
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / dhcp.lua
index af018eaa8510b55bfc12137b10e2058a711b4125..6f4aeb13ee6ac54bada0c64b466cc5ba54fa7c40 100644 (file)
@@ -21,10 +21,11 @@ s = m:section(TypedSection, "dhcp", "")
 s.addremove = true
 s.anonymous = true
 
-iface = s:option(ListValue, "interface", translate("interface"))
+iface = s:option(ListValue, "interface", translate("Interface"))
 luci.tools.webadmin.cbi_add_networks(iface)
 
-luci.model.uci.foreach("network", "interface",
+local uci = luci.model.uci.cursor()
+uci:foreach("network", "interface",
        function (section)
                if section[".name"] ~= "loopback" then
                        iface.default = iface.default or section[".name"]
@@ -32,33 +33,34 @@ luci.model.uci.foreach("network", "interface",
                end
        end)
 
-luci.model.uci.foreach("network", "alias",
+uci:foreach("network", "alias",
        function (section)
                iface:value(section[".name"])
                s:depends("interface", section[".name"])
        end)
 
-s:option(Value, "start", translate("start")).rmempty = true
+s:option(Value, "start", translate("Start")).rmempty = true
 
-s:option(Value, "limit", translate("limit")).rmempty = true
+s:option(Value, "limit", translate("Limit")).rmempty = true
 
 s:option(Value, "leasetime").rmempty = true
 
-s:option(Flag, "dynamicdhcp").rmempty = true
+local dd = s:option(Flag, "dynamicdhcp")
+dd.rmempty = false
+function dd.cfgvalue(self, section)
+       return Flag.cfgvalue(self, section) or "1"
+end
 
-s:option(Value, "name", translate("name")).optional = true
+s:option(Value, "name", translate("Name")).optional = true
 
 ignore = s:option(Flag, "ignore")
 ignore.optional = true
 
-s:option(Value, "netmask", translate("netmask")).optional = true
+s:option(Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask")).optional = true
 
 s:option(Flag, "force").optional = true
 
-for i, line in pairs(luci.util.execl("dnsmasq --help dhcp")) do
-       k, v = line:match("([^ ]+) +([^ ]+)")
-       s:option(Value, "dhcp"..k, v).optional = true
-end
+s:option(DynamicList, "dhcp_option").optional = true
 
 
 for i, n in ipairs(s.children) do
@@ -67,4 +69,4 @@ for i, n in ipairs(s.children) do
        end
 end
 
-return m
\ No newline at end of file
+return m