summaryrefslogtreecommitdiff
path: root/map.js
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2013-12-30 13:18:58 +0100
committerChristian Pointner <equinox@spreadspace.org>2013-12-30 13:18:58 +0100
commit92b6585130b4d719d236da0e2cdce9649e538f8b (patch)
treef79d174c3be10cbf80eea6debca80042a1d8cdaa /map.js
parent4c98da1ceff06e565a8e85e395c747b28edef19d (diff)
parent70b378464945443b234380c5098ec7066bb0b15f (diff)
Merge branch 'master' into stable
Diffstat (limited to 'map.js')
-rw-r--r--map.js382
1 files changed, 172 insertions, 210 deletions
diff --git a/map.js b/map.js
index b60b7f0..a248b1c 100644
--- a/map.js
+++ b/map.js
@@ -13,42 +13,38 @@ var links = new Array();
debug = function (log_txt) {
- if (typeof window.console != 'undefined') {
- console.log(log_txt);
- }
+ if (typeof window.console != 'undefined') {
+ console.log(log_txt);
+ }
}
function initialize(lat, lng, res) {
debug("Initializing Funkfeuer Graz Map");
- $('#southeastcontainer').hide();
google.maps.visualRefresh=true;
- var mapOptions = {
- center: new google.maps.LatLng(lat, lng),
- zoom: res,
- streetViewControl: false,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- mapTypeControlOptions: {
- mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID , google.maps.MapTypeId.SATELLITE , google.maps.MapTypeId.TERRAIN ],
+ var mapOptions = {
+ center: new google.maps.LatLng(lat, lng), zoom: res,
+ streetViewControl: false, disableDoubleClickZoom: true,
+ mapTypeId: google.maps.MapTypeId.ROADMAP,
+ mapTypeControlOptions: {
+ mapTypeIds: [google.maps.MapTypeId.ROADMAP, google.maps.MapTypeId.HYBRID,
+ google.maps.MapTypeId.SATELLITE , google.maps.MapTypeId.TERRAIN ],
style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR,
}
- };
- map = new google.maps.Map(document.getElementById("map"),
- mapOptions);
-//##// deaktiviert 2013112 goole maps api v3 incompatibel
-//##// map.disableDoubleClickZoom();
+ };
+ map = new google.maps.Map(document.getElementById("map"), mapOptions);
//##// map.addControl(new RulerControl());
-//##// reloadcon = new reloadcontrol();
-//##// map.addcontrol(reloadcon);
-//##// map.addControl(new GSmallMapControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(10,20)));
-//##// map.addControl(new GMapTypeControl(), new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(50,10)));
+
+ var reloadconDiv = document.createElement('div');
+ reloadcon = new ReloadControl(reloadconDiv, map);
+ map.controls[google.maps.ControlPosition.TOP_RIGHT].push(reloadconDiv);
google.maps.event.addListener(map, "click", onMapClick);
- lineinfo = document.createElement("div");
- document.getElementById("map").appendChild(lineinfo);
- lineinfo.style.visibility = "hidden"
+ linkinfo = document.createElement("div");
+ document.getElementById("map").appendChild(linkinfo);
+ linkinfo.style.visibility = "hidden"
dnsinfo = document.createElement("div");
document.getElementById("map").appendChild(dnsinfo);
@@ -60,8 +56,7 @@ function initialize(lat, lng, res) {
countboxText = document.createTextNode("Aktiv: 0");
countbox.appendChild(countboxText);
-//##// reloadcon.started();
- $.get( "data.php",onData);
+ reloadcon.reload();
}
function onMapClick(mouse_event)
@@ -70,13 +65,13 @@ function onMapClick(mouse_event)
setNewMarker(mouse_event.latLng);
}
-//##//function onData(data, responseCode) {
-//##// if (responseCode < 200 || responseCode > 299) {
-//##// reloadcon.finished();
-//##// return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")");
-//##// }
-//##// reloadcon.loaded();
+function onDataErr() {
+ reloadcon.finished();
+}
+
function onData(xmlData) {
+ reloadcon.loaded();
+
for(var loc in overlays["locations"]) {
overlays["locations"][loc].setMap(null);
}
@@ -101,7 +96,7 @@ function onData(xmlData) {
countboxText.data = "Aktiv: " + count;
}
-//##// reloadcon.finished();
+ reloadcon.finished();
}
function drawLocations(xmlData) {
@@ -182,35 +177,28 @@ function convertCoords(x) {
function drawLinks(xmlData) {
var element = xmlData.getElementsByTagName("link");
for (var i = 0; i< element.length; i++) {
- var state;
- var color;
- var textcolor;
- var width;
- state="Unbekannt"
var id = element[i].getAttribute("from") + "-" + element[i].getAttribute("to");
links[id] = new Link(element[i]);
var line = new google.maps.Polyline({path: [links[id].frompoint, links[id].topoint], strokeColor: makeColor(Math.floor(links[id].value)), strokeWeight: makeWeight(Math.floor(links[id].value))});
line.name = id;
- line.textcolor = textcolor;
- line.state = state;
+ line.state = "Unbekannt";
line.overlaytype = "link";
line.linkid = id;
line.dnsfrom = element[i].getAttribute("dnsfrom");
line.dnsto = element[i].getAttribute("dnsto");
line.Routerfrom = element[i].getAttribute("from");
line.Routerto = element[i].getAttribute("to");
-// google.maps.event.addListener(line, "mouseout", function() { lineinfo.style.visibility = "hidden"; });
+// google.maps.event.addListener(line, "mouseout", function() { linkinfo.style.visibility = "hidden"; });
// google.maps.event.addListener(line, "mouseover", function(point) { showLinkInfo(this, point)});
-// google.maps.event.addListener(line, "click", function(point){onLinkClick(this,point)});
-// google.maps.event.addListener(line, "click", function(latlng){map.openInfoWindowHtml(latlng, message)});
+ google.maps.event.addListener(line, "click", function(event) { onLinkClick(this, event.latLng) });
line.setMap(map);
overlays["links"].push(line);
}
- // if(document.visibleform.elements["defaultroute"].checked) {
- // toggleVisible("defaultroute");
- // }
+ if(document.visibleform.elements["defaultroute"].checked) {
+ toggleVisible("defaultroute");
+ }
if(document.visibleform.elements["bad"].checked) {
toggleVisible("bad");
}
@@ -223,54 +211,54 @@ function drawLinks(xmlData) {
if(document.visibleform.elements["tunnel"].checked) {
toggleVisible("tunnel");
}
- // if(document.visibleform.elements["2.4channel"].checked) {
- // toggleVisible("2.4channel");
- // }
- // if(document.visibleform.elements["channel1"].checked) {
- // toggleVisible("channel1");
- // }
- // if(document.visibleform.elements["channel2"].checked) {
- // toggleVisible("channel2");
- // }
- // if(document.visibleform.elements["channel3"].checked) {
- // toggleVisible("channel3");
- // }
- // if(document.visibleform.elements["channel4"].checked) {
- // toggleVisible("channel4");
- // }
- // if(document.visibleform.elements["channel5"].checked) {
- // toggleVisible("channel5");
- // }
- // if(document.visibleform.elements["channel6"].checked) {
- // toggleVisible("channel6");
- // }
- // if(document.visibleform.elements["channel7"].checked) {
- // toggleVisible("channel7");
- // }
- // if(document.visibleform.elements["channel8"].checked) {
- // toggleVisible("channel8");
- // }
- // if(document.visibleform.elements["channel9"].checked) {
- // toggleVisible("channel9");
- // }
- // if(document.visibleform.elements["channel10"].checked) {
- // toggleVisible("channel10");
- // }
- // if(document.visibleform.elements["channel11"].checked) {
- // toggleVisible("channel11");
- // }
- // if(document.visibleform.elements["channel12"].checked) {
- // toggleVisible("channel12");
- // }
- // if(document.visibleform.elements["channel13"].checked) {
- // toggleVisible("channel13");
- // }
- // if(document.visibleform.elements["5channel"].checked) {
- // toggleVisible("5channel");
- // }
- // if(document.visibleform.elements["undef"].checked) {
- // toggleVisible("undef");
- // }
+ if(document.visibleform.elements["2.4channel"].checked) {
+ toggleVisible("2.4channel");
+ }
+ if(document.visibleform.elements["channel1"].checked) {
+ toggleVisible("channel1");
+ }
+ if(document.visibleform.elements["channel2"].checked) {
+ toggleVisible("channel2");
+ }
+ if(document.visibleform.elements["channel3"].checked) {
+ toggleVisible("channel3");
+ }
+ if(document.visibleform.elements["channel4"].checked) {
+ toggleVisible("channel4");
+ }
+ if(document.visibleform.elements["channel5"].checked) {
+ toggleVisible("channel5");
+ }
+ if(document.visibleform.elements["channel6"].checked) {
+ toggleVisible("channel6");
+ }
+ if(document.visibleform.elements["channel7"].checked) {
+ toggleVisible("channel7");
+ }
+ if(document.visibleform.elements["channel8"].checked) {
+ toggleVisible("channel8");
+ }
+ if(document.visibleform.elements["channel9"].checked) {
+ toggleVisible("channel9");
+ }
+ if(document.visibleform.elements["channel10"].checked) {
+ toggleVisible("channel10");
+ }
+ if(document.visibleform.elements["channel11"].checked) {
+ toggleVisible("channel11");
+ }
+ if(document.visibleform.elements["channel12"].checked) {
+ toggleVisible("channel12");
+ }
+ if(document.visibleform.elements["channel13"].checked) {
+ toggleVisible("channel13");
+ }
+ if(document.visibleform.elements["5channel"].checked) {
+ toggleVisible("5channel");
+ }
+ if(document.visibleform.elements["undef"].checked) {
+ toggleVisible("undef");
+ }
}
function showLinkInfo(link, point) {
@@ -293,11 +281,11 @@ function showLinkInfo(link, point) {
html += '<strong>Name:</strong> ' + link.name + '<br />';
//##// html += '<strong>Länge:</strong> ' + link.getLength().toFixed(0) + ' m<br />';
html += '</div>';
- lineinfo.innerHTML = html;
+ linkinfo.innerHTML = html;
//##// var pos = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(180, 0));
-//##// pos.apply(lineinfo);
- lineinfo.style.visibility = "visible";
+//##// pos.apply(linkinfo);
+ linkinfo.style.visibility = "visible";
}
function Link(element) {
@@ -321,7 +309,7 @@ function Link(element) {
return link;
}
-function onLinkClick(line,latlng) {
+function onLinkClick(line, latlng) {
var html ='<div class="locinfo">';
html += '<strong>'+line.name+'</strong>';
html += '<table class="linkinfo">';
@@ -330,7 +318,7 @@ function onLinkClick(line,latlng) {
for (var i = 0;i < dnsfrom.length; ++i){
if(dnsfrom[i].indexOf(" (")>=0) {
link=dnsfrom[i].substring(0,dnsfrom[i].indexOf(" ("));
- } else {
+ } else {
link=dnsfrom[i];
}
html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsfrom[i]+'</td></tr>';
@@ -342,7 +330,7 @@ function onLinkClick(line,latlng) {
for (var i = 0;i < dnsto.length; ++i){
if(dnsto[i].indexOf(" (")>=0) {
link=dnsto[i].substring(0,dnsto[i].indexOf(" ("));
- } else {
+ } else {
link=dnsto[i];
}
html += '<tr><td> Router:</td><td>&nbsp;</td><td><a href="http://' + link+ '.ext.graz.funkfeuer.at/" target="_blank">'+dnsto[i]+'</td></tr>';
@@ -350,7 +338,9 @@ function onLinkClick(line,latlng) {
}
html += '</table>';
html += '</div>';
- map.openInfoWindowHtml(latlng,html);
+
+ var infowindow = new google.maps.InfoWindow({ content: html, position: latlng });
+ infowindow.open(map);
}
function makeColor(value) {
@@ -398,63 +388,63 @@ function makeIcon(type) {
function toggleVisible(element) {
var elements = Object();
- // if (element=='bad' || element=='middle' || element=='good'){
- // document.visibleform.elements["2.4channel"].checked=false;
- // document.visibleform.elements["channel1"].checked=false;
- // document.visibleform.elements["channel2"].checked=false;
- // document.visibleform.elements["channel3"].checked=false;
- // document.visibleform.elements["channel4"].checked=false;
- // document.visibleform.elements["channel5"].checked=false;
- // document.visibleform.elements["channel6"].checked=false;
- // document.visibleform.elements["channel7"].checked=false;
- // document.visibleform.elements["channel8"].checked=false;
- // document.visibleform.elements["channel9"].checked=false;
- // document.visibleform.elements["channel10"].checked=false;
- // document.visibleform.elements["channel11"].checked=false;
- // document.visibleform.elements["channel12"].checked=false;
- // document.visibleform.elements["channel13"].checked=false;
- // document.visibleform.elements["5channel"].checked=false;
- // document.visibleform.elements["undef"].checked=false;
- // }
- // if (element=='2.4channel'){
- // document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked;
- // document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked;
- // }
+ if (element=='bad' || element=='middle' || element=='good'){
+ document.visibleform.elements["2.4channel"].checked=false;
+ document.visibleform.elements["channel1"].checked=false;
+ document.visibleform.elements["channel2"].checked=false;
+ document.visibleform.elements["channel3"].checked=false;
+ document.visibleform.elements["channel4"].checked=false;
+ document.visibleform.elements["channel5"].checked=false;
+ document.visibleform.elements["channel6"].checked=false;
+ document.visibleform.elements["channel7"].checked=false;
+ document.visibleform.elements["channel8"].checked=false;
+ document.visibleform.elements["channel9"].checked=false;
+ document.visibleform.elements["channel10"].checked=false;
+ document.visibleform.elements["channel11"].checked=false;
+ document.visibleform.elements["channel12"].checked=false;
+ document.visibleform.elements["channel13"].checked=false;
+ document.visibleform.elements["5channel"].checked=false;
+ document.visibleform.elements["undef"].checked=false;
+ }
+ if (element=='2.4channel'){
+ document.visibleform.elements["channel1"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel2"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel3"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel4"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel5"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel6"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel7"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel8"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel9"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel10"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel11"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel12"].checked=document.visibleform.elements["2.4channel"].checked;
+ document.visibleform.elements["channel13"].checked=document.visibleform.elements["2.4channel"].checked;
+ }
switch(element) {
- // case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break;
+ case 'defaultroute': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].defaultroute == '0');"); break;
case 'offline': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state == 'offline');"); break;
case 'online': elements.overlays = overlays["locations"]; elements.select = new Function("id", "return (locations[overlays['locations'][id].locid].state != 'offline');"); break;
case 'bad': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 6);"); break;
case 'middle': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 3 && links[overlays['links'][id].linkid].value < 6);"); break;
case 'good': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value >= 0 && links[overlays['links'][id].linkid].value < 3);"); break;
case 'tunnel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].value == -1);"); break;
- // case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break;
- // case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break;
- // case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break;
- // case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break;
- // case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break;
- // case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break;
- // case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break;
- // case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break;
- // case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break;
- // case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break;
- // case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break;
- // case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break;
- // case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break;
- // case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break;
- // case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break;
- // case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break;
+ case 'channel1': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '1');"); break;
+ case 'channel2': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '2');"); break;
+ case 'channel3': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '3');"); break;
+ case 'channel4': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '4');"); break;
+ case 'channel5': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '5');"); break;
+ case 'channel6': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '6');"); break;
+ case 'channel7': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '7');"); break;
+ case 'channel8': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '8');"); break;
+ case 'channel9': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '9');"); break;
+ case 'channel10': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '10');"); break;
+ case 'channel11': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '11');"); break;
+ case 'channel12': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '12');"); break;
+ case 'channel13': document.visibleform.elements["2.4channel"].checked=false; elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].channel == '13');"); break;
+ case 'undef': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == 'undef');"); break;
+ case '2.4channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence == '2.4');"); break;
+ case '5channel': elements.overlays = overlays["links"]; elements.select = new Function("id", "return (links[overlays['links'][id].linkid].frequence !=='2.4' && links[overlays['links'][id].linkid].frequence !=='undef');"); break;
}
if(document.visibleform.elements[element].checked) {
@@ -507,7 +497,6 @@ function addNewNodeText(point) {
}
function setNewMarker(point) {
-// TODO: make this dragable??
var marker = new google.maps.Marker({position: point, icon: makeIcon('newnode')});
var infowindow = new google.maps.InfoWindow({ content: addNewNodeText(point) });
google.maps.event.addListener(infowindow,"closeclick",function () { marker.setMap(null); });
@@ -520,16 +509,11 @@ function setNewMarker(point) {
}
function fflogin(username, password) {
- var postbody = "username=" + encodeURIComponent(username) + "&password=" + encodeURIComponent(password) + "&login=Einloggen#";
-//##// GDownloadUrl("login.php", onFFLogin, postbody);
+ $.post("login.php", { username: username, password: password, login: "Einloggen#" } )
+ .done(function(data) { onFFLogin(data); });
}
-function onFFLogin(data, responseCode) {
- if (responseCode < 200 || responseCode > 299) {
- return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")");
- }
- xmlData = GXml.parse(data);
-
+function onFFLogin(xmlData) {
var error = xmlData.getElementsByTagName("error");
if(error.length > 0) {
alert(error[0].getAttribute("string"));
@@ -539,9 +523,7 @@ function onFFLogin(data, responseCode) {
if(status[0].getAttribute("code") == "logged_in") {
var username = xmlData.getElementsByTagName("username")[0].getAttribute("name");
showFFLogout(username);
-
-//##// reloadcon.started();
- $.get( "data.php",onData);
+ reloadcon.reload();
}
}
}
@@ -561,25 +543,18 @@ function showFFLogin() {
}
function fflogout() {
- var postbody = "logout=Ausloggen#";
-//##// GDownloadUrl("login.php", onFFLogout, postbody);
+ $.post("login.php", { logout: "Ausloggen#" } )
+ .done(function(data) { onFFLogout(data); });
}
-function onFFLogout(data, responseCode) {
- if (responseCode < 200 || responseCode > 299) {
- return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")");
- }
- xmlData = GXml.parse(data);
-
+function onFFLogout(xmlData) {
var error = xmlData.getElementsByTagName("error");
if(error.length > 0) {
alert(error[0].getAttribute("string"));
}
else {
showFFLogin();
-
-//##// reloadcon.started();
- $.get( "data.php",onData);
+ reloadcon.reload();
}
}
@@ -607,43 +582,30 @@ function showAddress(address) {
}
}
-//##//function ReloadControl() {
-//##//}
-//##//
-//##//ReloadControl.prototype = new GControl();
-//##//
-//##//ReloadControl.prototype.initialize = function(map) {
-//##// var container = document.createElement("div");
-//##// var btnDiv = document.createElement("div");
-//##// btnDiv.className = "btn";
-//##// btnDiv.id = "reloadbtn";
-//##// container.appendChild(btnDiv);
-//##// btnText = document.createTextNode("Daten neu laden");
-//##// btnDiv.appendChild(btnText);
-//##// google.maps.event.addDomListener(btnDiv, "click", function() {
-//##// reloadcon.started();
-//##// GDownloadUrl("data.php", onData);
-//##// });
-//##//
-//##// map.getContainer().appendChild(container);
-//##// return container;
-//##//}
-//##//
-//##//ReloadControl.prototype.started = function() {
-//##// btnText.data = "wird geladen...";
-//##//}
-//##//
-//##//ReloadControl.prototype.loaded = function() {
-//##// btnText.data = "wird verarbeitet...";
-//##//}
-//##//
-//##//ReloadControl.prototype.finished = function() {
-//##// btnText.data = "Daten neu laden";
-//##//}
-//##//
-//##//ReloadControl.prototype.getDefaultPosition = function() {
-//##// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7));
-//##//}
+function ReloadControl(controlDiv, map) {
+ controlDiv.style.padding = '5px';
+
+ var controlUI = document.createElement('div');
+ controlUI.className = 'btn';
+ controlUI.title = 'Click to reload data';
+ controlDiv.appendChild(controlUI);
+
+ var controlText = document.createElement('div');
+ controlText.innerHTML = 'Daten neu laden';
+ controlUI.appendChild(controlText);
+
+ var cntrl = new Object();
+ cntrl.reload = function() {
+ controlText.innerHTML = 'wird geladen...';
+ $.get("data.php", onData).fail(onDataErr);
+ }
+ cntrl.loaded = function() { controlText.innerHTML = 'wird verarbeitet...'; }
+ cntrl.finished = function() { controlText.innerHTML = 'Daten neu laden'; }
+
+ google.maps.event.addDomListener(controlUI, 'click', cntrl.reload);
+ return cntrl;
+}
+
//##//function RulerControl() {