libs/cbi: Fixed MultiValue select widget
[project/luci.git] / modules / admin-core / luasrc / model / cbi / admin_network / dhcp.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14 require("luci.model.uci")
15 require("luci.sys")
16
17 m = Map("dhcp", "DHCP")
18
19 s = m:section(TypedSection, "dhcp", "")
20 s.addremove = true
21 s.anonymous = true
22
23 iface = s:option(ListValue, "interface", translate("interface"))
24 luci.model.uci.foreach("network", "interface",
25 function (section)
26 if section[".name"] ~= "loopback" then
27 iface:value(section[".name"])
28 s:depends("interface", section[".name"])
29 end
30 end)
31
32 s:option(Value, "start", translate("start")).rmempty = true
33
34 s:option(Value, "limit", translate("limit")).rmempty = true
35
36 s:option(Value, "leasetime").rmempty = true
37
38 s:option(Flag, "dynamicdhcp").rmempty = true
39
40 s:option(Value, "name", translate("name")).optional = true
41
42 s:option(Flag, "ignore").optional = true
43
44 s:option(Value, "netmask", translate("netmask")).optional = true
45
46 s:option(Flag, "force").optional = true
47
48 for i, line in pairs(luci.sys.execl("dnsmasq --help dhcp")) do
49 k, v = line:match("([^ ]+) +([^ ]+)")
50 s:option(Value, "dhcp"..k, v).optional = true
51 end
52
53 return m