add webif
authorFelix Fietkau <nbd@openwrt.org>
Fri, 23 Sep 2005 13:15:58 +0000 (13:15 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Fri, 23 Sep 2005 13:15:58 +0000 (13:15 +0000)
SVN-Revision: 1980

26 files changed:
openwrt/package/Config.in
openwrt/package/Makefile
openwrt/package/webif/Config.in [new file with mode: 0644]
openwrt/package/webif/Makefile [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/apply-wireless.sh [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/apply.sh [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/form.awk [new file with mode: 0644]
openwrt/package/webif/files/usr/lib/webif/webif.sh [new file with mode: 0644]
openwrt/package/webif/files/www/cgi-bin/webif/.categories [new file with mode: 0644]
openwrt/package/webif/files/www/cgi-bin/webif/about.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/config.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/connection.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/index.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/info.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/lan.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/system.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/wan.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh [new file with mode: 0755]
openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh [new file with mode: 0755]
openwrt/package/webif/files/www/index.html [new file with mode: 0644]
openwrt/package/webif/files/www/webif.css [new file with mode: 0644]
openwrt/package/webif/files/www/webif.js [new file with mode: 0644]
openwrt/package/webif/ipkg/webif.control [new file with mode: 0644]
openwrt/package/webif/ipkg/webif.preinst [new file with mode: 0755]

index 11f504d1672e53d0a69c841d6738645bd81be894..73b031c608b4403fc13bccf8e419e4c5a0207484 100644 (file)
@@ -23,6 +23,7 @@ source "package/sablevm-classpath/Config.in"
 source "package/libffi-sable/Config.in"
 endmenu
 source "package/screen/Config.in"
+source "package/webif/Config.in"
 
 comment "Networking"
 source "package/aiccu/Config.in"
index d8f06fa566712fc44da30db991b7a92034971840..3c748baef8b6bc6050931325cb17e26314b34063 100644 (file)
@@ -114,6 +114,7 @@ package-$(BR2_PACKAGE_ULOGD) += ulogd
 package-$(BR2_PACKAGE_USBUTILS) += usbutils
 package-$(BR2_PACKAGE_VTUN) += vtun
 package-$(BR2_PACKAGE_VSFTPD) += vsftpd
+package-$(BR2_PACKAGE_WEBIF) += webif
 package-$(BR2_PACKAGE_WIFICONF) += wificonf
 package-$(BR2_PACKAGE_WIRELESS_TOOLS) += wireless-tools
 package-$(BR2_PACKAGE_WOL) += wol
diff --git a/openwrt/package/webif/Config.in b/openwrt/package/webif/Config.in
new file mode 100644 (file)
index 0000000..079b4d8
--- /dev/null
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_WEBIF
+       tristate "webif - OpenWrt Administrative Console"
+       default n
+       help
+         A web interface for configuring OpenWrt
+         
diff --git a/openwrt/package/webif/Makefile b/openwrt/package/webif/Makefile
new file mode 100644 (file)
index 0000000..c5222f6
--- /dev/null
@@ -0,0 +1,29 @@
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=webif
+PKG_VERSION:=0.01
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(TOPDIR)/package/rules.mk
+
+$(eval $(call PKG_template,WEBIF,webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
+
+$(PKG_BUILD_DIR)/.prepared:
+       mkdir -p $(PKG_BUILD_DIR)
+       touch $@
+       
+$(PKG_BUILD_DIR)/.configured:
+       touch $@
+
+$(PKG_BUILD_DIR)/.built:
+       touch $@
+
+$(IPKG_WEBIF): 
+       cp -a ./files/* $(IDIR_WEBIF)/
+       find $(IDIR_WEBIF) -name CVS | xargs rm -rf
+       find $(IDIR_WEBIF) -name .svn | xargs rm -rf
+       $(IPKG_BUILD) $(IDIR_WEBIF) $(PACKAGE_DIR)
diff --git a/openwrt/package/webif/files/usr/lib/webif/apply-wireless.sh b/openwrt/package/webif/files/usr/lib/webif/apply-wireless.sh
new file mode 100644 (file)
index 0000000..e45d574
--- /dev/null
@@ -0,0 +1,4 @@
+echo Reloading wireless settings...
+killall nas >&- 2>&- && sleep 2
+/sbin/wifi
+[ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa
diff --git a/openwrt/package/webif/files/usr/lib/webif/apply.sh b/openwrt/package/webif/files/usr/lib/webif/apply.sh
new file mode 100644 (file)
index 0000000..cafa9bc
--- /dev/null
@@ -0,0 +1,13 @@
+cd /tmp/.webif
+
+[ -f /etc/nvram.overrides ] && ( # White Russian
+       cd /proc/self
+       cat /tmp/.webif/config-* | tee fd/1 | xargs -n1 nvram set
+)
+
+nvram commit
+for config in config-*; do 
+       name="/usr/lib/webif/apply-${config#config-}.sh"
+       [ -f "$name" ] && sh $name &
+done
+rm -f config-*
diff --git a/openwrt/package/webif/files/usr/lib/webif/form.awk b/openwrt/package/webif/files/usr/lib/webif/form.awk
new file mode 100644 (file)
index 0000000..7b02bd9
--- /dev/null
@@ -0,0 +1,45 @@
+# $1 = type
+# $2 = form variable name
+# $3 = form variable value
+# $4 = (radio button) value of button
+# $5 = string to append
+# $6 = additional attributes 
+
+$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>"
+}
+$1 ~ /^field/ {
+       if (field_open == 1) print "</td></tr>"
+       if ($3 != "") field_id=" id=\"" $3 "\""
+       else field_id=""
+       print "<tr" field_id "><td>" $2 "</td><td>"
+       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 " />"
+}
+$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 " />"
+}
+$1 ~ /^text/ {
+       print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4
+}
+$1 ~ /^submit/ {
+       print "<input type=\"submit\" name=\"" $2 "\" value=\"" $3 "\" />"
+}
+{
+       print $5
+}
+$1 ~ /^end_form/ {
+       if (field_open == 1) print "</td></tr>"
+       print "</tbody>"
+       print "</table>"
+       print "</form>"
+}
diff --git a/openwrt/package/webif/files/usr/lib/webif/webif.sh b/openwrt/package/webif/files/usr/lib/webif/webif.sh
new file mode 100644 (file)
index 0000000..92cc7c4
--- /dev/null
@@ -0,0 +1,166 @@
+libdir=/usr/lib/webif
+wwwdir=/www
+cgidir=/www/cgi-bin/webif
+indexpage=index.sh
+
+header() {
+  UPTIME=$(uptime)
+  UPTIME="up ${UPTIME##*up}"
+  HOSTNAME=$(cat /proc/sys/kernel/hostname)
+  CHANGES=$(($(cat /tmp/.webif/config-* 2>&- | wc -l)))
+  CHANGES=${CHANGES#0}
+  CHANGES=${CHANGES:+( ${CHANGES} )}
+  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>
+EOF
+  grep '##WEBIF:category' $cgidir/.categories $cgidir/*.sh 2>/dev/null | awk -F: '
+       BEGIN {
+         print "<div class=\"categoryHeader\"><span>Categories: &nbsp;&nbsp;&nbsp; </span>"
+       }
+       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;";
+       }
+       END {
+         print "</div>"
+       }' -
+       [ \! -z "$2" ] && {
+         grep "##WEBIF:name:$1:" *.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>";
+               }
+               {
+                 if ($5 ~ /^'"$2"'$/) print "<a class=\"active\">&raquo;" $5 "&laquo;</a>&nbsp;&nbsp;&nbsp;"
+                 else print "<a href=\"" $6 "\">" $5 "</a>&nbsp;&nbsp;&nbsp;";
+               }
+               END {
+                 print "</div>";
+               }
+         ' -
+       }
+       [ -z "$3" ] && HEAD="" || HEAD="<h1>$3</h1><br />" 
+       cat <<EOF
+       </div>
+       <div id="main-copy">
+         <div class="rowOfBoxes">
+               <div class="noBorderOnLeft">
+               $HEAD
+EOF
+       [ -z "$REMOTE_USER" ] && {
+               [ -z $FORM_passwd1 ] || {
+                       echo '<pre>'
+                       (
+                               echo "$FORM_passwd1"
+                               sleep 1
+                               echo "$FORM_passwd2"
+                       ) | passwd root
+                       apply_passwd
+                       echo '</pre>'
+                       footer
+                       exit
+               }
+               grep 'root:!' /etc/passwd >&- 2>&- && {
+                       cat <<EOF
+<br />
+<br />
+<br />
+<h3>Warning: you haven't set a password for the Web interface and SSH access<br />
+Please enter one now</h3>
+<br />
+<form enctype="multipart/form-data" action="$SCRIPT_NAME" method="POST">
+<table>
+       <tr>
+               <td>Enter Password:</td>
+               <td><input type="password" name="passwd1" /></td>
+       </tr>
+       <tr>
+               <td>Repeat Password: &nbsp; </td>
+               <td><input type="password" name="passwd2" /></td>
+       </tr>
+       <tr>
+               <td />
+               <td><input type="submit" name="action" value="Set" /></td>
+       </tr>
+</table>
+</form>
+EOF
+                       footer
+                       exit
+               } || {
+                       apply_passwd
+               }
+       }
+}
+
+footer() {
+  cat <<EOF
+       <br />
+       </div> </div> </div>
+       <div id="footer">
+OpenWrt Administrative Console
+       </div>
+       </div>
+  </body>
+</html>
+EOF
+}
+
+apply_passwd() {
+       case ${SERVER_SOFTWARE%% *} in
+               busybox)
+                       echo -n '/:' > /etc/httpd.conf
+                       cat /etc/passwd | grep root | cut -d: -f1,2 >> /etc/httpd.conf
+                       killall -HUP httpd
+                       ;;
+       esac
+}
+
+display_form() {
+       echo "$1" | awk -F: -f /usr/lib/webif/form.awk
+}
+
+mkdir -p /tmp/.webif
+
+load_settings() {
+       [ \! "$1" = "nvram" -a -f /etc/config/$1 ] && . /etc/config/$1
+       [ -f /tmp/.webif/config-$1 ] && . /tmp/.webif/config-$1 
+}
+
+save_setting() {
+       oldval=$(eval "echo \${$2}")
+       oldval=${oldval:-$(nvram get "$2")}
+       [ "$oldval" != "$3" ] && echo "$2=\"$3\"" >> /tmp/.webif/config-$1
+}
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/.categories b/openwrt/package/webif/files/www/cgi-bin/webif/.categories
new file mode 100644 (file)
index 0000000..b1a84f4
--- /dev/null
@@ -0,0 +1,4 @@
+##WEBIF:category:Info
+##WEBIF:category:Status
+##WEBIF:category:System
+##WEBIF:category:Network
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/about.sh b/openwrt/package/webif/files/www/cgi-bin/webif/about.sh
new file mode 100755 (executable)
index 0000000..139d359
--- /dev/null
@@ -0,0 +1,20 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "Info" "About" "About webif"
+?>
+
+<h3>webif - OpenWrt Administrative Console</h3>
+
+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 />
+of the License, or (at your option) any later version. <br />
+<br />
+Copyright &copy; 2005 Felix Fietkau &lt;<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>&gt;<br />
+XHTML/CSS based on <a href="http://www.oswd.org/design/1773/prosimii/">&quot;Prosimii&quot;</a> by haran
+
+<? footer ?>
+<!--
+##WEBIF:name:Info:1:About
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/config.sh b/openwrt/package/webif/files/www/cgi-bin/webif/config.sh
new file mode 100755 (executable)
index 0000000..01a64f1
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+[ "$FORM_mode" = "clear" ] && rm -rf /tmp/.webif >&- 2>&- 
+header $FORM_cat .
+?>
+
+<?if [ "$FORM_mode" = "clear" ] ?>
+       <h2>All configuration changes have been cleared.</h2>
+<?el?>
+       <?if grep = /tmp/.webif/config-* >&- 2>&- ?>
+               <?if [ "$FORM_mode" = "save" ] ?>
+                       <h2>Updating configuration...</h2>
+                       <br />
+                       <pre><? sh /usr/lib/webif/apply.sh ?></pre>
+                       <h2>Done</h2>
+               <?fi?>
+       
+               <?if [ "$FORM_mode" = "review" ] ?>
+                       <h2>Configuration changes:</h2>
+       <? (
+       cd /tmp/.webif
+       for configname in config-*; do
+               echo -n "<h3>${configname#config-}</h3><pre>"
+               cat $configname
+               echo '</pre>'
+       done
+       ) ?>
+               <?fi?>
+               
+       <?el?>
+               <h2>No configuration changes were made.</h2>
+       <?fi?>
+<?fi?>
+
+
+<? footer ?>
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh b/openwrt/package/webif/files/www/cgi-bin/webif/connection.sh
new file mode 100755 (executable)
index 0000000..cf4ca6f
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "Status" "Connections" "Connection status"
+?>
+<? footer ?>
+<!--
+##WEBIF:name:Status:1:Connections
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/index.sh b/openwrt/package/webif/files/www/cgi-bin/webif/index.sh
new file mode 100755 (executable)
index 0000000..6a9a8f5
--- /dev/null
@@ -0,0 +1,8 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+category=$FORM_cat
+[ -z "$category" ] && category=Info
+header $category 1
+?>
+<? footer ?>
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/info.sh b/openwrt/package/webif/files/www/cgi-bin/webif/info.sh
new file mode 100755 (executable)
index 0000000..3a54d08
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "Info" "Router Info" "Router Info"
+?>
+<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
+<tbody>
+       <tr>
+               <td>Firmware Version</td>
+               <td><? cat /etc/banner | grep "(" | cut -b-20 | cut -b2- ?></td>
+       </tr>
+       <tr>
+               <td>Kernel Version</td>
+               <td><? cat /proc/version ?></td>
+       </tr>
+       <tr>
+               <td>Current Date/Time</td>
+               <td><? date ?></td>
+       </tr>
+       <tr>
+               <td>MAC-Address</td>
+               <td><? ifconfig eth0 | grep HWaddr | cut -b39-  ?></td>
+       </tr>
+</tbody>
+</table>
+
+<? footer ?>
+<!--
+##WEBIF:name:Info:2:Router Info
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh b/openwrt/package/webif/files/www/cgi-bin/webif/ipkg.sh
new file mode 100755 (executable)
index 0000000..8f2e04d
--- /dev/null
@@ -0,0 +1,55 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "System" "Installed software" "Installed software"
+?>
+<p style="position: absolute; right: 1em; top: 10.5em"><a href="ipkg.sh?action=update">Update package lists</a></p>
+<pre><?
+if [ "$FORM_action" = "update" ]; then
+       ipkg update
+elif [ "$FORM_action" = "install" ]; then
+       yes n | ipkg install `echo "$FORM_pkg" | sed -e 's, ,+,g'`
+elif [ "$FORM_action" = "remove" ]; then
+       ipkg remove `echo "$FORM_pkg" | sed -e 's, ,+,g'`
+fi
+?></pre>
+<div class="half noBorderOnLeft">
+  <h3>Installed packages</h3>
+  <table style="width: 90%">
+<?
+ipkg list_installed | awk -F ' ' '
+$2 !~ /terminated/ {
+       link=$1
+       gsub(/\+/,"%2B",link)
+       print "<tr><td>" $1 "</td><td><a href=\"ipkg.sh?action=remove&pkg=" link "\">Remove</td></tr>"
+}
+'
+?>
+  </table>
+</div>
+<div class="half noBorderOnLeft">
+  <h3>Available packages</h3>
+  <table style="width: 90%">
+<?
+grep Package: /usr/lib/ipkg/status /usr/lib/ipkg/lists/* 2>&- | sed -e 's, ,,' -e 's,/usr/lib/ipkg/lists/,,' | awk -F: '
+$1 ~ /status/ {
+       installed[$3]++;
+}
+($1 !~ /terminated/) && ($1 !~ /\/status/) && (!installed[$3]) {
+       if (current != $1) print "<tr><th>" $1 "</th><td></td></tr>"
+       link=$3
+       gsub(/\+/,"%2B",link)
+       print "<tr><td>" $3 "</td><td><a href=\"ipkg.sh?action=install&pkg=" link "\">Install</td></tr>"
+       current=$1
+}
+'
+?>
+  </table>
+</div>
+
+<div class="rowOfBoxes"></div>
+         
+<? footer ?>
+<!--
+##WEBIF:name:System:2:Installed software
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh b/openwrt/package/webif/files/www/cgi-bin/webif/lan.sh
new file mode 100755 (executable)
index 0000000..67de725
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+load_settings network
+
+[ -z $FORM_submit ] && {
+       FORM_lan_ipaddr=${lan_ipaddr:-$(nvram get lan_ipaddr)}
+       FORM_lan_netmask=${lan_netmask:-$(nvram get lan_netmask)}
+       FORM_lan_gateway=${lan_gateway:-$(nvram get lan_gateway)}
+       FORM_lan_dns=${lan_dns:-$(nvram get lan_dns)}
+} || {
+       SAVED=1
+       [ -z $FORM_lan_ipaddr ] || save_setting network lan_ipaddr $FORM_lan_ipaddr
+       [ -z $FORM_lan_netmask ] || save_setting network lan_netmask $FORM_lan_netmask
+       [ -z $FORM_lan_gateway ] || save_setting network lan_gateway $FORM_lan_gateway
+       [ -z $FORM_lan_dns ] || save_setting network lan_dns $FORM_lan_dns
+}
+header "Network" "LAN" "LAN settings"
+?>
+<?if [ "$SAVED" = "1" ] ?>
+       <h2>Settings saved</h2>
+<?el?>
+<? 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" ?>
+<?fi?>
+
+<? footer ?>
+<!--
+##WEBIF:name:Network:1:LAN
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/system.sh b/openwrt/package/webif/files/www/cgi-bin/webif/system.sh
new file mode 100755 (executable)
index 0000000..83435c6
--- /dev/null
@@ -0,0 +1,44 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+load_settings system
+load_settings nvram
+
+[ -z $FORM_submit ] && {
+               FORM_hostname=${wan_hostname:-$(nvram get wan_hostname)}
+               FORM_hostname=${FORM_hostname:-OpenWrt}
+               grep BCM947 /proc/cpuinfo 2>&- >&- && {
+                       FORM_boot_wait=${boot_wait:-$(nvram get boot_wait)}
+                       FORM_boot_wait=${FORM_boot_wait:-off}
+               }
+} || {
+               SAVED=1
+               [ -z $FORM_hostname ] || save_setting system wan_hostname $FORM_hostname
+               grep BCM947 /proc/cpuinfo 2>&- >&- && {
+                       [ -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"
+
+display_form "start_form:$SCRIPT_NAME
+field:Hostname
+text:hostname:$FORM_hostname
+$bootwait_form
+field
+submit:action:Save settings
+end_form"
+?>
+<?fi?>
+
+<? footer ?>
+<!--
+##WEBIF:name:System:1:Settings
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh b/openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh
new file mode 100755 (executable)
index 0000000..fbf0d79
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/haserl -u
+<? 
+. /usr/lib/webif/webif.sh
+header "System" "Firmware upgrade" "Firmware Upgrade"
+
+strip_cybertan() {
+       dd if="$FORM_firmware" of=/tmp/upgrade.bin bs=32 skip=1 2>/dev/null
+       rm $FORM_firmware
+}
+
+[ -z "$FORM_submit" -o -z "$FORM_firmware" ] || {
+       [ -n $FORM_firmware ] && {
+               HEADER=$(head -c4 $FORM_firmware | hexdump -e "8/1 \"%x\"")
+               grep BCM947 /proc/cpuinfo > /dev/null && {
+                       case "$HEADER" in
+                               48445230) # TRX
+                                       echo "Firmware is in TRX format<br />"
+                                       mv $FORM_firmware /tmp/upgrade.bin
+                                       UPGRADE=1
+                               ;;
+                               57353447|57353453) # WRT54G(S)
+                                       echo "Firmware is in Cybertan BIN format, converting... "
+                                       strip_cybertan
+                                       echo "done <br />"
+                                       UPGRADE=1
+                               ;;
+                               *)
+                                       rm $FORM_firmware
+                                       ERROR="<h2>Error: Invalid firmware file format</h2>"
+                               ;;
+                       esac
+               }
+       } || {
+               ERROR="<h2>Error: Couldn't open firmware file</h2>"
+       }
+}
+?>
+<?if [ -z "$UPGRADE" ] ?>
+       <? $ERROR ?>
+       <form method="POST" name="upgrade" action="<? echo -n $SCRIPT_NAME ?>" enctype="multipart/form-data">
+       <table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
+       <tbody>
+               <tr>
+                       <td>Options:</td>
+                       <td>
+                               <input type="checkbox" name="erase_fs" value="1" checked="checked" />Erase JFFS2 partition<br />
+                               <input type="checkbox" name="erase_nvram" value="1" />Erase NVRAM
+                       </td>
+               </tr>
+               <tr>
+                       <td>Firmware image to upload:</td>
+                       <td>
+                               <input type="file" name="firmware" />
+                       </td>
+               </tr>
+                       <td />
+                       <td><input type="submit" name="submit" value="Upgrade" /></td>
+               </tr>
+       </tbody>
+       </table>
+       </form>
+<?el?>
+<?
+       ERASE=""
+       [ "$FORM_erase_fs" = 1 ] && ERASE="-e linux "
+       [ "$FORM_erase_nvram" = 1 ] && ERASE="$ERASE -e nvram "
+?>
+Upgrading... 
+<? mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- >&- ?>
+done <br />
+<?fi?>
+
+<? footer ?>
+<!--
+##WEBIF:name:System:3:Firmware upgrade
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wan.sh
new file mode 100755 (executable)
index 0000000..c8c8a0b
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "Network" "WAN" "WAN settings"
+?>
+<? footer ?>
+<!--
+##WEBIF:name:Network:2:WAN
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-config.sh
new file mode 100755 (executable)
index 0000000..74b20b9
--- /dev/null
@@ -0,0 +1,203 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+load_settings "wireless"
+
+[ -z $FORM_submit ] && {
+       FORM_mode=${wl0_mode:-$(nvram get wl0_mode)}
+       FORM_ssid=${wl0_ssid:-$(nvram get wl0_ssid)}
+       FORM_encryption=off
+       akm=${wl0_akm:-$(nvram get wl0_akm)}
+       case "$akm" in
+               psk)
+                       FORM_encryption=psk
+                       FORM_wpa1=wpa1
+                       ;;
+               psk2)
+                       FORM_encryption=psk
+                       FORM_wpa2=wpa2
+                       ;;
+               'psk psk2')
+                       FORM_encryption=psk
+                       FORM_wpa1=wpa1
+                       FORM_wpa2=wpa2
+                       ;;
+               wpa)
+                       FORM_encryption=wpa
+                       FORM_wpa1=wpa1
+                       ;;
+               wpa2)
+                       FORM_encryption=wpa
+                       FORM_wpa2=wpa2
+                       ;;
+               'wpa wpa2')
+                       FORM_encryption=wpa
+                       FORM_wpa1=wpa1
+                       FORM_wpa2=wpa2
+                       ;;
+               *)
+                       FORM_wpa1=wpa1
+                       ;;
+       esac
+       FORM_wpa_psk=${wl0_wpa_psk:-$(nvram get wl0_wpa_psk)}
+       crypto=${wl0_crypto:-$(nvram get wl0_crypto)}
+       case "$crypto" in
+               tkip)
+                       FORM_tkip=tkip
+                       ;;
+               aes)
+                       FORM_aes=aes
+                       ;;
+               'tkip+aes'|'aes+tkip')
+                       FORM_aes=aes
+                       FORM_tkip=tkip
+                       ;;
+       esac
+       [ $FORM_encryption = off ] && {
+               wep=${wl0_wep:-$(nvram get wl0_wep)}
+               case "$wep" in
+                       1|enabled|on)
+                               FORM_encryption=wep
+                               ;;
+                       *)
+                               FORM_encryption=disabled
+               esac
+       }
+       FORM_key1=${wl0_key1:-$(nvram get wl0_key1)}
+       FORM_key2=${wl0_key2:-$(nvram get wl0_key2)}
+       FORM_key3=${wl0_key3:-$(nvram get wl0_key3)}
+       FORM_key4=${wl0_key4:-$(nvram get wl0_key4)}
+       key=${wl0_key:-$(nvram get wl0_key)}
+       FORM_key=${key:-1}
+       true
+} || {
+       SAVED=1
+       save_setting wireless wl0_mode "$FORM_mode"
+       save_setting wireless wl0_ssid "$FORM_ssid"
+       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
+                       ;;
+               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
+}
+
+header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" '
+?>
+<script type="text/javascript" src="/webif.js"></script>
+<script type="text/javascript">
+<!--
+function modechange()
+{
+       if (checked('encryption_wpa') || checked('encryption_psk')) {
+               show('wpa_support');
+               show('wpa_crypto');
+       } else {
+               hide('wpa_support');
+               hide('wpa_crypto');
+       }
+       
+       if (checked('encryption_psk')) {
+               show('wpa_psk');
+       } else {
+               hide('wpa_psk');
+       }
+       
+       if (checked('encryption_wep')) {
+               show('wep_keys');
+       } else {
+               hide('wep_keys');
+       }
+
+       if (checked('mode_wet') || checked('mode_sta')) {
+                       var wpa = document.getElementById('encryption_wpa');
+                       wpa.disabled = true;
+                       if (wpa.checked) {
+                                       wpa.checked = false;
+                                       document.getElementById('encryption_off').checked = true;
+                       }
+       } else {
+                       document.getElementById('encryption_wpa').disabled = false;
+       }
+}
+-->
+</script>
+
+<?if [ "$SAVED" = "1" ] ?>
+       <h2>Settings saved</h2>
+<?el?>
+<? 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
+checkbox:wpa1:$FORM_wpa1:wpa1:WPA1
+checkbox:wpa2:$FORM_wpa2:wpa2:WPA2
+field:WPA encryption type:wpa_crypto
+checkbox:tkip:$FORM_tkip:tkip:RC4 (TKIP)
+checkbox:aes:$FORM_aes:aes:AES
+field:WPA preshared key:wpa_psk
+text:wpa_psk:$FORM_wpa_psk
+field:WEP keys:wep_keys
+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
+end_form"
+?>
+<?fi?>
+
+<? footer ?>
+<!--
+##WEBIF:name:Network:3:Wireless
+-->
diff --git a/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh b/openwrt/package/webif/files/www/cgi-bin/webif/wireless-status.sh
new file mode 100755 (executable)
index 0000000..b718a6e
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/haserl
+<? 
+. /usr/lib/webif/webif.sh
+header "Status" "Wireless" "Wireless status"
+?>
+
+<pre><? iwconfig 2>&1 | grep -v 'no wireless' | grep '\w' ?></pre>
+
+<? footer ?>
+<!--
+##WEBIF:name:Status:2:Wireless
+-->
diff --git a/openwrt/package/webif/files/www/index.html b/openwrt/package/webif/files/www/index.html
new file mode 100644 (file)
index 0000000..c11a7e4
--- /dev/null
@@ -0,0 +1,10 @@
+<html>
+       <head>
+               <meta http-equiv="refresh" content="0; URL=/cgi-bin/webif/info.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>...
+               </div>
+       </body>
+</html>
diff --git a/openwrt/package/webif/files/www/webif.css b/openwrt/package/webif/files/www/webif.css
new file mode 100644 (file)
index 0000000..f41aaf6
--- /dev/null
@@ -0,0 +1,460 @@
+/***************************************
+ * 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;
+}
+
+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;
+}
+
+dt {
+  font-weight: bold;
+  margin: 0;
+  padding: 0 0 1ex 0;
+}
+
+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;
+}
+
+.superHeader a:hover {
+  color: rgb(193,102,90);
+  background-color: transparent;
+  text-decoration: none;
+}
+
+.topHeader {
+  color: rgb(130,128,154);
+  background-color: rgb(33,50,66);
+  text-align: left;
+  margin: 0;
+  padding: 0.5ex 10px;
+}
+
+.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;
+}
+
+.categoryHeader span {
+  color: rgb(195,196,210);
+  background-color: transparent;
+  font-weight: bold;
+  text-transform: uppercase;
+}
+
+.categoryHeader a {
+  color: rgb(195,196,210);
+  background-color: transparent;
+  text-decoration: none;
+  margin: 0;
+  padding: 0 0.25ex 0 0;
+}
+
+.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;
+}
+
+.categoryHeader a:hover {
+  color: rgb(193,102,90);
+  background-color: transparent;
+  text-decoration: none;
+}
+
+.midHeader {
+  color: white;
+  background-color: rgb(61,92,122);
+  margin: 0;
+  padding: 0.26ex 10px;
+}
+
+.headerTitle {
+  font-size: 300%;
+  margin: 0;
+  padding: 0;
+}
+
+.headerSubTitle {
+  font-size: 151%;
+  font-weight: normal;
+  font-style: italic;
+  margin: 0 0 1ex 0;
+  padding: 0;
+}
+
+.headerInfo {
+  text-align: right;
+  margin: 0;
+  padding: 0 0 2ex 0;
+  position: absolute;
+  right: 1em;
+  top: 0.3em;
+}
+
+.headerInfo span {
+  color: rgb(195,196,210);
+  background-color: transparent;
+  font-weight: bold;
+  text-transform: uppercase;
+}
+
+.headerInfo a {
+  color: white;
+  background-color: transparent;
+  text-decoration: none;
+  margin: 0;
+  padding: 0 0 0.5ex 0;
+  display: block;
+}
+
+.headerInfo a:hover {
+  color: rgb(195,196,210);
+  background-color: transparent;
+  text-decoration: underline;
+}
+
+.headerLinks {
+  text-align: right;
+  margin: 0;
+  padding: 0 0 2ex 0;
+  position: absolute;
+  right: 1.5em;
+  top: 3em;
+}
+
+.headerLinks a {
+  color: white;
+  background-color: transparent;
+  text-decoration: none;
+  display: block;
+}
+
+.headerLinks a:hover {
+  color: rgb(195,196,210);
+  background-color: transparent;
+  text-decoration: underline;
+}
+
+.subHeader {
+  color: white;
+  background-color: rgb(117,144,174);
+  margin: 0;
+  padding: 0.5ex 10px;
+}
+
+.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;
+}
+
+.subHeader a:hover, .subHeader .highlight {
+  color: rgb(255,204,0);
+  background-color: transparent;
+  text-decoration: none;
+}
+
+
+/* ##### Main Copy ##### */
+
+#main-copy {
+  margin: 0;
+  padding: 0.5em 10px;
+  clear: left;
+}
+
+#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;
+}
+
+#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;
+}
+
+#main-copy p {
+  line-height: 1.75em;
+  margin: 1em 0 1.5em 0;
+  padding: 0;
+}
+
+.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;
+}
+
+.newsHeading:hover {
+  color: rgb(117,144,174);
+  background-color: transparent;
+  text-decoration: underline;
+}
+
+.newsDate {
+  font-style: italic;
+  margin: 0 !important;
+  padding: 0;
+}
+
+.newsSummary {
+  margin: 1.5ex 0 2.5ex 0.75ex !important;
+  padding: 0;
+}
+
+.more {
+  text-align: right;
+  margin: 0;
+  padding: 0.5em 0;
+}
+
+.more a {
+  color: rgb(61,92,122);
+  background-color: transparent;
+  font-size: 92%;
+  text-decoration: underline;
+  margin: 0;
+  padding: 0.25ex 0.75ex;
+}
+
+.more a:hover {
+  color: rgb(117,144,174);
+  text-decoration: none;
+}
+
+.rowOfBoxes {
+  clear: both;
+}
+
+.quarter, .threeQuarter, .oneThird, .half, .twoThirds, .fullWidth {
+  margin: 1em 0;
+  float: left;
+  border-left: 1px solid rgb(204,204,204);
+}
+
+.quarter {
+  width: 21%;
+  padding: 0 1.9%;
+}
+
+.threeQuarter {
+  width: 71%;
+  padding: 0 1.9%;
+}
+
+.oneThird {
+  width: 28%;
+  padding: 0 1.9%;
+}
+
+.half {
+  text-align: justify;
+  width: 46%;
+  padding: 0 1.9%;
+}
+
+.twoThirds {
+  text-align: justify;
+  width: 63%;
+  padding: 0 1.9%;
+}
+
+.fullWidth {
+  text-align: justify;
+  width: 96%;
+  padding: 0 1.2em;
+  border-left: none;
+}
+
+.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;
+}
+
+.dividingBorderAbove {
+  border-top: 1px solid rgb(204,204,204);
+}
+
+/* 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%;
+}
+
+* > #footer {
+  width: auto;
+  left: 0;
+  right: 0;
+}
+
+#footer a {
+  color: rgb(0,68,204);
+  background-color: transparent;
+  text-decoration: underline;
+}
+
+#footer a:hover {
+  text-decoration: none;
+}
diff --git a/openwrt/package/webif/files/www/webif.js b/openwrt/package/webif/files/www/webif.js
new file mode 100644 (file)
index 0000000..b93693b
--- /dev/null
@@ -0,0 +1,13 @@
+function checked(name)
+{
+       return document.getElementById(name).checked;
+}
+function hide(name)
+{
+       document.getElementById(name).style.display = 'none';
+}
+function show(name)
+{
+       document.getElementById(name).style.display = '';
+}
+
diff --git a/openwrt/package/webif/ipkg/webif.control b/openwrt/package/webif/ipkg/webif.control
new file mode 100644 (file)
index 0000000..8707357
--- /dev/null
@@ -0,0 +1,9 @@
+Package: webif
+Version: 0.00
+Architecture: all
+Maintainer: Felix Fietkau <openwrt@nbd.name>
+Source: buildroot internal
+Section: net
+Depends: haserl
+Priority: normal
+Description: A modular, extensible web interface for OpenWrt.
diff --git a/openwrt/package/webif/ipkg/webif.preinst b/openwrt/package/webif/ipkg/webif.preinst
new file mode 100755 (executable)
index 0000000..236ce92
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+rm -f /www/index.html