diff options
author | Ulf Samuelsson <ulf.samuelsson@atmel.com> | 2008-03-30 20:40:53 +0000 |
---|---|---|
committer | Ulf Samuelsson <ulf.samuelsson@atmel.com> | 2008-03-30 20:40:53 +0000 |
commit | 0be9560cb5f49d332f9936f36e0b8677affb5866 (patch) | |
tree | 103b4415919fa167af76a9cac2d34921657e893a /package/webif/files/www | |
parent | 4b45fed00627295ee88632dbf81e020ed96e5860 (diff) |
Add webif package
Diffstat (limited to 'package/webif/files/www')
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif.sh | 2 | ||||
-rw-r--r-- | package/webif/files/www/cgi-bin/webif/.categories | 2 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/about.sh | 31 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/config.sh | 46 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/index.sh | 8 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/info.sh | 44 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/ipkg.sh | 2 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/status-connection.sh | 29 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/status-dhcp.sh | 38 | ||||
-rwxr-xr-x | package/webif/files/www/cgi-bin/webif/status-wireless.sh | 12 | ||||
-rw-r--r-- | package/webif/files/www/index.html | 16 | ||||
-rw-r--r-- | package/webif/files/www/webif.css | 296 | ||||
-rw-r--r-- | package/webif/files/www/webif.js | 33 |
13 files changed, 559 insertions, 0 deletions
diff --git a/package/webif/files/www/cgi-bin/webif.sh b/package/webif/files/www/cgi-bin/webif.sh new file mode 100755 index 000000000..63ed48f5c --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec ./webif/info.sh diff --git a/package/webif/files/www/cgi-bin/webif/.categories b/package/webif/files/www/cgi-bin/webif/.categories new file mode 100644 index 000000000..331d4dfd1 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/.categories @@ -0,0 +1,2 @@ +##WEBIF:category:Info +##WEBIF:category:Status diff --git a/package/webif/files/www/cgi-bin/webif/about.sh b/package/webif/files/www/cgi-bin/webif/about.sh new file mode 100755 index 000000000..a0049c226 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/about.sh @@ -0,0 +1,31 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +header "Info" "About" "@TR<<About>>..." +?> + +<h3>webif - @TR<<OpenWrt Administrative Console>></h3> +<br /> +@TR<<GPL_Text|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 /> +@TR<<Copyright>> © 2005-2006 OpenWrt.org <br /> +<br /> +@TR<<Contributions by>>: +<ul class="about"> + <li class="about">Philipp Kewisch <<a href="mailto:openwrt@kewis.ch">openwrt@kewis.ch</a>></li> + <li class="about">Spectra <<a href="mailto:spectra@gmx.ch">spectra@gmx.ch</a>></li> + <li class="about">Jeremy Collake <<a href="mailto:jeremy.collake@gmail.com">jeremy.collake@gmail.com</a>></li> + <li class="about">Travis Kemen <<a href="mailto:kemen04@gmail.com">kemen04@gmail.com</a>></li> + <li class="about">Markus Wigge</li> + <li class="about">SeDkY</li> + <li class="about">Ivoshiee</li> + <li class="about">arteqw</li> + <li class="about">silver71</li> + <li class="about">@TR<<Layout based on>> <a href="http://www.openwebdesign.org/design/1773/prosimii/">"Prosimii"</a> @TR<<by>> haran</li> +</ul> + + +<? footer ?> +<!-- +##WEBIF:name:Info:20:About +--> diff --git a/package/webif/files/www/cgi-bin/webif/config.sh b/package/webif/files/www/cgi-bin/webif/config.sh new file mode 100755 index 000000000..0259537aa --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/config.sh @@ -0,0 +1,46 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh + +update_changes + +case "$CHANGES" in + ""|0)FORM_mode=nochange +esac +case "$FORM_mode" in + nochange) header $FORM_cat . "@TR<<No config change.|No configuration changes were made.>>";; + clear) + rm -rf /tmp/.webif >&- 2>&- + header $FORM_cat . "@TR<<Config discarded.|Your configuration changes have been discarded.>>" + CHANGES="" + echo "${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}" + ;; + review) + header $FORM_cat . "@TR<<Config changes:|Current configuration changes:>>" + cd /tmp/.webif + for configname in config-*; do + grep = $configname >&- 2>&- && { + echo -n "<h3>${configname#config-}</h3><br /><pre>" + cat $configname + echo '</pre><br />' + } + done + CONFIGFILES="" + for configname in file-*; do + exists "$configname" && CONFIGFILES="$CONFIGFILES ${configname#file-}" + done + CONFIGFILES="${CONFIGFILES:+<h3 style="display:inline">Config files: </h3>$CONFIGFILES<br />}" + echo $CONFIGFILES + ;; + save) + header $FORM_cat . "@TR<<Updating config...|Updating your configuration...>>" + CHANGES="" + echo "<pre>" + sh /usr/lib/webif/apply.sh 2>&1 + echo "</pre>${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}" + ;; +esac + +footer + +?> diff --git a/package/webif/files/www/cgi-bin/webif/index.sh b/package/webif/files/www/cgi-bin/webif/index.sh new file mode 100755 index 000000000..466b34d20 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/index.sh @@ -0,0 +1,8 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +category=$FORM_cat +empty "$category" && category=Info +header $category 1 + +footer ?> diff --git a/package/webif/files/www/cgi-bin/webif/info.sh b/package/webif/files/www/cgi-bin/webif/info.sh new file mode 100755 index 000000000..cc7639702 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/info.sh @@ -0,0 +1,44 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +header "Info" "Router Info" "@TR<<Router Info>>" + +?> +<pre><? +_version=$( grep "(" /etc/banner ) +_version="${_version%% ---*}" +_kversion="$( cat /proc/version )" +_date="$(date)" +_mac="$(/sbin/ifconfig eth0 | grep HWaddr | cut -b39-)" +sed -e 's/&/&/g' < /etc/banner +cat <<EOF +</pre> +<br /> +<br /> +<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center"> +<tbody> + <tr> + <td>@TR<<Firmware Version>></td> + <td>$_version</td> + </tr> + <tr> + <td>@TR<<Kernel Version>></td> + <td>$_kversion</td> + </tr> + <tr> + <td>@TR<<Current Date/Time>></td> + <td>$_date</td> + </tr> + <tr> + <td>@TR<<MAC Address>></td> + <td>$_mac</td> + </tr> +</tbody> +</table> +EOF + +footer +?> +<!-- +##WEBIF:name:Info:10:Router Info +--> diff --git a/package/webif/files/www/cgi-bin/webif/ipkg.sh b/package/webif/files/www/cgi-bin/webif/ipkg.sh new file mode 100755 index 000000000..62c0fae90 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/ipkg.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec ./system-ipkg.sh diff --git a/package/webif/files/www/cgi-bin/webif/status-connection.sh b/package/webif/files/www/cgi-bin/webif/status-connection.sh new file mode 100755 index 000000000..fbf329b1b --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/status-connection.sh @@ -0,0 +1,29 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +header "Status" "Connections" "@TR<<Connection Status>>" +?> +<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center"> +<tbody> + <tr> + <th><b>@TR<<Physical Connections|Ethernet/Wireless Physical Connections>></b></th> + </tr> + <tr> + <td><pre><? cat /proc/net/arp ?></pre></td> + </tr> + + <tr><td><br /><br /></td></tr> + + <tr> + <th><b>@TR<<Router Connections|Connections to the Router>></b></th> + </tr> + <tr> + <td><pre><? netstat -n 2>&- | awk '$0 ~ /^Active UNIX/ {ignore = 1}; ignore != 1 { print $0 }' ?></pre></td> + </tr> +</tbody> +</table> + +<? footer ?> +<!-- +##WEBIF:name:Status:100:Connections +--> diff --git a/package/webif/files/www/cgi-bin/webif/status-dhcp.sh b/package/webif/files/www/cgi-bin/webif/status-dhcp.sh new file mode 100755 index 000000000..5517b781f --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/status-dhcp.sh @@ -0,0 +1,38 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +header "Status" "DHCP" "@TR<<DHCP leases>>" +?> +<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center"> +<tbody> + <tr> + <th>@TR<<MAC Address>></th> + <th>@TR<<IP Address>></th> + <th>@TR<<Name>></th> + <th>@TR<<Expires in>></th> + </tr> +<? [ -e /tmp/dhcp.leases ] && awk -vdate="$(date +%s)" ' +$1 > 0 { + print "<tr>" + print "<td>" $2 "</td>" + print "<td>" $3 "</td>" + print "<td>" $4 "</td>" + print "<td>" + t = $1 - date + h = int(t / 60 / 60) + if (h > 0) printf h "h " + m = int(t / 60 % 60) + if (m > 0) printf m "min " + s = int(t % 60) + printf s "sec " + printf "</td>" + print "</tr>" +} +' /tmp/dhcp.leases ?> +</tbody> +</table> + +<? footer ?> +<!-- +##WEBIF:name:Status:150:DHCP +--> diff --git a/package/webif/files/www/cgi-bin/webif/status-wireless.sh b/package/webif/files/www/cgi-bin/webif/status-wireless.sh new file mode 100755 index 000000000..c7ad0a306 --- /dev/null +++ b/package/webif/files/www/cgi-bin/webif/status-wireless.sh @@ -0,0 +1,12 @@ +#!/usr/bin/webif-page +<? +. /usr/lib/webif/webif.sh +header "Status" "Wireless" "@TR<<Wireless Status>>" +?> + +<pre><? iwconfig 2>&1 | grep -v 'no wireless' | grep '\w' ?></pre> + +<? footer ?> +<!-- +##WEBIF:name:Status:200:Wireless +--> diff --git a/package/webif/files/www/index.html b/package/webif/files/www/index.html new file mode 100644 index 000000000..72a918726 --- /dev/null +++ b/package/webif/files/www/index.html @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Pragma" CONTENT="no-cache"> + <meta http-equiv="Expires" CONTENT="-1"> + <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> + <meta http-equiv="refresh" content="0; URL=/cgi-bin/webif.sh" /> + <title>Web Administrative Console</title> + </head> + <body style="margin: 0pt auto; height:100%; color: #C3C4D2; background-color: #213242;"> + <div style="width: 100%; height: 100%; position: fixed; display: table;"> + <p style="display: table-cell; line-height: 4em; vertical-align: middle; text-align: center;">Web Administrative Console<br />Redirecting to : <a style="color: inherit;" href="/cgi-bin/webif.sh">main page</a></p> + </div> + </body> +</html> diff --git a/package/webif/files/www/webif.css b/package/webif/files/www/webif.css new file mode 100644 index 000000000..86c5a62f9 --- /dev/null +++ b/package/webif/files/www/webif.css @@ -0,0 +1,296 @@ +/* layout */ + +* { + margin: 0; + padding: 0; +} + +html, body { + width: inherit; + height: 100%; +} + +dd { + margin-left: 1em; + margin-bottom: 0.2em; +} + +ul { + display: inline; + list-style-type: none; +} + +ul.about { + list-style-type: disc; +} + +li.about { + margin-left: 2em; +} + +hr, +#submenu h3, +#short-status h3, +#content .settings-block .settings .settings-help h3 { + display: none; +} + +ul.about, +hr.separator { + display: block; +} + +option { + padding-right: 1em; +} + +#container { + position: relative; + min-height: 100%; +} + +#header { + position: relative; + width: 100%; +} + +#header-title { + padding-top: 2em; + padding-bottom: 0.2em; +} + +#openwrt-title { + position: relative; + float: left; + left: 1em; + top: 0.7em; +} + +#short-status { + position: relative; + right: 1em; + line-height: 1.2em; + padding-bottom: 0.2em; +} + +#mainmenu, +#submenu { + position: absolute; + width: 100%; + padding-top: 0.2em; + padding-bottom: 0.2em; +} + +#mainmenu +{ + top: 0; + left: 0; +} + +#mainmenu h3 { + padding-left: 1em; + float: left; +} + +#mainmenu li { + font-size: 0.9em; + float: left; + margin-left: 1.5em; +} + +#submenu li { + float: left; + margin-left: 1em; +} + + +#content { + padding-top: 2em; + margin-left: 1em; + padding-bottom: 6em; +} + +#content .settings-block { + margin-bottom: 1.5em; +} + +#content .settings-block .settings-block-title { + margin-bottom: 10px; +} + +#content .settings-block .settings { + clear: both; + margin-left: 1.5em; + padding-right: 1em; +} + +#content .settings-block .settings-block-title, +#content .settings-block .settings .settings-title { + padding: 0.2em; +} + +#content .settings-block .settings .settings-content { + padding-top: 1em; + margin-left: 1em; + float: left; + width: 58%; + padding-bottom: 0.5em; +} + +#content .settings-block .settings .settings-content select, +#content .settings-block .settings .settings-content input { + margin-top: 0.8em; +} + +#content .settings-block .settings .settings-help { + padding: 0.4em; + padding-top: 1.4em; + margin-left: 42%; +} + +#content .settings-block .settings .settings-help .more-help { + margin-right: 10%; + text-align: right; +} + +#save { + position: absolute; + bottom: 0; + width: 100%; +} + +#save .page-save div { + float: right; + width: 15em; + height: 1.5em; + padding-right: 1em; + padding-top: 0.5em; + padding-bottom: 0.4em; +} + +#save .apply { + clear: both; + width: 100%; + height: 5em; +} + +#save .apply div { + float: right; + width: 15em; + height: 4em; + padding-right: 1em; + padding-top: 0.5em; + padding-bottom: 0.5em; +} + +th { + text-align: left; +} + +#content .settings-block .settings .settings-help .more-help, +#save, +#short-status { + text-align: right; +} + +/* font */ +body { + font-family: Verdana, Helvetica, sans-serif; + font-size: 1.0em; +} + +dt, +.selected-maincat, +#mainmenu a:active, +#submenu a { + font-weight: bold; +} + + + +#openwrt-title h1 { + font-size: 2.8em; +} + + +#short-status ul { + font-size: 0.8em; +} + +#mainmenu h3, +#mainmenu li, +#short-status h3 { + font-size: 0.9em; +} + +#mainmenu a, +#submenu a, +#save a { + text-decoration: none; +} + +#save a:hover { + text-decoration: underline; +} + +#mainmenu h3 { + text-transform: uppercase; +} + +#save a { + font-weight: normal; + font-size: 1.1em; +} + + +/* color */ + +#header-title, +#submenu, +#submenu a, +#save a, +#save .page-save +{ + color: #fff; +} + +#header-title, +#save .apply div { + background-color: #3D5C7A; +} + +#mainmenu { + color: #C3C4D2; + background-color: #213242; +} + +#mainmenu a { + color: #C3C4D2; +} + +#mainmenu a:hover { + color: rgb(193,102,90); +} + +#submenu, +#save div { + background-color: #7590AE; +} + +#content .settings-block .settings-block-title h2 { + color: #7590AE; +} + +#submenu a:hover { + color: #FB0; +} + +#content .settings-block .settings .settings-title { + color: #000; + background-color: #CCC; +} + +#save .page-save { + background-color: #FFF; +} + diff --git a/package/webif/files/www/webif.js b/package/webif/files/www/webif.js new file mode 100644 index 000000000..64d26cd8b --- /dev/null +++ b/package/webif/files/www/webif.js @@ -0,0 +1,33 @@ +function value(name) +{ + var item = document.getElementById(name); + return (item ? item.value : ""); +} +function isset(name, val) +{ + return (value(name) == val); +} +function checked(name) +{ + var item = document.getElementById(name); + return ((item) && item.checked); +} +function hide(name) +{ + var item = document.getElementById(name); + if (item) + item.style.display = 'none'; +} +function show(name) +{ + var item = document.getElementById(name); + if (item) + item.style.display = ''; +} +function set_visible(name, value) +{ + if (value) + show(name) + else + hide(name) +} |