X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fniu%2Fluasrc%2Fmodel%2Fcbi%2Fniu%2Fnetwork%2Fwandevice.lua;h=db7d9025417fdd45d9e8645feef531742350ba15;hp=1f65196f1475afaacab800cf75bd5cfd9e0afcb2;hb=0784b7b9d512602f519aa7c0e826f97ef5ca25ff;hpb=43820b99ecac96b1f5c3abe44eb446cdea5d41b4 diff --git a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua b/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua index 1f65196f1..db7d90254 100644 --- a/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua +++ b/modules/niu/luasrc/model/cbi/niu/network/wandevice.lua @@ -12,19 +12,27 @@ You may obtain a copy of the License at $Id$ ]]-- -local cursor = require "luci.model.uci".cursor() +local cursor = require "luci.model.uci".inst_state local nw = require "luci.model.network" nw.init(cursor) -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") -function f.handle(self, state, data) - if state == FORM_VALID then - +for _, iface in ipairs(nw.get_interfaces()) do + if iface:name():find("eth") == 1 then + local net = iface:get_network() + if not net or net:name() == "wan" or os.getenv("LUCI_SYSROOT") then + l:value("ethernet:%s" % iface:name(), + "Cable / DSL / Ethernet Adapter (%s)" % iface:name()) + end end end -return f +l:value("none", "No Internet Connection") + +return m