fix safari javascript bug
authorFelix Fietkau <nbd@openwrt.org>
Fri, 14 Oct 2005 09:32:33 +0000 (09:32 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 14 Oct 2005 09:32:33 +0000 (09:32 +0000)
SVN-Revision: 2105

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

index 844a56c4b46c50f86b26214e5cc2c6720e4c0c5e..30c1ec52773953e50f0555df32ff4c71d92d4db3 100644 (file)
@@ -14,6 +14,10 @@ BEGIN {
        gsub(/^[ \t]+/,"",$1)
 }
 
+$1 ~ /^onchange/ {
+       onchange = $2
+}
+
 ($1 != "") && ($1 !~ /^option/) && (select_open == 1) {
        select_open = 0
        print "</select>"
@@ -32,21 +36,25 @@ $1 ~ /^field/ {
        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
 }
index 656bdbc7a68792392552854c38fe8a1222f7cc6f..efad4d114df5d99c2fd25efdb9639fc0a83791db 100755 (executable)
@@ -24,12 +24,12 @@ if empty "$FORM_submit"; then
        
        # 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
@@ -148,11 +148,12 @@ function modechange()
 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
@@ -175,8 +176,8 @@ 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
index 0ee96be9e17d11ccfe4a8a1735a37a6d262d01cd..62fb4b1a402c4278a2dad5d879d6078782870704 100755 (executable)
@@ -214,6 +214,7 @@ function modechange()
 EOF
 
 display_form <<EOF
+onchange|modechange
 start_form|Wireless Configuration
 field|ESSID
 text|ssid|$FORM_ssid
@@ -223,20 +224,20 @@ 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 <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