778a70fb96b22b703c8f13103e67ca76d30e127e
[project/luci.git] / modules / admin-full / luasrc / controller / admin / network.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 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 module("luci.controller.admin.network", package.seeall)
15
16 function index()
17 require("luci.i18n")
18 local uci = require("luci.model.uci").cursor()
19 local i18n = luci.i18n.translate
20
21 local page = node("admin", "network")
22 page.target = alias("admin", "network", "network")
23 page.title = i18n("network")
24 page.order = 50
25 page.index = true
26
27 local page = node("admin", "network", "vlan")
28 page.target = cbi("admin_network/vlan")
29 page.title = i18n("a_n_switch")
30 page.order = 20
31
32 local page = node("admin", "network", "wireless")
33 page.target = form("admin_network/wireless")
34 page.title = i18n("wifi")
35 page.i18n = "wifi"
36 page.order = 15
37 page.subindex = true
38 uci:foreach("wireless", "wifi-device",
39 function (section)
40 local ifc = section[".name"]
41 entry({"admin", "network", "wireless", ifc},
42 alias("admin", "network", "wifi", ifc),
43 ifc:upper()).i18n = "wifi"
44 end
45 )
46
47 local page = node("admin", "network", "wifi")
48 page.target = cbi("admin_network/wifi")
49 page.leaf = true
50 page.i18n = "wifi"
51
52 local page = node("admin", "network", "network")
53 page.target = cbi("admin_network/network")
54 page.title = i18n("interfaces", "Schnittstellen")
55 page.order = 10
56 page.subindex = true
57 uci:foreach("network", "interface",
58 function (section)
59 local ifc = section[".name"]
60 if ifc ~= "loopback" then
61 entry({"admin", "network", "network", ifc},
62 alias("admin", "network", "ifaces", ifc),
63 ifc:upper())
64 end
65 end
66 )
67
68 local page = node("admin", "network", "ifaces")
69 page.target = cbi("admin_network/ifaces")
70 page.leaf = true
71
72 local page = node("admin", "network", "dhcp")
73 page.target = cbi("admin_network/dhcp")
74 page.title = "DHCP"
75 page.order = 30
76 page.subindex = true
77
78 entry(
79 {"admin", "network", "dhcp", "leases"},
80 cbi("admin_network/dhcpleases"),
81 i18n("dhcp_leases")
82 )
83
84 local page = node("admin", "network", "hosts")
85 page.target = cbi("admin_network/hosts")
86 page.title = i18n("hostnames", "Hostnames")
87 page.order = 40
88
89 local page = node("admin", "network", "routes")
90 page.target = cbi("admin_network/routes")
91 page.title = i18n("a_n_routes")
92 page.order = 50
93 page.leaf = true
94
95 entry(
96 {"admin", "network", "routes", "static"},
97 function() end,
98 i18n("a_n_routes_static")
99 )
100
101 entry(
102 {"admin", "network", "conntrack"},
103 form("admin_network/conntrack"),
104 i18n("a_n_conntrack"),
105 60
106 )
107
108 end