add some indirection around make targets of module.mk, so you can combine it more...
[project/luci.git] / modules / freifunk / src / controller / freifunk / freifunk.lua
1 module("luci.controller.freifunk.freifunk", package.seeall)
2
3 function index()
4 local page = node()
5 page.target = alias("freifunk")
6
7 local page = node("freifunk")
8 page.title = "Freifunk"
9 page.target = alias("freifunk", "index")
10 page.order = 5
11 page.setuser = "nobody"
12 page.setgroup = "nogroup"
13
14 local page = node("freifunk", "index")
15 page.target = template("freifunk/index")
16 page.title = "√úbersicht"
17 page.order = 10
18
19 local page = node("freifunk", "index", "contact")
20 page.target = template("freifunk/contact")
21 page.title = "Kontakt"
22
23
24 local page = node("freifunk", "status")
25 page.target = action_status
26 page.title = "Status"
27 page.order = 20
28 page.setuser = false
29 page.setgroup = false
30
31 local page = node("freifunk", "status", "routes")
32 page.target = template("public_status/routes")
33 page.title = "Routingtabelle"
34 page.order = 10
35
36 local page = node("freifunk", "status", "iwscan")
37 page.target = template("public_status/iwscan")
38 page.title = "WLAN-Scan"
39 page.order = 20
40
41 local page = node("admin", "index", "freifunk")
42 page.target = cbi("freifunk/freifunk")
43 page.title = "Freifunk"
44 page.order = 30
45
46 local page = node("admin", "index", "contact")
47 page.target = cbi("freifunk/contact")
48 page.title = "Kontakt"
49 page.order = 40
50 end
51
52 function action_status()
53 local data = {}
54
55 data.s, data.m, data.r = luci.sys.sysinfo()
56
57 data.wifi = luci.sys.wifi.getiwconfig()
58
59 data.routes = {}
60 for i, r in pairs(luci.sys.net.routes()) do
61 if r.Destination == "00000000" then
62 table.insert(data.routes, r)
63 end
64 end
65
66
67 luci.template.render("public_status/index", data)
68 end