forked from freifunk-franken/firmware
Remove the old WebUI
Signed-off-by: Dominik Heidler <dominik@heidler.eu> Reviewed-by: Tim Niemeyer <tim@tn-x.org>
This commit is contained in:
parent
056035ffab
commit
cd848616ff
|
@ -1,71 +0,0 @@
|
|||
#!/usr/bin/haserl
|
||||
<%
|
||||
echo -en "content-type: text/plain\r\n\r\n"
|
||||
|
||||
addr() {
|
||||
local addr="$(ip -$1 address show dev $2 2> /dev/null | tr '/' ' '| awk '/inet/{ printf("%s ", $2); }')"
|
||||
echo "${addr:--}"
|
||||
}
|
||||
|
||||
default_gw() {
|
||||
ip -$1 route list 0/0 dev $2 2> /dev/null | awk '{print($3); exit(0)}'
|
||||
}
|
||||
|
||||
print() {
|
||||
echo " option $1 '$2'"
|
||||
}
|
||||
|
||||
printList() {
|
||||
for item in $2; do
|
||||
echo " list $1 '$item'"
|
||||
done
|
||||
}
|
||||
|
||||
#include OpenWrt version
|
||||
. /etc/openwrt_release
|
||||
. /etc/firmware_release
|
||||
|
||||
echo "package misc"
|
||||
echo "config data 'data'"
|
||||
print 'mac' "$(uci -q get network.mesh.macaddr)"
|
||||
wanif=$(uci -q get network.wan.ifname)
|
||||
printList 'freifunk_addr4' "$(addr 4 br-mesh)"
|
||||
printList 'freifunk_addr6' "$(addr 6 br-mesh)"
|
||||
printList 'wan_addr4' "$(addr 4 $wanif)"
|
||||
printList 'wan_addr6' "$(addr 6 $wanif)"
|
||||
|
||||
up="$(uptime)"
|
||||
print 'load' "${up##*:}"
|
||||
uptime="${up%%,*}"
|
||||
print 'uptime' "${uptime##*up}"
|
||||
print 'uname' "$(uname -s -m -r)"
|
||||
print 'date' "$(date)"
|
||||
|
||||
if pidof fastd >/dev/null ; then
|
||||
print 'has_vpn' 'Ja'
|
||||
else
|
||||
print 'has_vpn' 'Nein'
|
||||
fi
|
||||
|
||||
if [ -n "$(default_gw 4 $wanif)" -o -n "$(default_gw 6 $wanif)" ]; then
|
||||
print 'has_internet' 'Ja'
|
||||
else
|
||||
print 'has_internet' 'Nein'
|
||||
fi
|
||||
|
||||
print 'node_count' "$((`cat /sys/kernel/debug/batman_adv/bat0/transtable_global | grep '^ [^ ]' | cut -b 39-55 | sort | uniq | wc -l 2> /dev/null`+1))"
|
||||
print 'neigh_count' "$(cat /sys/kernel/debug/batman_adv/bat0/originators | grep '^[0-9a-f]' | cut -b 37-53 | sort | uniq | wc -l 2> /dev/null)"
|
||||
print 'firmware_version' "$FIRMWARE_VERSION"
|
||||
print 'fastd_version' "$(fastd --version 2> /dev/null | cut -d' ' -f 2)"
|
||||
print 'batman_version' "$(cat /sys/module/batman_adv/version 2> /dev/null)"
|
||||
print 'openwrt_version' "$DISTRIB_DESCRIPTION"
|
||||
name="$(uci get -q 'system.@system[0].hostname')"
|
||||
print 'name' "${name:--}"
|
||||
print 'model' "$(cat /tmp/sysinfo/model 2> /dev/null)"
|
||||
print 'freifunk_user_count' "$(cat /sys/kernel/debug/batman_adv/bat0/transtable_local 2> /dev/null | grep -c 'W')"
|
||||
print 'freifunk_rx_bytes' "$(cat /sys/class/net/br-mesh/statistics/rx_bytes 2> /dev/null)"
|
||||
print 'freifunk_tx_bytes' "$(cat /sys/class/net/br-mesh/statistics/tx_bytes 2> /dev/null)"
|
||||
print 'wan_rx_bytes' "$(cat /sys/class/net/$wanif/statistics/rx_bytes 2> /dev/null)"
|
||||
print 'wan_tx_bytes' "$(cat /sys/class/net/$wanif/statistics/tx_bytes 2> /dev/null)"
|
||||
|
||||
%>
|
|
@ -1,33 +0,0 @@
|
|||
#!/usr/bin/haserl
|
||||
<%
|
||||
echo -en "content-type: text/plain\r\n\r\n"
|
||||
|
||||
case $GET_func in
|
||||
reboot)
|
||||
reboot
|
||||
echo "(I) Bitte warten. Neustart wird durchgeführt..."
|
||||
;;
|
||||
wifi_status)
|
||||
wifi status
|
||||
;;
|
||||
wifiscan)
|
||||
iw dev "$GET_device" scan 2> /dev/null | grep '^BSS \|SSID\|set: channel\|signal\|capability\|MESH ID'
|
||||
;;
|
||||
set_config_file)
|
||||
file_name="$GET_name"
|
||||
file_data="$GET_data"
|
||||
|
||||
if echo "$file_data" > "/etc/config/$file_name" 2> /dev/null; then
|
||||
echo "(I) Einstellungen wurden gespeichert. Bitte Neustarten."
|
||||
if [ "$file_name" = "system" ]; then
|
||||
uci get -q 'system.@system[0].hostname' > /proc/sys/kernel/hostname
|
||||
fi
|
||||
else
|
||||
echo "(E) Beim Speichern ist ein Fehler aufgetreten. Bitte Neustarten."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "(E) misc: Invalid command: '$GET_func'"
|
||||
;;
|
||||
esac
|
||||
%>
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/haserl
|
||||
<%
|
||||
echo -en "content-type: text/plain\r\n\r\n"
|
||||
|
||||
pass1="$GET_pass1"
|
||||
pass2="$GET_pass2"
|
||||
|
||||
(echo "$pass1"; sleep 1; echo "$pass2") | passwd &> /dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
#force instant password change
|
||||
/etc/init.d/uhttpd restart 2> /dev/null
|
||||
else
|
||||
echo "(E) Es ist ein Fehler aufgetreten."
|
||||
fi
|
||||
|
||||
%>
|
|
@ -1,16 +0,0 @@
|
|||
#!/usr/bin/haserl
|
||||
<%
|
||||
echo -en "content-type: text/plain\r\n\r\n"
|
||||
|
||||
. /lib/functions.sh
|
||||
|
||||
case "$GET_func" in
|
||||
get_settings)
|
||||
uci export -qn system
|
||||
uci export -qn simple-tc
|
||||
;;
|
||||
*)
|
||||
echo "(E) settings: Invalid command: '$GET_func'"
|
||||
;;
|
||||
esac
|
||||
%>
|
|
@ -1,36 +0,0 @@
|
|||
#!/usr/bin/haserl --upload-dir=/tmp --upload-limit=12000
|
||||
<%
|
||||
echo -en "content-type: text/plain\r\n\r\n"
|
||||
|
||||
case "${GET_func:-$POST_func}" in
|
||||
apply_firmware)
|
||||
path="$POST_firmware"
|
||||
keep="$POST_keep_config"
|
||||
|
||||
if [ ! -f "$path" ]; then
|
||||
echo "(E) Datei nicht gefunden."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$keep" = "yes" ]; then
|
||||
args=""
|
||||
else
|
||||
args="-n"
|
||||
fi
|
||||
|
||||
echo "(I) Starte sysupgrade..."
|
||||
|
||||
#apply openwrt or vendor image
|
||||
sysupgrade $args $path
|
||||
;;
|
||||
restore_firmware)
|
||||
echo "(I) Undo all changes ..."
|
||||
echo y | firstboot
|
||||
echo "(I) Rebooting now ..."
|
||||
reboot
|
||||
;;
|
||||
*)
|
||||
echo "(E) upgrade: Invalid command: '$GET_func'"
|
||||
;;
|
||||
esac
|
||||
%>
|
|
@ -1,54 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Home</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
<script src="home.js"></script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
<fieldset>
|
||||
<legend id="system">System</legend>
|
||||
<div><label>Name: </label><span id="name">?</span></div>
|
||||
<div><label>Modell: </label><span id="model">?</span></div>
|
||||
<div><label>MAC-Adresse: </label><span id="mac">?</span></div>
|
||||
<div><label>Bekannte Knoten: </label><span id="node_count">?</span></div>
|
||||
<div><label>Nachbarknoten: </label><span id="neigh_count">?</span></div>
|
||||
<div><label>VPN aktiv: </label><span id="has_vpn">?</span></div>
|
||||
<div><label>Laufzeit: </label><span id="uptime">?</span></div>
|
||||
<div><label>Auslastung: </label><span id="load">?</span></div>
|
||||
<div><label>System: </label><span id="uname">?</span></div>
|
||||
<div><label>Uhrzeit: </label><span id="date">?</span></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend id="freifunk">Netz: Freifunk</legend>
|
||||
<div><label>Nutzer: </label><span id="freifunk_user_count">?</span></div>
|
||||
<div><label>Empfangen: </label><span id="freifunk_rx_bytes">?</span> </div>
|
||||
<div><label>Gesendet: </label><span id="freifunk_tx_bytes">?</span></div>
|
||||
<div><label>IPv4 Adressen: </label><span id="freifunk_addr4">?</span></div>
|
||||
<div><label>IPv6 Adressen: </label><span id="freifunk_addr6">?</span></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend id="wan">Netz: WAN</legend>
|
||||
<div><label>Internet Vorhanden: </label><span id="has_internet">?</span></div>
|
||||
<div><label>Empfangen: </label><span id="wan_rx_bytes">?</span> </div>
|
||||
<div><label>Gesendet: </label><span id="wan_tx_bytes">?</span></div>
|
||||
<div><label>IPv4 Adressen: </label><span id="wan_addr4">?</span></div>
|
||||
<div><label>IPv6 Adressen: </label><span id="wan_addr6">?</span></div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend id="software">Software</legend>
|
||||
<div><label>Firmware Version: </label><span id="firmware_version">?</span></div>
|
||||
<div><label>OpenWrt Version: </label><span id="openwrt_version">?</span></div>
|
||||
<div><label>Batman-Adv Version: </label><span id="batman_version">?</span></div>
|
||||
<div><label>Fastd Version: </label><span id="fastd_version">?</span></div>
|
||||
</fieldset>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,46 +0,0 @@
|
|||
|
||||
function formatSize(bytes) {
|
||||
if(typeof bytes === "undefined" || bytes == "") {
|
||||
return "-";
|
||||
} else if (bytes < 1000) {
|
||||
return bytes + " B";
|
||||
} else if (bytes < 1000*1000) {
|
||||
return (bytes/ 1000.0).toFixed(0) + " KB";
|
||||
} else if (bytes < 1000*1000*1000) {
|
||||
return (bytes/1000.0/1000.0).toFixed(1) + " MB";
|
||||
} else {
|
||||
return (bytes/1000.0/1000.0/1000.0).toFixed(2) + " GB";
|
||||
}
|
||||
}
|
||||
|
||||
function init() {
|
||||
send("/cgi-bin/home", { }, function(data) {
|
||||
var obj = fromUCI(data).misc.data;
|
||||
for(var key in obj) {
|
||||
var value = obj[key];
|
||||
|
||||
if(key == 'stype') {
|
||||
continue;
|
||||
}
|
||||
|
||||
//for traffic
|
||||
if(/_bytes$/.test(key)) {
|
||||
value = formatSize(value);
|
||||
}
|
||||
|
||||
//for addresses
|
||||
if(typeof(value) == 'object') {
|
||||
value = "<ul><li>"+value.join("</li><li>")+"</li></ul>"
|
||||
}
|
||||
|
||||
setText(key, value);
|
||||
}
|
||||
});
|
||||
|
||||
addHelpText($("system"), "Eine \xdcbersicht \xfcber den Router.");
|
||||
addHelpText($("freifunk"), "Das \xf6ffentliche Freifunknetz..");
|
||||
addHelpText($("wan"), "Das Netz \xfcber dass das Internet erreicht wird.");
|
||||
addHelpText($("software"), "Einige installierte Softwareversionen.");
|
||||
addHelpText($("freifunk_user_count"), "Die Anzahl der Nutzer an diesem Router in den letzten zwei Stunden.");
|
||||
addHelpText($("has_vpn"), "Status der VPN-Verbindung zum Server im Internet.");
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Freifunk</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var html_cache = {};
|
||||
var js_cache = {};
|
||||
var adv_mode = false;
|
||||
|
||||
function adv_apply()
|
||||
{
|
||||
var inputs = document.getElementsByClassName('adv_disable');
|
||||
var elems = document.getElementsByClassName('adv_hide');
|
||||
|
||||
for(var i=0; i < inputs.length; i++)
|
||||
inputs[i].disabled = adv_mode ? "": "disabled";
|
||||
for(var i=0; i < elems.length; i++)
|
||||
elems[i].style.display = adv_mode ? "block" : "none";
|
||||
}
|
||||
|
||||
function adv_toggle(e)
|
||||
{
|
||||
adv_mode = !adv_mode;
|
||||
e.innerHTML = adv_mode ? "Erweitert: An" : "Erweitert: Aus";
|
||||
adv_apply();
|
||||
}
|
||||
|
||||
function nav_onclick()
|
||||
{
|
||||
setText('msg', "");
|
||||
var url = this.getAttribute("href");
|
||||
if(url == '#') return false;
|
||||
|
||||
var id = url.substring(0, url.lastIndexOf('.'));
|
||||
|
||||
var process_html = function(data) {
|
||||
var b = $("body");
|
||||
removeChilds(b);
|
||||
var pattern = /<body[^>]*>((.|[\n\r])*)<\/body>/im;
|
||||
b.innerHTML = pattern.exec(data)[1];
|
||||
html_cache[id] = data;
|
||||
};
|
||||
|
||||
var process_js = function(data) {
|
||||
(window.execScript || function(data) {
|
||||
window["eval"].call(window, data);
|
||||
window["eval"].call(window, "init();");
|
||||
})(data);
|
||||
js_cache[id] = data;
|
||||
};
|
||||
|
||||
//load html file
|
||||
if(id in html_cache)
|
||||
process_html(html_cache[id]);
|
||||
else
|
||||
jx.load(url, process_html, 'text');
|
||||
|
||||
//load javascript file
|
||||
if(id in js_cache)
|
||||
process_js(js_cache[id]);
|
||||
else
|
||||
jx.load(url.replace(".html", ".js"), process_js, 'text');
|
||||
|
||||
onDesc($("globalnav"), 'UL', function(n) { hide(n); });
|
||||
onParents(this, 'UL', function(n) { show(n); });
|
||||
onChilds(this.parentNode, 'UL', function(n) { show(n); });
|
||||
|
||||
onDesc($("globalnav"), 'A', function(n) { removeClass(n, "here"); });
|
||||
onParents(this, 'LI', function(n) { addClass(n.firstChild, "here"); });
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function preselect() {
|
||||
onDesc($("globalnav"), 'UL', function(n) { hide(n); });
|
||||
onDesc($("globalnav"), 'A', function(n) {
|
||||
if(n.getAttribute("href") != '#')
|
||||
n.onclick = nav_onclick;
|
||||
});
|
||||
$("first").onclick();
|
||||
}
|
||||
|
||||
function reboot() {
|
||||
if(!confirm("Neustart durchf\xFChren?")) return;
|
||||
send("/cgi-bin/misc", { func : "reboot" }, function(data) {
|
||||
setText('msg', data);
|
||||
});
|
||||
}
|
||||
|
||||
function logout() {
|
||||
window.location="https://none@" + window.location.host;
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body onload="preselect();">
|
||||
|
||||
<ul id="globalnav">
|
||||
<li><a href="home.html" id="first">Home</a></li>
|
||||
<li><a href="settings.html">Einstellungen</a></li>
|
||||
<li><a href="wifiscan.html">WifiScan</a></li>
|
||||
<li><a href="upgrade.html">Upgrade</a></li>
|
||||
<li><a href="password.html">Password</a></li>
|
||||
<li><a href="#" onclick="reboot()">Neustart</a></li>
|
||||
<li><a href="#" onclick="logout()">Logout</a></li>
|
||||
<li><a href="#" onclick="adv_toggle(this)">Erweitert: Aus</a></li>
|
||||
</ul>
|
||||
<br>
|
||||
<pre id="msg" tabindex="-1"></pre>
|
||||
|
||||
<div id="help" style="z-index: 2;"></div>
|
||||
|
||||
<div id="body"></div>
|
||||
|
||||
<div id="footer"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -30,9 +30,7 @@ var map;
|
|||
var marker;
|
||||
|
||||
function oebn0(name) {
|
||||
var f = window.opener.uci['system'];
|
||||
var i = window.opener.firstSectionID(f, "system");
|
||||
return window.opener.document.getElementsByName(['system', i, name].join('#'))[0];
|
||||
return window.opener.document.getElementsByName(name)[0];
|
||||
}
|
||||
|
||||
function add_marker(pos) {
|
||||
|
@ -58,8 +56,6 @@ function report_marker_pos() {
|
|||
var lng_field = oebn0('longitude');
|
||||
lat_field.value = pos.lat.toFixed(8);
|
||||
lng_field.value = pos.lng.toFixed(8);
|
||||
window.opener.updateFrom(lat_field);
|
||||
window.opener.updateFrom(lng_field);
|
||||
}
|
||||
|
||||
function init_map() {
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Password</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
<script src="password.js"></script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
<fieldset>
|
||||
<legend>Passwort</legend>
|
||||
<div>
|
||||
<label>Neues Password:</label> <input id="p1" type="password">
|
||||
</div>
|
||||
<div>
|
||||
<label>Bestätigung:</label> <input id="p2" type="password">
|
||||
</div>
|
||||
<div><br />Das Passwort ist für den Zugriff auf die Weboberfläche des Routers und auch den Zugriff per SSH. Der Benutzername ist 'root'.</div>
|
||||
</fieldset>
|
||||
<div>
|
||||
<button type="button" onclick="apply()">Ändern</button>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,24 +0,0 @@
|
|||
|
||||
function init() {
|
||||
$("p1").focus();
|
||||
}
|
||||
|
||||
function apply()
|
||||
{
|
||||
p1 = $('p1').value;
|
||||
p2 = $('p2').value;
|
||||
|
||||
$('p1').value = "";
|
||||
$('p2').value = "";
|
||||
|
||||
if(p1 != p2) {
|
||||
setText('msg', "(E) Die Passwörter sind nicht identisch.");
|
||||
return;
|
||||
} else {
|
||||
setText('msg', "(I) Das Passwort wird geändert. Bitte die Seite neu laden.");
|
||||
}
|
||||
|
||||
send("/cgi-bin/password", { func : "set_password", pass1 : p1, pass2 : p2 }, function(data) {
|
||||
setText('msg', data);
|
||||
});
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Einstellungen</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
<script src="settings.js"></script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
<fieldset>
|
||||
<legend>Allgemeine Einstellungen</legend>
|
||||
<span id="general"></span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Bitratenkontrolle</legend>
|
||||
<span id="traffic"></span>
|
||||
<div><br />Die für das Freifunknetz beanspruchte Internet-Bitrate am WAN kann hier begrenzt werden.</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="button" onclick="save_data()">Speichern</button>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,170 +0,0 @@
|
|||
|
||||
/*
|
||||
All required uci packages are stored variable uci.
|
||||
The GUI code displayes and manipulated this variable.
|
||||
*/
|
||||
var uci = {};
|
||||
var gid = 0;
|
||||
|
||||
|
||||
function init()
|
||||
{
|
||||
send("/cgi-bin/settings", { func : "get_settings" }, function(data) {
|
||||
uci = fromUCI(data);
|
||||
rebuild_general();
|
||||
adv_apply();
|
||||
});
|
||||
}
|
||||
|
||||
function updateFrom(src)
|
||||
{
|
||||
var obj = {};
|
||||
collect_inputs(src, obj);
|
||||
for(var name in obj)
|
||||
{
|
||||
var value = obj[name];
|
||||
var path = name.split('#');
|
||||
|
||||
var pkg = path[0];
|
||||
var sec = path[1];
|
||||
var opt = path[2];
|
||||
|
||||
uci[pkg].pchanged = true;
|
||||
uci[pkg][sec][opt] = value;
|
||||
}
|
||||
}
|
||||
|
||||
function getChangeModeAction(ifname)
|
||||
{
|
||||
return function(e) {
|
||||
var src = (e.target || e.srcElement);
|
||||
var mode = (src.data || src.value);
|
||||
delNetSection(ifname);
|
||||
addNetSection(ifname, mode);
|
||||
};
|
||||
}
|
||||
|
||||
function appendSetting(p, path, value, mode)
|
||||
{
|
||||
var id = path.join('#');
|
||||
var b;
|
||||
var cfg = path[0];
|
||||
var name = path[path.length-1];
|
||||
switch(name)
|
||||
{
|
||||
case "latitude":
|
||||
b = append_input(p, "GPS Breitengrad", id, value);
|
||||
b.lastChild.placeholder = "52.02713078";
|
||||
addInputCheck(b.lastChild, /^$|^\d{1,3}\.\d{1,8}$/, "Ung\xfcltige Eingabe. Bitte nur maximal 8 Nachkommastellen und keine Kommas verwenden.");
|
||||
addHelpText(b, "Die Latitude Koordinate dieses Knotens auf der Freifunk-Karte (z.B. \"52.02713078\").");
|
||||
var map_button = append_button(b, "Position auf Karte anzeigen / setzen", function() {
|
||||
window.open('/map.html', '_blank', 'location=0,status=0,scrollbars=1,width=400,height=300')
|
||||
});
|
||||
b.style["position"] = "relative";
|
||||
map_button.style["position"] = "absolute";
|
||||
map_button.style["height"] = "44px";
|
||||
map_button.style["margin-left"] = "5px";
|
||||
break;
|
||||
case "longitude":
|
||||
b = append_input(p, "GPS Längengrad", id, value);
|
||||
b.lastChild.placeholder = "8.52829987";
|
||||
addInputCheck(b.lastChild, /^$|^\d{1,3}\.\d{1,8}$/, "Ung\xfcltige Eingabe. Bitte nur maximal 8 Nachkommastellen und keine Kommas verwenden.");
|
||||
addHelpText(b, "Die Longitude Koordinate dieses Knotens auf der Freifunk-Karte (z.B. \"8.52829987\").");
|
||||
break;
|
||||
case "position_comment":
|
||||
b = append_input(p, "Standort Beschreibung", id, value);
|
||||
b.lastChild.placeholder = "Am Antennenmast";
|
||||
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,255}$/, "Ung\xfcltige Eingabe.");
|
||||
addHelpText(b, "Eine genauere Beschreibung zum Standort");
|
||||
break;
|
||||
case "hostname":
|
||||
b = append_input(p, "Knotenname", id, value);
|
||||
b.lastChild.placeholder = "MeinRouter";
|
||||
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,32}$/, "Ung\xfcltige Eingabe.");
|
||||
addHelpText(b, "Der Name dieses Knotens auf der Freifunk-Karte.");
|
||||
break;
|
||||
case "description":
|
||||
b = append_input(p, "Knotenbeschreibung", id, value);
|
||||
b.lastChild.placeholder = "In einer grauen Kiste versteckt";
|
||||
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,255}$/, "Ung\xfcltige Eingabe.");
|
||||
addHelpText(b, "Beschreibung dieses Knotens.");
|
||||
break;
|
||||
case "contact":
|
||||
b = append_input(p, "E-Mail Adresse", id, value);
|
||||
b.lastChild.placeholder = "info@example.com";
|
||||
addInputCheck(b.lastChild, /^$|^[\-\^'\w\.\:\[\]\(\)\/ &@\+\u0080-\u00FF]{0,128}$/, "Ung\xfcltige Eingabe.");
|
||||
addHelpText(b, "Kontaktdaten f\xfcr die \xf6ffentliche Freifunk-Karte und Statusseite. Falls ihr euch von anderen Leuten kontaktieren lassen wollt (z.B. \"info@example.com\").");
|
||||
break;
|
||||
case "enabled":
|
||||
if(cfg == "simple-tc") {
|
||||
b = append_radio(p, "Bitratenkontrolle", id, value, [["An", "1"], ["Aus", "0"]]);
|
||||
addHelpText(b, "Bitratenkontrolle f\xfcr den Upload-/Download \xfcber das Freifunknetz \xfcber den eigenen Internetanschluss.");
|
||||
}
|
||||
break;
|
||||
case "limit_egress":
|
||||
b = append_input(p, "Freifunk Upload", id, value);
|
||||
addInputCheck(b.lastChild, /^\d+$/, "Upload ist ung\xfcltig.");
|
||||
addHelpText(b, "Maximaler Upload in KBit/s f\xfcr die Bitratenkontrolle.");
|
||||
break;
|
||||
case "limit_ingress":
|
||||
b = append_input(p, "Freifunk Download", id, value);
|
||||
addInputCheck(b.lastChild, /^\d+$/, "Download ist ung\xfcltig.");
|
||||
addHelpText(b, "Maximaler Download in KBit/s f\xfcr die Bitratenkontrolle.");
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
b.id = id; //needed for updateFrom
|
||||
b.onchange = function() {
|
||||
updateFrom(b);
|
||||
};
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
function rebuild_general()
|
||||
{
|
||||
var gfs = $("general");
|
||||
var tfs = $("traffic");
|
||||
|
||||
removeChilds(gfs);
|
||||
removeChilds(tfs);
|
||||
|
||||
if('system' in uci) {
|
||||
var f = uci['system'];
|
||||
var i = firstSectionID(f, "system");
|
||||
appendSetting(gfs, ['system', i, "hostname"], f[i]["hostname"]);
|
||||
appendSetting(gfs, ['system', i, "description"], f[i]["description"]);
|
||||
appendSetting(gfs, ['system', i, "latitude"], f[i]["latitude"]);
|
||||
appendSetting(gfs, ['system', i, "longitude"], f[i]["longitude"]);
|
||||
appendSetting(gfs, ['system', i, "position_comment"], f[i]["position_comment"]);
|
||||
appendSetting(gfs, ['system', i, "contact"], f[i]["contact"]);
|
||||
}
|
||||
|
||||
if('simple-tc' in uci) {
|
||||
var t = uci['simple-tc'];
|
||||
var i = firstSectionID(t, "interface");
|
||||
appendSetting(tfs, ['simple-tc', i, "enabled"], t[i]["enabled"]);
|
||||
appendSetting(tfs, ['simple-tc', i, "limit_ingress"], t[i]["limit_ingress"]);
|
||||
appendSetting(tfs, ['simple-tc', i, "limit_egress"], t[i]["limit_egress"]);
|
||||
}
|
||||
}
|
||||
|
||||
function save_data()
|
||||
{
|
||||
for(var name in uci)
|
||||
{
|
||||
var obj = uci[name];
|
||||
if(!obj.pchanged)
|
||||
continue;
|
||||
var data = toUCI(obj);
|
||||
send("/cgi-bin/misc", { func : "set_config_file", name : name, data : data },
|
||||
function(data) {
|
||||
$('msg').innerHTML = data;
|
||||
$('msg').focus();
|
||||
init();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,432 +0,0 @@
|
|||
|
||||
function $(id) { return document.getElementById(id); }
|
||||
function create(name) { return document.createElement(name); }
|
||||
function show(e) { e.style.display='block'; }
|
||||
function hide(e) { e.style.display='none'; }
|
||||
function addClass(e, c) { e.classList.add(c); } //HTML5!
|
||||
function removeClass(e, c) { e.classList.remove(c); }
|
||||
function setText(id, txt) { $(id).innerHTML = txt; }
|
||||
function inArray(item, array) { return array.indexOf(item) != -1; }
|
||||
|
||||
function split(str)
|
||||
{
|
||||
if(typeof str != 'string')
|
||||
return [];
|
||||
var a = str.match(/[^\s]+/g);
|
||||
return (a ? a : []);
|
||||
}
|
||||
|
||||
function uniq(arr)
|
||||
{
|
||||
var obj = {};
|
||||
for(var i in arr) obj[arr[i]] = 0;
|
||||
return Object.keys(obj);
|
||||
}
|
||||
|
||||
//remove an item from a string list
|
||||
function removeItem(str, item)
|
||||
{
|
||||
var array = split(str);
|
||||
for(var i in array)
|
||||
if(array[i] == item)
|
||||
array.splice(i, 1);
|
||||
return array.join(' ');
|
||||
}
|
||||
|
||||
function addItem(str, item)
|
||||
{
|
||||
var array = split(str);
|
||||
for(var i in array)
|
||||
if(array[i] == item)
|
||||
return str;
|
||||
array.push(item);
|
||||
return array.join(' ');
|
||||
}
|
||||
|
||||
function replaceItem(str, old_item, new_item)
|
||||
{
|
||||
var array = split(str);
|
||||
for(var i in array)
|
||||
if(array[i] == old_item)
|
||||
array[i] = new_item;
|
||||
return array.join(' ');
|
||||
}
|
||||
|
||||
function addHelpText(elem, text) {
|
||||
var help = $("help");
|
||||
|
||||
if(help) {
|
||||
elem.onmouseover = function(e) {
|
||||
help.style.top = (e.clientY-20)+"px";
|
||||
help.style.left = (e.clientX+80)+"px";
|
||||
help.innerHTML = text;
|
||||
show(help);
|
||||
};
|
||||
|
||||
elem.onmouseout = function() {
|
||||
help.innerHTML = "";
|
||||
hide(help);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//to config file syntax
|
||||
function toUCI(pkg_obj)
|
||||
{
|
||||
var str = "\n";
|
||||
for(var sid in pkg_obj)
|
||||
{
|
||||
if(sid == "pchanged")
|
||||
continue;
|
||||
|
||||
var options = pkg_obj[sid];
|
||||
var sname = (sid.substring(0, 3) != "cfg") ? (" '"+sid+"'") : "";
|
||||
str += "config "+options.stype+sname+"\n";
|
||||
for(var oname in options)
|
||||
{
|
||||
if(oname == "stype")
|
||||
continue;
|
||||
var value = options[oname];
|
||||
if(typeof value == 'object')
|
||||
{
|
||||
for(var i in value)
|
||||
str += " list "+oname+" '"+value[i]+"'\n";
|
||||
}
|
||||
else
|
||||
str += " option "+oname+" '"+value+"'\n";
|
||||
}
|
||||
str += "\n";
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
// parses output from one or multiple
|
||||
// calls like "uci export -qn foo"
|
||||
function fromUCI(pkgs_str)
|
||||
{
|
||||
var pkg_objs = {};
|
||||
var pkg;
|
||||
var cfg;
|
||||
|
||||
var lines = pkgs_str.split("\n");
|
||||
for(var i = 0; i < lines.length; ++i)
|
||||
{
|
||||
var line = lines[i];
|
||||
var items = split(line);
|
||||
if(items.length < 2) continue;
|
||||
switch(items[0])
|
||||
{
|
||||
case 'package':
|
||||
pkg = { pchanged : false };
|
||||
pkg_objs[items[1]] = pkg;
|
||||
break;
|
||||
case 'config':
|
||||
var val = (items.length == 3) ? line.match(/'(.*)'/)[1] : ("cfg"+(++gid));
|
||||
cfg = { stype : items[1] };
|
||||
pkg[val] = cfg;
|
||||
break;
|
||||
case 'option':
|
||||
var val = line.match(/'(.*)'/)[1];
|
||||
cfg[items[1]] = val;
|
||||
break;
|
||||
case 'list':
|
||||
var val = line.match(/'(.*)'/)[1];
|
||||
if(!(items[1] in cfg)) cfg[items[1]] = [];
|
||||
cfg[items[1]].push(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pkg_objs;
|
||||
}
|
||||
|
||||
function firstSectionID(obj, stype)
|
||||
{
|
||||
for(var id in obj)
|
||||
if(obj[id].stype == stype)
|
||||
return id;
|
||||
}
|
||||
|
||||
function config_foreach(objs, stype, func)
|
||||
{
|
||||
for(var key in objs)
|
||||
{
|
||||
var obj = objs[key];
|
||||
if((obj["stype"] == stype || stype == "*") && func(key, obj))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function config_find(objs, mobj)
|
||||
{
|
||||
for(var key in objs)
|
||||
{
|
||||
var obj = objs[key];
|
||||
var found = true;
|
||||
for(mkey in mobj)
|
||||
{
|
||||
if(obj[mkey] != mobj[mkey])
|
||||
{
|
||||
found = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found)
|
||||
return obj;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function params(obj)
|
||||
{
|
||||
var str = "";
|
||||
for(var key in obj) {
|
||||
if(str.length) str += "&";
|
||||
else str += "?";
|
||||
str += encodeURIComponent(key) + "=" + encodeURIComponent(obj[key]);
|
||||
}
|
||||
return str.replace(/%20/g, "+");
|
||||
}
|
||||
|
||||
function send(url, obj, func)
|
||||
{
|
||||
url += params(obj);
|
||||
jx.load(url, func, 'text');
|
||||
}
|
||||
|
||||
function onDesc(e, tag, func)
|
||||
{
|
||||
for(var i = 0; i < e.childNodes.length; ++i) {
|
||||
var c = e.childNodes[i];
|
||||
if(c.tagName == tag && func(c) == false) return;
|
||||
onDesc(c, tag, func);
|
||||
}
|
||||
}
|
||||
|
||||
function onChilds(e, tag, func)
|
||||
{
|
||||
for(var i = 0; i < e.childNodes.length; ++i) {
|
||||
var c = e.childNodes[i];
|
||||
if(c.tagName == tag && func(c) == false) return;
|
||||
}
|
||||
}
|
||||
|
||||
function onParents(e, tag, func)
|
||||
{
|
||||
while(e != document) {
|
||||
e = e.parentNode;
|
||||
if(e.tagName == tag && func(e) == false) return;
|
||||
}
|
||||
}
|
||||
|
||||
function removeChilds(p)
|
||||
{
|
||||
while(p.hasChildNodes())
|
||||
p.removeChild(p.firstChild);
|
||||
}
|
||||
|
||||
function show_error(data)
|
||||
{
|
||||
var is_error = (data.substr(0, 3) == "(E)");
|
||||
if(is_error)
|
||||
setText('msg', data);
|
||||
return is_error;
|
||||
}
|
||||
|
||||
function checkName(name)
|
||||
{
|
||||
if(/[\w_]{2,12}/.test(name))
|
||||
return true;
|
||||
alert("Name '"+name+"' ist ung\xfcltig.");
|
||||
return false;
|
||||
}
|
||||
|
||||
//prepend input check
|
||||
function addInputCheck(input, regex, msg)
|
||||
{
|
||||
var prev_value = input.value;
|
||||
var prev_onchange = input.onchange;
|
||||
input.onchange = function(e) {
|
||||
if(regex.test(input.value)) {
|
||||
if(prev_onchange)
|
||||
prev_onchange(e);
|
||||
return;
|
||||
}
|
||||
alert(msg);
|
||||
input.value = prev_value;
|
||||
e.stopPropagation();
|
||||
};
|
||||
}
|
||||
|
||||
function collect_inputs(p, obj)
|
||||
{
|
||||
if(p.tagName == "SELECT")
|
||||
obj[p.name] = p.value;
|
||||
if(p.tagName == "INPUT")
|
||||
if(p.type == "text" || p.type == "password" || (p.type == "radio" && p.checked))
|
||||
obj[p.name] = p.value
|
||||
else if(p.type == "checkbox" && p.checked)
|
||||
{
|
||||
var v = obj[p.name];
|
||||
v = (typeof v == "undefined") ? (p.data || p.value) : (v + " " + (p.data || p.value));
|
||||
obj[p.name] = v;
|
||||
}
|
||||
|
||||
for(var i = 0; i < p.childNodes.length; ++i)
|
||||
collect_inputs(p.childNodes[i], obj);
|
||||
}
|
||||
|
||||
function append(parent, tag, id)
|
||||
{
|
||||
var e = create(tag);
|
||||
if(id) e.id = id;
|
||||
parent.appendChild(e);
|
||||
return e;
|
||||
}
|
||||
|
||||
function append_section(parent, title, id)
|
||||
{
|
||||
var fs = append(parent, "fieldset");
|
||||
var lg = create("legend");
|
||||
lg.innerHTML = title;
|
||||
if(id) fs.id = id;
|
||||
fs.appendChild(lg);
|
||||
return fs;
|
||||
}
|
||||
|
||||
function append_button(parent, text, onclick)
|
||||
{
|
||||
var button = append(parent, 'button');
|
||||
button.type = 'button';
|
||||
button.innerHTML = text;
|
||||
button.onclick = onclick;
|
||||
return button;
|
||||
}
|
||||
|
||||
function append_label(parent, title, value)
|
||||
{
|
||||
var div = append(parent, 'div');
|
||||
var label = append(div, 'label');
|
||||
label.innerHTML = title + ":";
|
||||
|
||||
if(typeof value == 'string')
|
||||
{
|
||||
//div.className = "label_option";
|
||||
var span = append(div, 'span');
|
||||
span.innerHTML = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
div.className = "list_option";
|
||||
var span = append(div, 'span');
|
||||
for(var i in value)
|
||||
{
|
||||
var d = append(span, 'div');
|
||||
d.innerHTML = value[i];
|
||||
}
|
||||
}
|
||||
return div;
|
||||
}
|
||||
|
||||
function append_options(parent, name, selected, choices)
|
||||
{
|
||||
var select = append(parent, 'select');
|
||||
select.style.minWidth = "5em";
|
||||
select.name = name;
|
||||
for(var i in choices)
|
||||
{
|
||||
var s = (typeof choices[i] != 'object');
|
||||
var choice_text = " " + (s ? choices[i] : choices[i][0]);
|
||||
var choice_value = "" + (s ? choices[i] : choices[i][1]);
|
||||
|
||||
var option = append(select, 'option');
|
||||
option.value = choice_value;
|
||||
option.selected = (choice_value == selected) ? "selected" : "";
|
||||
option.innerHTML= choice_text;
|
||||
}
|
||||
return select;
|
||||
}
|
||||
|
||||
function append_selection(parent, title, name, selected, choices)
|
||||
{
|
||||
var p = append(parent, 'div');
|
||||
var label = append(p, 'label');
|
||||
|
||||
p.className = "select_option";
|
||||
label.innerHTML = title + ":";
|
||||
|
||||
append_options(p, name, selected, choices);
|
||||
return p;
|
||||
}
|
||||
|
||||
//append an input field
|
||||
//e.g. append_input(parent, "Name", "name_string", "MyName")
|
||||
function append_input(parent, title, name, value)
|
||||
{
|
||||
var div = append(parent, 'div');
|
||||
var label = create('label');
|
||||
var input = create('input');
|
||||
|
||||
label.innerHTML = title + ":";
|
||||
input.value = (typeof value == "undefined") ? "" : value;
|
||||
input.name = name;
|
||||
input.type = "text";
|
||||
|
||||
div.appendChild(label);
|
||||
div.appendChild(input);
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
//append a radio field
|
||||
//e.g. append_radio(parent, "Enabled", "enabled", 0, [["Yes", 1], ["No", 0])
|
||||
function append_radio(parent, title, name, selected, choices) {
|
||||
return _selection("radio", parent, title, name, [selected], choices);
|
||||
}
|
||||
|
||||
//append a checkbox field
|
||||
//e.g. append_check(parent, "Enabled", "enabled", ["grass"], [["Grass", "grass"], ["Butter", "butter"]])
|
||||
function append_check(parent, title, name, selected, choices) {
|
||||
return _selection("checkbox", parent, title, name, selected, choices);
|
||||
}
|
||||
|
||||
function _selection(type, parent, title, name, selected, choices)
|
||||
{
|
||||
var p = append(parent, 'div');
|
||||
var label = append(p, 'label');
|
||||
var span = append(p, 'span');
|
||||
|
||||
p.className = "radio_option";
|
||||
label.innerHTML = title + ":";
|
||||
|
||||
for (var i in choices)
|
||||
{
|
||||
var s = (typeof choices[i] == 'string');
|
||||
var choice_text = "" + (s ? choices[i] : choices[i][0]);
|
||||
var choice_value = "" + (s ? choices[i] : choices[i][1]);
|
||||
var choice_help = s ? undefined : choices[i][2];
|
||||
|
||||
var div = append(span, 'div');
|
||||
var input = append(div, 'input');
|
||||
var label = append(div, 'label');
|
||||
|
||||
input.name = name;
|
||||
input.value = choice_value;
|
||||
input.data = choice_value; //for IE :-(
|
||||
input.type = type;
|
||||
if(inArray(choice_value, selected))
|
||||
input.checked = "checked"
|
||||
|
||||
label.innerHTML = " " + choice_text;
|
||||
|
||||
if(choice_text == "_")
|
||||
hide(div);
|
||||
|
||||
if(choice_help) {
|
||||
addHelpText(label, choice_help);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
//from jx_compressed.js
|
||||
jx={getHTTPObject:function(){var A=false;if(typeof ActiveXObject!="undefined"){try{A=new ActiveXObject("Msxml2.XMLHTTP")}catch(C){try{A=new ActiveXObject("Microsoft.XMLHTTP")}catch(B){A=false}}}else{if(window.XMLHttpRequest){try{A=new XMLHttpRequest()}catch(C){A=false}}}return A},load:function(url,callback,format){var http=this.init();if(!http||!url){return }if(http.overrideMimeType){http.overrideMimeType("text/xml")}if(!format){var format="text"}format=format.toLowerCase();var now="uid="+new Date().getTime();url+=(url.indexOf("?")+1)?"&":"?";url+=now;http.open("GET",url,true);http.onreadystatechange=function(){if(http.readyState==4){if(http.status==200){var result="";if(http.responseText){result=http.responseText}if(format.charAt(0)=="j"){result=result.replace(/[\n\r]/g,"");result=eval("("+result+")")}if(callback){callback(result)}}else{if(error){error(http.status)}}}};http.send(null)},init:function(){return this.getHTTPObject()}}
|
|
@ -1,226 +0,0 @@
|
|||
|
||||
/* common */
|
||||
|
||||
* { margin:0; padding:0; }
|
||||
|
||||
a { text-decoration: none; }
|
||||
|
||||
li { list-style-type: none; }
|
||||
|
||||
html {
|
||||
font: 90%/1.3 arial,sans-serif;
|
||||
padding:1em;
|
||||
background:#fafafa;
|
||||
}
|
||||
|
||||
body {
|
||||
font: normal 16px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
|
||||
}
|
||||
|
||||
|
||||
/* specific */
|
||||
|
||||
.mac {
|
||||
color: #0033CC;
|
||||
cursor: help;
|
||||
}
|
||||
|
||||
#nds_files label {
|
||||
width: 18em;
|
||||
}
|
||||
|
||||
#nds_macs {
|
||||
margin-bottom: 2em;
|
||||
}
|
||||
|
||||
#wifiscan table {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#wifiscan td:nth-of-type(1) {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#help {
|
||||
padding: 5px;
|
||||
height: 0px;
|
||||
position: absolute;
|
||||
min-height: 50px;
|
||||
background-color: #f2f2f2;
|
||||
display:none;
|
||||
border: 2px dotted grey;
|
||||
}
|
||||
|
||||
#switches label {
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
/* forms */
|
||||
|
||||
legend {
|
||||
color: #0b77b7;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
label {
|
||||
float: left;
|
||||
width: 12em;
|
||||
text-align: right;
|
||||
margin-right: 1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #ddd;
|
||||
padding: 0.5em;
|
||||
margin: 0.5em;
|
||||
width: 36em;
|
||||
}
|
||||
|
||||
fieldset fieldset {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
fieldset > * {
|
||||
margin: 0.3em 0;
|
||||
clear: both;
|
||||
}
|
||||
|
||||
fieldset div > * {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
input {
|
||||
padding: 0.15em;
|
||||
width: 15em;
|
||||
border: 1px solid #ddd;
|
||||
background: #fafafa;
|
||||
font: bold 0.95em arial, sans-serif;
|
||||
-moz-border-radius: 0.4em;
|
||||
-khtml-border-radius: 0.4em;
|
||||
}
|
||||
|
||||
input:hover, input:focus {
|
||||
border-color: #c5c5c5;
|
||||
background: #f6f6f6;
|
||||
}
|
||||
|
||||
select {
|
||||
min-width: 4em;
|
||||
}
|
||||
|
||||
option {
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.radio_option div {
|
||||
float: left;
|
||||
white-space: nowrap;
|
||||
clear: none;
|
||||
}
|
||||
|
||||
.radio_option div label, .radio_option div input {
|
||||
vertical-align: middle;
|
||||
display: inline;
|
||||
float: none;
|
||||
width: auto;
|
||||
background: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.select_option label {
|
||||
font-size: 1em;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.list_option div {
|
||||
clear: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
float: left;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
|
||||
/* navigation */
|
||||
|
||||
#globalnav {
|
||||
position: relative;
|
||||
float: auto;
|
||||
width: 98%;
|
||||
padding: 0 0 1.75em 1em;
|
||||
margin: 0;
|
||||
margin-bottom: 2%;
|
||||
list-style: none;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
#globalnav li {
|
||||
float: left;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#globalnav a {
|
||||
display: block;
|
||||
color: #444;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
background: #ddd;
|
||||
margin: 0;
|
||||
padding: 0.25em 1em;
|
||||
border-left: 1px solid #fff;
|
||||
border-top: 1px solid #fff;
|
||||
border-right: 1px solid #aaa;
|
||||
}
|
||||
|
||||
#globalnav a:hover,
|
||||
#globalnav a:active,
|
||||
#globalnav a.here:link,
|
||||
#globalnav a.here:visited {
|
||||
background: #bbb;
|
||||
}
|
||||
|
||||
#globalnav a.here:link,
|
||||
#globalnav a.here:visited {
|
||||
position: relative;
|
||||
z-index: 102;
|
||||
}
|
||||
|
||||
/* sub-navigation */
|
||||
|
||||
#globalnav ul {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 1.5em;
|
||||
float: left;
|
||||
background: #bbb;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
padding: 0.25em 0.25em 0.25em 1em;
|
||||
list-style: none;
|
||||
border-top: 1px solid #fff;
|
||||
}
|
||||
|
||||
#globalnav ul li {
|
||||
float: left;
|
||||
display: block;
|
||||
margin-top: 1px;
|
||||
}
|
||||
|
||||
#globalnav ul a {
|
||||
background: #bbb;
|
||||
color: #fff;
|
||||
display: inline;
|
||||
margin: 0;
|
||||
padding: 0 1em;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
#globalnav ul a:hover,
|
||||
#globalnav ul a:active,
|
||||
#globalnav ul a.here:link,
|
||||
#globalnav ul a.here:visited {
|
||||
color: #444;
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Upgrade</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
<script src="upgrade.js"></script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
<fieldset>
|
||||
<legend>Router Zurücksetzen</legend>
|
||||
<div>
|
||||
<button type="button" onclick="restore_firmware()">Zurücksetzen</button>
|
||||
</div>
|
||||
<div><br />Alle Einstellungen werden zurückgesetzt und der Router startet neu.</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<legend>Manuelles Update</legend>
|
||||
<div id="selected_image"></div>
|
||||
<form action="/cgi-bin/upgrade" enctype="multipart/form-data" method="post">
|
||||
<div class="radio_option">
|
||||
<label>
|
||||
<input type="file" id="import_file" name="firmware" onchange="$('selected_image').innerHTML=this.value.replace(/^.*[\\\/](.*)$/, '$1');" style="visibility:hidden;position:absolute;top:-50;left:-50"/>
|
||||
<input type="hidden" name="func" value="apply_firmware" />
|
||||
<button type="button" onclick="$('import_file').click()">Image Auswählen</button>
|
||||
<button type="submit">Senden</button>
|
||||
</label>
|
||||
<div>
|
||||
<input type="checkbox" name="keep_config" value="yes" />
|
||||
<label>Konfiguration erhalten</label>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<div><br />Hier kann ein Freifunk-Image verwendet werden (*-sysupgrade.bin) oder die Firmware des Routerherstellers.</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,12 +0,0 @@
|
|||
|
||||
function init() {
|
||||
/* Nothing to do */
|
||||
}
|
||||
|
||||
function restore_firmware() {
|
||||
if(!confirm("Sollen alle Einstellungen zur\xFCckgesetzt werden?")) return;
|
||||
send("/cgi-bin/upgrade", { func : 'restore_firmware' }, function(text) {
|
||||
setText('msg', text);
|
||||
});
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Wifiscan</title>
|
||||
<meta charset="utf-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<script src="shared.js"></script>
|
||||
<script src="wifiscan.js"></script>
|
||||
</head>
|
||||
<body onload="init();">
|
||||
|
||||
<fieldset id="wifiscan">
|
||||
<legend>Wifi Scan</legend>
|
||||
<div>
|
||||
<select id="wifiscan_selection"></select>
|
||||
<button type="button" onclick="wifi_scan()">Scan starten</button>
|
||||
</div>
|
||||
<table id="wifiscan_table" style="display: none">
|
||||
<tr><th>Name</th><th>Kanal</th><th>Signal</th><th>Typ</th></tr>
|
||||
<tbody id="wifiscan_tbody"></tbody>
|
||||
</table>
|
||||
</fieldset>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,77 +0,0 @@
|
|||
|
||||
function fetch(regex, data)
|
||||
{
|
||||
var result = data.match(regex);
|
||||
return result ? result[1] : "";
|
||||
}
|
||||
|
||||
function append_td(tr, value) {
|
||||
append(tr, 'td').innerHTML = value ? value : "?";
|
||||
}
|
||||
|
||||
function wifi_scan()
|
||||
{
|
||||
var s = $('wifiscan_selection');
|
||||
var device = s.options[s.selectedIndex].value;
|
||||
|
||||
send("/cgi-bin/misc", {func:'wifiscan', device:device}, function(data) {
|
||||
var tbody = $("wifiscan_tbody");
|
||||
removeChilds(tbody);
|
||||
|
||||
var items = data.split(/BSS /).filter(Boolean);
|
||||
for(var i = 0; i < items.length; ++i)
|
||||
{
|
||||
var item = items[i];
|
||||
var ssid = fetch(/SSID: (.*)\n/, item);
|
||||
var channel = fetch(/channel (.*)\n/, item);
|
||||
var signal = fetch(/signal: (.*)\n/, item);
|
||||
var capability = fetch(/capability: (.*)\n/, item);
|
||||
var mesh_id = fetch(/MESH ID: (.*)\n/, item);
|
||||
|
||||
var tr = append(tbody, 'tr');
|
||||
append_td(tr, mesh_id ? mesh_id : ssid);
|
||||
append_td(tr, channel);
|
||||
append_td(tr, signal);
|
||||
|
||||
//determine the wifi mode
|
||||
if(mesh_id) {
|
||||
append_td(tr, " 802.11s");
|
||||
} else if(/IBSS/.test(capability)) {
|
||||
append_td(tr, " AdHoc");
|
||||
} else if(/ESS/.test(capability)) {
|
||||
append_td(tr, " AccessPoint");
|
||||
} else {
|
||||
append_td(tr, " ???");
|
||||
}
|
||||
}
|
||||
|
||||
var table = $('wifiscan_table');
|
||||
show(table);
|
||||
});
|
||||
}
|
||||
|
||||
function add_list_entry(device, ifname) {
|
||||
var list = $('wifiscan_selection');
|
||||
var o = append(list, 'option');
|
||||
o.style.paddingRight = "1em";
|
||||
o.innerHTML = device;
|
||||
o.value = ifname;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a selection of wireless devices
|
||||
* represented as the first interface found.
|
||||
*/
|
||||
function init() {
|
||||
send("/cgi-bin/misc", {func:'wifi_status'}, function(data) {
|
||||
var data = JSON.parse(data);
|
||||
for(var device in data) {
|
||||
var interfaces = data[device].interfaces;
|
||||
if(interfaces.length == 0)
|
||||
continue;
|
||||
var ifname = interfaces[0].ifname ;
|
||||
if(typeof(ifname) == 'string')
|
||||
add_list_entry(device, ifname);
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue