NIU:
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / network / wandevice.lua
index 1f65196..9287ba8 100644 (file)
@@ -12,19 +12,24 @@ You may obtain a copy of the License at
 $Id$
 ]]--
 
-local cursor = require "luci.model.uci".cursor()
-local nw = require "luci.model.network"
-nw.init(cursor)
+local niulib = require "luci.niulib"
 
-f = Form("wandev", "Internet Device")
-l = f:field(ListValue, "device", "Gerät")
-l:value("ethernet:eth0", "Ethernet / Cable / DSL (eth0)")
-l:value("none", "No Internet Connection")
+m = Map("network", "Configure Internet Connection")
+s = m:section(NamedSection, "wan", "interface", "Internet Connection Device")
+s.anonymous = true
+s.addremove = false
+
+l = s:option(ListValue, "_wandev", "Internet Connection via")
+
+for _, ifc in ipairs(niulib.eth_get_available("wan")) do
+       l:value("ethernet:%s" % ifc, "Cable / DSL / Ethernet-Adapter (%s)" % ifc)
+end
 
-function f.handle(self, state, data)
-       if state == FORM_VALID then
-               
-       end
+for _, wifi in ipairs(niulib.wifi_get_available("client")) do
+       l:value("wlan:%s" % wifi, "WLAN-Adapter (%s)" % wifi)
 end
 
-return f
+
+l:value("none", "No Internet Connection")
+
+return m