summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-10-27 16:47:42 +0000
committerSteven Barth <steven@midlink.org>2009-10-27 16:47:42 +0000
commit6122dc723a36ec88e18949d93f3ec50c36eab4b8 (patch)
tree6ab5115005c794026dd19f67c19ddca27d3e1b0f
parent92bbfc8ca837a6c447fc8402789123cfa81c92ed (diff)
NIU: More LAN settings, initial WAN
-rw-r--r--modules/niu/luasrc/controller/niu/network.lua7
-rw-r--r--modules/niu/luasrc/model/cbi/niu/network/lan.lua11
-rw-r--r--modules/niu/luasrc/model/cbi/niu/network/lan1.lua57
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 11f87fc3c7..b17e6e760f 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 acbfe4fb43..b5d97d2b1c 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 727526b784..33bb48c230 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