libs/web: some fixes for network_ifacelist widget
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 14 Jan 2011 19:57:30 +0000 (19:57 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 14 Jan 2011 19:57:30 +0000 (19:57 +0000)
libs/web/luasrc/view/cbi/network_ifacelist.htm

index c4d392e9ed74ec2c424d59ac6c12152e311312a6..1cedc02b748f8a1b1cf76c7b90fdcb5f79620d86 100644 (file)
@@ -19,7 +19,12 @@ $Id$
 
        local iface
        local ifaces = net:get_interfaces()
-       local value = (self:formvalue(section) or self.default)
+       local value = self:formvalue(section)
+
+       if not value or value == "" then
+               value = self:cfgvalue(section) or self.default
+       end
+
        local checked = { }
 
        if value then
@@ -46,7 +51,8 @@ $Id$
                        attr("type", self.widget or "radio") ..
                        attr("id", cbid .. "." .. iface:name()) ..
                        attr("name", cbid) .. attr("value", iface:name()) ..
-                       ifattr(checked[iface:name()], "checked", "checked")
+                       ifattr(checked[iface:name()], "checked", "checked") ..
+                       ifattr(iface:type() == "wifi" and not iface:is_up(), "disabled", "disabled")
                %> /> &nbsp;
                <label<%=attr("for", cbid .. "." .. iface:name())%>>
                        <% if link then -%><a href="<%=link%>"><% end -%>