gsub(/^[ \t]+/,"",$1)
}
+$1 ~ /^onchange/ {
+ onchange = $2
+}
+
($1 != "") && ($1 !~ /^option/) && (select_open == 1) {
select_open = 0
print "</select>"
if ($3 != "") field_opts=" id=\"" $3 "\""
else field_opts=""
if ($4 == "hidden") field_opts = field_opts " style=\"display: none\""
- print "<tr" field_opts "><td width=\"45%\">" $2 "</td><td width=\"55%\">"
+ print "<tr" field_opts "><td width=\"50%\">" $2 "</td><td width=\"50%\">"
field_open=1
}
$1 ~ /^checkbox/ {
- if ($3==$4) checkbox_selected="checked=\"checked\" "
- else checkbox_selected=""
- print "<input id=\"" $2 "_" $4 "\" type=\"checkbox\" name=\"" $2 "\" value=\"" $4 "\" " checkbox_selected $6 " />"
+ if ($3==$4) opts="checked=\"checked\" "
+ else opts=""
+ if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\""
+ print "<input id=\"" $2 "_" $4 "\" type=\"checkbox\" name=\"" $2 "\" value=\"" $4 "\" " opts " />"
}
$1 ~ /^radio/ {
- if ($3==$4) radio_selected="checked=\"checked\" "
- else radio_selected=""
- print "<input id=\"" $2 "_" $4 "\" type=\"radio\" name=\"" $2 "\" value=\"" $4 "\" " radio_selected $6 " />"
+ if ($3==$4) opts="checked=\"checked\" "
+ else opts=""
+ if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\""
+ print "<input id=\"" $2 "_" $4 "\" type=\"radio\" name=\"" $2 "\" value=\"" $4 "\" " opts " />"
}
$1 ~ /^select/ {
- print "<select id=\"" $2 "\" name=\"" $2 "\">"
+ opts = ""
+ if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\""
+ print "<select id=\"" $2 "\" name=\"" $2 "\"" opts ">"
select_open = 1
select_default = $3
}
# detect pptp package and compile option
[ -x /sbin/ifup.pptp ] && {
- PPTP_OPTION="radio|wan_proto|$FORM_wan_proto|pptp|PPTP<br />|onChange=\"modechange()\""
+ PPTP_OPTION="radio|wan_proto|$FORM_wan_proto|pptp|PPTP<br />"
PPTP_SERVER_OPTION="field|PPTP Server IP|pptp_server_ip|hidden
text|pptp_server_ip|$FORM_pptp_server_ip"
}
[ -x /sbin/ifup.pppoe ] && {
- PPPOE_OPTION="radio|wan_proto|$FORM_wan_proto|pppoe|PPPoE<br />|onChange=\"modechange()\""
+ PPPOE_OPTION="radio|wan_proto|$FORM_wan_proto|pppoe|PPPoE<br />"
}
# pptp, dhcp and static common
EOF
display_form <<EOF
+onchange|modechange
start_form|WAN Configuration
field|Internet Connection Type
-radio|wan_proto|$FORM_wan_proto|none|None<br />|onchange="modechange()"
-radio|wan_proto|$FORM_wan_proto|dhcp|DHCP<br />|onchange="modechange()"
-radio|wan_proto|$FORM_wan_proto|static|Static IP<br />|onchange="modechange()"
+radio|wan_proto|$FORM_wan_proto|none|None<br />
+radio|wan_proto|$FORM_wan_proto|dhcp|DHCP<br />
+radio|wan_proto|$FORM_wan_proto|static|Static IP<br />
$PPPOE_OPTION
$PPTP_OPTION
end_form
start_form|PPP Settings|ppp_settings|hidden
field|PPP Redial Policy|ppp_redial|hidden
-radio|ppp_redial|$FORM_ppp_redial|demand|Connect on Demand<br />|onChange="modechange()"
-radio|ppp_redial|$FORM_ppp_redial|persist|Keep Alive|onChange="modechange()"
+radio|ppp_redial|$FORM_ppp_redial|demand|Connect on Demand<br />
+radio|ppp_redial|$FORM_ppp_redial|persist|Keep Alive
field|Maximum Idle Time|ppp_demand_idletime|hidden
text|ppp_idletime|$FORM_ppp_idletime
field|Redial Timeout|ppp_persist_redialperiod|hidden
EOF
display_form <<EOF
+onchange|modechange
start_form|Wireless Configuration
field|ESSID
text|ssid|$FORM_ssid
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 <br />|onChange="modechange()"
-radio|mode|$FORM_mode|adhoc|Ad-Hoc|onChange="modechange()"
+radio|mode|$FORM_mode|ap|Access Point<br />
+radio|mode|$FORM_mode|sta|Client <br />
+radio|mode|$FORM_mode|wet|Bridge <br />
+radio|mode|$FORM_mode|adhoc|Ad-Hoc
helpitem|Mode
helptext|Operation mode
helplink|http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-7126c5958e237d603674b3a9739c9d23bdfdb293
end_form
start_form|Encryption settings
field|Encryption type
-radio|encryption|$FORM_encryption|off|Disabled <br />|onChange="modechange()"
-radio|encryption|$FORM_encryption|wep|WEP <br />|onChange="modechange()"
-radio|encryption|$FORM_encryption|psk|WPA (preshared key) <br />|onChange="modechange()"
-radio|encryption|$FORM_encryption|wpa|WPA (RADIUS)|onChange="modechange()"
+radio|encryption|$FORM_encryption|off|Disabled <br />
+radio|encryption|$FORM_encryption|wep|WEP <br />
+radio|encryption|$FORM_encryption|psk|WPA (preshared key) <br />
+radio|encryption|$FORM_encryption|wpa|WPA (RADIUS)
field|WPA support|wpa_support|hidden
checkbox|wpa1|$FORM_wpa1|wpa1|WPA1
checkbox|wpa2|$FORM_wpa2|wpa2|WPA2