NIU:
[project/luci.git] / modules / niu / luasrc / model / cbi / niu / wireless / apdevice.lua
1 --[[
2 LuCI - Lua Configuration Interface
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 local niulib = require "luci.niulib"
15 local cursor = require "luci.model.uci".inst
16
17 m = Map("wireless", translate("Configure Private Access Point"))
18 s = m:section(NamedSection, "ap", "wifi-iface", translate("Wireless Radio Device"),
19 translate(
20 "Select the wireless radio device that should be used to run the interface."..
21 " Note that wireless radios will not show up here if you already use"..
22 " them for other wireless services and are not capable of being used by"..
23 " more than one service simultaneously or run this specific service at all."))
24 s.anonymous = true
25 s.addremove = false
26
27 local l = s:option(ListValue, "device", translate("Wireless Device"))
28
29 for _, wifi in ipairs(niulib.wifi_get_available("ap")) do
30         l:value(wifi, translate("WLAN-Adapter (%s)") % wifi)
31 end
32 l:value("none", translate("Disable Private Access Point"))
33
34
35 local extend = cursor:get("wireless", "bridge", "network")
36         and cursor:get("wireless", "bridge", "ssid")
37         
38 if extend ~= cursor:get("wireless", "ap", "ssid") then
39         local templ = s:option(ListValue, "_cfgtpl", translate("Configuration Template"))
40         templ:depends({["!default"] = 1})
41         templ:depends({["!reverse"] = 1, device = "none"})
42         templ:value("", translate("Access Point (Current Settings)"))
43         templ:value("bridge", translate("Extend network %s") % extend)
44 end
45
46 return m