modules/admin-full: fix initial state of network_ifacelist widget

This commit is contained in:
Jo-Philipp Wich 2011-09-14 09:28:28 +00:00
parent 537c929d63
commit a4ea7904b8

View file

@ -123,7 +123,6 @@ ifname_single.template = "cbi/network_ifacelist"
ifname_single.widget = "radio" ifname_single.widget = "radio"
ifname_single.nobridges = true ifname_single.nobridges = true
ifname_single.network = arg[1] ifname_single.network = arg[1]
ifname_single.rmempty = true
ifname_single:depends({ type = "", proto = "static" }) ifname_single:depends({ type = "", proto = "static" })
ifname_single:depends({ type = "", proto = "dhcp" }) ifname_single:depends({ type = "", proto = "dhcp" })
ifname_single:depends({ type = "", proto = "pppoe" }) ifname_single:depends({ type = "", proto = "pppoe" })
@ -132,7 +131,8 @@ ifname_single:depends({ type = "", proto = "ahcp" })
ifname_single:depends({ type = "", proto = "none" }) ifname_single:depends({ type = "", proto = "none" })
function ifname_single.cfgvalue(self, s) function ifname_single.cfgvalue(self, s)
return self.map.uci:get("network", s, "ifname") -- let the template figure out the related ifaces through the network model
return nil
end end
function ifname_single.write(self, s, val) function ifname_single.write(self, s, val)
@ -154,6 +154,11 @@ function ifname_single.write(self, s, val)
end end
end end
function ifname_single.remove(self, s)
self:write(s, "")
end
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface")) ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
ifname_multi.template = "cbi/network_ifacelist" ifname_multi.template = "cbi/network_ifacelist"
ifname_multi.nobridges = true ifname_multi.nobridges = true
@ -162,6 +167,7 @@ ifname_multi.widget = "checkbox"
ifname_multi:depends("type", "bridge") ifname_multi:depends("type", "bridge")
ifname_multi.cfgvalue = ifname_single.cfgvalue ifname_multi.cfgvalue = ifname_single.cfgvalue
ifname_multi.write = ifname_single.write ifname_multi.write = ifname_single.write
ifname_multi.remove = ifname_single.remove
if has_firewall then if has_firewall then