c914f3eddbf744c6bff25c8ae2b0548c01dd04e3
[project/luci.git] / modules / admin-full / luasrc / view / admin_network / wifi_join_settings.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9         http://www.apache.org/licenses/LICENSE-2.0
10
11 $Id$
12
13 -%>
14
15 <%-
16
17         local sys = require "luci.sys"
18         local utl = require "luci.util"
19         local uci = require "luci.model.uci".cursor_state()
20
21         local ifaces = { }
22         uci:foreach("network", "interface", function(i)
23                 if i.ifname ~= "lo" then
24                         ifaces[#ifaces+1] = { i['.name'], i.ifname, i.ipaddr }
25                 end
26         end)
27
28         local dev = luci.http.formvalue("device")
29         local iw = luci.sys.wifi.getiwinfo(dev)
30
31 -%>
32
33 <%+header%>
34
35 <h2><a id="content" name="content"><%:a_s_iw_join Join Network%></a></h2>
36
37 <form method="post" action="<%=REQUEST_URI%>">
38         <div class="cbi-map">
39                 <div class="cbi-map-descr">
40                         <%=luci.i18n.translatef("a_s_iw_join_desc", "You are about to join the wireless network <em><strong>%s</strong></em>. " ..
41                                 "In order to complete the process, you need to provide some additional details.",
42                                 utl.pcdata(luci.http.formvalue("join") or "(hidden)")
43                         )%>
44                 </div>
45
46                 <fieldset class="cbi-section">
47                         <input type="hidden" name="confirm" value="1" />
48                         <input type="hidden" name="join" value="<%=utl.pcdata(luci.http.formvalue("join"))%>" />
49                         <input type="hidden" name="device" value="<%=utl.pcdata(luci.http.formvalue("device"))%>" />
50                         <input type="hidden" name="mode" value="<%=luci.http.formvalue("mode")%>" />
51                         <input type="hidden" name="bssid" value="<%=luci.http.formvalue("bssid")%>" />
52                         <input type="hidden" name="channel" value="<%=luci.http.formvalue("channel")%>" />
53                         <input type="hidden" name="wep" value="<%=luci.http.formvalue("wep")%>" />
54                         <input type="hidden" name="wpa_version" value="<%=luci.http.formvalue("wpa_version")%>" />
55
56                         <% if luci.http.formvalue("wep") == "1" then %>
57                                 <label for="pw_key">WEP passphrase</label><br />
58                                 <input class="cbi-input-password" type="password" name="key" id="pw_key" />
59                                 <br /><br />
60                         <% elseif tonumber(luci.http.formvalue("wpa_version") or 0) > 0 and luci.http.formvalue("wpa_suites") == "PSK" then %>
61                                 <label for="pw_key">WPA passphrase</label><br />
62                                 <input class="cbi-input-password" type="password" name="key" id="pw_key" />
63
64                                 <% if tonumber(luci.http.formvalue("wpa_version") or 0) == 3 then %>
65                                         <select name="wpa_suite">
66                                                 <option value="psk">WPA-PSK</option>
67                                                 <option value="psk2" selected="selected">WPA2-PSK</option>
68                                                 <option value="psk+psk2">WPA/WPA2-PSK mixed mode</option>
69                                         </select>
70                                 <% else %>
71                                         <input type="hidden" name="wpa_suite" value="psk<%=tonumber(luci.http.formvalue("wpa_version") or 0) == 2 and 2%>" />
72                                 <% end %>
73
74                                 <br /><br />
75                         <% end %>
76
77                         <label for="sel_attach_intf">Attach wireless to</label><br />
78                         <select name="attach_intf" id="sel_attach_intf">
79                                 <% for _, i in ipairs(ifaces) do %>
80                                         <option<% if i[1] == "wan" then %> selected="selected"<% end %> value="<%=i[1]%>"><%=i[1]%> (<%=i[2]%><% if i[3] then %> - <%=i[3]%><% end %>)</option>
81                                 <% end %>
82                                 <option value="">-- no interface --</option>
83                         </select>
84
85                         <br/><br />
86                         <hr /><br />
87
88                         <% if luci.http.formvalue("mode") == "Ad-Hoc" then %>
89                         <input type="checkbox" name="fixed_bssid" value="1" id="cb_fixed_bssid" checked="checked" />
90                         <label for="cb_fixed_bssid">Lock to BSSID <%=luci.http.formvalue("bssid")%></label>
91                         <br />
92                         <% end %>
93
94                         <% if iw.mbssid_support then %>
95                                 <input type="checkbox" name="replace_net" value="1" id="cb_replace_net" checked="checked" />
96                                 <label for="cb_replace_net">Overwrite existing wireless configuration</label>
97                                 <br />
98                         <% else %>
99                                 <input type="hidden" name="replace_net" value="1" />
100                         <% end %>
101
102                         <input type="checkbox" name="autoconnect" value="1" id="cb_autoconnect" checked="checked" />
103                         <label for="cb_autoconnect">Automatically connect</label>
104                 </fieldset>
105         </div>
106         <div class="cbi-page-actions">
107                 <input class="cbi-button-apply" type="submit" value="<%:a_s_iw_join_confirm Join network%>" />
108                 <input class="cbi-button-reset" type="submit" name="cancel" value="<%:a_s_iw_back_scan Back to scan results%>" />
109         </div>
110 </form>
111
112 <%+footer%>