c90662b6e6a792432a1ad91ac719a3414c421550
[project/luci.git] / modules / niu / luasrc / controller / niu / network.lua
1 --[[
2 LuCI - Lua Development Framework
3
4 Copyright 2009 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local require = require
16 module "luci.controller.niu.network"
17
18 function index()
19         entry({"niu", "network"}, nil, "Network", 10).dbtemplate = "niu/network"
20
21         entry({"niu", "network", "wan"}, 
22         cbi("niu/network/wan", {on_success_to={"niu"}}), "Configure Internet Connection", 10)
23
24         entry({"niu", "network", "lan"}, 
25         cbi("niu/network/lan", {on_success_to={"niu"}}), "Configure Local Network", 20)
26         
27         uci.inst_state:foreach("dhcp", "dhcp", function(s)
28                 if s.interface == "lan" and s.ignore ~= "1" then 
29                         entry({"niu", "network", "assign"}, cbi("niu/network/assign",
30                                 {on_success_to={"niu"}}), "Display and Customize Address Assignment", 30)
31                 end
32         end)
33         
34         entry({"niu", "network", "routes"},  cbi("niu/network/routes",
35          {on_success_to={"niu"}}), "Display and Customize Routing", 40)
36          
37         entry({"niu", "network", "conntrack"},  call("cnntrck"),
38          "Display Local Network Activity", 50)
39 end
40
41 function cnntrck()
42         require "luci.template".render("niu/network/conntrack")
43 end