luci-base: raise maximum POST value size to 100KB
[project/luci.git] / modules / luci-mod-admin-full / luasrc / view / cbi / wireless_modefreq.htm
1 <%+cbi/valueheader%>
2
3 <script type="text/javascript">//<![CDATA[
4         var freqlist = <%= luci.http.write_json(self.freqlist) %>;
5         var hwmodes  = <%= luci.http.write_json(self.hwmodes) %>;
6         var htmodes  = <%= luci.http.write_json(self.htmodes) %>;
7
8         var channels = {
9                 '11g': [
10                         'auto', 'auto', true
11                 ],
12                 '11a': [
13                         'auto', 'auto', true
14                 ]
15         };
16
17         for (var i = 0; i < freqlist.length; i++)
18                 channels[(freqlist[i].mhz > 2484) ? '11a' : '11g'].push(
19                         freqlist[i].channel,
20                         '%d (%d MHz)'.format(freqlist[i].channel, freqlist[i].mhz),
21                         !freqlist[i].restricted
22                 );
23
24         var modes = [
25                 '', 'Legacy', true,
26                 'n', 'N', hwmodes.n,
27                 'ac', 'AC', hwmodes.ac
28         ];
29
30         var htmodes = {
31                 '':   [
32                         '', '-', true
33                 ],
34                 'n':  [
35                         'HT20', '20 MHz', htmodes.HT20,
36                         'HT40', '40 MHz', htmodes.HT40
37                 ],
38                 'ac': [
39                         'VHT20', '20 MHz', htmodes.VHT20,
40                         'VHT40', '40 MHz', htmodes.VHT40,
41                         'VHT80', '80 MHz', htmodes.VHT80,
42                         'VHT160', '160 MHz', htmodes.VHT160
43                 ]
44         };
45
46         var bands = {
47                 '':   [
48                         '11g', '2.4 GHz', (channels['11g'].length > 3),
49                         '11a', '5 GHz', (channels['11a'].length > 3)
50                 ],
51                 'n':  [
52                         '11g', '2.4 GHz', (channels['11g'].length > 3),
53                         '11a', '5 GHz', (channels['11a'].length > 3)
54                 ],
55                 'ac': [
56                         '11a', '5 GHz', true
57                 ]
58         };
59
60         function cbi_set_values(sel, vals)
61         {
62                 if (sel.vals)
63                         sel.vals.selected = sel.selectedIndex;
64
65                 while (sel.options[0])
66                         sel.remove(0);
67
68                 for (var i = 0; vals && i < vals.length; i += 3)
69                 {
70                         if (!vals[i+2])
71                                 continue;
72
73                         var opt = document.createElement('option');
74                             opt.value = vals[i+0];
75                             opt.text  = vals[i+1];
76
77                         sel.add(opt);
78                 }
79
80                 if (!isNaN(vals.selected))
81                         sel.selectedIndex = vals.selected;
82
83                 sel.parentNode.style.display = (sel.options.length <= 1) ? 'none' : '';
84                 sel.vals = vals;
85         }
86
87         function cbi_toggle_wifi_mode(id)
88         {
89                 cbi_toggle_wifi_htmode(id);
90                 cbi_toggle_wifi_band(id);
91         }
92
93         function cbi_toggle_wifi_htmode(id)
94         {
95                 var mode = document.getElementById(id + '.mode');
96                 var bwdt = document.getElementById(id + '.htmode');
97
98                 cbi_set_values(bwdt, htmodes[mode.value]);
99         }
100
101         function cbi_toggle_wifi_band(id)
102         {
103                 var mode = document.getElementById(id + '.mode');
104                 var band = document.getElementById(id + '.band');
105
106                 cbi_set_values(band, bands[mode.value]);
107                 cbi_toggle_wifi_channel(id);
108         }
109
110         function cbi_toggle_wifi_channel(id)
111         {
112                 var band = document.getElementById(id + '.band');
113                 var chan = document.getElementById(id + '.channel');
114
115                 cbi_set_values(chan, channels[band.value]);
116         }
117
118         function cbi_init_wifi(id)
119         {
120                 var mode = document.getElementById(id + '.mode');
121                 var band = document.getElementById(id + '.band');
122                 var chan = document.getElementById(id + '.channel');
123                 var bwdt = document.getElementById(id + '.htmode');
124
125                 cbi_set_values(mode, modes);
126
127                 if (/VHT20|VHT40|VHT80|VHT160/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
128                         mode.value = 'ac';
129                 else if (/HT20|HT40/.test(<%= luci.http.write_json(self.map:get(section, "htmode")) %>))
130                         mode.value = 'n';
131                 else
132                         mode.value = '';
133
134                 cbi_toggle_wifi_mode(id);
135
136                 if (/a/.test(<%= luci.http.write_json(self.map:get(section, "hwmode")) %>))
137                         band.value = '11a';
138                 else
139                         band.value = '11g';
140
141                 cbi_toggle_wifi_band(id);
142
143                 bwdt.value = <%= luci.http.write_json(self.map:get(section, "htmode")) %>;
144                 chan.value = <%= luci.http.write_json(self.map:get(section, "channel")) %>;
145         }
146 //]]></script>
147
148 <label style="float:left; margin-right:3px">
149         <%:Mode%><br />
150         <select style="width:auto" id="<%= cbid %>.mode" name="<%= cbid %>.mode" onchange="cbi_toggle_wifi_mode('<%= cbid %>')"></select>
151 </label>
152 <label style="float:left; margin-right:3px">
153         <%:Band%><br />
154         <select style="width:auto" id="<%= cbid %>.band" name="<%= cbid %>.band" onchange="cbi_toggle_wifi_band('<%= cbid %>')"></select>
155 </label>
156 <label style="float:left; margin-right:3px">
157         <%:Channel%><br />
158         <select style="width:auto" id="<%= cbid %>.channel" name="<%= cbid %>.channel"></select>
159 </label>
160 <label style="float:left; margin-right:3px">
161         <%:Width%><br />
162         <select style="width:auto" id="<%= cbid %>.htmode" name="<%= cbid %>.htmode"></select>
163 </label>
164 <br style="clear:left" />
165
166 <script type="text/javascript">cbi_init_wifi('<%= cbid %>');</script>
167
168 <%+cbi/valuefooter%>