new webif layout, new input validation code, lots of fixes, proper authentication
authorFelix Fietkau <nbd@openwrt.org>
Thu, 29 Sep 2005 15:12:04 +0000 (15:12 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 29 Sep 2005 15:12:04 +0000 (15:12 +0000)
SVN-Revision: 2004

12 files changed:
openwrt/package/webif/files/usr/lib/webif/form.awk
openwrt/package/webif/files/usr/lib/webif/validate.awk [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/webif.sh
openwrt/package/webif/files/www/cgi-bin/webif.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/about.sh
openwrt/package/webif/files/www/cgi-bin/webif/config.sh
openwrt/package/webif/files/www/cgi-bin/webif/lan.sh
openwrt/package/webif/files/www/cgi-bin/webif/system.sh
openwrt/package/webif/files/www/cgi-bin/webif/wan.sh
openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh
openwrt/package/webif/files/www/index.html
openwrt/package/webif/files/www/webif.css

index 25d1507accedbd9a4c844c8592d9d843225ea3b7..09c8e644c34542f24b7ae4c2196cf6ca3640b304 100644 (file)
@@ -5,23 +5,31 @@
 # $5 = string to append
 # $6 = additional attributes 
 
+BEGIN {
+       FS="|"
+       print "<input type=\"hidden\" name=\"submit\" value=\"1\" />"
+}
+
 # trim leading whitespaces 
 {
        gsub(/^[ \t]+/,"",$1)
 }
 
 $1 ~ /^start_form/ {
-       print "<form method=\"POST\" action=\"" $2 "\" enctype=\"multipart/form-data\">"
-       print "<input type=\"hidden\" name=\"submit\" value=\"1\" />"
-       print "<table style=\"width: 90%; text-align: left;\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" align=\"center\">"
-       print "<tbody>"
+       if ($3 != "") field_opts=" id=\"" $3 "\""
+       else field_opts=""
+       if ($4 == "hidden") field_opts = field_opts " style=\"display: none\""
+       print "<div class=\"settings\"" field_opts ">"
+       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 = ""
 }
 $1 ~ /^field/ {
        if (field_open == 1) print "</td></tr>"
        if ($3 != "") field_opts=" id=\"" $3 "\""
        else field_opts=""
        if ($4 == "hidden") field_opts = field_opts " style=\"display: none\""
-       print "<tr" field_opts "><td>" $2 "</td><td>"
+       print "<tr" field_opts "><td width=\"45%\">" $2 "</td><td width=\"55%\">"
        field_open=1
 }
 $1 ~ /^checkbox/ {
@@ -34,22 +42,22 @@ $1 ~ /^radio/ {
        else radio_selected=""
        print "<input id=\"" $2 "_" $4 "\" type=\"radio\" name=\"" $2 "\" value=\"" $4 "\" " radio_selected $6 " />"
 }
-$1 ~ /^text/ {
-       print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4
-}
-$1 ~ /^submit/ {
-       print "<input type=\"submit\" name=\"" $2 "\" value=\"" $3 "\" />"
-}
+$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>" }
+$1 ~ /^helptext/ { form_help = form_help "<dd>" $2 "</dd>" }
+$1 ~ /^helplink/ { form_help_link = "<div class=\"more-help\"><a href=\"" $2 "\">more...</a></div>" }
+
 {
        print $5
 }
+
 $1 ~ /^end_form/ {
        if (field_open == 1) print "</td></tr>"
        field_open = 0
-       print "</tbody>"
-       print "</table>"
-       print "</form>"
-}
-END {
-       if(field_open == 1) print "</td></tr>"
+       print "</table></div>"
+       if (form_help != "") form_help = "<dl>" form_help "</dl>"
+       print "<div class=\"settings-help\"><blockquote><h3><strong>Short help:</strong></h3>" form_help form_help_link "</blockquote></div>"
+       form_help = ""
+       print "<div style=\"clear: both\">&nbsp;</div></div>"
 }
diff --git a/openwrt/package/webif/files/usr/lib/webif/validate.awk b/openwrt/package/webif/files/usr/lib/webif/validate.awk
new file mode 100644 (file)
index 0000000..3c07643
--- /dev/null
@@ -0,0 +1,69 @@
+# $1 = type
+# $2 = variable name
+# $3 = field name
+# $4 = options
+# $5 = value
+BEGIN {
+       FS="|"
+       output=""
+}
+
+{ 
+       valid_type = 0
+       valid = 1
+       # XXX: weird hack, but it works...
+       n = split($0, param, "|")
+       value = param[5]
+       for (i = 6; i <= n; i++) value = value FS param[i]
+       verr = ""
+}
+
+$1 == "int" {
+       valid_type = 1
+       if (value !~ /^[0-9]*$/) { valid = 0; verr = "Invalid value" }
+}
+
+# FIXME: add proper netmask validation
+($1 == "ip") || ($1 == "netmask") {
+       valid_type = 1
+       if ((value != "") && (value !~ /^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$/)) valid = 0
+       else {
+               split(value, ipaddr, "\\.")
+               for (i = 1; i <= 4; i++) {
+                       if ((ipaddr[i] < 0) || (ipaddr[i] > 255)) valid = 0
+               }
+       }
+       if (valid == 0) verr = "Invalid value"
+}
+
+valid_type != 1 { valid = 0 }
+
+valid == 1 {
+       n = split($4, options, " ")
+       for (i = 1; (valid == 1) && (i <= n); i++) {
+               if (options[i] == "required") {
+                       if (value == "") { valid = 0; verr = "No value entered" }
+               } else if (options[i] ~ /^min=/) {
+                       if ($1 == "int") {
+                               min = options[i]
+                               sub(/^min=/, "", min)
+                               if (value < min) { valid = 0; verr = "Value too small" }
+                       }
+               } else if (options[i] ~ /^max=/) {
+                       if ($1 == "int") {
+                               max = options[i]
+                               sub(/^max=/, "", max)
+                               if (value > max) { valid = 0; verr = "Value too large" }
+                       }
+               }
+       }
+}
+
+valid_type == 1 {
+       if (valid == 1) output = output $2 "=\"" value "\";\n"
+       else error = error "Error in " $3 ": " verr "<br />"
+}
+
+END {
+       print output "ERROR=\"" error "\";\n"
+}
index bb054867be086f280f1eed875a34710b5bb99880..18851a7a4e03e1bfa14ee5dafba8ba195ca9c899 100644 (file)
@@ -1,87 +1,85 @@
 libdir=/usr/lib/webif
 wwwdir=/www
 cgidir=/www/cgi-bin/webif
+rootdir=/cgi-bin/webif
 indexpage=index.sh
 
 header() {
-  UPTIME=$(uptime)
-  UPTIME="up ${UPTIME##*up}"
+  UPTIME="$(uptime)"
+  LOADAVG="${UPTIME#*load average: }"
+  UPTIME="${UPTIME#*up }"
+  UPTIME="${UPTIME%%,*}"
   HOSTNAME=$(cat /proc/sys/kernel/hostname)
-  CHANGES=$(($(cat /tmp/.webif/config-* 2>&- | wc -l)))
-  CHANGES=${CHANGES#0}
-  CHANGES=${CHANGES:+( ${CHANGES} )}
+  VERSION=$(cat /etc/banner | grep "(")
+  VERSION="${VERSION%% ---*}"
   cat <<EOF
 Content-Type: text/html
 Pragma: no-cache
 
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-US">
-  <head>
-       <meta http-equiv="content-type" content="application/xhtml+xml; charset=ISO-8859-15" />
-       <link rel="stylesheet" type="text/css" href="/webif.css" media="screen, tv, projection" title="Default" />
-       <title>OpenWrt Administrative Console</title>
-  </head>
-  <body $4>
-  <div id="container">
-       <div id="header">
-         <div class="topHeader">&nbsp;</div>
-         <div class="midHeader">
-               <h1 class="headerTitle">OpenWrt Admin Console</h1>
-               <div class="headerSubTitle">$UPTIME</div>
-               <br class="doNotDisplay doNotPrint" />
-               <div class="headerInfo">
-                 <span>Hostname: &nbsp;</span>
-                 $HOSTNAME
-               </div>
-               <div class="headerLinks">
-                 <a href="config.sh?mode=save&cat=$1">Apply settings &laquo;</a>
-                 <a href="config.sh?mode=clear&cat=$1">Clear changes &laquo;</a>
-                 <a href="config.sh?mode=review&cat=$1">Review changes $CHANGES &laquo;</a>
-               </div>
-         </div>
-         <div class="doNotDisplay doNotPrint">
-                 <br />
-                 <br />
-                 <br />
-         </div>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+       <head>
+       <title>OpenWrt Administrative Console</title>
+               <link rel="stylesheet" type="text/css" href="/webif.css" />
+       </head>
+       <body $4><div id="container">
+           <div id="header">
+               <div id="header-title">
+                               <div id="openwrt-title"><h1>OpenWrt Admin Console</h1></div>
+                               <div id="short-status">
+                                       <h3><strong>Status:</strong></h3>
+                                       <ul>
+                                               <li><strong>Hostname:</strong> $HOSTNAME</li>
+                                               <li><strong>Uptime:</strong> $UPTIME</li>
+                                               <li><strong>Load:</strong> $LOADAVG</li>
+                                               <li><strong>Version:</strong> $VERSION</li>
+                                       </ul>
+                               </div>
+                       </div>
 EOF
   grep '##WEBIF:category' $cgidir/.categories $cgidir/*.sh 2>/dev/null | awk -F: '
        BEGIN {
-         print "<div class=\"categoryHeader\"><span>Categories: &nbsp;&nbsp;&nbsp; </span>"
+         print "<div id=\"mainmenu\"><h3><strong>Categories:</strong></h3><ul>"
        }
        categories !~ /:$4:/ {
          categories = categories ":" $4 ":";
-         if ($4 ~ /^'"$1"'$/) print "<a class=\"active\">&raquo;" $4 "&laquo;</a> &nbsp;"
-         else print "<a href=\"'"$indexpage"'?cat=" $4 "\">&nbsp;" $4 "&nbsp;</a> &nbsp;";
+         if ($4 ~ /^'"$1"'$/) print "<li class=\"selected-maincat\"><a href=\"'"$rootdir/$indexpage"'?cat=" $4 "\">&raquo;" $4 "&laquo;</a></li>"
+         else print "<li><a href=\"'"$rootdir/$indexpage"'?cat=" $4 "\">&nbsp;" $4 "&nbsp;</a></li>";
        }
        END {
-         print "</div>"
+         print "</ul></div>"
        }' -
        [ \! -z "$2" ] && {
-         grep "##WEBIF:name:$1:" *.sh 2>/dev/null | sed -e 's,^\([a-zA-Z\.\-]*\):\(.*\)$,\2:\1,' | sort -n | awk -F: '
+         grep -H "##WEBIF:name:$1:" $cgidir/*.sh 2>/dev/null | sed -e 's,^.*/\([a-zA-Z\.\-]*\):\(.*\)$,\2:\1,' | sort -n | awk -F: '
                BEGIN {
-                 print "<div class=\"subHeader\"><span class=\"doNotDisplay doNotPrint\">Config pages: &nbsp;</span>";
+             print "<div id=\"submenu\"><h3><strong>Sub-Categories:</strong></h3><ul>"
                }
                {
-                 if ($5 ~ /^'"$2"'$/) print "<a class=\"active\">&raquo;" $5 "&laquo;</a>&nbsp;&nbsp;&nbsp;"
-                 else print "<a href=\"" $6 "\">" $5 "</a>&nbsp;&nbsp;&nbsp;";
+                 if ($5 ~ /^'"$2"'$/) print "<li class=\"selected-maincat\"><a href=\"'"$rootdir/"'" $6 "\">&raquo;" $5 "&laquo;</a></li>"
+                 else print "<li><a href=\"'"$rootdir/"'" $6 "\">&nbsp;" $5 "&nbsp;</a></li>"
                }
                END {
-                 print "</div>";
+             print "</ul></div>"
                }
          ' -
        }
-       [ -z "$3" ] && HEAD="" || HEAD="<h1>$3</h1><br />" 
+       SAVED=${SAVED:+: Settings saved}
+       SAVED_TITLE=${ERROR:+: Settings not saved}
+       SAVED_TITLE=${SAVED_TITLE:-$SAVED}
+       ERROR=${ERROR:+<h3>$ERROR</h3><br /><br />}
+       HEAD="${3:+<div class=\"settings-block-title\"><h2>$3$SAVED_TITLE</h2></div>}"
+       FORM="${5:+<form enctype=\"multipart/form-data\" action=\"$5\" method=\"post\">}"
+       SAVEBUTTON="${5:+<p><input type=\"submit\" name=\"action\" value=\"Save changes\" /></p>}"
        cat <<EOF
-       </div>
-       <div id="main-copy">
-         <div class="rowOfBoxes">
-               <div class="noBorderOnLeft">
-               $HEAD
+               </div>
+               $FORM
+               <div id="content">
+                       <div class="settings-block">
+                               $HEAD
+                               $ERROR
 EOF
        [ -z "$REMOTE_USER" \
-         -a "${SCRIPT_NAME#/cgi-bin/webif/}" != "info.sh"\
-         -a "${SCRIPT_NAME#/cgi-bin/webif/}" != "about.sh" ] && {
+         -a "${SCRIPT_NAME#/cgi-bin/}" != "webif.sh" ] && {
                [ -z $FORM_passwd1 ] || {
                        echo '<pre>'
                        (
@@ -128,14 +126,30 @@ EOF
 }
 
 footer() {
+  CHANGES=$(($(cat /tmp/.webif/config-* 2>&- | wc -l)))
+  CHANGES=${CHANGES#0}
+  CHANGES=${CHANGES:+(${CHANGES})}
   cat <<EOF
-       <br />
-       </div> </div> </div>
-       <div id="footer">
-OpenWrt Administrative Console
-       </div>
-       </div>
-  </body>
+                       </div>
+                       <hr width="40%" />
+               </div>
+               <br />
+               <div id="save">
+                       <div class="page-save">
+                               <div>
+                                       $SAVEBUTTON
+                               </div>
+                       </div>
+                       <div class="apply">
+                               <div>
+                                       <a href="config.sh?mode=save&amp;cat=Network">Apply changes &laquo;</a><br />
+                                       <a href="config.sh?mode=clear&amp;cat=Network">Clear changes &laquo;</a><br />
+                                       <a href="config.sh?mode=review&amp;cat=Network">Review changes $CHANGES &laquo;</a>
+                               </div>
+                       </div>
+               </div>
+               </form>
+    </div></body>
 </html>
 EOF
 }
@@ -143,17 +157,15 @@ EOF
 apply_passwd() {
        case ${SERVER_SOFTWARE%% *} in
                busybox)
-                       echo -n '/:' > /etc/httpd.conf
+                       echo -n '/cgi-bin/webif:' > /etc/httpd.conf
                        cat /etc/passwd | grep root | cut -d: -f1,2 >> /etc/httpd.conf
-                       echo '/cgi-bin/webif/info.sh:*' >> /etc/httpd.conf
-                       echo '/cgi-bin/webif/about.sh:*' >> /etc/httpd.conf
                        killall -HUP httpd
                        ;;
        esac
 }
 
 display_form() {
-       echo "$1" | awk -F: -f /usr/lib/webif/form.awk
+       echo "$1" | awk -F'|' -f /usr/lib/webif/form.awk
 }
 
 mkdir -p /tmp/.webif
@@ -163,55 +175,16 @@ load_settings() {
        [ -f /tmp/.webif/config-$1 ] && . /tmp/.webif/config-$1 
 }
 
-validate_ip() {
-       [ \! -z "$1" ] && {
-               ipcalc "$1" >&- 2>&- && return 0 || {
-                       ERROR="$ERROR Invalid IP address: $2<br />"
-                       return 255
-               }
-       } || {
-               [ "$3" != "1" ] && return 0 || {
-                       ERROR="$ERROR No IP address entered: $2<br />"
-                       return 255
-               } 
-       }
-}
-
-validate_ips() {
-       [ \! -z "$1" ] && {
-               invalid_ip=0
-               for tmp_ip in $1; do
-                       ipcalc "$1" >&- 2>&- || invalid_ip=1
-               done
-               [ "$invalid_ip" != 1 ] && return 0 || {
-                       ERROR="$ERROR Invalid IP address list: $2<br />"
-                       return 255
-               }
-       } || {
-               [ "$3" != "1" ] && return 0 || {
-                       ERROR="$ERROR No IP address entered: $2<br />"
-                       return 255
-               } 
-       }
-}
-
-validate_netmask() {
-       [ \! -z "$1" ] && {
-               # FIXME
-               ipcalc "$1" >&- 2>&- && return 0 || {
-                       ERROR="$ERROR Invalid Netmask: $2<br />"
-                       return 255
-               }
-       } || {
-               [ "$3" != "1" ] && return 0 || {
-                       ERROR="$ERROR No Netmask entered: $2<br />"
-                       return 255
-               } 
-       }
+validate() {
+       eval "$(echo "$1" | awk -f /usr/lib/webif/validate.awk)"
+       [ -z "$ERROR" ] && return 0 || return 255
 }
 
 save_setting() {
        oldval=$(eval "echo \${$2}")
        oldval=${oldval:-$(nvram get "$2")}
+       mv /tmp/.webif/config-$1 /tmp/.webif/config-$1-old 2>&- >&-
+       grep -v "^$2=" /tmp/.webif/config-$1-old > /tmp/.webif/config-$1 2>&-
        [ "$oldval" != "$3" ] && echo "$2=\"$3\"" >> /tmp/.webif/config-$1
+       rm -f /tmp/.webif/config-$1-old
 }
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif.sh b/openwrt/package/webif/files/www/cgi-bin/webif.sh
new file mode 100755 (executable)
index 0000000..63ed48f
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+exec ./webif/info.sh
index 47138c86dbefd2f04e482c033269474eb9b82427..3e5f40fb84e0edaef2bb301bffd76db26b26add1 100755 (executable)
@@ -5,7 +5,7 @@ header "Info" "About" "About webif"
 ?>
 
 <h3>webif - OpenWrt Administrative Console</h3>
-
+<br />
 This program is free software; you can redistribute it and/or <br />
 modify it under the terms of the GNU General Public License <br />
 as published by the Free Software Foundation; either version 2 <br />
@@ -14,11 +14,12 @@ of the License, or (at your option) any later version. <br />
 Copyright &copy; 2005 Felix Fietkau &lt;<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>&gt;<br />
 <br />
 Contributions by:
-<ul>
-       <li>Philipp Kewisch &lt;<a href="mailto:openwrt@kewis.ch">openwrt@kewis.ch</a>&gt;</li>
+<ul class="about">
+       <li class="about">Philipp Kewisch &lt;<a href="mailto:openwrt@kewis.ch">openwrt@kewis.ch</a>&gt;</li>
+       <li class="about">Spectra &lt;<a href="mailto:spectra@gmx.ch">spectra@gmx.ch</a>&gt;</li>
+       <li class="about">Layout based on <a href="http://www.oswd.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> by haran</li>
 </ul>
 
-XHTML/CSS based on <a href="http://www.oswd.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> by haran
 
 <? footer ?>
 <!--
index 01a64f1fe6b37889f1fdf0b3fbb2d61432467b68..f1e8806a5cbc037f728247cce0683766b0ee0d67 100755 (executable)
@@ -21,9 +21,11 @@ header $FORM_cat .
        <? (
        cd /tmp/.webif
        for configname in config-*; do
-               echo -n "<h3>${configname#config-}</h3><pre>"
-               cat $configname
-               echo '</pre>'
+               grep = $configname >&- 2>&- && {
+                       echo -n "<h3>${configname#config-}</h3><pre>"
+                       cat $configname
+                       echo '</pre>'
+               }
        done
        ) ?>
                <?fi?>
index 817b2bf3ea355c475052d4471d50bb483f200ab3..9eee53d8072cd401bf5f2af85bdad96f6321152d 100755 (executable)
@@ -10,32 +10,31 @@ load_settings network
        FORM_lan_dns=${lan_dns:-$(nvram get lan_dns)}
 } || {
        SAVED=1
-       validate_ip "$FORM_lan_ipaddr" "LAN IP" 1 && save_setting network lan_ipaddr $FORM_lan_ipaddr
-       validate_ip "$FORM_lan_netmask" "LAN Netmask" 1 && save_setting network lan_netmask $FORM_lan_netmask
-       validate_ip "$FORM_lan_gateway" "LAN Gateway" && save_setting network lan_gateway $FORM_lan_gateway
-       validate_ips "$FORM_lan_dns" "LAN DNS Servers" && save_setting network lan_dns $FORM_lan_dns
+       validate "
+ip|FORM_lan_ipaddr|LAN IP|required|$FORM_lan_ipaddr
+netmask|FORM_lan_netmask|LAN network mask|required|$FORM_lan_netmask
+ip|FORM_lan_gateway|LAN gateway||$FORM_lan_gateway" && {
+               save_setting network lan_ipaddr $FORM_lan_ipaddr
+               save_setting network lan_netmask $FORM_lan_netmask
+               save_setting network lan_gateway $FORM_lan_gateway
+               save_setting network lan_dns $FORM_lan_dns
+       }
 }
-header "Network" "LAN" "LAN settings"
-?>
-<?if [ "$SAVED" = "1" ] ?>
-       <? [ -z "$ERROR" ] || echo "<h2>Errors occured:</h2><h3>$ERROR</h3>" ?>
-       <h2>Settings saved</h2>
-       <br />
-<?fi?>
-<? display_form "start_form:$SCRIPT_NAME
-field:IP Address
-text:lan_ipaddr:$FORM_lan_ipaddr
-field:Netmask
-text:lan_netmask:$FORM_lan_netmask
-field:Default Gateway
-text:lan_gateway:$FORM_lan_gateway
-field:DNS Server
-text:lan_dns:$FORM_lan_dns
-field
-submit:action:Save settings
-end_form" ?>
 
-<? footer ?>
+header "Network" "LAN" "LAN settings" '' "$SCRIPT_NAME"
+
+display_form "start_form|LAN Configuration
+field|IP Address
+text|lan_ipaddr|$FORM_lan_ipaddr
+field|Netmask
+text|lan_netmask|$FORM_lan_netmask
+field|Default Gateway
+text|lan_gateway|$FORM_lan_gateway
+field|DNS Server
+text|lan_dns|$FORM_lan_dns
+end_form" 
+
+footer ?>
 <!--
 ##WEBIF:name:Network:1:LAN
 -->
index 83435c65dc9e373f1e08c8bd7e855f2320b16b5f..c0fae57cd0e8a80f3ba732fdaa2de3b090b3e316 100755 (executable)
@@ -18,25 +18,19 @@ load_settings nvram
                        [ -z $FORM_boot_wait ] || save_setting nvram boot_wait $FORM_boot_wait
                }
 }
-header "System" "Settings" "System settings"
-?>
-<?if [ "$SAVED" = "1" ] ?>
-       <h2>Settings saved</h2>
-<?el?>
-<? 
-grep BCM947 /proc/cpuinfo 2>&- >&- && bootwait_form="field:boot_wait
-radio:boot_wait:$FORM_boot_wait:on:On<br />
-radio:boot_wait:$FORM_boot_wait:off:Off"
+header "System" "Settings" "System settings" '' "$SCRIPT_NAME"
+
+grep BCM947 /proc/cpuinfo 2>&- >&- && bootwait_form="field|boot_wait
+radio|boot_wait|$FORM_boot_wait|on|On<br />
+radio|boot_wait|$FORM_boot_wait|off|Off"
 
-display_form "start_form:$SCRIPT_NAME
-field:Hostname
-text:hostname:$FORM_hostname
+display_form "start_form|System settings
+field|Hostname
+text|hostname|$FORM_hostname
 $bootwait_form
 field
-submit:action:Save settings
 end_form"
 ?>
-<?fi?>
 
 <? footer ?>
 <!--
index b3e6b984a65cecbb57f64ef0d23ebdc8b7f1fd42..c9a64691e9c20038f1a40c44832e463fc2458252 100755 (executable)
@@ -15,12 +15,12 @@ load_settings network
        
        # detect pptp package and compile option
        [ -x /sbin/ifup.pptp ] && {
-               PPTP_OPTION="radio:wan_proto:$FORM_wan_proto:pptp:PPTP<br />:onChange=\"modechange()\""
-               PPTP_SERVER_OPTION="field:PPTP Server IP:pptp_server_ip:hidden
-text:pptp_server_ip:$FORM_pptp_server_ip"
+               PPTP_OPTION="radio|wan_proto|$FORM_wan_proto|pptp|PPTP<br />|onChange=\"modechange()\""
+               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 />|onChange=\"modechange()\""
        }
        
        # pptp, dhcp and static common
@@ -55,59 +55,64 @@ text:pptp_server_ip:$FORM_pptp_server_ip"
                return -1
        }
 
-       save_setting network wan_proto $FORM_wan_proto
-       
-       # Settings specific to one protocol type
        case "$FORM_wan_proto" in
                static)
-                       validate_ip "$FORM_wan_dns" "WAN DNS Server" 1 && \
-                               save_setting network wan_dns $FORM_wan_dns
-
-                       validate_ip "$FORM_wan_gateway" "WAN Gateway" && \
-                               save_setting network wan_gateway $FORM_wan_gateway
-
-                       # Requirements for input validation
-                       REQ_IP=1
-                       REQ_NETMASK=1
+                       V_IP="required"
+                       V_NM="required"
                        ;;
                pptp)
-                       validate_ip "$FORM_pptp_server_ip" "PPTP Server" 1 && \
-                               save_setting network pptp_server_ip "$FORM_pptp_server_ip"
+                       V_PPTP="required"
                        ;;
        esac
-       
-       # Common settings for PPTP, Static and DHCP 
-       [ "$FORM_wan_proto" = "pptp" -o "$FORM_wan_proto" = "static" -o "$FORM_wan_proto" = "dhcp" ] && {
-               validate_ip "$FORM_wan_ipaddr" "WAN IP" $REQ_IP && \
-                       save_setting network wan_ipaddr $FORM_wan_ipaddr
-       
-               validate_netmask "$FORM_wan_netmask" "WAN Netmask" $REQ_NETMASK && \
-                       save_setting network wan_netmask $FORM_wan_netmask 
-       }
-       
-       # Common PPP settings
-       [ "$FORM_wan_proto" = "pppoe" -o "$FORM_wan_proto" = "pptp" ] && {
-               [ -z $FORM_ppp_username ] || save_setting network ppp_username $FORM_ppp_username
-               [ -z $FORM_ppp_passwd ] || save_setting network ppp_passwd $FORM_ppp_passwd
-
-               # These can be blank
-               save_setting network ppp_idletime $FORM_ppp_idletime
-               save_setting network ppp_redialperiod $FORM_ppp_redialperiod
-               save_setting network ppp_mtu $FORM_ppp_mtu
 
-               case "$FORM_ppp_redial" in
-                       demand)
-                               save_setting network ppp_demand 1
+       # FIXME: add validation for DNS server list
+       validate "
+ip|FORM_wan_ipaddr|IP address|$V_IP|$FORM_wan_ipaddr
+netmask|FORM_wan_netmask|network mask|$V_NM|$FORM_wan_netmask
+ip|FORM_wan_gateway|gateway address||$FORM_wan_gateway
+ip|FORM_pptp_server_ip|PPTP server IP|$V_PPTP|$FORM_pptp_server_ip" && {
+               save_setting network wan_proto $FORM_wan_proto
+               
+               # Settings specific to one protocol type
+               case "$FORM_wan_proto" in
+                       static)
+                               save_setting network wan_dns $FORM_wan_dns
+                               save_setting network wan_gateway $FORM_wan_gateway
                                ;;
-                       persist)
-                               save_setting network ppp_demand ""
+                       pptp)
+                               save_setting network pptp_server_ip "$FORM_pptp_server_ip"
                                ;;
-               esac    
+               esac
+               
+               # Common settings for PPTP, Static and DHCP 
+               [ "$FORM_wan_proto" = "pptp" -o "$FORM_wan_proto" = "static" -o "$FORM_wan_proto" = "dhcp" ] && {
+                       save_setting network wan_ipaddr $FORM_wan_ipaddr
+                       save_setting network wan_netmask $FORM_wan_netmask 
+               }
+               
+               # Common PPP settings
+               [ "$FORM_wan_proto" = "pppoe" -o "$FORM_wan_proto" = "pptp" ] && {
+                       [ -z $FORM_ppp_username ] || save_setting network ppp_username $FORM_ppp_username
+                       [ -z $FORM_ppp_passwd ] || save_setting network ppp_passwd $FORM_ppp_passwd
+       
+                       # These can be blank
+                       save_setting network ppp_idletime $FORM_ppp_idletime
+                       save_setting network ppp_redialperiod $FORM_ppp_redialperiod
+                       save_setting network ppp_mtu $FORM_ppp_mtu
+       
+                       case "$FORM_ppp_redial" in
+                               demand)
+                                       save_setting network ppp_demand 1
+                                       ;;
+                               persist)
+                                       save_setting network ppp_demand ""
+                                       ;;
+                       esac    
+               }
        }
-
 }
 
-header "Network" "WAN" "WAN settings" ' onLoad="modechange()" '
+header "Network" "WAN" "WAN settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
 ?>
 <script type="text/javascript" src="/webif.js "></script>
 <script type="text/javascript">
@@ -133,45 +138,37 @@ function modechange()
 }
 -->
 </script>
-<?if [ "$SAVED" = "1" ] ?>
-       <? [ -z "$ERROR" ] || echo "<h2>Errors occured:</h2><h3>$ERROR</h3>" ?>
-       <h2>Settings Saved</h2>
-       <br />
-<?fi?>
-<? display_form "start_form:$SCRIPT_NAME
-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()\"
+<? display_form "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()\"
 $PPPOE_OPTION
 $PPTP_OPTION
 
-field:Internet IP Address:wan_ipaddr:hidden
-text:wan_ipaddr:$FORM_wan_ipaddr
-field:Subnet Mask:wan_netmask:hidden
-text:wan_netmask:$FORM_wan_netmask
-field:Gateway:wan_gateway:hidden
-text:wan_gateway:$FORM_wan_gateway
-field:DNS Server(s):wan_dns:hidden
-text:wan_dns:$FORM_wan_dns
+field|Internet IP Address|wan_ipaddr|hidden
+text|wan_ipaddr|$FORM_wan_ipaddr
+field|Subnet Mask|wan_netmask|hidden
+text|wan_netmask|$FORM_wan_netmask
+field|Gateway|wan_gateway|hidden
+text|wan_gateway|$FORM_wan_gateway
+field|DNS Server(s)|wan_dns|hidden
+text|wan_dns|$FORM_wan_dns
 $PPTP_SERVER_OPTION
 
-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()\"
-field:Maximum Idle Time:ppp_demand_idletime:hidden
-text:ppp_idletime:$FORM_ppp_idletime
-field:Redial Timeout:ppp_persist_redialperiod:hidden
-text:ppp_redialperiod:$FORM_ppp_redialperiod
-field:PPP Username:ppp_username:hidden
-text:ppp_username:$FORM_ppp_username
-field:PPP Password:ppp_passwd:hidden
-text:ppp_passwd:$FORM_ppp_passwd
-field:PPP MTU:ppp_mtu:hidden
-text:ppp_mtu:$FORM_ppp_mtu
-
-field
-submit:action:Save Settings
+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()\"
+field|Maximum Idle Time|ppp_demand_idletime|hidden
+text|ppp_idletime|$FORM_ppp_idletime
+field|Redial Timeout|ppp_persist_redialperiod|hidden
+text|ppp_redialperiod|$FORM_ppp_redialperiod
+field|PPP Username|ppp_username|hidden
+text|ppp_username|$FORM_ppp_username
+field|PPP Password|ppp_passwd|hidden
+text|ppp_passwd|$FORM_ppp_passwd
+field|PPP MTU|ppp_mtu|hidden
+text|ppp_mtu|$FORM_ppp_mtu
 end_form" ?>
 
 <? footer ?>
index d4e698d63320d6ed74445d92ad67f08673acc43d..839f9ea537fb533b256b3d16a6a765661c4d1222 100755 (executable)
@@ -3,7 +3,33 @@
 . /usr/lib/webif/webif.sh
 load_settings "wireless"
 
-[ -z $FORM_submit ] && {
+WDS=${wl0_wds:-$(nvram get wl0_wds)}
+WDS="${WDS# }"
+[ -z "$FORM_wdsremove" ] || {
+       WDS=$(echo "$WDS " | awk '
+BEGIN {
+       RS=" "
+       FS=":"
+       first = 1
+}
+($0 !~ /^'"$FORM_wdsremove"'/) {
+       if (first != 1) printf " "
+       printf $0
+       first = 0
+}
+END { print "" }')
+       WDS="${WDS:- }"
+       save_setting wireless wl0_wds "$WDS"
+       FORM_submit=""
+}
+[ -z "$FORM_wdssubmit" ] || {
+       # FIXME: add input validation
+       WDS="$WDS $FORM_newmac"
+       WDS="${WDS# }"
+       save_setting wireless wl0_wds "$WDS"
+       FORM_submit=""
+}
+if [ -z "$FORM_submit" ]; then
        FORM_mode=${wl0_mode:-$(nvram get wl0_mode)}
        FORM_ssid=${wl0_ssid:-$(nvram get wl0_ssid)}
        FORM_encryption=off
@@ -68,52 +94,53 @@ load_settings "wireless"
        FORM_key4=${wl0_key4:-$(nvram get wl0_key4)}
        key=${wl0_key:-$(nvram get wl0_key)}
        FORM_key=${key:-1}
-       true
-} || {
+else
        SAVED=1
-       save_setting wireless wl0_mode "$FORM_mode"
-       save_setting wireless wl0_ssid "$FORM_ssid"
-       case "$FORM_aes$FORM_tkip" in 
-               aes) save_setting wireless wl0_crypto aes;;
-               tkip) save_setting wireless wl0_crypto tkip;;
-               aestkip) save_setting wireless wl0_crypto tkip+aes;;
-       esac
-       case "$FORM_encryption" in
-               psk)
-                       case "${FORM_wpa1}${FORM_wpa2}" in
-                               wpa1) save_setting wireless wl0_akm "psk";;
-                               wpa2) save_setting wireless wl0_akm "psk2";;
-                               wpa1wpa2) save_setting wireless wl0_akm "psk psk2";;
-                       esac
-                       save_setting wireless wl0_wpa_psk "$FORM_wpa_psk"
-                       ;;
-               wpa)
-                       case "${FORM_wpa1}${FORM_wpa2}" in
-                               wpa1) save_setting wireless wl0_akm "wpa";;
-                               wpa2) save_setting wireless wl0_akm "wpa2";;
-                               wpa1wpa2) save_setting wireless wl0_akm "wpa wpa2";;
-                       esac
-                       validate_ip "$FORM_radius_ipaddr" "RADIUS Server" 1 && \
+       [ "$FORM_encryption" = "wpa" ] && VALIDATE_RADIUS="required"
+       validate "ip|FORM_radius_ipaddr|RADIUS IP address|$VALIDATE_RADIUS|$FORM_radius_ipaddr" && {
+               save_setting wireless wl0_mode "$FORM_mode"
+               save_setting wireless wl0_ssid "$FORM_ssid"
+               case "$FORM_aes$FORM_tkip" in 
+                       aes) save_setting wireless wl0_crypto aes;;
+                       tkip) save_setting wireless wl0_crypto tkip;;
+                       aestkip) save_setting wireless wl0_crypto tkip+aes;;
+               esac
+               case "$FORM_encryption" in
+                       psk)
+                               case "${FORM_wpa1}${FORM_wpa2}" in
+                                       wpa1) save_setting wireless wl0_akm "psk";;
+                                       wpa2) save_setting wireless wl0_akm "psk2";;
+                                       wpa1wpa2) save_setting wireless wl0_akm "psk psk2";;
+                               esac
+                               save_setting wireless wl0_wpa_psk "$FORM_wpa_psk"
+                               ;;
+                       wpa)
+                               case "${FORM_wpa1}${FORM_wpa2}" in
+                                       wpa1) save_setting wireless wl0_akm "wpa";;
+                                       wpa2) save_setting wireless wl0_akm "wpa2";;
+                                       wpa1wpa2) save_setting wireless wl0_akm "wpa wpa2";;
+                               esac
                                save_setting wireless wl0_radius_ipaddr "$FORM_radius_ipaddr"
-                       save_setting wireless wl0_radius_key "$FORM_radius_key"
-                       ;;
-               wep)
-                       save_setting wireless wl0_wep enabled
-                       save_setting wireless wl0_akm "none"
-                       save_setting wireless wl0_key1 "$FORM_key1"
-                       save_setting wireless wl0_key2 "$FORM_key2"
-                       save_setting wireless wl0_key3 "$FORM_key3"
-                       save_setting wireless wl0_key4 "$FORM_key4"
-                       save_setting wireless wl0_key "$FORM_key"
-                       ;;
-               off)
-                       save_setting wireless wl0_akm "none"
-                       save_setting wireless wl0_wep disabled
-                       ;;
-       esac
-}
+                               save_setting wireless wl0_radius_key "$FORM_radius_key"
+                               ;;
+                       wep)
+                               save_setting wireless wl0_wep enabled
+                               save_setting wireless wl0_akm "none"
+                               save_setting wireless wl0_key1 "$FORM_key1"
+                               save_setting wireless wl0_key2 "$FORM_key2"
+                               save_setting wireless wl0_key3 "$FORM_key3"
+                               save_setting wireless wl0_key4 "$FORM_key4"
+                               save_setting wireless wl0_key "$FORM_key"
+                               ;;
+                       off)
+                               save_setting wireless wl0_akm "none"
+                               save_setting wireless wl0_wep disabled
+                               ;;
+               esac
+       }
+fi
 
-header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" '
+header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
 ?>
 <script type="text/javascript" src="/webif.js"></script>
 <script type="text/javascript">
@@ -124,12 +151,12 @@ function modechange()
        set_visible('wpa_support', v);
        set_visible('wpa_crypto', v);
        
-       set_visible('wpa_psk', checked('encryption_psk'));
+       set_visible('wpapsk', checked('encryption_psk'));
        set_visible('wep_keys', checked('encryption_wep'));
 
        v = checked('encryption_wpa');
-       set_visible('radius_key', v);
-       set_visible('radius_ipaddr', v);
+       set_visible('radiuskey', v);
+       set_visible('radius_ip', v);
 
        if (checked('mode_wet') || checked('mode_sta')) {
                        var wpa = document.getElementById('encryption_wpa');
@@ -141,52 +168,80 @@ function modechange()
        } else {
                        document.getElementById('encryption_wpa').disabled = false;
        }
+       hide('save');
+       show('save');
 }
 -->
 </script>
 
-<?if [ "$SAVED" = "1" ] ?>
-       <? [ -z "$ERROR" ] || echo "<h2>Errors occured:</h2><h3>$ERROR</h3>" ?>
-       <h2>Settings saved</h2>
-       <br />
-<?fi?>
-<? display_form "start_form:$SCRIPT_NAME
-field:ESSID
-text:ssid:$FORM_ssid
-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()\" 
-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()\"
-field:WPA support:wpa_support:hidden
-checkbox:wpa1:$FORM_wpa1:wpa1:WPA1
-checkbox:wpa2:$FORM_wpa2:wpa2:WPA2
-field:WPA encryption type:wpa_crypto:hidden
-checkbox:tkip:$FORM_tkip:tkip:RC4 (TKIP)
-checkbox:aes:$FORM_aes:aes:AES
-field:WPA preshared key:wpa_psk:hidden
-text:wpa_psk:$FORM_wpa_psk
-field:RADIUS Server IP:radius_ipaddr:hidden
-text:radius_ipaddr:$FORM_radius_ipaddr
-field:RADIUS Server Key:radius_key:hidden
-text:radius_key:$FORM_radius_key
-field:WEP keys:wep_keys:hidden
-radio:key:$FORM_key:1
-text:key1:$FORM_key1:<br />
-radio:key:$FORM_key:2
-text:key2:$FORM_key2:<br />
-radio:key:$FORM_key:3
-text:key3:$FORM_key3:<br />
-radio:key:$FORM_key:4
-text:key4:$FORM_key4:<br />
-field
-submit:action:Save settings
+<? display_form "start_form|Wireless Configuration
+field|ESSID
+text|ssid|$FORM_ssid
+helpitem|ESSID
+helptext|Name of your Wireless Network
+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
+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()\"
+field|WPA support|wpa_support|hidden
+checkbox|wpa1|$FORM_wpa1|wpa1|WPA1
+checkbox|wpa2|$FORM_wpa2|wpa2|WPA2
+field|WPA encryption type|wpa_crypto|hidden
+checkbox|tkip|$FORM_tkip|tkip|RC4 (TKIP)
+checkbox|aes|$FORM_aes|aes|AES
+field|WPA preshared key|wpapsk|hidden
+text|wpa_psk|$FORM_wpa_psk
+field|RADIUS Server IP|radius_ip|hidden
+text|radius_ipaddr|$FORM_radius_ipaddr
+field|RADIUS Server Key|radiuskey|hidden
+text|radius_key|$FORM_radius_key
+field|WEP keys|wep_keys|hidden
+radio|key|$FORM_key|1
+text|key1|$FORM_key1|<br />
+radio|key|$FORM_key|2
+text|key2|$FORM_key2|<br />
+radio|key|$FORM_key|3
+text|key3|$FORM_key3|<br />
+radio|key|$FORM_key|4
+text|key4|$FORM_key4|<br />
 end_form"
 ?>
+<div class="settings">
+       <div class="settings-title"><h3><strong>WDS connections</strong></h3></div>
+       <div class="settings-content">
+       <table summary="Settings" width="100%">
+<?
+echo "$WDS " | awk '
+BEGIN {
+       RS=" "
+       FS=":"
+}
+
+$0 ~ /^[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]$/ {
+       print "<tr><td width=\"50%\">" $0 "</td><td>&nbsp;<a href=\"'"$SCRIPT_NAME"'?wdsremove=" $0 "\">Remove</a></td></tr>"
+}
+'
+?>
+               <tr>
+                       <td width="45%"><input type="text" name="newmac" value="00:00:00:00:00:00" /></td>
+                       <td width="55%"><input type="submit" name="wdssubmit" value="Add WDS peer" /></td>
+               </tr>
+       </table>
+       </div>
+       <div class="settings-help">&nbsp;</div>
+</div>
+<div style="clear: both">&nbsp;</div>
+
 
 <? footer ?>
 <!--
index c11a7e45f491c0ad48074a2aa347fdfb5934b8a0..477fb8b281288d7758ec53adae1936c4692bafb8 100644 (file)
@@ -1,10 +1,10 @@
 <html>
        <head>
-               <meta http-equiv="refresh" content="0; URL=/cgi-bin/webif/info.sh" />
+               <meta http-equiv="refresh" content="0; URL=/cgi-bin/webif.sh" />
        </head>
        <body>
                <div style="vertical-align: middle; text-align: center; height: 100%">
-                       Redirecting to <a href="/cgi-bin/webif/info.sh">main page</a>...
+                       Redirecting to <a href="/cgi-bin/webif.sh">main page</a>...
                </div>
        </body>
 </html>
index f41aaf6faaec7f288b3dbbc187ed9cc3afde44ec..e0439778e7678c4472a76435cebe80d6d6cd212e 100644 (file)
-/***************************************
- * TITLE: Prosimii Screen Stylesheet   * 
- * URI  : prosimii/prosimii-screen.css *
- * MODIF: 2004-Apr-28 21:43 +0800      *
- ***************************************/
-
-
-/* ##### Common Styles ##### */
-
-html, body {
-  height: 100%;
-  width: inherit;
-}
-
-#container {
-  position: relative;
-  min-height: 100%;
-}
-
-body {
-  font-family: verdana, helvetica, arial, sans-serif;
-  font-size: 73%;  /* Enables font size scaling in MSIE */
-  margin: 0;
-  padding: 0;
-}
-
-html > body {
-  font-size: 9pt;
-}
-
-acronym, .titleTip {
-  border-bottom: 1px dotted rgb(61,92,122);
-  cursor: help;
-  margin: 0;
-  padding: 0 0 0.4px 0;
+* {
+       margin: 0;
+       padding: 0;
 }
 
-a {
-  color: rgb(61,92,122);
-  background-color: transparent;
-  text-decoration: underline;
-  margin: 0;
-  padding: 0 1px 2px 1px;
-}
-
-a:hover {
-  color: rgb(117,144,174);
-  text-decoration: none;
-}
-
-ol {
-  margin: 1em 0 1.5em 0;
-  padding: 0;
-}
-
-ul {
-  list-style-type: square;
-  margin: 1em 0 1.5em 0;
-  padding: 0;
-}
-
-dl {
-  margin: 1em 0 0.5em 0;
-  padding: 0;
-}
-
-ul li {
-  line-height: 1.5em;
-  margin: 1.25ex 0 0 1.5em;
-  padding: 0;
-}
-
-ol li {
-  line-height: 1.5em;
-  margin: 1.25ex 0 0 2em;
-  padding: 0;
+html, body {
+       font-family: Verdana, Helvetica, sans-serif;
+       font-size: 10pt;
+       width: inherit;
+       height: 100%;
 }
 
 dt {
-  font-weight: bold;
-  margin: 0;
-  padding: 0 0 1ex 0;
+       font-weight: bold;
 }
 
 dd {
-  line-height: 1.75em;
-  margin: 0 0 1.5em 1.5em;
-  padding: 0;
-}
-
-.doNotDisplay {
-  display: none !important;
-}
-
-
-.smallCaps {
-  font-size: 117%;
-  font-variant: small-caps;
-}
-
-
-/* ##### Header ##### */
-
-.superHeader {
-  color: rgb(130,128,154);
-  background-color: rgb(33,50,66);
-  text-align: right;
-  margin: 0;
-  padding: 0.5ex 10px;
-}
-
-.superHeader span {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  font-weight: bold;
-  text-transform: uppercase;
-}
-
-.superHeader a {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  text-decoration: none;
-  margin: 0;
-  padding: 0 0.25ex 0 0;
+       margin-left: 1em;
+       margin-bottom: 0.2em;
 }
 
-.superHeader a:hover {
-  color: rgb(193,102,90);
-  background-color: transparent;
-  text-decoration: none;
+ul {
+       display: inline;
+       list-style-type: none;
 }
 
-.topHeader {
-  color: rgb(130,128,154);
-  background-color: rgb(33,50,66);
-  text-align: left;
-  margin: 0;
-  padding: 0.5ex 10px;
+ul.about {
+       display: block;
+       list-style-type: disc;
 }
-
-.categoryHeader {
-  color: rgb(130,128,154);
-  background-color: rgb(33,50,66);
-  position: absolute;
-  top: 0;
-  text-align: left;
-  margin: 0;
-  padding: 0.5ex 10px;
+li.about {
+       margin-left: 2em;
 }
 
-.categoryHeader span {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  font-weight: bold;
-  text-transform: uppercase;
+hr {
+       display: none;
 }
 
-.categoryHeader a {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  text-decoration: none;
-  margin: 0;
-  padding: 0 0.25ex 0 0;
+.selected-maincat {
+       font-weight: bold;
 }
 
-.categoryHeader a.active {
-  color: rgb(195,196,210);
-  font-weight: bold;
-  background-color: transparent;
-  text-decoration: none;
-  margin: 0;
-  padding: 0 0.25ex 0 0;
+#container {
+       position: relative;
+       min-height: 100%;
 }
 
-.categoryHeader a:hover {
-  color: rgb(193,102,90);
-  background-color: transparent;
-  text-decoration: none;
+#header {
+       position: relative;
+       width: 100%;
 }
 
-.midHeader {
-  color: white;
-  background-color: rgb(61,92,122);
-  margin: 0;
-  padding: 0.26ex 10px;
+#header #header-title {
+       padding-top: 2em;
+       padding-bottom: 0.2em;
+       color: white;
+       background-color: #3D5C7A;
 }
 
-.headerTitle {
-  font-size: 300%;
-  margin: 0;
-  padding: 0;
+#header #header-title #openwrt-title {
+       position: relative;
+       float: left;
+       left: 1em;
+       top: 0.7em;
 }
 
-.headerSubTitle {
-  font-size: 151%;
-  font-weight: normal;
-  font-style: italic;
-  margin: 0 0 1ex 0;
-  padding: 0;
+#header #header-title #openwrt-title h1 {
+       font-size: 2.8em;
 }
 
-.headerInfo {
-  text-align: right;
-  margin: 0;
-  padding: 0 0 2ex 0;
-  position: absolute;
-  right: 1em;
-  top: 0.3em;
+#header #header-title #short-status {
+       position: relative;
+       text-align: right;
+       right: 1em;
+       line-height: 1.2em;
+       padding-bottom: 0.2em;
 }
 
-.headerInfo span {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  font-weight: bold;
-  text-transform: uppercase;
+#header #header-title #short-status ul {
+       font-size: 0.8em;
 }
 
-.headerInfo a {
-  color: white;
-  background-color: transparent;
-  text-decoration: none;
-  margin: 0;
-  padding: 0 0 0.5ex 0;
-  display: block;
+#header #header-title #short-status h3 {
+       display: none;
+       font-size: 0.9em;
 }
 
-.headerInfo a:hover {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  text-decoration: underline;
+#header #mainmenu {
+       position: absolute;
+       color: #C3C4D2;
+       background-color: #213242;
+       padding-top: 0.2em;
+       padding-bottom: 0.2em;
+       margin-top: 0.1em;
+       top: 0;
+       left: 0;
+       height: 1.2em;
+       width: 100%;
 }
 
-.headerLinks {
-  text-align: right;
-  margin: 0;
-  padding: 0 0 2ex 0;
-  position: absolute;
-  right: 1.5em;
-  top: 3em;
+#header #mainmenu a {
+       color: #C3C4D2;
+       text-decoration: none;
 }
 
-.headerLinks a {
-  color: white;
-  background-color: transparent;
-  text-decoration: none;
-  display: block;
+#header #mainmenu a:hover {
+       color: rgb(193,102,90);
 }
 
-.headerLinks a:hover {
-  color: rgb(195,196,210);
-  background-color: transparent;
-  text-decoration: underline;
+#header #mainmenu a:active {
+       font-weight: bold;
 }
 
-.subHeader {
-  color: white;
-  background-color: rgb(117,144,174);
-  margin: 0;
-  padding: 0.5ex 10px;
+#header #mainmenu h3 {
+       padding-left: 1em;
+       float: left;
+       font-size: 9pt;
+       text-transform: uppercase;
 }
 
-.subHeader a, .subHeader .highlight {
-  color: white;
-  background-color: transparent;
-  font-size: 110%;
-  font-weight: bold;
-  text-decoration: none;
-  margin: 0;
-  padding: 0 0.25ex 0 0;
+#header #mainmenu ul {
+       display: inline;
+       list-style-type: none;
 }
 
-.subHeader a:hover, .subHeader .highlight {
-  color: rgb(255,204,0);
-  background-color: transparent;
-  text-decoration: none;
+#header #mainmenu li {
+       font-size: 9pt;
+       float: left;
+       margin-left: 1.5em;
 }
 
-
-/* ##### Main Copy ##### */
-
-#main-copy {
-  margin: 0;
-  padding: 0.5em 10px;
-  clear: left;
+#header #submenu {
+       position: absolute;
+       color: white;
+       background-color: #7590AE;
+       width: 100%;
+       padding-top: 0.2em;
+       padding-bottom: 0.2em;
+       height: 1.3em;
 }
 
-#main-copy h1 {
-  color: rgb(117,144,174);
-  background-color: transparent;
-  font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif;
-  font-size: 200%;
-  margin: 0;
-  padding: 0;
+#header #submenu a {
+       font-weight: bold;
+       color: white;
+       text-decoration: none;
 }
 
-#main-copy h2 {
-  color: rgb(61,92,122);
-  background-color: transparent;
-  font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif;
-  font-weight: normal;
-  font-size: 151%;
-  margin: 0;
-  padding: 1ex 0 0 0;
+#header #submenu a:hover {
+       color: rgb(255,204,0);
 }
 
-#main-copy p {
-  line-height: 1.75em;
-  margin: 1em 0 1.5em 0;
-  padding: 0;
+#header #submenu a:active {
+       font-weight: bold;
 }
 
-.newsHeading {
-  color: rgb(61,92,122);
-  background-color: transparent;
-  font-family: "trebuchet ms", verdana, helvetica, arial, sans-serif;
-  font-size: 145%;
-  text-decoration: none;
-  margin: 0;
-  padding: 1ex 0 0 0;
-  display: block;
+#header #submenu h3 {
+       display: none;
 }
 
-.newsHeading:hover {
-  color: rgb(117,144,174);
-  background-color: transparent;
-  text-decoration: underline;
+#header #submenu ul {
+       display: inline;
+       list-style-type: none;
 }
 
-.newsDate {
-  font-style: italic;
-  margin: 0 !important;
-  padding: 0;
+#header #submenu li {
+       float: left;
+       margin-left: 1em;
 }
 
-.newsSummary {
-  margin: 1.5ex 0 2.5ex 0.75ex !important;
-  padding: 0;
+#content {
+       padding-top: 2em;
+       margin-left: 1em;
+       padding-bottom: 5em;
 }
 
-.more {
-  text-align: right;
-  margin: 0;
-  padding: 0.5em 0;
+#content .settings-block {
+       margin-bottom: 1.5em;
 }
 
-.more a {
-  color: rgb(61,92,122);
-  background-color: transparent;
-  font-size: 92%;
-  text-decoration: underline;
-  margin: 0;
-  padding: 0.25ex 0.75ex;
+#content .settings-block .settings-block-title {
+       padding: 0.2em;
+       margin-bottom: 10px;
 }
 
-.more a:hover {
-  color: rgb(117,144,174);
-  text-decoration: none;
+#content .settings-block .settings-block-title h2 {
+       color: #7590AE;
 }
 
-.rowOfBoxes {
-  clear: both;
+#content .settings-block .settings {
+       clear: both;
+       margin-left: 1.5em;
+       padding-right: 1em;
 }
 
-.quarter, .threeQuarter, .oneThird, .half, .twoThirds, .fullWidth {
-  margin: 1em 0;
-  float: left;
-  border-left: 1px solid rgb(204,204,204);
+#content .settings-block .settings .settings-title {
+       padding: 0.2em;
+       color: #000;
+       background-color: #CCC;
 }
 
-.quarter {
-  width: 21%;
-  padding: 0 1.9%;
+#content .settings-block .settings .settings-content {
+       margin-left: 1em;
+       float: left;
+       width: 58%;
+       padding-bottom: 0.5em;
 }
 
-.threeQuarter {
-  width: 71%;
-  padding: 0 1.9%;
+#content .settings-block .settings .settings-content input {
+       margin-top: 0.8em;
 }
 
-.oneThird {
-  width: 28%;
-  padding: 0 1.9%;
+#content .settings-block .settings .settings-help {
+       padding: 0.4em;
+       margin-left: 42%;
 }
 
-.half {
-  text-align: justify;
-  width: 46%;
-  padding: 0 1.9%;
+#content .settings-block .settings .settings-help h3 {
+       display: none;
 }
 
-.twoThirds {
-  text-align: justify;
-  width: 63%;
-  padding: 0 1.9%;
+#content .settings-block .settings .settings-help .more-help {
+       margin-right: 10%;
+       text-align: right;
 }
 
-.fullWidth {
-  text-align: justify;
-  width: 96%;
-  padding: 0 1.2em;
-  border-left: none;
+#save {
+       position: absolute;
+       text-align: right;
+       bottom: 0;
+       clear: both;
+       width: 100%;
+       height: 7.4em;
 }
 
-.filler {  /* use with an empty <p> element to add padding to the end of a text box */
-  border: 1px solid white;
-}
-.noBorderOnLeft {
-  border-left: none;
+#save a {
+       color: white;
+       text-decoration: none;
+       font-weight: normal;
+       font-size: 11pt;
 }
 
-.dividingBorderAbove {
-  border-top: 1px solid rgb(204,204,204);
+#save a:hover {
+       text-decoration: underline;
 }
 
-/* More elegant alternatives to .noBorderOnLeft & .dividingBorderAbove
- * that don't require the creation of new classes - but which are not
- * supported by MSIE - are the following:
- *
- * .rowOfBoxes > div:first-child {
- *   border-left: none;
- * }
- *
- * .rowOfBoxes + .rowOfBoxes {
- *   border-top: 1px solid rgb(204,204,204);
- * }
- */
-
-
-/* ##### Footer ##### */
-
-#footer {
-  border-top: 1px solid rgb(128,128,128);
-  color: rgb(51,51,102);
-  background-color: rgb(239,239,239);
-  font-size: 87%;
-  text-align: center;
-  line-height: 1.25em;
-  margin: 2em 0 0 0;
-  padding: 1ex 10px;
-  position: absolute;
-  bottom: 0;
-  width: 100%;
+#save .page-save {
+       background-color: #FFF;
+       color: #FFF;
+       height: 2.3em;
+       width: 100%;
 }
 
-* > #footer {
-  width: auto;
-  left: 0;
-  right: 0;
+#save .page-save div {
+       float: right;
+       width: 15em;
+       height: 1.5em;
+       padding-right: 1em;
+       padding-top: 0.5em;
+       padding-bottom: 0.4em;
+       background-color: #7590AE;
 }
 
-#footer a {
-  color: rgb(0,68,204);
-  background-color: transparent;
-  text-decoration: underline;
+#save .apply {
+       clear: both;
+       background-color: #7590AE;
+       width: 100%;
+       height: 5em;
 }
 
-#footer a:hover {
-  text-decoration: none;
+#save .apply div {
+       float: right;
+       height: 4em;
+       width: 15em;
+       padding-right: 1em;
+       padding-top: 0.5em;
+       padding-bottom: 0.5em;
+       background-color: #3D5C7A;
 }