e3f80a1b1e0c1c976a6a3d22005415b73d46898f
[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
26         local page  = node("admin", "network", "vlan")
27         page.target = cbi("admin_network/vlan")
28         page.title  = i18n("a_n_switch")
29         page.order  = 20
30
31         local page  = node("admin", "network", "wireless")
32         page.target = form("admin_network/wireless")
33         page.title  = i18n("wifi")
34         page.i18n   = "wifi"
35         page.order  = 15
36         uci:foreach("wireless", "wifi-device",
37                 function (section)
38                         local ifc = section[".name"]
39                                 entry({"admin", "network", "wireless", ifc},
40                                  alias("admin", "network", "wifi", ifc),
41                                  ifc:upper()).i18n = "wifi"
42                 end
43         )
44
45         local page  = node("admin", "network", "wifi")
46         page.target = cbi("admin_network/wifi")
47         page.leaf   = true
48         page.i18n = "wifi"
49
50         local page  = node("admin", "network", "network")
51         page.target = cbi("admin_network/network")
52         page.title  = i18n("interfaces", "Schnittstellen")
53         page.order  = 10
54         uci:foreach("network", "interface",
55                 function (section)
56                         local ifc = section[".name"]
57                         if ifc ~= "loopback" then
58                                 entry({"admin", "network", "network", ifc},
59                                  alias("admin", "network", "ifaces", ifc),
60                                  ifc:upper())
61                         end
62                 end
63         )
64
65         local page  = node("admin", "network", "ifaces")
66         page.target = cbi("admin_network/ifaces")
67         page.leaf   = true
68
69         local page  = node("admin", "network", "dhcp")
70         page.target = cbi("admin_network/dhcp")
71         page.title  = "DHCP"
72         page.order  = 30
73
74         entry(
75          {"admin", "network", "dhcp", "leases"},
76          cbi("admin_network/dhcpleases"),
77          i18n("dhcp_leases")
78         )
79
80         local page  = node("admin", "network", "hosts")
81         page.target = cbi("admin_network/hosts")
82         page.title  = i18n("hostnames", "Hostnames")
83         page.order  = 40
84
85         local page  = node("admin", "network", "routes")
86         page.target = cbi("admin_network/routes")
87         page.title  = i18n("a_n_routes")
88         page.order  = 50
89         page.leaf   = true
90
91         entry(
92          {"admin", "network", "routes", "static"},
93          function() end,
94          i18n("a_n_routes_static")
95         )
96
97         entry(
98                 {"admin", "network", "conntrack"},
99                 form("admin_network/conntrack"),
100                 i18n("a_n_conntrack"),
101                 60
102         )
103
104 end