add channel setting
authorFelix Fietkau <nbd@openwrt.org>
Fri, 30 Sep 2005 14:01:56 +0000 (14:01 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 30 Sep 2005 14:01:56 +0000 (14:01 +0000)
SVN-Revision: 2009

openwrt/package/webif/files/usr/lib/webif/form.awk
openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh

index 09c8e644c34542f24b7ae4c2196cf6ca3640b304..3cc77e6185babe49c64601195432f734bb6c5fa6 100644 (file)
@@ -23,6 +23,7 @@ $1 ~ /^start_form/ {
        if ($2 != "") print "<div class=\"settings-title\"><h3><strong>" $2 "</strong></h3></div>"
        print "<div class=\"settings-content\"><table width=\"100%\" summary=\"Settings\">"
        form_help = ""
+       form_help_link = ""
 }
 $1 ~ /^field/ {
        if (field_open == 1) print "</td></tr>"
@@ -42,6 +43,22 @@ $1 ~ /^radio/ {
        else radio_selected=""
        print "<input id=\"" $2 "_" $4 "\" type=\"radio\" name=\"" $2 "\" value=\"" $4 "\" " radio_selected $6 " />"
 }
+($1 != "") && ($1 !~ /^option/) {
+       select_open = 0
+       print "</select>"
+}
+$1 ~ /^select/ {
+       print "<select id=\"" $2 "\" name=\"" $2 "\">"
+       select_open = 1
+       select_default = $3
+}
+($1 ~ /^option/) && (select_open == 1) {
+       if ($2 == select_default) option_selected=" selected=\"selected\""
+       else option_selected=""
+       if ($3 != "") option_title = $3
+       else option_title = $2
+       print "<option" option_selected " value=\"" $2 "\">" option_title "</option>"
+}
 $1 ~ /^text/ { print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4 }
 $1 ~ /^submit/ { print "<input type=\"submit\" name=\"" $2 "\" value=\"" $3 "\" />" }
 $1 ~ /^helpitem/ { form_help = form_help "<dt>" $2 ":</dt>" }
index 0eb1e96252f06207021669d78e1561c3b5ea8ca8..c3c5bfde9eab6758175933e26292636c955a4628 100755 (executable)
@@ -31,10 +31,22 @@ END { print "" }')
        }
        FORM_submit=""
 }
+CC=${wl0_country_code:-$(nvram get wl0_country_code)}
+case "$CC" in
+       All|all|ALL) CHANNELS="1 2 3 4 5 6 7 8 9 10 11 12 13 14"; CHANNEL_MAX=14 ;;
+       *) CHANNELS="1 2 3 4 5 6 7 8 9 10 11"; CHANNEL_MAX=11 ;;
+esac
+F_CHANNELS=""
+for ch in $CHANNELS; do
+       F_CHANNELS="${F_CHANNELS}option|$ch
+"
+done
+
 if [ -z "$FORM_submit" ]; then
        FORM_newmac=${FORM_newmac:-00:00:00:00:00:00}
        FORM_mode=${wl0_mode:-$(nvram get wl0_mode)}
        FORM_ssid=${wl0_ssid:-$(nvram get wl0_ssid)}
+       FORM_channel=${wl0_channel:-$(nvram get wl0_channel)}
        FORM_encryption=off
        akm=${wl0_akm:-$(nvram get wl0_akm)}
        case "$akm" in
@@ -108,9 +120,12 @@ wep|FORM_key2|WEP key 2||$FORM_key2
 wep|FORM_key3|WEP key 3||$FORM_key3
 wep|FORM_key4|WEP key 4||$FORM_key4
 string|FORM_wpa_psk|WPA pre-shared key|min=8 max=63 $V_PSK|$FORM_wpa_psk
-string|FORM_radius_key|RADIUS server key|min=4 max=63 $V_RADIUS|$FORM_radius_key" && {
+string|FORM_radius_key|RADIUS server key|min=4 max=63 $V_RADIUS|$FORM_radius_key
+string|FORM_ssid|ESSID|required|$FORM_ssid
+int|FORM_channel|Channel|required min=1 max=$CHANNEL_MAX|$FORM_channel" && {
                save_setting wireless wl0_mode "$FORM_mode"
                save_setting wireless wl0_ssid "$FORM_ssid"
+               save_setting wireless wl0_channel "$FORM_channel"
                case "$FORM_aes$FORM_tkip" in 
                        aes) save_setting wireless wl0_crypto aes;;
                        tkip) save_setting wireless wl0_crypto tkip;;
@@ -190,13 +205,16 @@ field|ESSID
 text|ssid|$FORM_ssid
 helpitem|ESSID
 helptext|Name of your Wireless Network
+field|Channel
+select|channel|$FORM_channel
+$F_CHANNELS
 field|Mode
 radio|mode|$FORM_mode|ap|Access Point<br />|onChange=\"modechange()\" 
 radio|mode|$FORM_mode|sta|Client <br />|onChange=\"modechange()\" 
 radio|mode|$FORM_mode|wet|Bridge|onChange=\"modechange()\" 
 helpitem|Mode
 helptext|Operation mode
-helplink|http://www.google.com
+helplink|http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-7126c5958e237d603674b3a9739c9d23bdfdb293
 end_form
 start_form|Encryption settings
 field|Encryption type