diff options
author | Steven Barth <steven@midlink.org> | 2009-10-27 16:47:42 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-10-27 16:47:42 +0000 |
commit | 6122dc723a36ec88e18949d93f3ec50c36eab4b8 (patch) | |
tree | 6ab5115005c794026dd19f67c19ddca27d3e1b0f /modules | |
parent | 92bbfc8ca837a6c447fc8402789123cfa81c92ed (diff) |
NIU: More LAN settings, initial WAN
Diffstat (limited to 'modules')
-rw-r--r-- | modules/niu/luasrc/controller/niu/network.lua | 7 | ||||
-rw-r--r-- | modules/niu/luasrc/model/cbi/niu/network/lan.lua | 11 | ||||
-rw-r--r-- | modules/niu/luasrc/model/cbi/niu/network/lan1.lua | 57 |
3 files changed, 45 insertions, 30 deletions
diff --git a/modules/niu/luasrc/controller/niu/network.lua b/modules/niu/luasrc/controller/niu/network.lua index 11f87fc3c..b17e6e760 100644 --- a/modules/niu/luasrc/controller/niu/network.lua +++ b/modules/niu/luasrc/controller/niu/network.lua @@ -18,5 +18,10 @@ module "luci.controller.niu.network" function index() entry({"niu", "network"}, alias("admin", "network"), "Network") .dbtemplate = "niu/network" - entry({"niu", "network", "lan"}, cbi("niu/network/lan"), "Configure LAN") + + entry({"niu", "network", "lan"}, + cbi("niu/network/lan", {on_success_to={"niu"}}), "Configure LAN") + + entry({"niu", "network", "wan"}, + cbi("niu/network/wan", {on_success_to={"niu"}}), "Configure Internet") end diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan.lua b/modules/niu/luasrc/model/cbi/niu/network/lan.lua index acbfe4fb4..b5d97d2b1 100644 --- a/modules/niu/luasrc/model/cbi/niu/network/lan.lua +++ b/modules/niu/luasrc/model/cbi/niu/network/lan.lua @@ -1,3 +1,4 @@ +local cursor = require "luci.model.uci".cursor() local d = Delegator() d.allow_finish = true d.allow_back = true @@ -5,4 +6,14 @@ d.allow_cancel = true d:add("lan1", load("niu/network/lan1")) +function d.on_cancel() + cursor:revert("network") + cursor:revert("dhcp") +end + +function d.on_done() + cursor:commit("network") + cursor:commit("dhcp") +end + return d
\ No newline at end of file diff --git a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua index 727526b78..33bb48c23 100644 --- a/modules/niu/luasrc/model/cbi/niu/network/lan1.lua +++ b/modules/niu/luasrc/model/cbi/niu/network/lan1.lua @@ -14,15 +14,12 @@ $Id$ ]]-- local nw = require "luci.model.network" -local fw = require "luci.model.firewall" local has_ipv6 = nw:has_ipv6() -m = Map("network", translate("interfaces"), translate("a_n_ifaces1")) -m:chain("firewall") +m = Map("network", translate("m_n_lan")) nw.init(m.uci) -fw.init(m.uci) s = m:section(NamedSection, "lan", "interface") s.addremove = false @@ -59,48 +56,50 @@ if has_ipv6 then end -br = s:taboption("expert", Flag, "type", translate("a_n_i_bridge"), translate("a_n_i_bridge1")) -br.enabled = "bridge" -br.rmempty = true - stp = s:taboption("expert", Flag, "stp", translate("a_n_i_stp"), translate("a_n_i_stp1", "Enables the Spanning Tree Protocol on this bridge")) -stp:depends("type", "1") -stp.rmempty = true -ifname_single = s:taboption("expert", Value, "ifname_single", translate("interface")) -ifname_single.template = "cbi/network_ifacelist" -ifname_single.widget = "radio" -ifname_single.nobridges = true -ifname_single.rmempty = true -ifname_single:depends("type", "") +ifname_multi = s:taboption("expert", MultiValue, "ifname_multi", translate("interface")) +ifname_multi.template = "cbi/network_ifacelist" +ifname_multi.nobridges = true +ifname_multi.widget = "checkbox" -function ifname_single.cfgvalue(self, s) +function ifname_multi.cfgvalue(self, s) return self.map.uci:get("network", s, "ifname") end -function ifname_single.write(self, s, val) +function ifname_multi.write(self, s, val) local n = nw:get_network(s) if n then n:ifname(val) end end - -ifname_multi = s:taboption("expert", MultiValue, "ifname_multi", translate("interface")) -ifname_multi.template = "cbi/network_ifacelist" -ifname_multi.nobridges = true -ifname_multi.widget = "checkbox" -ifname_multi:depends("type", "1") -ifname_multi.cfgvalue = ifname_single.cfgvalue -ifname_multi.write = ifname_single.write - for _, d in ipairs(nw:get_interfaces()) do if not d:is_bridge() then - ifname_single:value(d:name()) ifname_multi:value(d:name()) end end +m2 = Map("dhcp", "DHCP") + +s = m2:section(TypedSection, "dhcp", "DHCP-Server") +s.anonymous = true +s.addremove = false +s.dynamic = false + +s:tab("general", translate("niu_general", "General Settings")) + +s:depends("interface", "lan") + +enable = s:taboption("general", ListValue, "ignore", translate("enable"), "") +enable:value(0, translate("enable")) +enable:value(1, translate("disable")) + + +s:tab("expert", translate("niu_expert", "Expert Settings")) +start = s:taboption("expert", Value, "start", translate("m_n_d_firstaddress")) +limit = s:taboption("expert", Value, "limit", translate("m_n_d_numleases"), "") +time = s:taboption("expert", Value, "leasetime") -return m +return m, m2 |