build: split into luci and luci-addons packages
[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 module "luci.controller.niu.network"
16
17 function index()
18         local toniu = {on_success_to={"niu"}}
19         
20         local e = entry({"niu", "network"}, alias("niu"), "Network", 10)
21         e.niu_dbtemplate = "niu/network"
22         e.niu_dbtasks = true
23         e.niu_dbicon = "icons32/network-workgroup.png"
24
25         entry({"niu", "network", "wan"}, 
26         cbi("niu/network/wan", toniu), "Configure Internet Connection", 1)
27
28         entry({"niu", "network", "lan"}, 
29         cbi("niu/network/lan", toniu), "Configure Local Network", 2)
30         
31         uci.inst_state:foreach("dhcp", "dhcp", function(s)
32                 if s.interface == "lan" and s.ignore ~= "1" then 
33                         entry({"niu", "network", "assign"}, cbi("niu/network/assign",
34                                 toniu), "Manage Address Assignment", 30)
35                 end
36         end)
37          
38          if fs.access("/etc/config/ddns") then
39                 entry({"niu", "network", "ddns"},  cbi("niu/network/ddns", toniu),
40                  "Configure Dynamic-DNS names", 60)             
41          end
42 end