modules/admin-full: fix typo in dhcp cbi model, patch by "BasicXP" <basicxp@ubuntu...
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_network / vlan.lua
index 744ff66..25fd0a8 100644 (file)
@@ -13,7 +13,7 @@ You may obtain a copy of the License at
 $Id$
 ]]--
 
-m = Map("network", translate("Switch"), translate("The network ports on your router can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network."))
+m = Map("network", translate("Switch"), translate("The network ports on this device can be combined to several <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s in which computers can communicate directly with each other. <abbr title=\"Virtual Local Area Network\">VLAN</abbr>s are often used to separate different network segments. Often there is by default one Uplink port for a connection to the next greater network like the internet and other ports for a local network."))
 
 m.uci:foreach("network", "switch",
        function(x)
@@ -92,10 +92,6 @@ m.uci:foreach("network", "switch",
                        s:option(Flag, has_vlan, translate("Enable VLAN functionality"))
                end
 
-               if enable_vlan4k then
-                       s:option(Flag, "enable_vlan4k", translate("Enable 4K VLANs"))
-               end
-
                if has_learn then
                        x = s:option(Flag, has_learn, translate("Enable learning and aging"))
                        x.default = x.enabled
@@ -109,7 +105,10 @@ m.uci:foreach("network", "switch",
 
 
                -- VLAN table
-               s = m:section(TypedSection, "switch_vlan", translatef("VLANs on %q", switch_name))
+               s = m:section(TypedSection, "switch_vlan",
+                       switch_title and translatef("VLANs on %q (%s)", switch_name, switch_title)
+                                                 or translatef("VLANs on %q", switch_name))
+
                s.template = "cbi/tblsection"
                s.addremove = true
                s.anonymous = true
@@ -161,11 +160,11 @@ m.uci:foreach("network", "switch",
                                        end
                                end)
 
-                       m.uci:set("network", sid, "device", switch_name)
-                       m.uci:set("network", sid, "vlan", max_nr + 1)
+                       m:set(sid, "device", switch_name)
+                       m:set(sid, "vlan", max_nr + 1)
 
                        if has_vlan4k then
-                               m.uci:set("network", sid, has_vlan4k, max_id + 1)
+                               m:set(sid, has_vlan4k, max_id + 1)
                        end
 
                        return sid
@@ -241,7 +240,11 @@ m.uci:foreach("network", "switch",
                                end
                        end
 
-                       m.uci:set("network", section, "ports", table.concat(p, " "))
+                       if enable_vlan4k then
+                               m:set(sid, "enable_vlan4k", "1")
+                       end
+
+                       m:set(section, "ports", table.concat(p, " "))
                        return Value.write(self, section, value)
                end
 
@@ -253,14 +256,12 @@ m.uci:foreach("network", "switch",
 
                -- Build per-port off/untagged/tagged choice lists.
                local pt
-               local off = 1
                for pt = 0, num_ports - 1 do
                        local title
                        if pt == cpu_port then
-                               off   = 0
                                title = translate("CPU")
                        else
-                               title = translatef("Port %d", pt + off)
+                               title = translatef("Port %d", pt)
                        end
 
                        local po = s:option(ListValue, tostring(pt), title)