Changeset 3009


Ignore:
Timestamp:
2006-01-18T02:15:22+01:00 (12 years ago)
Author:
nbd
Message:

webif-changes:

  • removed extra files display-dhcp.awk, display-hosts.awk, moved the code into hosts.sh
  • moved the wds list from wireless-config to wireless-advanced ("Advanced Wireless")
  • added wireless mac filter editor
Location:
branches/whiterussian/openwrt/package/webif/files
Files:
1 added
2 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/whiterussian/openwrt/package/webif/files/usr/lib/webif/form.awk

    r2976 r3009  
    2121($1 != "") && ($1 !~ /^option/) && (select_open == 1) { 
    2222        select_open = 0 
    23         print "</select>" 
     23        printf "</select>" 
    2424} 
    2525$1 ~ /^start_form/ { 
     
    3737        else field_opts="" 
    3838        if ($4 == "hidden") field_opts = field_opts " style=\"display: none\"" 
    39         print "<tr" field_opts "><td width=\"50%\">" $2 "</td><td width=\"50%\">" 
     39        print "<tr" field_opts ">" 
     40        if ($2 != "") print "<td width=\"50%\">" $2 "</td><td width=\"50%\">" 
     41        else print "<td colspan=\"2\">" 
     42 
    4043        field_open=1 
    4144} 
     
    6467        if ($3 != "") option_title = $3 
    6568        else option_title = $2 
    66         print "<option" option_selected " value=\"" $2 "\">" option_title "</option>" 
     69        print "<option" option_selected " value=\"" $2 "\">" option_title "&nbsp;&nbsp;</option>" 
    6770} 
    6871($1 ~ /^listedit/) { 
     
    7376        print "<tr><td width=\"100%\" colspan="2"><input type=\"text\" name=\"" $2 "add\" value=\"" $5 "\" /><input type=\"submit\" name=\"" $2 "submit\" value=\"Add\" /></td></tr>" 
    7477} 
     78$1 ~ /^caption/ { print "<b>" $2 "</b>" } 
     79$1 ~ /^string/ { print $2 } 
    7580$1 ~ /^text/ { print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4 } 
    7681$1 ~ /^password/ { print "<input id=\"" $2 "\" type=\"password\" name=\"" $2 "\" value=\"" $3 "\" />" $4 } 
  • branches/whiterussian/openwrt/package/webif/files/usr/lib/webif/validate.awk

    r3005 r3009  
    7777                verr = "String too long" 
    7878        } 
    79         if (length(value) < 8) { 
     79        if ((length(value) != 0) && (length(value) < 8)) { 
    8080                valid = 0 
    8181                verr = "String too short" 
  • branches/whiterussian/openwrt/package/webif/files/www/cgi-bin/webif/hosts.sh

    r2090 r3009  
    8585awk -v "url=$SCRIPT_NAME" \ 
    8686        -v "ip=$FORM_host_ip" \ 
    87         -v "name=$FORM_host_name"  -f /usr/lib/webif/common.awk -f /usr/lib/webif/display-hosts.awk $HOSTS_FILE 
     87        -v "name=$FORM_host_name"  -f /usr/lib/webif/common.awk -f - $HOSTS_FILE <<EOF 
     88BEGIN { 
     89        FS="[ \t]" 
     90        start_form("Hostnames") 
     91        print "<table width=\"70%\" summary=\"Settings\">" 
     92        print "<tr><th>IP</th><th>Hostname</th><th></th></tr>" 
     93        print "<tr><td colspan=\"3\"><hr class=\"separator\" /></td></tr>" 
     94} 
     95 
     96# only for valid IPv4 addresses 
     97(\$1 ~ /^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/) { 
     98        gsub(/#.*$/, ""); 
     99        output = "" 
     100        names_found = 0 
     101        n = split(\$0, names, "[ \\t]") 
     102        first = 1 
     103        for (i = 2; i <= n; i++) { 
     104                if (names[i] != "") { 
     105                        if (first != 1) output = output "<tr>" 
     106                        output = output "<td>" names[i] "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_host=1&remove_ip=" $1 "&remove_name=" names[i] "\\">Remove</a></td></tr>" 
     107                        first = 0 
     108                        names_found++ 
     109                } 
     110        } 
     111        if (names_found > 0) { 
     112                print "<tr><td rowspan=\\"" names_found "\\">" \$1 "</td>" output 
     113                print "<tr><td colspan=\\"3\\"><hr class=\\"separator\\" /></td></tr>" 
     114        } 
     115} 
     116 
     117END { 
     118        print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">" 
     119        print "<tr><td><input type\\"text\\" name=\\"host_ip\\" value=\\"" ip "\\" /></td><td><input type=\\"text\\" name=\\"host_name\\" value=\\"" name "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_host\\" value=\\"Add\\" /></td></tr>" 
     120        print "</form>" 
     121        print "</table>" 
     122        end_form() 
     123} 
     124EOF 
    88125 
    89126# Static DHCP mappings (/etc/ethers) 
    90127awk -v "url=$SCRIPT_NAME" \ 
    91128        -v "mac=$FORM_dhcp_mac" \ 
    92         -v "ip=$FORM_dhcp_ip" -f /usr/lib/webif/common.awk -f /usr/lib/webif/display-dhcp.awk $ETHERS_FILE 
     129        -v "ip=$FORM_dhcp_ip" -f /usr/lib/webif/common.awk -f - $ETHERS_FILE <<EOF 
     130         
     131BEGIN { 
     132        FS="[ \\t]" 
     133        print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">" 
     134        start_form("Static IP addresses (for DHCP)") 
     135        print "<table width=\\"70%\\" summary=\\"Settings\\">" 
     136        print "<tr><th>MAC address</th><th>IP</th><th></th></tr>" 
     137} 
     138 
     139# only for valid MAC addresses 
     140(\$1 ~ /^[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]$/) { 
     141        gsub(/#.*$/, ""); 
     142        print "<tr><td>" \$1 "</td><td>" \$2 "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_dhcp=1&remove_mac=" \$1 "\\">Remove</a></td></tr>" 
     143} 
     144 
     145END { 
     146        print "<tr><td><input type\\"text\\" name=\\"dhcp_mac\\" value=\\"" mac "\\" /></td><td><input type=\\"text\\" name=\\"dhcp_ip\\" value=\\"" ip "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_dhcp\\" value=\\"Add\\" /></td></tr>" 
     147        print "</table>" 
     148        print "</form>" 
     149        end_form(); 
     150} 
     151EOF 
    93152 
    94153footer ?> 
    95154<!-- 
    96 ##WEBIF:name:Network:4:Hosts 
     155##WEBIF:name:Network:5:Hosts 
    97156--> 
  • branches/whiterussian/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh

    r3008 r3009  
    33. /usr/lib/webif/webif.sh 
    44load_settings "wireless" 
    5  
    6 FORM_wds="${wl0_wds:-$(nvram get wl0_wds)}" 
    7 LISTVAL="$FORM_wds" 
    8 handle_list "$FORM_wdsremove" "$FORM_wdsadd" "$FORM_wdssubmit" 'mac|FORM_wdsadd|WDS MAC address|required' && { 
    9         FORM_wds="$LISTVAL" 
    10         save_setting wireless wl0_wds "$FORM_wds" 
    11 } 
    12 FORM_wdsadd=${FORM_wdsadd:-00:00:00:00:00:00} 
    135 
    146CC=${wl0_country_code:-$(nvram get wl0_country_code)} 
     
    2315done 
    2416 
    25  
    2617if empty "$FORM_submit"; then 
    2718        FORM_mode=${wl0_mode:-$(nvram get wl0_mode)} 
     
    10394        SAVED=1 
    10495        case "$FORM_encryption" in 
    105                 wpa) V_RADIUS="required";; 
     96                wpa) V_RADIUS=" 
     97string|FORM_radius_key|RADIUS server key|min=4 max=63 required|$FORM_radius_key 
     98ip|FORM_radius_ipaddr|RADIUS IP address|required|$FORM_radius_ipaddr";; 
    10699                psk) V_PSK="wpapsk|FORM_wpa_psk|WPA pre-shared key|required|$FORM_wpa_psk";; 
    107         esac 
    108  
    109         validate <<EOF 
    110 int|FORM_radio|Radio On/Off|required min=0 max=1|$FORM_radio 
    111 ip|FORM_radius_ipaddr|RADIUS IP address|$V_RADIUS|$FORM_radius_ipaddr 
     100                wep) V_WEP=" 
     101int|FORM_key|WEP key number|min=1 max=4|$FORM_key 
    112102wep|FORM_key1|WEP key 1||$FORM_key1 
    113103wep|FORM_key2|WEP key 2||$FORM_key2 
    114104wep|FORM_key3|WEP key 3||$FORM_key3 
    115 wep|FORM_key4|WEP key 4||$FORM_key4 
    116 $V_PSK 
    117 string|FORM_radius_key|RADIUS server key|min=4 max=63 $V_RADIUS|$FORM_radius_key 
     105wep|FORM_key4|WEP key 4||$FORM_key4";; 
     106        esac 
     107 
     108        validate <<EOF 
     109int|FORM_radio|Radio On/Off|required min=0 max=1|$FORM_radio 
    118110string|FORM_ssid|ESSID|required|$FORM_ssid 
    119111int|FORM_channel|Channel|required min=1 max=$CHANNEL_MAX|$FORM_channel 
     112$V_WEP 
     113$V_RADIUS 
     114$V_PSK 
    120115EOF 
    121116        equal "$?" 0 && { 
     
    272267text|key4|$FORM_key4|<br /> 
    273268end_form 
    274 start_form|WDS connections 
    275 listedit|wds|$SCRIPT_NAME?|$FORM_wds|$FORM_wdsadd 
    276 helpitem|Note 
    277 helptext|You should save your settings on this page before adding/removing WDS links 
    278 end_form 
    279269EOF 
    280270 
  • branches/whiterussian/openwrt/package/webif/files/www/webif.js

    r1987 r3009  
     1function value(name) 
     2{ 
     3        var item = document.getElementById(name); 
     4        return (item ? item.value : ""); 
     5} 
    16function checked(name) 
    27{ 
Note: See TracChangeset for help on using the changeset viewer.