NIU: Minor fixes
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / network / wandevice.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2009 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
15 local niulib = require "luci.niulib"
16
17 m = Map("network", "Configure Internet Connection")
18 s = m:section(NamedSection, "wan", "interface", "Internet Connection Device")
19 s.anonymous = true
20 s.addremove = false
21
22 s:tab("general", translate("General Settings"))
23 s:tab("expert", translate("Expert Settings"))
24
25 l = s:taboption("general", ListValue, "_wandev", "Internet Connection via")
26
27 for _, ifc in ipairs(niulib.eth_get_available("wan")) do
28         l:value("ethernet:%s" % ifc, "Cable / DSL / Ethernet-Adapter (%s)" % ifc)
29 end
30
31 for _, wifi in ipairs(niulib.wifi_get_available("client")) do
32         l:value("wlan:%s" % wifi, "WLAN-Adapter (%s)" % wifi)
33 end
34
35 for _, ifc in ipairs(niulib.eth_get_bridged("lan")) do
36         l:value("ethernet:!%s" % ifc, "Used Ethernet-Adapter (%s)" % ifc, {_showused = "1"})
37 end
38
39 l:value("none", "No Internet Connection")
40
41 v = s:taboption("expert", ListValue, "_showused", translate("Show ethernet adapters in use"))
42 v:value("", translate("never"))
43 v:value("1", translate("from LAN-bridge, unbridge on-demand"))
44
45
46
47 return m