* luci/libs: uvl: add support for external validation commands, various cleanups
[project/luci.git] / modules / admin-full / luasrc / model / cbi / admin_wifi / networks.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 require("luci.tools.webadmin")
15 m = Map("wireless", translate("networks"), translate("a_w_networks1"))
16
17 s = m:section(TypedSection, "wifi-iface", "")
18 s.addremove = true
19 s.anonymous = true
20
21 s:option(Value, "ssid", translate("a_w_netid")).maxlength = 32
22
23 device = s:option(ListValue, "device", translate("device"))
24 luci.model.uci.foreach("wireless", "wifi-device",
25         function (section)
26                 device:value(section[".name"])
27         end)
28
29 network = s:option(ListValue, "network", translate("network"), translate("a_w_network1"))
30 network:value("")
31 luci.tools.webadmin.cbi_add_networks(network)
32
33 mode = s:option(ListValue, "mode", translate("mode"))
34 mode:value("ap", translate("a_w_ap"))
35 mode:value("adhoc", translate("a_w_adhoc"))
36 mode:value("ahdemo", translate("a_w_ahdemo"))
37 mode:value("sta", translate("a_w_client"))
38 mode:value("wds", translate("a_w_wds"))
39 mode:value("monitor", translate("a_w_monitor"))
40
41 s:option(Value, "bssid", "BSSID").optional = true
42
43 s:option(Value, "txpower", translate("a_w_txpwr"), "dbm").rmempty = true
44
45 s:option(Flag, "frameburst", translate("a_w_brcmburst")).optional = true
46 s:option(Flag, "bursting", translate("a_w_athburst")).optional = true
47
48
49 encr = s:option(ListValue, "encryption", translate("encryption"))
50 encr:value("none", "keine")
51 encr:value("wep", "WEP")
52 encr:value("psk", "WPA-PSK")
53 encr:value("wpa", "WPA-Radius")
54 encr:value("psk2", "WPA2-PSK")
55 encr:value("wpa2", "WPA2-Radius")
56
57 key = s:option(Value, "key", translate("key"))
58 key:depends("encryption", "wep")
59 key:depends("encryption", "psk")
60 key:depends("encryption", "wpa")
61 key:depends("encryption", "psk2")
62 key:depends("encryption", "wpa2")
63 key.rmempty = true
64
65 server = s:option(Value, "server", translate("a_w_radiussrv"))
66 server:depends("encryption", "wpa")
67 server:depends("encryption", "wpa2")
68 server.rmempty = true
69
70 port = s:option(Value, "port", translate("a_w_radiusport"))
71 port:depends("encryption", "wpa")
72 port:depends("encryption", "wpa2")
73 port.rmempty = true
74
75 s:option(Flag, "isolate", translate("a_w_apisolation"), translate("a_w_apisolation1")).optional = true
76
77 s:option(Flag, "hidden", translate("a_w_hideessid")).optional = true
78
79
80
81 return m