libs/cbi: Fixed MultiValue select widget
[project/luci.git] / modules / admin-core / luasrc / model / cbi / admin_network / dhcp.lua
index 63ef0aa3d7ba5a3e5b0191dc3a1596081a042d2b..b22f7354ae8b76207cfd9127217dc3a8c460b545 100644 (file)
@@ -1,37 +1,49 @@
--- ToDo: Translate, Add descriptions and help texts
+--[[
+LuCI - Lua Configuration Interface
+
+Copyright 2008 Steven Barth <steven@midlink.org>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+]]--
 require("luci.model.uci")
 require("luci.sys")
 
-m = Map("dhcp", "DHCP", [[Mit Hilfe von DHCP können Netzteilnehmer automatisch
-ihre Netzwerkkonfiguration (IP-Adresse, Netzmaske, DNS-Server, DHCP, ...) beziehen.]])
+m = Map("dhcp", "DHCP")
 
-s = m:section(TypedSection, "dhcp")
+s = m:section(TypedSection, "dhcp", "")
 s.addremove = true
 s.anonymous = true
 
-iface = s:option(ListValue, "interface", "Schnittstelle")
-for k, v in pairs(luci.model.uci.sections("network")) do
-       if v[".type"] == "interface" and k ~= "loopback" then
-               iface:value(k)
-               s:depends("interface", k) -- Only change sections with existing interfaces
-       end
-end
+iface = s:option(ListValue, "interface", translate("interface"))
+luci.model.uci.foreach("network", "interface",
+       function (section)
+               if section[".name"] ~= "loopback" then
+                       iface:value(section[".name"])
+                       s:depends("interface", section[".name"])
+               end
+       end)
 
-s:option(Value, "start", "Start", "Erste vergebene Adresse (letztes Oktett)").rmempty = true
+s:option(Value, "start", translate("start")).rmempty = true
 
-s:option(Value, "limit", "Limit", "Anzahl zu vergebender Adressen -1").rmempty = true
+s:option(Value, "limit", translate("limit")).rmempty = true
 
-s:option(Value, "leasetime", "Laufzeit").rmempty = true
+s:option(Value, "leasetime").rmempty = true
 
-s:option(Flag, "dynamicdhcp", "Dynamisches DHCP").rmempty = true
+s:option(Flag, "dynamicdhcp").rmempty = true
 
-s:option(Value, "name", "Name").optional = true
+s:option(Value, "name", translate("name")).optional = true
 
-s:option(Flag, "ignore", "Schnittstelle ignorieren", "DHCP für dieses Netzwerk deaktivieren").optional = true
+s:option(Flag, "ignore").optional = true
 
-s:option(Value, "netmask", "Netzmaske").optional = true
+s:option(Value, "netmask", translate("netmask")).optional = true
 
-s:option(Flag, "force", "Start erzwingen").optional = true
+s:option(Flag, "force").optional = true
 
 for i, line in pairs(luci.sys.execl("dnsmasq --help dhcp")) do
        k, v = line:match("([^ ]+) +([^ ]+)")