From 53180fa94e95906400abb7a7979dec0a8764410a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 29 Dec 2013 22:35:35 +0000 Subject: visability for channels and default route --- index.php | 126 +++++++++++++++++++-------------------- map.js | 202 +++++++++++++++++++++++++++++++------------------------------- 2 files changed, 164 insertions(+), 164 deletions(-) diff --git a/index.php b/index.php index 32845d1..7281972 100644 --- a/index.php +++ b/index.php @@ -59,10 +59,10 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { Elemente
aus-/einblenden
- - - - + + + + @@ -88,61 +88,61 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') {
 !Default
  
- - - - - - - - - - - - - - - - - - - - - - - - - - + + + +
 Kanaele undef.
+ + + + + +
 Alle 5GHz Kanaele
+ + + + + +
 Alle 2.4GHz Kanaele
+ + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 1 2 3
 4 5 6
 7 8 9
 10 11 12
 13
@@ -150,11 +150,11 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') {
diff --git a/map.js b/map.js index b60b7f0..9644bf9 100644 --- a/map.js +++ b/map.js @@ -208,9 +208,9 @@ function drawLinks(xmlData) { 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 +223,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) { @@ -398,63 +398,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) { -- cgit v1.2.1 From 060170fdb2ec56dde0276c867c6398c745ef238f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 29 Dec 2013 22:59:44 +0000 Subject: clicking on links works now --- map.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/map.js b/map.js index 9644bf9..821df9b 100644 --- a/map.js +++ b/map.js @@ -182,18 +182,12 @@ 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"); @@ -202,8 +196,7 @@ function drawLinks(xmlData) { line.Routerto = element[i].getAttribute("to"); // google.maps.event.addListener(line, "mouseout", function() { lineinfo.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); @@ -321,7 +314,7 @@ function Link(element) { return link; } -function onLinkClick(line,latlng) { +function onLinkClick(line, latlng) { var html ='
'; html += ''+line.name+''; html += ''; @@ -330,7 +323,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 += ''; @@ -342,7 +335,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 += ''; @@ -350,7 +343,9 @@ function onLinkClick(line,latlng) { } html += '
Router: '+dnsfrom[i]+'
Router: '+dnsto[i]+'
'; html += '
'; - map.openInfoWindowHtml(latlng,html); + + var infowindow = new google.maps.InfoWindow({ content: html, position: latlng }); + infowindow.open(map); } function makeColor(value) { -- cgit v1.2.1 From 747dce83bffd46a9164cd8f8537ede14bb70e1b1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 29 Dec 2013 23:05:36 +0000 Subject: cleanup --- map.js | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/map.js b/map.js index 821df9b..da7111c 100644 --- a/map.js +++ b/map.js @@ -26,29 +26,26 @@ function initialize(lat, lng, res) { var mapOptions = { center: new google.maps.LatLng(lat, lng), zoom: res, - streetViewControl: false, + 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, - } + 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))); 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); @@ -194,7 +191,7 @@ function drawLinks(xmlData) { 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(event) { onLinkClick(this, event.latLng) }); @@ -286,11 +283,11 @@ function showLinkInfo(link, point) { html += 'Name: ' + link.name + '
'; //##// html += 'Länge: ' + link.getLength().toFixed(0) + ' m
'; html += ''; - 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) { -- cgit v1.2.1 From cf44f3ddd41b623f46dec46c947b2b8aec1ccc70 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 29 Dec 2013 23:13:47 +0000 Subject: cleanups --- map.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/map.js b/map.js index da7111c..602da68 100644 --- a/map.js +++ b/map.js @@ -13,9 +13,9 @@ 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) { @@ -23,18 +23,16 @@ function initialize(lat, lng, res) { $('#southeastcontainer').hide(); google.maps.visualRefresh=true; - 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, - } - }; + 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); //##// map.addControl(new RulerControl()); -- cgit v1.2.1 From fc31517a03988f10e02ebe982cfd019f202f0ebf Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 01:21:06 +0000 Subject: reenable login container --- index.php | 18 +++++++++--------- map.js | 1 - 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/index.php b/index.php index 7281972..a21968c 100644 --- a/index.php +++ b/index.php @@ -158,15 +158,15 @@ if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { ?> -
- Adresse suchen (Strassenname Nr. <, Ort>): -
-

- - -

-
-
+ + + + + + + + + diff --git a/map.js b/map.js index 602da68..7eb01ce 100644 --- a/map.js +++ b/map.js @@ -20,7 +20,6 @@ debug = function (log_txt) { function initialize(lat, lng, res) { debug("Initializing Funkfeuer Graz Map"); - $('#southeastcontainer').hide(); google.maps.visualRefresh=true; var mapOptions = { -- cgit v1.2.1 From 3407c6aea9c93d1abf62fe2bec61cd4f2807f619 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 01:24:15 +0000 Subject: position of login box --- map.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/map.css b/map.css index 90ec25c..034feb7 100644 --- a/map.css +++ b/map.css @@ -58,8 +58,8 @@ div.box { #southeastcontainer { position: absolute; - right: center; - bottom: 40px; + left: 1ex; + bottom: 1ex; padding: 0; } -- cgit v1.2.1 From 868d5d661987483ac10214216a2ceda5d0c1cd7a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:08:15 +0000 Subject: reenables login readded reaload control (basic version) --- login.php | 4 +-- map.css | 26 +++++++++------- map.js | 104 +++++++++++++++++++++++++++----------------------------------- 3 files changed, 63 insertions(+), 71 deletions(-) diff --git a/login.php b/login.php index 8a65bcb..4f9363a 100644 --- a/login.php +++ b/login.php @@ -1,4 +1,4 @@ -'."\n"; echo ''."\n"; diff --git a/map.css b/map.css index 034feb7..dcaf43c 100644 --- a/map.css +++ b/map.css @@ -91,14 +91,21 @@ div.box { } div.btn { - color: #0000cc; - background-color: white; - border: 1px solid black; - font: small Arial; - text-decoration: underline; + overflow: hidden; text-align: center; - padding: 2px; - margin-bottom: 3px; + position: relative; + color: black; + font-family: Roboto,Arial,sans-serif; + font-size: 11px; + background-color: white; + padding: 1px 6px; + border-bottom-left-radius: 2px; + border-top-left-radius: 2px; + background-clip: padding-box; + border: 1px solid rgba(0, 0, 0, 0.15); + box-shadow: 0px 1px 4px -1px rgba(0, 0, 0, 0.3); + min-width: 28px; + font-weight: 500; cursor: pointer; } @@ -106,10 +113,6 @@ div.btn { width: 10em; } -#reloadbtn { - width: 10em; -} - *.locinfo,table { font-size: 8pt; color: black; @@ -119,6 +122,7 @@ div.btn { font-size: 8pt; color: black; } + table.legend { margin-top: 3px; } diff --git a/map.js b/map.js index 7eb01ce..f2aa9aa 100644 --- a/map.js +++ b/map.js @@ -35,8 +35,12 @@ function initialize(lat, lng, res) { map = new google.maps.Map(document.getElementById("map"), mapOptions); //##// map.addControl(new RulerControl()); -//##// reloadcon = new reloadcontrol(); -//##// map.addcontrol(reloadcon); + + var reloadconDiv = document.createElement('div'); + var reloadcon = new ReloadControl(reloadconDiv, map); + + reloadconDiv.index = 1; + map.controls[google.maps.ControlPosition.TOP_RIGHT].push(reloadconDiv); google.maps.event.addListener(map, "click", onMapClick); @@ -509,16 +513,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")); @@ -528,7 +527,6 @@ 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); } @@ -550,25 +548,19 @@ 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); + $.get("data.php", onData); } } @@ -596,43 +588,39 @@ 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); + + google.maps.event.addDomListener(controlUI, 'click', function() { +// reloadcon.started(); + $.get("data.php", onData); + }); +} + +// 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 RulerControl() { -- cgit v1.2.1 From 0cf4d26fa38c09d4ad7fe4259e89eeb9c5f08c52 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:24:32 +0000 Subject: added extended reload control feature --- map.js | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/map.js b/map.js index f2aa9aa..56212d6 100644 --- a/map.js +++ b/map.js @@ -58,7 +58,7 @@ function initialize(lat, lng, res) { countboxText = document.createTextNode("Aktiv: 0"); countbox.appendChild(countboxText); -//##// reloadcon.started(); + reloadcon.started(); $.get( "data.php",onData); } @@ -73,8 +73,9 @@ function onMapClick(mouse_event) //##// reloadcon.finished(); //##// return alert("Fehler: Konnte die Daten nicht laden!\n(Server Antwort-Code: " + responseCode + ")"); //##// } -//##// reloadcon.loaded(); function onData(xmlData) { + reloadcon.loaded(); + for(var loc in overlays["locations"]) { overlays["locations"][loc].setMap(null); } @@ -99,7 +100,7 @@ function onData(xmlData) { countboxText.data = "Aktiv: " + count; } -//##// reloadcon.finished(); + reloadcon.finished(); } function drawLocations(xmlData) { @@ -527,7 +528,7 @@ function onFFLogin(xmlData) { if(status[0].getAttribute("code") == "logged_in") { var username = xmlData.getElementsByTagName("username")[0].getAttribute("name"); showFFLogout(username); -//##// reloadcon.started(); + reloadcon.started(); $.get( "data.php",onData); } } @@ -559,7 +560,7 @@ function onFFLogout(xmlData) { } else { showFFLogin(); -//##// reloadcon.started(); + reloadcon.started(); $.get("data.php", onData); } } @@ -597,30 +598,21 @@ function ReloadControl(controlDiv, map) { controlDiv.appendChild(controlUI); var controlText = document.createElement('div'); - controlText.innerHTML = 'Daten neu laden'; + controlText.innerHTML = 'Daten neu laden'; controlUI.appendChild(controlText); google.maps.event.addDomListener(controlUI, 'click', function() { -// reloadcon.started(); + controlText.innerHTML = 'wird geladen...'; $.get("data.php", onData); }); -} - -// 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"; -// } + var cntrl = new Object(); + cntrl.started = function() { controlText.innerHTML = 'wird geladen...'; } + cntrl.loaded = function() { controlText.innerHTML = 'wird verarbeitet...'; } + cntrl.finished = function() { controlText.innerHTML = 'Daten neu laden'; } + return cntrl; +} -// ReloadControl.prototype.getDefaultPosition = function() { -// return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(7, 7)); -// } //##//function RulerControl() { -- cgit v1.2.1 From dbc4875e553af4d617bba3d2450562c0671aea95 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:38:49 +0000 Subject: improved reload control --- map.js | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/map.js b/map.js index 56212d6..8f7a088 100644 --- a/map.js +++ b/map.js @@ -37,9 +37,7 @@ function initialize(lat, lng, res) { //##// map.addControl(new RulerControl()); var reloadconDiv = document.createElement('div'); - var reloadcon = new ReloadControl(reloadconDiv, map); - - reloadconDiv.index = 1; + reloadcon = new ReloadControl(reloadconDiv, map); map.controls[google.maps.ControlPosition.TOP_RIGHT].push(reloadconDiv); google.maps.event.addListener(map, "click", onMapClick); @@ -58,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) @@ -68,11 +65,10 @@ 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 + ")"); -//##// } +function onDataErr() { + reloadcon.finished(); +} + function onData(xmlData) { reloadcon.loaded(); @@ -528,8 +524,7 @@ function onFFLogin(xmlData) { 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(); } } } @@ -560,8 +555,7 @@ function onFFLogout(xmlData) { } else { showFFLogin(); - reloadcon.started(); - $.get("data.php", onData); + reloadcon.reload(); } } @@ -601,15 +595,15 @@ function ReloadControl(controlDiv, map) { controlText.innerHTML = 'Daten neu laden'; controlUI.appendChild(controlText); - google.maps.event.addDomListener(controlUI, 'click', function() { - controlText.innerHTML = 'wird geladen...'; - $.get("data.php", onData); - }); - var cntrl = new Object(); - cntrl.started = function() { controlText.innerHTML = 'wird geladen...'; } + 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; } -- cgit v1.2.1 From 736522335971a165326b741632dbd5e1efdf6ec3 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:41:22 +0000 Subject: cleanup --- index.php | 6 ------ map.js | 1 - 2 files changed, 7 deletions(-) diff --git a/index.php b/index.php index a21968c..b462de0 100644 --- a/index.php +++ b/index.php @@ -10,12 +10,6 @@ if(empty($lat)) $lat=47.07102; if(empty($lng)) $lng=15.440; if(empty($res)) $res=15; -$apikey = 'unknownhost'; -if($_SERVER['HTTP_HOST'] == 'dev-karte.ffgraz.net') { - $apikey = 'ABQIAAAAZRu0cBQNp9TOBJp1i-DhohS9pf3riiZoWFmOpEuQ19If-UHZjhRHIGQIC00eY1H5H71yDqx-QzdyJA'; -} elseif($_SERVER['HTTP_HOST'] == 'dev-karte.graz.funkfeuer.at') { - $apikey = 'ABQIAAAAZRu0cBQNp9TOBJp1i-DhohSbKGG4yPVU7VmuBMuIIaQfSNuMAxRrbvJwWee4f-0iW-LpRZkkrl531Q'; -} ?> diff --git a/map.js b/map.js index 8f7a088..a248b1c 100644 --- a/map.js +++ b/map.js @@ -497,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); }); -- cgit v1.2.1 From 70b378464945443b234380c5098ec7066bb0b15f Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Mon, 30 Dec 2013 02:44:13 +0000 Subject: cleanup --- check_user.php | 2 +- config.php | 8 +- data.php | 226 ++++++++++++++++++++++++++++----------------------------- db.class.php | 2 +- 4 files changed, 118 insertions(+), 120 deletions(-) diff --git a/check_user.php b/check_user.php index 4b89267..bd7dfc7 100644 --- a/check_user.php +++ b/check_user.php @@ -10,7 +10,7 @@ function check_user($username, $password) $db->query("SELECT password FROM person WHERE email='".$escaped_username."'"); $data = $db->getNextObject(); - if($data->password == md5($password)) + if($data->password == md5($password)) return true; return false; diff --git a/config.php b/config.php index 3f0e272..d806fbb 100644 --- a/config.php +++ b/config.php @@ -10,13 +10,11 @@ $conf['router']['file'] = 'InfoRouter.plain'; /* neue eintraege bitte kommentieren !!!! */ $conf['acl']['range'] = array( - "10.0.0.0/8", // Funkfeuer Graz Private - "217.29.149.64/28", // 0xFF Citycom IP Bereich + "10.0.0.0/8", // Funkfeuer Graz et.al Private Adressen "193.33.150.0/23", // Funkfeuer Graz Public + "217.29.149.64/28", // 0xFF Citycom IP Bereich "193.238.156.0/22", // Funkfeuer Wien - "89.106.208.0/21", // mur.at -// "84.119.56.63/32", // equinox home test - "212.17.113.195/32" // roland home wien + "89.106.208.0/21" // mur.at ); ?> diff --git a/data.php b/data.php index 2735c0b..7f59f3f 100644 --- a/data.php +++ b/data.php @@ -41,35 +41,35 @@ $ipname = array(); $dnsnames = array(); $ip = array(); $nodelocnames = array(); -$ipnodelocnames = array(); +$ipnodelocnames = array(); $links = array(); $already = array(); $count = array(); $db->query("SELECT ip, ip.name as ipname,location.id as locid,location.name as locname, node.name as nodename FROM ip, node, location WHERE ip.node_id = node.id and node.location_id=location.id"); while ($data = $db->getNextObject()) { - $locids[$data->ip]= $data->locid; - $nodename[$data->ip]= $data->nodename; - $locname[$data->ip]= $data->locname; - $ipname[$data->ip]= $data->ipname; - $dnsname = $data->ipname.'.'.$data->nodename.'.'.$data->locname; - $dnsnames[$data->locid][]=$dnsname; - $ip[$dnsname]=$data->ip; + $locids[$data->ip]= $data->locid; + $nodename[$data->ip]= $data->nodename; + $locname[$data->ip]= $data->locname; + $ipname[$data->ip]= $data->ipname; + $dnsname = $data->ipname.'.'.$data->nodename.'.'.$data->locname; + $dnsnames[$data->locid][]=$dnsname; + $ip[$dnsname]=$data->ip; $nodelocname = $data->nodename.'.'.$data->locname; - $nodelocnames[$data->locid][]=$nodelocname; - $ipnodelocnames[$nodelocname][]=$data->ipname; + $nodelocnames[$data->locid][]=$nodelocname; + $ipnodelocnames[$nodelocname][]=$data->ipname; } if($conf['acl']['auth']) - $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location ORDER BY name ASC"); + $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location ORDER BY name ASC"); else - $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location WHERE location.hidden = 0 ORDER BY name ASC"); + $db->query("SELECT id as locid, name as locname, pixel_x, pixel_y, gallery_link, location.hastinc as hastinc FROM location WHERE location.hidden = 0 ORDER BY name ASC"); while ($data = $db->getNextObject()) { - if ($data->pixel_x == "0") - continue; + if ($data->pixel_x == "0") + continue; - $data->lng = $lng_startpoint + ($data->pixel_x - $x_startpoint) / $dx_dLng; - $data->lat = $lat_startpoint + ($y_startpoint - $data->pixel_y) / $dy_dLat; + $data->lng = $lng_startpoint + ($data->pixel_x - $x_startpoint) / $dx_dLng; + $data->lat = $lat_startpoint + ($y_startpoint - $data->pixel_y) / $dy_dLat; $data->state = "offline"; if($conf['acl']['auth']){ foreach($nodelocnames[$data->locid] as $nodelocname){ @@ -93,7 +93,7 @@ while ($data = $db->getNextObject()) { if ($channel!="" or $frequence!=""){ $data->dnsnames = $dnsname." (Kanal: ".$channel." / ".$frequence." GHz);".$data->dnsnames; break 2; - } + } } $data->dnsnames = $dnsname.";".$data->dnsnames; } @@ -117,7 +117,7 @@ while ($data = $db->getNextObject()) { } } */ - } + } $locations[$data->locid] = $data; } @@ -126,27 +126,27 @@ $lines = file($conf['topo']['file']); $linecnt=0; $i =0; -foreach ($lines as $num => $line) +foreach ($lines as $num => $line) { - $linecnt++; - if(preg_match($regmatch,$line,$matches)==0) + $linecnt++; + if(preg_match($regmatch,$line,$matches)==0) continue; - list( , $ipfromLoc, $iptoLoc, $label) = $matches; + list( , $ipfromLoc, $iptoLoc, $label) = $matches; + + if (empty($ipfromLoc) || empty($iptoLoc) || empty($label)) + continue; - if (empty($ipfromLoc) || empty($iptoLoc) || empty($label)) - continue; - if (empty($locids[$ipfromLoc]) || empty($locids[$iptoLoc])) - continue; - - if(empty($locations[$locids[$ipfromLoc]]->locid) || empty($locations[$locids[$iptoLoc]]->locid)) - continue; - - if($locations[$locids[$ipfromLoc]]->locid == $locations[$locids[$iptoLoc]]->locid) - continue; -// echo $locations[$locids[$ipfromLoc]]->locid; + continue; + + if(empty($locations[$locids[$ipfromLoc]]->locid) || empty($locations[$locids[$iptoLoc]]->locid)) + continue; + + if($locations[$locids[$ipfromLoc]]->locid == $locations[$locids[$iptoLoc]]->locid) + continue; +// echo $locations[$locids[$ipfromLoc]]->locid; // echo "-"; // echo "$ipfromLoc\n"; // echo $locations[$locids[$iptoLoc]]->locid; @@ -154,26 +154,26 @@ foreach ($lines as $num => $line) // echo "$iptoLoc\n"; - + if(isset($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid])&& - ($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used == true)) { - $jot = $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i; + ($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used == true)) { + $jot = $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i; if($links[$jot]->label != -1){ if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ - $links[$jot]->label = ($links[$jot]->label + $label)/2; - } else if ($links[$jot]->label > $label){ - $links[$jot]->label = $label; + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; } } - if (array_key_exists($ipfromLoc,$routerhash)){ + if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$jot]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$jot]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$jot]->channel = $routerhash[$iptoLoc][4]; @@ -183,20 +183,20 @@ foreach ($lines as $num => $line) } } else{ $links[$jot]->channel ="undef"; - $links[$jot]->frequence ="undef"; + $links[$jot]->frequence ="undef"; // echo "keine IP\n"; - } + } if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ if (strpos($links[$jot]->dnsfrom ,$routerhash[$ipfromLoc][1])===false){ $links[$jot]->dnsfrom =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequence.' GHz)'.';'.($links[$jot]->dnsfrom)); } - + + } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$jot]->defaultroute = "1"; - } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -206,30 +206,30 @@ foreach ($lines as $num => $line) } } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$jot]->defaultroute = "1"; - } - } - - } - elseif(isset($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid])&& + $links[$jot]->defaultroute = "1"; + } + } + + } + elseif(isset($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid])&& ($already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->used == true)) { - $jot = $already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->i; + $jot = $already[$locations[$locids[$iptoLoc]]->locid . '-' . $locations[$locids[$ipfromLoc]]->locid]->i; if($links[$jot]->label != -1){ if (($links[$jot]->$ipfromLoc==$iptoLoc) || ($links[$jot]->$iptoLoc==$ipfromLoc)){ - $links[$jot]->label = ($links[$jot]->label + $label)/2; - } else if ($links[$jot]->label > $label){ - $links[$jot]->label = $label; + $links[$jot]->label = ($links[$jot]->label + $label)/2; + } else if ($links[$jot]->label > $label){ + $links[$jot]->label = $label; } } if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$jot]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$jot]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$jot]->channel = $routerhash[$iptoLoc][4]; @@ -239,19 +239,19 @@ foreach ($lines as $num => $line) } } else{ $links[$jot]->channel ="undef"; - $links[$jot]->frequence ="undef"; + $links[$jot]->frequence ="undef"; // echo "keine IP\n"; } - if (array_key_exists($ipfromLoc,$routerhash)){ + if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ if (strpos($links[$jot]->dnsto,$routerhash[$ipfromLoc][1])===false){ // echo "C\n"; $links[$jot]->dnsto =($routerhash[$ipfromLoc][1].' (Kanal: '.$links[$jot]->channel.' / '.$links[$jot]->frequence.' GHz)'.';'.($links[$jot]->dnsto)); } } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$jot]->defaultroute = "1"; - } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$jot]->defaultroute = "1"; + } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -261,28 +261,28 @@ foreach ($lines as $num => $line) } } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$jot]->defaultroute = "1"; - } + $links[$jot]->defaultroute = "1"; + } } - } - else { + } + else { // if(isset($already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid])) { - $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used = true; - $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i = $i; -// - $links[$i]->ipfromLoc = $ipfromLoc; - $links[$i]->iptoLoc = $iptoLoc; - - if (array_key_exists($ipfromLoc,$routerhash)){ + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->used = true; + $already[$locations[$locids[$ipfromLoc]]->locid . '-' . $locations[$locids[$iptoLoc]]->locid]->i = $i; +// + $links[$i]->ipfromLoc = $ipfromLoc; + $links[$i]->iptoLoc = $iptoLoc; + + if (array_key_exists($ipfromLoc,$routerhash)){ if ($routerhash[$ipfromLoc][4]!==""){ $links[$i]->channel = $routerhash[$ipfromLoc][4]; - + } if ($routerhash[$ipfromLoc][5]!==""){ $links[$i]->frequence = $routerhash[$ipfromLoc][5]; } - + } else if (array_key_exists($iptoLoc,$routerhash)){ if ($routerhash[$iptoLoc][4]!==""){ $links[$i]->channel = $routerhash[$iptoLoc][4]; @@ -292,24 +292,24 @@ foreach ($lines as $num => $line) } } else{ $links[$i]->channel ="undef"; - $links[$i]->frequence ="undef"; + $links[$i]->frequence ="undef"; // echo "keine IP\n"; - } + } $links[$i]->defaultroute = "0"; if($conf['acl']['auth']){ $links[$i]->dnsfrom =$ipname[$ipfromLoc].'.'.$nodename[$ipfromLoc].'.'.$locname[$ipfromLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz )'; $links[$i]->dnsto =$ipname[$iptoLoc].'.'.$nodename[$iptoLoc].'.'.$locname[$iptoLoc].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz)'; } - + if (array_key_exists($ipfromLoc,$routerhash)){ if($conf['acl']['auth']){ $links[$i]->dnsfrom =$routerhash[$ipfromLoc][1].' (Kanal: '.$links[$i]->channel.' / '.$links[$i]->frequence.' GHz)'; } - if ($routerhash[$ipfromLoc][3]==$iptoLoc){ - $links[$i]->defaultroute = "1"; - } + if ($routerhash[$ipfromLoc][3]==$iptoLoc){ + $links[$i]->defaultroute = "1"; + } } if (array_key_exists($iptoLoc,$routerhash)){ if($conf['acl']['auth']){ @@ -317,36 +317,36 @@ foreach ($lines as $num => $line) } if ($routerhash[$iptoLoc][3]==$ipfromLoc){ - $links[$i]->defaultroute = "1"; - } + $links[$i]->defaultroute = "1"; + } } if($links[$i]->label != -1){ - $links[$i]->label = $label; + $links[$i]->label = $label; if($locations[$locids[$ipfromLoc]]->state == "offline") - $locations[$locids[$ipfromLoc]]->state = "online"; + $locations[$locids[$ipfromLoc]]->state = "online"; if($locations[$locids[$iptoLoc]]->state == "offline") - $locations[$locids[$iptoLoc]]->state = "online"; + $locations[$locids[$iptoLoc]]->state = "online"; + } + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" ) || + ($locations[$locids[$iptoLoc]]->hastinc && $locations[$locids[$ipfromLoc]]->hastinc)) { + $links[$i]->label = -1; + + $links[$i]->defaultroute ="1"; + $locations[$locids[$ipfromLoc]]->state = "tunnel"; + $locations[$locids[$iptoLoc]]->state = "tunnel"; } - if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || - ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" ) || - ($locations[$locids[$iptoLoc]]->hastinc && $locations[$locids[$ipfromLoc]]->hastinc)) { - $links[$i]->label = -1; - - $links[$i]->defaultroute ="1"; - $locations[$locids[$ipfromLoc]]->state = "tunnel"; - $locations[$locids[$iptoLoc]]->state = "tunnel"; - } - if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || - ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" )){ + if (($nodename[$ipfromLoc] == "tunnel" && $locations[$locids[$ipfromLoc]]->locname=="housing") || + ($nodename[$iptoLoc] == "tunnel" && $locations[$locids[$iptoLoc]]->locname=="housing" )){ $links[$i]->frequence ="LAN"; - $links[$i]->channel ="undef"; + $links[$i]->channel ="undef"; } - - $i++; - } + + $i++; + } } @@ -355,9 +355,9 @@ echo "\n"; echo "\n"; foreach ($locations as $location) { - $data = $locations[$location->locid]; - printf("\t" . '' . "\n", - $data->locid, $data->locname, $data->lat, $data->lng, $data->pixel_x, $data->pixel_y, $data->state, $data->gallery_link, $data->dnsnames); + $data = $locations[$location->locid]; + printf("\t" . '' . "\n", + $data->locid, $data->locname, $data->lat, $data->lng, $data->pixel_x, $data->pixel_y, $data->state, $data->gallery_link, $data->dnsnames); } echo "\n"; @@ -367,14 +367,14 @@ foreach ($links as $link) { - $data1 = $locations[$locids[$link->ipfromLoc]]; - $data2 = $locations[$locids[$link->iptoLoc]]; + $data1 = $locations[$locids[$link->ipfromLoc]]; + $data2 = $locations[$locids[$link->iptoLoc]]; - $count[$data1->locid]=true; - $count[$data2->locid]=true; + $count[$data1->locid]=true; + $count[$data2->locid]=true; - printf("\t" . '' . "\n", - $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequence, $link->dnsfrom,$link->dnsto); + printf("\t" . '' . "\n", + $data1->locid, $data1->locname, $data1->lat,$data1->lng,$data2->locid, $data2->locname, $data2->lat, $data2->lng, $link->label, $link->channel, $link->defaultroute, $link->frequence, $link->dnsfrom,$link->dnsto); } echo "\n"; diff --git a/db.class.php b/db.class.php index 0921bc8..1a3647f 100644 --- a/db.class.php +++ b/db.class.php @@ -13,7 +13,7 @@ function DB($user, $pass, $host, $dbname) { } function connect() { - $this->db = mysql_connect($this->host, $this->user, $this->pass) + $this->db = mysql_connect($this->host, $this->user, $this->pass) or $this->error("Verbindungsaufbau fehlgeschlagen"); mysql_select_db($this->dbname); } -- cgit v1.2.1