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 --- map.js | 202 ++++++++++++++++++++++++++++++++--------------------------------- 1 file changed, 101 insertions(+), 101 deletions(-) (limited to 'map.js') 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(-) (limited to 'map.js') 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(-) (limited to 'map.js') 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(-) (limited to 'map.js') 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 --- map.js | 1 - 1 file changed, 1 deletion(-) (limited to 'map.js') 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 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) --- map.js | 104 +++++++++++++++++++++++++++++------------------------------------ 1 file changed, 46 insertions(+), 58 deletions(-) (limited to 'map.js') 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(-) (limited to 'map.js') 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(-) (limited to 'map.js') 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 --- map.js | 1 - 1 file changed, 1 deletion(-) (limited to 'map.js') 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