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