PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+# for whiterussian only:
+NVRAM_OPTS=-DNVRAM -lnvram -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib
+
include $(TOPDIR)/package/rules.mk
$(eval $(call PKG_template,WEBIF,webif,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
touch $@
$(PKG_BUILD_DIR)/.built:
+ $(TARGET_CC) $(TARGET_CFLAGS) $(NVRAM_OPTS) -o $(PKG_BUILD_DIR)/webif-page src/webif-page.c
+ $(STRIP) $(PKG_BUILD_DIR)/webif-page
touch $@
$(IPKG_WEBIF):
cp -a ./files/* $(IDIR_WEBIF)/
+ install -d $(IDIR_WEBIF)/usr/bin
+ install -m0755 $(PKG_BUILD_DIR)/webif-page $(IDIR_WEBIF)/usr/bin/webif-page
find $(IDIR_WEBIF) -name CVS | xargs rm -rf
find $(IDIR_WEBIF) -name .svn | xargs rm -rf
$(IPKG_BUILD) $(IDIR_WEBIF) $(PACKAGE_DIR)
eval "$(cat /usr/lib/webif/apply-*.sh 2>&-)"
reload_network() {
- echo Reloading networking settings ...
+ echo '@TR<<Reloading>> @TR<<networking settings>> ...'
grep '^wan_' config-network >&- 2>&- && {
ifdown wan
ifup wan
}
reload_wireless() {
- echo Reloading wireless settings ...
+ echo '@TR<<Reloading>> @TR<<wireless settings>> ...'
killall nas >&- 2>&- && sleep 2
/sbin/wifi
[ -f /etc/init.d/S41wpa ] && /etc/init.d/S41wpa
}
reload_system() {
- echo Applying system settings ...
+ echo '@TR<<Applying>> @TR<<system settings>> ...'
echo "$(nvram get wan_hostname)" > /proc/sys/kernel/hostname
}
# file-* other config files
for config in $(ls file-* 2>&-); do
name=${config#file-}
- echo "Processing config file: $name"
+ echo "@TR<<Processing>> @TR<<config file>>: $name"
eval 'case "$name" in
'"$HANDLERS_file"'
esac'
cd /proc/self
cat /tmp/.webif/config-* 2>&- | grep '=' >&- 2>&- && {
cat /tmp/.webif/config-* 2>&- | tee fd/1 | xargs -n1 nvram set
- echo "Committing NVRAM ..."
+ echo "@TR<<Committing>> NVRAM ..."
nvram commit
}
)
}
($3 == "name") && ((p[$4] == 0) || (p[$4] > int($5))) {
gsub(/^.*\//, "", $1);
- p[$4] = int($5)
+ p[$4] = int($5) + 1
f[$4] = rootdir "/" $1
}
END {
- print "<div id=\"mainmenu\"><h3><strong>Categories:</strong></h3><ul>"
+ print "<div id=\"mainmenu\"><h3><strong>@TR<<Categories>>:</strong></h3><ul>"
for (i = 1; i <= n; i++) {
- if (sel == i) print "<li class=\"selected-maincat\"><a href=\"" f[c[i]] "\">»" c[i] "«</a></li>"
- else print "<li><a href=\"" f[c[i]] "\"> " c[i] " </a></li>";
+ if (sel == i) print "<li class=\"selected-maincat\"><a href=\"" f[c[i]] "\">»@TR<<" c[i] ">>«</a></li>"
+ else print "<li><a href=\"" f[c[i]] "\"> @TR<<" c[i] ">> </a></li>";
}
print "</ul></div>"
function end_form(form_help, form_help_link) {
print "</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>"
+ print "<div class=\"settings-help\"><blockquote><h3><strong>@TR<<Short help>>:</strong></h3>" form_help form_help_link "</blockquote></div>"
print "<div style=\"clear: both\"> </div></div>"
}
opts = ""
if (onchange != "") opts = opts " onClick=\"" onchange "()\" onChange=\"" onchange "()\""
print "<select id=\"" $2 "\" name=\"" $2 "\"" opts ">"
+ select_id = $2
select_open = 1
select_default = $3
}
else option_selected=""
if ($3 != "") option_title = $3
else option_title = $2
- print "<option" option_selected " value=\"" $2 "\">" option_title " </option>"
+ print "<option id=\"" select_id "_" $2 "\"" option_selected " value=\"" $2 "\">" option_title " </option>"
}
($1 ~ /^listedit/) {
n = split($4 " ", items, " ")
for (i = 1; i <= n; i++) {
- if (items[i] != "") print "<tr><td width=\"50%\">" items[i] "</td><td> <a href=\"" $3 $2 "remove=" items[i] "\">Remove</a></td></tr>"
+ if (items[i] != "") print "<tr><td width=\"50%\">" items[i] "</td><td> <a href=\"" $3 $2 "remove=" items[i] "\">@TR<<Remove>></a></td></tr>"
}
- print "<tr><td width=\"100%\" colspan="2"><input type=\"text\" name=\"" $2 "add\" value=\"" $5 "\" /><input type=\"submit\" name=\"" $2 "submit\" value=\"Add\" /></td></tr>"
+ print "<tr><td width=\"100%\" colspan="2"><input type=\"text\" name=\"" $2 "add\" value=\"" $5 "\" /><input type=\"submit\" name=\"" $2 "submit\" value=\"@TR<<Add>>\" /></td></tr>"
}
$1 ~ /^caption/ { print "<b>" $2 "</b>" }
$1 ~ /^string/ { print $2 }
$1 ~ /^text/ { print "<input id=\"" $2 "\" type=\"text\" name=\"" $2 "\" value=\"" $3 "\" />" $4 }
$1 ~ /^password/ { print "<input id=\"" $2 "\" type=\"password\" 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>" }
+$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 "\">@TR<<more...>></a></div>" }
($1 ~ /^checkbox/) || ($1 ~ /^radio/) {
print $5
--- /dev/null
+# Common
+Settings saved => Einstellungen gespeichert
+Settings not saved => Einstellungen nicht gespeichert
+Save Changes => Speichern
+Apply Changes => Übernehmen
+Clear Changes => Verwerfen
+Review Changes => Anzeigen
+Host Name => Hostname
+Uptime => Uptime
+Load => Systemlast
+Version => Version
+Categories => Kategorien
+Subcategories => Unterkategorien
+more... => mehr...
+Add => Hinzufügen
+Remove => Entfernen
+
+# Categories
+Info => Info
+About => Über
+Router Info => Routerinformationen
+
+Status => Status
+Connections => Netzwerkverbindungen
+DHCP => DHCP
+Wireless => WLAN
+
+System => System
+Password => Passwort
+Settings => Einstellungen
+Installed Software => Installierte Software
+Firmware Upgrade => Firmware aktualisieren
+
+Network => Netzwerk
+LAN => LAN
+WAN => Internet
+Wireless => WLAN
+Advanced Wireless => WLAN (erweitert)
+Hosts => Host-Konfiguration
+
+
+# 'About' page
+Copyright => Copyright
+
+GPL_Text => Dieses Programm ist freie Software. Sie können es unter den Bedingungen der GNU General Public License,<br /> wie von der Free Software Foundation veröffentlicht, weitergeben und/oder modifizieren,<br /> entweder gemäß Version 2 der Lizenz oder (nach Ihrer Option) jeder späteren Version.
+Contributions by => Mit Beiträgen von
+Layout based on => Layout basiert auf
+by => von
+
+
+No config change. => Es wurden keine Konfigurationsänderungen vorgenommen.
+Config discarded. => Ihre Konfigurationsänderungen wurden verworfen.
+Config changes: => Aktuelle Konfigurationsänderungen:
+Updating config... => Aktualisiere die Konfiguration...
+
+
+# 'Router Info' page
+Firmware Version => Firmwareversion
+Kernel Version => Kernelversion
+Current Date/Time => Datum/Uhrzeit
+MAC Address => MAC-Adresse
+
+
+# 'Connections' page
+Connection Status => Verbindungsstatus
+Physical Connections => Netzwerkschnittstellen
+Router Connections => Netzwerkverbindungen auf dem Router
+
+
+# 'DHCP' page
+DHCP leases => DHCP-Leases
+IP Address => IP-Adresse
+Name => Name
+Expires in => Gültigkeitsdauer
+
+
+# 'Wireless Status' page
+Wireless Status => WLAN-Status
+
+# 'Password' page
+Password Change => Passwortänderung
+New Password => Neues Passwort
+Confirm Password => Passwort bestätigen
+
+# 'System Settings' page
+System Settings => Systemeinstellungen
+Host Name => Hostname
+
+
+# 'Installed Software' page
+Installed Packages => Installierte Pakete
+Update package lists => Paketlisten aktualisieren
+Uninstall => Deinstallieren
+Install => Installieren
+
+
+# 'Firmware Upgrade' page
+Firmware format => Firmware-Format
+converting... => konvertiere...
+Error => Fehler
+done => fertig
+Invalid_format => Das Dateiformat der Firmware ist ungültig
+Open_failed => Konnte die Firmwaredatei nicht öffnen
+Erase_JFFS2 => JFFS2-Partition löschen
+Erase NVRAM => NVRAM löschen
+Options => Optionen
+Firmware_image => Firmware-Datei:
+Upgrade => Aktualisieren
+Upgrading... => Aktualisiere...
+
+# 'LAN Settings' page
+LAN Settings => Netzwerkeinstellungen
+LAN Configuration => Netzwerkkonfiguration
+Netmask => Subnetzmaske
+Default Gateway => Standardgateway
+DNS Servers => DNS-Server
+DNS Address => DNS-Serveradresse
+
+Note => Hinweis
+Helptext DNS save => Sie müssen Ihre Änderungen an dieser Seite speichern, bevor Sie DNS-Server hinzufügen oder entfernen
+
+
+# 'WAN Settings' page
+WAN Settings => Internet-Einstellungen
+WAN Configuration => Internet-Konfiguration
+PPTP Server IP => PPTP-Serveradresse
+Connection Type => Verbindungsart
+No WAN => Keine Verbindung
+DHCP => DHCP
+Static IP => Statische Konfiguration
+IP Settings => IP-Konfiguration
+PPP Settings => PPP-Einstellungen
+Redial Policy => Verbindungsaufbau
+Connect on Demand => Bei Bedarf
+Keep Alive => Verbindung aufrechterhalten
+Maximum Idle Time => Maximale Wartezeit bei Inaktivität
+Redial Timeout => Wartezeit bei unterbrochener Verbindung
+MTU => Maximale Paketgröße
+Username => Benutzername
+
+
+# 'Wireless Configuration' page
+Wireless Configuration => WLAN-Konfiguration
+Wireless Interface => WLAN-Interface
+WEP Key => WEP-Schlüssel
+Selected WEP Key => Ausgewählter WEP Schlüssel
+WPA PSK => WPA-Schlüssel
+ESSID => ESSID
+Channel => Kanal
+RADIUS IP Address => RADIUS-Serveradresse
+RADIUS Server Key => RADIUS-Serverpasswort
+Enabled => Aktiviert
+Disabled => Deaktiviert
+ESSID Broadcast => ESSID-Broadcast
+Show => Anzeigen
+Hide => Verstecken
+WLAN Mode => Betriebsmodus
+Access Point => Access Point
+Client => Client
+Bridge => Bridge
+Ad-Hoc => Ad-Hoc
+Operation mode => Betriebsmodus des Funknetzwerks
+Encryption Settings => Verschlüsselungseinstellungen
+Encryption Type => Verschlüsselungsart
+PSK => Passwort
+WPA Mode => WPA-Modus
+WPA Algorithms => WPA-Verschlüsselungsalgorithmen
+WEP Keys => WEP-Schlüssel
+
+Helptext ESSID => Name des Funknetzwerks
+
+# 'Advanced Wireless Configuration' page
+Advanced Wireless Configuration => WLAN-Konfiguration (erweitert)
+WDS Connections => WDS-Verbindungen
+MAC Filter List => Zugriffsbeschränkung (MAC-Adresse)
+Filter Mode => Filtermodus
+Allow => Erlauben
+Deny => Verweigern
+Set => Setzen
+Settings => Einstellungen
+Automatic WDS => Automatische WDS-Verbindung
+
+# "Hosts" page
+
+MAC Address => MAC-Adresse
+Configured Hosts => Konfigurierte Hosts
+DHCP Static => Statische DHCP-Einträge
+Host Names => Host-Einträge
BEGIN {
FS=":"
- print "<div id=\"submenu\"><h3><strong>Sub-Categories:</strong></h3><ul>"
+ print "<div id=\"submenu\"><h3><strong>@TR<<Subcategories>>:</strong></h3><ul>"
}
{
- if ($5 ~ "^" selected "$") print "<li class=\"selected-maincat\"><a href=\"" rootdir "/" $6 "\">»" $5 "«</a></li>"
- else print "<li><a href=\"" rootdir "/" $6 "\"> " $5 " </a></li>"
+ if ($5 ~ "^" selected "$") print "<li class=\"selected-maincat\"><a href=\"" rootdir "/" $6 "\">»@TR<<" $5 ">>«</a></li>"
+ else print "<li><a href=\"" rootdir "/" $6 "\"> @TR<<" $5 ">> </a></li>"
}
END {
print "</ul></div>"
$1 == "int" {
valid_type = 1
- if (value !~ /^[0-9]*$/) { valid = 0; verr = "Invalid value" }
+ if (value !~ /^[0-9]*$/) { valid = 0; verr = "@TR<<Invalid value>>" }
}
# FIXME: add proper netmask validation
if ((ipaddr[i] < 0) || (ipaddr[i] > 255)) valid = 0
}
}
- if (valid == 0) verr = "Invalid value"
+ if (valid == 0) verr = "@TR<<Invalid value>>"
}
$1 == "wep" {
valid_type = 1
if (value !~ /^[0-9A-Fa-f]*$/) {
valid = 0
- verr = "Invalid value"
+ verr = "@TR<<Invalid value>>"
} else if ((length(value) != 0) && (length(value) != 10) && (length(value) != 26)) {
valid = 0
verr = "Invalid key length"
valid_type = 1
if (value !~ /^[0-9a-zA-z\.\-]*$/) {
valid = 0
- verr = "Invalid value"
+ verr = "@TR<<Invalid value>>"
}
}
valid_type = 1
if ((value != "") && (value !~ /^[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]$/)) {
valid = 0
- verr = "Invalid value"
+ verr = "@TR<<Invalid value>>"
}
}
sub(/^max=/, "", max)
max = int(max)
if ($1 == "int") {
- if (value > max) { valid = 0; verr = "Value too large" }
+ if (value > max) { valid = 0; verr = "@TR<<Value too large>> (@TR<<maximum>>: " max ")" }
} else if ($1 == "string") {
- if (length(value) > max) { valid = 0; verr = "Value too large" }
+ if (length(value) > max) { valid = 0; verr = "@TR<<String too short>> (@TR<<maximum>>: " max ")" }
}
} else if ((options[i] == "nodots") && ($1 == "hostname")) {
if (value ~ /\./) {
valid = 0
- verr = "Invalid value"
+ verr = "@TR<<Invalid value>>"
}
}
}
header() {
empty "$ERROR" && {
- _saved_title="${SAVED:+: Settings saved}"
+ _saved_title="${SAVED:+: @TR<<Settings saved>>}"
} || {
FORM_submit="";
ERROR="<h3>$ERROR</h3><br /><br />"
- _saved_title=": Settings not saved"
+ _saved_title=": @TR<<Settings not saved>>"
}
_category="$1"
_version="${_version%% ---*}"
_head="${3:+<div class=\"settings-block-title\"><h2>$3$_saved_title</h2></div>}"
_form="${5:+<form enctype=\"multipart/form-data\" action=\"$5\" method=\"post\"><input type="hidden" name="submit" value="1" />}"
- _savebutton="${5:+<p><input type=\"submit\" name=\"action\" value=\"Save changes\" /></p>}"
+ _savebutton="${5:+<p><input type=\"submit\" name=\"action\" value=\"@TR<<Save Changes>>\" /></p>}"
_categories=$(categories $1)
_subcategories=${2:+$(subcategories "$1" "$2")}
<!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>
+ <title>@TR<<OpenWrt Administrative Console>></title>
<link rel="stylesheet" type="text/css" href="/webif.css" />
</head>
<body $4><div id="container">
<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>
+ <li><strong>@TR<<Host Name>>:</strong> $_hostname</li>
+ <li><strong>@TR<<Uptime>>:</strong> $_uptime</li>
+ <li><strong>@TR<<Load>>:</strong> $_loadavg</li>
+ <li><strong>@TR<<Version>>:</strong> $_version</li>
</ul>
</div>
</div>
<br />
<br />
<br />
-<h3>Warning: you haven't set a password for the Web interface and SSH access<br />
+<h3>TR{Warning}: you haven't set a password for the Web interface and SSH access<br />
Please enter one now (the user name in your browser will be 'root').</h3>
<br />
<br />
</div>
<div class="apply">
<div>
- <a href="config.sh?mode=save&cat=$_category&prev=$SCRIPT_NAME">Apply changes «</a><br />
- <a href="config.sh?mode=clear&cat=$_category&prev=$SCRIPT_NAME">Clear changes «</a><br />
- <a href="config.sh?mode=review&cat=$_category&prev=$SCRIPT_NAME">Review changes $_changes «</a>
+ <a href="config.sh?mode=save&cat=$_category&prev=$SCRIPT_NAME">@TR<<Apply Changes>> «</a><br />
+ <a href="config.sh?mode=clear&cat=$_category&prev=$SCRIPT_NAME">@TR<<Clear Changes>> «</a><br />
+ <a href="config.sh?mode=review&cat=$_category&prev=$SCRIPT_NAME">@TR<<Review Changes>> $_changes «</a>
</div>
</div>
</div>
read _systype < /proc/cpuinfo
equal "${_systype##* }" "BCM947XX"
}
+
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "Info" "About" "About webif"
+header "Info" "About" "@TR<<About>>..."
?>
-<h3>webif - OpenWrt Administrative Console</h3>
+<h3>webif - @TR<<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 />
-of the License, or (at your option) any later version. <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 />
-Copyright © 2005 Felix Fietkau <<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>><br />
+@TR<<Copyright>> © 2005 Felix Fietkau <<a href="mailto:openwrt@nbd.name">openwrt@nbd.name</a>><br />
<br />
-Contributions by:
+@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">Layout based on <a href="http://www.openwebdesign.org/design/1773/prosimii/">"Prosimii"</a> by haran</li>
+ <li class="about">@TR<<Layout based on>> <a href="http://www.openwebdesign.org/design/1773/prosimii/">"Prosimii"</a> @TR<<by>> haran</li>
</ul>
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
""|0)FORM_mode=nochange
esac
case "$FORM_mode" in
- nochange) header $FORM_cat . "Configuration: no changes were made.";;
+ nochange) header $FORM_cat . "@TR<<No config change.|No configuration changes were made.>>";;
clear)
rm -rf /tmp/.webif >&- 2>&-
- header $FORM_cat . "Configuration: cleared."
+ 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 . "Configuration changes:"
+ header $FORM_cat . "@TR<<Config changes:|Current configuration changes:>>"
cd /tmp/.webif
for configname in config-*; do
grep = $configname >&- 2>&- && {
echo $CONFIGFILES
;;
save)
- header $FORM_cat . "Configuration: updating..."
+ header $FORM_cat . "@TR<<Updating config...|Updating your configuration...>>"
CHANGES=""
echo "<pre>"
- sh /usr/lib/webif/apply.sh
+ sh /usr/lib/webif/apply.sh 2>&1
echo "</pre>${FORM_prev:+<meta http-equiv=\"refresh\" content=\"2; URL=$FORM_prev\" />}"
;;
esac
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "Status" "Connections" "Connection status"
+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>Ethernet/Wireless physical connections</b></th>
+ <th><b>@TR<<Physical Connections|Ethernet/Wireless Physical Connections>></b></th>
</tr>
<tr>
<td><pre><? cat /proc/net/arp ?></pre></td>
<tr><td><br /><br /></td></tr>
<tr>
- <th><b>Connections to the router</b></th>
+ <th><b>@TR<<Router Connections|Connections to the Router>></b></th>
</tr>
<tr>
- <td><pre><? netstat -n 2>&- ?></pre></td>
+ <td><pre><? netstat -n 2>&- | awk '$0 ~ /^Active UNIX/ {ignore = 1}; ignore != 1 { print $0 }' ?></pre></td>
</tr>
</tbody>
</table>
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
empty "$FORM_add_host" || {
# add a host to /etc/hosts
validate <<EOF
-ip|FORM_host_ip|IP Address|required|$FORM_host_ip
-hostname|FORM_host_name|Hostname|required|$FORM_host_name
+ip|FORM_host_ip|@TR<<IP Address>>|required|$FORM_host_ip
+hostname|FORM_host_name|@TR<<Host Name>>|required|$FORM_host_name
EOF
equal "$?" 0 && update_hosts add "$FORM_host_ip" "$FORM_host_name"
}
empty "$FORM_add_dhcp" || {
# add a host to /etc/ethers
validate <<EOF
-mac|FORM_dhcp_mac|MAC Address|required|$FORM_dhcp_mac
-ip|FORM_dhcp_ip|IP|required|$FORM_dhcp_ip
+mac|FORM_dhcp_mac|@TR<<MAC Address>>|required|$FORM_dhcp_mac
+ip|FORM_dhcp_ip|@TR<<IP Address>>|required|$FORM_dhcp_ip
EOF
equal "$?" 0 && update_ethers add "$FORM_dhcp_mac" "$FORM_dhcp_ip"
}
empty "$FORM_remove_host" || update_hosts del "$FORM_remove_ip" "$FORM_remove_name"
empty "$FORM_remove_dhcp" || update_ethers del "$FORM_remove_mac"
-header "Network" "Hosts" "Configured hosts" ''
+header "Network" "Hosts" "@TR<<Configured Hosts>>" ''
# Hosts in /etc/hosts
awk -v "url=$SCRIPT_NAME" \
-v "name=$FORM_host_name" -f /usr/lib/webif/common.awk -f - $HOSTS_FILE <<EOF
BEGIN {
FS="[ \t]"
- start_form("Hostnames")
+ start_form("@TR<<Host Names>>")
print "<table width=\"70%\" summary=\"Settings\">"
- print "<tr><th>IP</th><th>Hostname</th><th></th></tr>"
+ print "<tr><th>@TR<<IP Address>></th><th>@TR<<Host Name>></th><th></th></tr>"
print "<tr><td colspan=\"3\"><hr class=\"separator\" /></td></tr>"
}
for (i = 2; i <= n; i++) {
if (names[i] != "") {
if (first != 1) output = output "<tr>"
- output = output "<td>" names[i] "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_host=1&remove_ip=" $1 "&remove_name=" names[i] "\\">Remove</a></td></tr>"
+ output = output "<td>" names[i] "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_host=1&remove_ip=" $1 "&remove_name=" names[i] "\\">@TR<<Remove>></a></td></tr>"
first = 0
names_found++
}
END {
print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
- print "<tr><td><input type\\"text\\" name=\\"host_ip\\" value=\\"" ip "\\" /></td><td><input type=\\"text\\" name=\\"host_name\\" value=\\"" name "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_host\\" value=\\"Add\\" /></td></tr>"
+ print "<tr><td><input type\\"text\\" name=\\"host_ip\\" value=\\"" ip "\\" /></td><td><input type=\\"text\\" name=\\"host_name\\" value=\\"" name "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_host\\" value=\\"@TR<<Add>>\\" /></td></tr>"
print "</form>"
print "</table>"
end_form()
BEGIN {
FS="[ \\t]"
print "<form enctype=\\"multipart/form-data\\" method=\\"post\\">"
- start_form("Static IP addresses (for DHCP)")
+ start_form("@TR<<DHCP Static|Static IP addresses (for DHCP)>>")
print "<table width=\\"70%\\" summary=\\"Settings\\">"
- print "<tr><th>MAC address</th><th>IP</th><th></th></tr>"
+ print "<tr><th>@TR<<MAC Address>></th><th>@TR<<IP Address>></th><th></th></tr>"
}
# only for valid MAC addresses
(\$1 ~ /^[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]$/) {
gsub(/#.*$/, "");
- print "<tr><td>" \$1 "</td><td>" \$2 "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_dhcp=1&remove_mac=" \$1 "\\">Remove</a></td></tr>"
+ print "<tr><td>" \$1 "</td><td>" \$2 "</td><td align=\\"right\\" width=\\"10%\\"><a href=\\"" url "?remove_dhcp=1&remove_mac=" \$1 "\\">@TR<<Remove>></a></td></tr>"
}
END {
- print "<tr><td><input type\\"text\\" name=\\"dhcp_mac\\" value=\\"" mac "\\" /></td><td><input type=\\"text\\" name=\\"dhcp_ip\\" value=\\"" ip "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_dhcp\\" value=\\"Add\\" /></td></tr>"
+ print "<tr><td><input type\\"text\\" name=\\"dhcp_mac\\" value=\\"" mac "\\" /></td><td><input type=\\"text\\" name=\\"dhcp_ip\\" value=\\"" ip "\\" /></td><td style=\\"width: 10em\\"><input type=\\"submit\\" name=\\"add_dhcp\\" value=\\"@TR<<Add>>\\" /></td></tr>"
print "</table>"
print "</form>"
end_form();
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
category=$FORM_cat
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "Info" "Router Info" "Router Info"
+header "Info" "Router Info" "@TR<<Router Info>>"
?>
<pre><?
<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
<tbody>
<tr>
- <td>Firmware Version</td>
+ <td>@TR<<Firmware Version>></td>
<td>$_version</td>
</tr>
<tr>
- <td>Kernel Version</td>
+ <td>@TR<<Kernel Version>></td>
<td>$_kversion</td>
</tr>
<tr>
- <td>Current Date/Time</td>
+ <td>@TR<<Current Date/Time>></td>
<td>$_date</td>
</tr>
<tr>
- <td>MAC-Address</td>
+ <td>@TR<<MAC Address>></td>
<td>$_mac</td>
</tr>
</tbody>
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "System" "Installed software" "Installed software"
+header "System" "Installed Software" "@TR<<Installed Software>>"
?>
-<p style="position: absolute; right: 1em; top: 10.5em"><a href="ipkg.sh?action=update">Update package lists</a></p>
+<p style="position: absolute; right: 1em; top: 10.5em"><a href="ipkg.sh?action=update">@TR<<Update package lists>></a></p>
<pre><?
if [ "$FORM_action" = "update" ]; then
ipkg update
fi
?></pre>
<div class="half noBorderOnLeft">
- <h3>Installed packages</h3>
+ <h3>@TR<<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>"
+ print "<tr><td>" $1 "</td><td><a href=\"ipkg.sh?action=remove&pkg=" link "\">@TR<<Uninstall>></td></tr>"
}
'
?>
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>"
+ print "<tr><td>" $3 "</td><td><a href=\"ipkg.sh?action=install&pkg=" link "\">@TR<<Install>></td></tr>"
current=$1
}
'
<? footer ?>
<!--
-##WEBIF:name:System:2:Installed software
+##WEBIF:name:System:2:Installed Software
-->
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
load_settings network
FORM_dns="${lan_dns:-$(nvram get lan_dns)}"
LISTVAL="$FORM_dns"
-handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|LAN DNS address|required' && {
+handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|@TR<<DNS Address>>|required' && {
FORM_dns="$LISTVAL"
save_setting network lan_dns "$FORM_dns"
}
else
SAVED=1
validate <<EOF
-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
+ip|FORM_lan_ipaddr|@TR<<IP Address>>|required|$FORM_lan_ipaddr
+netmask|FORM_lan_netmask|@TR<<Netmask>>|required|$FORM_lan_netmask
+ip|FORM_lan_gateway|@TR<<Gateway>>||$FORM_lan_gateway
EOF
equal "$?" 0 && {
save_setting network lan_ipaddr $FORM_lan_ipaddr
}
fi
-header "Network" "LAN" "LAN settings" '' "$SCRIPT_NAME"
+header "Network" "LAN" "@TR<<LAN Configuration>>" '' "$SCRIPT_NAME"
display_form <<EOF
-start_form|LAN Configuration
-field|IP Address
+start_form|@TR<<LAN Configuration>>
+field|@TR<<IP Address>>
text|lan_ipaddr|$FORM_lan_ipaddr
-field|Netmask
+field|@TR<<Netmask>>
text|lan_netmask|$FORM_lan_netmask
-field|Default Gateway
+field|@TR<<Default Gateway>>
text|lan_gateway|$FORM_lan_gateway
end_form
-start_form|DNS Servers
+start_form|@TR<<DNS Servers>>
listedit|dns|$SCRIPT_NAME?|$FORM_dns|$FORM_dnsadd
-helpitem|Note
-helptext|You should save your settings on this page before adding/removing DNS servers
+helpitem|@TR<<Note>>
+helptext|@TR<<Helptext DNS save#You need save your settings on this page before adding/removing DNS servers>>
end_form
EOF
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "Status" "DHCP" "DHCP leases"
+header "Status" "DHCP" "@TR<<DHCP leases>>"
?>
<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
<tbody>
<tr>
- <th>MAC Address</th>
- <th>IP Address</th>
- <th>Name</th>
- <th>Expires in</th>
+ <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 {
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
}
}
-header "System" "Password" "Password change" '' "$SCRIPT_NAME"
+header "System" "Password" "@TR<<Password Change>>" '' "$SCRIPT_NAME"
display_form <<EOF
-start_form|System settings
-field|New Password:
+start_form|@TR<<Password Change>>
+field|@TR<<New Password>>:
password|pw1
-field|Confirm Password:
+field|@TR<<Confirm Password>>:
password|pw2
end_form
EOF
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
load_settings system
}
fi
-header "System" "Settings" "System settings" '' "$SCRIPT_NAME"
+header "System" "Settings" "@TR<<System Settings>>" '' "$SCRIPT_NAME"
is_bcm947xx && bootwait_form="field|boot_wait
-radio|boot_wait|$FORM_boot_wait|on|On<br />
-radio|boot_wait|$FORM_boot_wait|off|Off"
+select|boot_wait|$FORM_boot_wait
+option|on|@TR<<Enabled>>
+option|off|@TR<<Disabled>>"
display_form <<EOF
-start_form|System settings
-field|Hostname
+start_form|@TR<<System Settings>>
+field|@TR<<Host Name>>
text|hostname|$FORM_hostname
$bootwait_form
field
-#!/usr/bin/haserl -u
+#!/usr/bin/webif-page -u
<?
. /usr/lib/webif/webif.sh
-header "System" "Firmware upgrade" "Firmware upgrade"
+header "System" "Firmware Upgrade" "@TR<<Firmware Upgrade>>"
strip_cybertan() {
(
grep BCM947 /proc/cpuinfo > /dev/null && {
case "$HEADER" in
48445230) # TRX
- echo "Firmware is in TRX format<br />"
+ echo "@TR<<Firmware format>>: TRX<br />"
mv $FORM_firmware /tmp/upgrade.bin
UPGRADE=1
;;
57353447|57353453|57353473) # WRT54G(S)
- echo "Firmware is in Cybertan BIN format, converting... "
+ echo "@TR<<Firmware format>>: Cybertan BIN =< @TR<<converting...>> "
strip_cybertan
- echo "done <br />"
+ echo "@TR<<done>>. <br />"
UPGRADE=1
;;
*)
rm $FORM_firmware
- ERROR="<h2>Error: Invalid firmware file format</h2>"
+ ERROR="<h2>@TR<<Error>>: @TR<<Invalid_format|Invalid firmware file format>></h2>"
;;
esac
}
} || {
- ERROR="<h2>Error: Couldn't open firmware file</h2>"
+ ERROR="<h2>@TR<<Error>>: @TR<<Open_failed|Couldn't open firmware file>></h2>"
}
}
?>
<table style="width: 90%; text-align: left;" border="0" cellpadding="2" cellspacing="2" align="center">
<tbody>
<tr>
- <td>Options:</td>
+ <td>@TR<<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
+ <input type="checkbox" name="erase_fs" value="1" checked="checked" />@TR<<Erase_JFFS2|Erase JFFS2 partition>><br />
+ <input type="checkbox" name="erase_nvram" value="1" />@TR<<Erase NVRAM>>
</td>
</tr>
<tr>
- <td>Firmware image to upload:</td>
+ <td>@TR<<Firmware_image|Firmware image to upload:>></td>
<td>
<input type="file" name="firmware" />
</td>
</tr>
<td />
- <td><input type="submit" name="submit" value="Upgrade" /></td>
+ <td><input type="submit" name="submit" value="@TR<<Upgrade>>" /></td>
</tr>
</tbody>
</table>
ERASE="${FORM_erase_fs:+-e linux }"
ERASE="$ERASE${FORM_erase_nvram:+-e nvram }"
cp /bin/busybox /tmp/
- echo -n 'Upgrading... '
+ echo -n '@TR<<Upgrading...>> '
# FIXME: probably a race condition (with the reboot), but it seems to work
- mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "done." }'
+ mtd -r $ERASE write /tmp/upgrade.bin linux 2>&- | awk 'END { print "@TR<<done>>." }'
exit
?>
<?fi?>
<? footer ?>
<!--
-##WEBIF:name:System:3:Firmware upgrade
+##WEBIF:name:System:3:Firmware Upgrade
-->
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
FORM_dns="${wan_dns:-$(nvram get wan_dns)}"
LISTVAL="$FORM_dns"
-handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|WAN DNS address|required' && {
+handle_list "$FORM_dnsremove" "$FORM_dnsadd" "$FORM_dnssubmit" 'ip|FORM_dnsadd|@TR<<DNS Address>>|required' && {
FORM_dns="$LISTVAL"
save_setting network wan_dns "$FORM_dns"
}
SAVED=1
empty "$FORM_wan_proto" && {
- ERROR="No WAN protocol selected"
+ ERROR="@TR<<No WAN Proto|No WAN protocol has been selected>>"
return 255
}
esac
validate <<EOF
-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
+ip|FORM_wan_ipaddr|@TR<<IP Address>>|$V_IP|$FORM_wan_ipaddr
+netmask|FORM_wan_netmask|@TR<<Netmask>>|$V_NM|$FORM_wan_netmask
+ip|FORM_wan_gateway|@TR<<Default Gateway>>||$FORM_wan_gateway
+ip|FORM_pptp_server_ip|@TR<<PPTP Server IP>>|$V_PPTP|$FORM_pptp_server_ip
EOF
equal "$?" 0 && {
save_setting network wan_proto $FORM_wan_proto
}
-header "Network" "WAN" "WAN settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
+header "Network" "WAN" "@TR<<WAN Configuration>>" ' onLoad="modechange()" ' "$SCRIPT_NAME"
cat <<EOF
<script type="text/javascript" src="/webif.js "></script>
display_form <<EOF
onchange|modechange
-start_form|WAN Configuration
-field|Internet Connection Type
-radio|wan_proto|$FORM_wan_proto|none|None<br />
-radio|wan_proto|$FORM_wan_proto|dhcp|DHCP<br />
-radio|wan_proto|$FORM_wan_proto|static|Static IP<br />
+start_form|@TR<<WAN Configuration>>
+field|@TR<<Connection Type>>
+radio|wan_proto|$FORM_wan_proto|none|@TR<<No WAN#None>><br />
+radio|wan_proto|$FORM_wan_proto|dhcp|@TR<<DHCP>><br />
+radio|wan_proto|$FORM_wan_proto|static|@TR<<Static IP>><br />
$PPPOE_OPTION
$PPTP_OPTION
end_form
-
-start_form|IP Settings|ip_settings|hidden
-field|Internet IP Address|wan_ipaddr|hidden
+tatus
+start_form|@TR<<IP Settings>>|ip_settings|hidden
+field|@TR<<IP Address>>|wan_ipaddr|hidden
text|wan_ipaddr|$FORM_wan_ipaddr
-field|Subnet Mask|wan_netmask|hidden
+field|@TR<<Netmask>>|wan_netmask|hidden
text|wan_netmask|$FORM_wan_netmask
-field|Gateway|wan_gateway|hidden
+field|@TR<<Default Gateway>>|wan_gateway|hidden
text|wan_gateway|$FORM_wan_gateway
$PPTP_SERVER_OPTION
end_form
-start_form|DNS Servers|wan_dns|hidden
+start_form|@TR<<DNS Servers>>|wan_dns|hidden
listedit|dns|$SCRIPT_NAME?wan_proto=static&|$FORM_dns|$FORM_dnsadd
-helpitem|Note
-helptext|You should save your settings on this page before adding/removing DNS servers
+helpitem|@TR<<Note>>
+helptext|@TR<<Helptext DNS save#You should save your settings on this page before adding/removing DNS servers>>
end_form
-start_form|PPP Settings|ppp_settings|hidden
-field|PPP Redial Policy|ppp_redial|hidden
-radio|ppp_redial|$FORM_ppp_redial|demand|Connect on Demand<br />
-radio|ppp_redial|$FORM_ppp_redial|persist|Keep Alive
-field|Maximum Idle Time|ppp_demand_idletime|hidden
+start_form|@TR<<PPP Settings>>|ppp_settings|hidden
+field|@TR<<Redial Policy>>|ppp_redial|hidden
+radio|ppp_redial|$FORM_ppp_redial|demand|@TR<<Connect on Demand>><br />
+radio|ppp_redial|$FORM_ppp_redial|persist|@TR<<Keep Alive>>
+field|@TR<<Maximum Idle Time>>|ppp_demand_idletime|hidden
text|ppp_idletime|$FORM_ppp_idletime
-field|Redial Timeout|ppp_persist_redialperiod|hidden
+field|@TR<<Redial Timeout>>|ppp_persist_redialperiod|hidden
text|ppp_redialperiod|$FORM_ppp_redialperiod
-field|PPP Username|ppp_username|hidden
+field|@TR<<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
+field|@TR<<Password>>|ppp_passwd|hidden
+password|ppp_passwd|$FORM_ppp_passwd
+field|@TR<<MTU>>|ppp_mtu|hidden
text|ppp_mtu|$FORM_ppp_mtu
end_form
EOF
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
load_settings "wireless"
}
FORM_maclistadd=${FORM_maclistadd:-00:00:00:00:00:00}
-if empty "$FORM_macmode_set"; then
- FORM_macmode="${wl0_macmode:-$(nvram get wl0_macmode)}"
-else
- save_setting wireless wl0_macmode "$FORM_macmode"
-fi
-
if empty "$FORM_submit"; then
+ FORM_macmode="${wl0_macmode:-$(nvram get wl0_macmode)}"
FORM_lazywds=${wl0_lazywds:-$(nvram get wl0_lazywds)}
case "$FORM_lazywds" in
- 0|off|disabled) FORM_lazywds=0;;
- *) FORM_lazywds=1;;
+ 1|on|enabled) FORM_lazywds=1;;
+ *) FORM_lazywds=0;;
esac
else
SAVED=1
EOF
equal "$?" 0 && {
save_setting wireless wl0_lazywds "$FORM_lazywds"
+ save_setting wireless wl0_macmode "$FORM_macmode"
}
-
fi
-header "Network" "Advanced Wireless" "Advanced Wireless Settings" ' onLoad="modechange()"' "$SCRIPT_NAME"
+header "Network" "Advanced Wireless" "@TR<<Advanced Wireless Configuration>>" ' onLoad="modechange()"' "$SCRIPT_NAME"
cat <<EOF
<script type="text/javascript" src="/webif.js"></script>
}
</script>
-<form enctype="multipart/form-data" method="post" action="$SCRIPT_NAME">
EOF
display_form <<EOF
onchange|modechange
-start_form|WDS connections
+start_form|@TR<<WDS Connections>>
listedit|wds|$SCRIPT_NAME?|$FORM_wds|$FORM_wdsadd
end_form
-start_form|MAC filter list
+start_form|@TR<<MAC Filter List>>
listedit|maclist|$SCRIPT_NAME?|$FORM_maclist|$FORM_maclistadd
-field
-caption|Filter mode:
+end_form
+start_form|@TR<<Settings>>
+field|@TR<<Automatic WDS>>
+select|lazywds|$FORM_lazywds
+option|1|@TR<<Enabled>>
+option|0|@TR<<Disabled>>
+field|@TR<<Filter Mode>>:
select|macmode|$FORM_macmode
-option|disabled
-option|allow
-option|deny
-submit|macmode_set|Set
-field|Lazy WDS
-radio|lazywds|$FORM_lazywds|1|Enabled<br />
-radio|lazywds|$FORM_lazywds|0|Disabled
+option|disabled|@TR<<Disabled>>
+option|allow|@TR<<Allow>>
+option|deny|@TR<<Deny>>
end_form
EOF
-?>
-</form>
-<? footer ?>
+footer ?>
<!--
##WEBIF:name:Network:4:Advanced Wireless
-->
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
load_settings "wireless"
SAVED=1
case "$FORM_encryption" in
wpa) V_RADIUS="
-string|FORM_radius_key|RADIUS server key|min=4 max=63 required|$FORM_radius_key
-ip|FORM_radius_ipaddr|RADIUS IP address|required|$FORM_radius_ipaddr";;
- psk) V_PSK="wpapsk|FORM_wpa_psk|WPA pre-shared key|required|$FORM_wpa_psk";;
+string|FORM_radius_key|@TR<<RADIUS Server Key>>|min=4 max=63 required|$FORM_radius_key
+ip|FORM_radius_ipaddr|@TR<<RADIUS IP Address>>|required|$FORM_radius_ipaddr";;
+ psk) V_PSK="wpapsk|FORM_wpa_psk|@TR<<WPA PSK#WPA Pre-Shared Key>>|required|$FORM_wpa_psk";;
wep) V_WEP="
-int|FORM_key|WEP key number|min=1 max=4|$FORM_key
-wep|FORM_key1|WEP key 1||$FORM_key1
-wep|FORM_key2|WEP key 2||$FORM_key2
-wep|FORM_key3|WEP key 3||$FORM_key3
-wep|FORM_key4|WEP key 4||$FORM_key4";;
+int|FORM_key|@TR<<Selected WEP Key>>|min=1 max=4|$FORM_key
+wep|FORM_key1|@TR<<WEP Key>> 1||$FORM_key1
+wep|FORM_key2|@TR<<WEP Key>> 2||$FORM_key2
+wep|FORM_key3|@TR<<WEP Key>> 3||$FORM_key3
+wep|FORM_key4|@TR<<WEP Key>> 4||$FORM_key4";;
esac
validate <<EOF
-int|FORM_radio|Radio On/Off|required min=0 max=1|$FORM_radio
-int|FORM_broadcast|Broadcast On/Off|required min=0 max=1|$FORM_broadcast
-string|FORM_ssid|ESSID|required|$FORM_ssid
-int|FORM_channel|Channel|required min=1 max=$CHANNEL_MAX|$FORM_channel
+int|FORM_radio|wl0_radio|required min=0 max=1|$FORM_radio
+int|FORM_broadcast|wl0_closed|required min=0 max=1|$FORM_broadcast
+string|FORM_ssid|@TR<<ESSID>>|required|$FORM_ssid
+int|FORM_channel|@TR<<Channel>>|required min=1 max=$CHANNEL_MAX|$FORM_channel
$V_WEP
$V_RADIUS
$V_PSK
}
fi
-header "Network" "Wireless" "Wireless settings" ' onLoad="modechange()" ' "$SCRIPT_NAME"
+header "Network" "Wireless" "@TR<<Wireless Configuration>>" ' onLoad="modechange()" ' "$SCRIPT_NAME"
cat <<EOF
<script type="text/javascript" src="/webif.js"></script>
<!--
function modechange()
{
- if (checked('mode_adhoc')) {
- var psk = document.getElementById('encryption_psk');
- psk.disabled = true;
- if (psk.checked) {
- psk.checked = false;
- document.getElementById('encryption_off').checked = true;
+ if (isset('mode','adhoc')) {
+ document.getElementById('encryption_psk').disabled = true;
+ if (isset('encryption','psk')) {
+ document.getElementById('encryption').value = 'off';
}
} else {
document.getElementById('encryption_psk').disabled = false;
}
- if (checked('mode_wet') || checked('mode_sta') || checked('mode_adhoc')) {
- var wpa = document.getElementById('encryption_wpa');
- wpa.disabled = true;
- if (wpa.checked) {
- wpa.checked = false;
- document.getElementById('encryption_off').checked = true;
+
+ if (!isset('mode','ap')) {
+ document.getElementById('encryption_wpa').disabled = true;
+ if (value('encryption') == 'wpa') {
+ document.getElementById('encryption').value = 'off';
}
} else {
document.getElementById('encryption_wpa').disabled = false;
}
-
- var v = (checked('encryption_wpa') || checked('encryption_psk'));
+
+ var v = (isset('encryption','wpa') || isset('encryption','psk'));
set_visible('wpa_support', v);
set_visible('wpa_crypto', v);
- set_visible('wpapsk', checked('encryption_psk'));
- set_visible('wep_keys', checked('encryption_wep'));
+ set_visible('wpapsk', isset('encryption','psk'));
+ set_visible('wep_keys', isset('encryption','wep'));
- v = checked('encryption_wpa');
+ v = isset('encryption','wpa');
set_visible('radiuskey', v);
set_visible('radius_ip', v);
display_form <<EOF
onchange|modechange
-start_form|Wireless Configuration
-field|Power
-radio|radio|$FORM_radio|1|Enabled<br />
-radio|radio|$FORM_radio|0|Disabled
-field|Broadcast
-radio|broadcast|$FORM_broadcast|0|Enabled<br />
-radio|broadcast|$FORM_broadcast|1|Disabled
-field|ESSID
+start_form|@TR<<Wireless Configuration>>
+field|@TR<<Wireless Interface>>
+select|radio|$FORM_radio
+option|1|@TR<<Enabled>>
+option|0|@TR<<Disabled>>
+field|@TR<<ESSID Broadcast>>
+select|broadcast|$FORM_broadcast
+option|0|@TR<<Show>>
+option|1|@TR<<Hide>>
+field|@TR<<ESSID>>
text|ssid|$FORM_ssid
-helpitem|ESSID
-helptext|Name of your Wireless Network
-field|Channel
+helpitem|@TR<<ESSID>>
+helptext|@TR<<Helptext ESSID#Name of your Wireless Network>>
+field|@TR<<Channel>>
select|channel|$FORM_channel
$F_CHANNELS
-field|Mode
-radio|mode|$FORM_mode|ap|Access Point<br />
-radio|mode|$FORM_mode|sta|Client <br />
-radio|mode|$FORM_mode|wet|Bridge <br />
-radio|mode|$FORM_mode|adhoc|Ad-Hoc
-helpitem|Mode
-helptext|Operation mode
+field|@TR<<WLAN Mode#Mode>>
+select|mode|$FORM_mode
+option|ap|@TR<<Access Point>>
+option|sta|@TR<<Client>>
+option|wet|@TR<<Client>> (@TR<<Bridge>>)
+option|adhoc|@TR<<Ad-Hoc>>
+helpitem|@TR<<WLAN Mode#Mode>>
+helptext|@TR<<Operation mode>>
helplink|http://wiki.openwrt.org/OpenWrtDocs/Configuration#head-7126c5958e237d603674b3a9739c9d23bdfdb293
end_form
-start_form|Encryption settings
-field|Encryption type
-radio|encryption|$FORM_encryption|off|Disabled <br />
-radio|encryption|$FORM_encryption|wep|WEP <br />
-radio|encryption|$FORM_encryption|psk|WPA (preshared key) <br />
-radio|encryption|$FORM_encryption|wpa|WPA (RADIUS)
-field|WPA support|wpa_support|hidden
+start_form|@TR<<Encryption Settings>>
+field|@TR<<Encryption Type>>
+select|encryption|$FORM_encryption
+option|off|@TR<<Disabled>>
+option|wep|WEP
+option|psk|WPA (@TR<<PSK>>)
+option|wpa|WPA (RADIUS)
+field|@TR<<WPA Mode>>|wpa_support|hidden
checkbox|wpa1|$FORM_wpa1|wpa1|WPA1
checkbox|wpa2|$FORM_wpa2|wpa2|WPA2
-field|WPA encryption type|wpa_crypto|hidden
+field|@TR<<WPA Algorithms>>|wpa_crypto|hidden
checkbox|tkip|$FORM_tkip|tkip|RC4 (TKIP)
checkbox|aes|$FORM_aes|aes|AES
-field|WPA preshared key|wpapsk|hidden
+field|WPA @TR<<PSK>>|wpapsk|hidden
text|wpa_psk|$FORM_wpa_psk
-field|RADIUS Server IP|radius_ip|hidden
+field|@TR<<RADIUS IP Address>>|radius_ip|hidden
text|radius_ipaddr|$FORM_radius_ipaddr
-field|RADIUS Server Key|radiuskey|hidden
+field|@TR<<RADIUS Server Key>>|radiuskey|hidden
text|radius_key|$FORM_radius_key
-field|WEP keys|wep_keys|hidden
+field|@TR<<WEP Keys>>|wep_keys|hidden
radio|key|$FORM_key|1
text|key1|$FORM_key1|<br />
radio|key|$FORM_key|2
-#!/usr/bin/haserl
+#!/usr/bin/webif-page
<?
. /usr/lib/webif/webif.sh
-header "Status" "Wireless" "Wireless status"
+header "Status" "Wireless" "@TR<<Wireless Status>>"
?>
<pre><? iwconfig 2>&1 | grep -v 'no wireless' | grep '\w' ?></pre>
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);
--- /dev/null
+/*
+ * Webif page translator
+ *
+ * Copyright (C) 2005 Felix Fietkau <nbd@openwrt.org>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <glob.h>
+#include <ctype.h>
+#ifdef NVRAM
+#include <bcmnvram.h>
+#endif
+
+#define HASH_MAX 100
+#define LINE_BUF 1024 /* max. buffer allocated for one line */
+#define MAX_TR 32 /* max. translations done on one line */
+#define TR_START "@TR<<"
+#define TR_END ">>"
+
+struct lstr {
+ char *name;
+ char *value;
+ struct lstr *next;
+};
+typedef struct lstr lstr;
+
+static lstr *ltable[HASH_MAX];
+static char buf[LINE_BUF], buf2[LINE_BUF];
+
+/* djb2 hash function */
+static inline unsigned long hash(char *str)
+{
+ unsigned long hash = 5381;
+ int c;
+
+ while ((c = *str++))
+ hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
+
+ return hash;
+}
+
+static inline char *translate_lookup(char *str)
+{
+ char *name, *def, *p, *res = NULL;
+ lstr *i;
+ int h;
+
+ def = name = str;
+ if (((p = strchr(str, '|')) != NULL)
+ || ((p = strchr(str, '#')) != NULL)) {
+ def = p + 1;
+ *p = 0;
+ }
+
+ h = hash(name) % HASH_MAX;
+ i = ltable[h];
+ while ((res == NULL) && (i != NULL)) {
+ if (strcmp(name, i->name) == 0)
+ res = i->value;
+ i = i->next;
+ }
+
+ if (res == NULL)
+ res = def;
+
+ return res;
+}
+
+static inline void add_line(char *name, char *value)
+{
+ int h = hash(name) % HASH_MAX;
+ lstr *s = malloc(sizeof(lstr));
+ lstr *p;
+
+ s->name = strdup(name);
+ s->value = strdup(value);
+ s->next = NULL;
+
+ if (ltable[h] == NULL)
+ ltable[h] = s;
+ else {
+ for(p = ltable[h]; p->next != NULL; p = p->next);
+ p->next = s;
+ }
+}
+
+static char *translate_line(char *line)
+{
+ static char *tok[MAX_TR * 3];
+ char *l, *p, *p2, *res;
+ int len = 0, pos = 0, i;
+
+ l = line;
+ while (l != NULL) {
+ if ((p = strstr(l, TR_START)) == NULL) {
+ len += strlen((tok[pos++] = l));
+ break;
+ }
+
+ p2 = strstr(p, TR_END);
+ if (p2 == NULL)
+ break;
+
+ *p = 0;
+ *p2 = 0;
+ len += strlen((tok[pos++] = l));
+ len += strlen((tok[pos++] = translate_lookup(p + strlen(TR_START))));
+
+ l = p2;
+ l += strlen(TR_END);
+ }
+ len++;
+
+ if (len > LINE_BUF)
+ p = malloc(len);
+ else
+ p = buf2;
+
+ p[0] = 0;
+ res = p;
+ for (i = 0; i < pos; i++) {
+ strcat(p, tok[i]);
+ p += strlen(tok[i]);
+ }
+
+ return res;
+}
+
+/* load and parse language file */
+static void load_lang(char *file)
+{
+ FILE *f;
+ char *b, *name, *value;
+
+ f = fopen(file, "r");
+ while (!feof(f) && (fgets(buf, LINE_BUF - 1, f) != NULL)) {
+ b = buf;
+ while (isspace(*b))
+ b++; /* skip leading spaces */
+ if (!*b)
+ continue;
+
+ name = b;
+ if ((b = strstr(name, "=>")) == NULL)
+ continue; /* separator not found */
+
+ value = b + 2;
+ if (!*value)
+ continue;
+
+ *b = 0;
+ for (b--; isspace(*b); b--)
+ *b = 0; /* remove trailing spaces */
+
+ while (isspace(*value))
+ value++; /* skip leading spaces */
+
+ for (b = value + strlen(value) - 1; isspace(*b); b--)
+ *b = 0; /* remove trailing spaces */
+
+ if (!*value)
+ continue;
+
+ add_line(name, value);
+ }
+}
+
+int main (int argc, char **argv)
+{
+ FILE *f;
+ int len, i;
+ char line[LINE_BUF];
+ glob_t langfiles;
+ char *lang = NULL;
+
+ memset(ltable, 0, HASH_MAX * sizeof(lstr *));
+#ifdef NVRAM
+ if ((lang = nvram_get("language")) != NULL) {
+#else
+ if ((f = fopen("/etc/config/webif", "r")) != NULL) {
+ int n, i;
+
+ while (!feof(f) && (lang == NULL)) {
+ fgets(line, LINE_BUF - 1, f);
+
+ if (strncasecmp(line, "lang", 4) != 0)
+ goto nomatch;
+
+ lang = line + 4;
+ while (isspace(*lang))
+ lang++;
+
+ if (*lang != '=')
+ goto nomatch;
+
+ lang++;
+
+ while (isspace(*lang))
+ lang++;
+
+ for (i = 0; isalpha(lang[i]) && (i < 32); i++);
+ lang[i] = 0;
+ continue;
+nomatch:
+ lang = NULL;
+ }
+ fclose(f);
+#endif
+
+ sprintf(buf, "/usr/lib/webif/lang/%s/*.txt", lang);
+ i = glob(buf, GLOB_ERR | GLOB_MARK, NULL, &langfiles);
+ if (i == GLOB_NOSPACE || i == GLOB_ABORTED || i == GLOB_NOMATCH) {
+ // no language files found
+ } else {
+ for (i = 0; i < langfiles.gl_pathc; --i) {
+ load_lang(langfiles.gl_pathv[i]);
+ }
+ }
+ }
+
+ i = 1;
+ strcpy(buf, "/usr/bin/haserl");
+ while (argv[i]) {
+ sprintf(buf + strlen(buf), " %s", argv[i++]);
+ }
+ f = popen(buf, "r");
+
+ while (!feof(f) && (fgets(buf, LINE_BUF - 1, f)) != NULL) {
+ fprintf(stdout, "%s", translate_line(buf));
+ }
+
+ return 0;
+}