build: split into luci and luci-addons packages
[project/luci.git] / modules / niu / luasrc / controller / niu / wireless.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.wireless"
16
17 function index()
18         if not fs.access("/etc/config/wireless") then
19                 return
20         end
21
22         local toniu = {on_success_to={"niu"}}
23         
24         local e = entry({"niu", "wireless"}, alias("niu"), _("Wireless"), 20)
25         --e.niu_dbtemplate = "niu/wireless"
26         e.niu_dbtasks = true
27         e.niu_dbicon = "icons32/network-wireless.png"
28
29         entry({"niu", "wireless", "ap"}, 
30         cbi("niu/wireless/ap", toniu), _("Configure Private Access Point"), 1)
31         
32         local bridge = false
33         uci.inst:foreach("wireless", "wifi-device", function(s)
34                 if not bridge and (s.type == "mac80211" or s.type == "atheros") then
35                         entry({"niu", "wireless", "bridge"}, 
36                         cbi("niu/wireless/bridge", toniu), _("Join a local WDS network"), 2)
37                         bridge = true
38                 end
39         end)
40 end