modules/admin-full: don't expose "reset" and "enable" options for switches, do not...
authorJo-Philipp Wich <jow@openwrt.org>
Sun, 17 Jul 2011 05:46:54 +0000 (05:46 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Sun, 17 Jul 2011 05:46:54 +0000 (05:46 +0000)
modules/admin-full/luasrc/model/cbi/admin_network/vlan.lua

index c2f1c1f..ee35261 100644 (file)
@@ -18,8 +18,6 @@ m = Map("network", translate("Switch"), translate("The network ports on your rou
 m.uci:foreach("network", "switch",
        function(x)
                local switch_name = x.name or x['.name']
-               local has_enable  = "enable"
-               local has_reset   = nil
                local has_vlan    = nil
                local has_learn   = nil 
                local has_vlan4k  = nil
@@ -55,11 +53,10 @@ m.uci:foreach("network", "switch",
                                        num_ports, cpu_port, num_vlans =
                                                line:match("ports: (%d+) %(cpu @ (%d+)%), vlans: (%d+)")
 
-                                       num_ports  = tonumber(num_ports or  6)
-                                       num_vlans  = tonumber(num_vlans or 16)
-                                       cpu_port   = tonumber(cpu_port  or  5)
+                                       num_ports  = tonumber(num_ports) or  6
+                                       num_vlans  = tonumber(num_vlans) or 16
+                                       cpu_port   = tonumber(cpu_port)  or  5
                                        min_vid    = 1
-                                       has_enable = nil
 
                                elseif line:match(": pvid") or line:match(": tag") or line:match(": vid") then
                                        if is_vlan_attr then has_vlan4k = line:match(": (%w+)") end
@@ -71,9 +68,6 @@ m.uci:foreach("network", "switch",
                                elseif line:match(": enable_learning") then
                                        has_learn = "enable_learning"
 
-                               elseif line:match(": reset") then
-                                       has_reset = "reset"
-
                                elseif line:match(": enable_vlan4k") then
                                        enable_vlan4k = true
 
@@ -117,14 +111,8 @@ m.uci:foreach("network", "switch",
                s = m:section(NamedSection, x['.name'], "switch", translatef("Switch %q", switch_name))
                s.addremove = false
 
-               if has_enable then
-                       x = s:option(Flag, has_enable, translate("Enable this switch"))
-                       x.default = x.enabled
-               end
-
                if has_vlan then
-                       x = s:option(Flag, has_vlan, translate("Enable VLAN functionality"))
-                       x.default = x.enabled
+                       s:option(Flag, has_vlan, translate("Enable VLAN functionality"))
                end
 
                if enable_vlan4k then
@@ -142,11 +130,6 @@ m.uci:foreach("network", "switch",
                        x.rmempty = true
                end
 
-               if has_reset then
-                       x = s:option(Flag, has_reset, translate("Reset switch during setup"))
-                       x.default = x.enabled
-               end
-
 
                -- VLAN table
                s = m:section(TypedSection, "switch_vlan", translatef("VLANs on %q", switch_name))