function extent() { var dataExtent = markerLayer.getDataExtent(); map.zoomToExtent(dataExtent); } function ffff(){ $('#jqxWindowxx').jqxWindow({ position: { x: '300', y: '300' }}); $('#jqxWindowxx').jqxWindow({ okButton: $('#okButton')}); $("#jqxWindowxx").jqxWindow({ height: '300', width: '600', theme: 'summer', isModal: false, autoOpen: false, title: '', showCollapseButton: true }); $('#jqxWindowxx').jqxWindow({ content: 'foobar' }); $('#jqxWindowxx').jqxWindow('setContent', ''); //$('#jqxWindowxx').jqxWindow({ z-index: 999999999999999}); //$('#jqxWindowxx').jqxWindow({ zIndex: 999999999999999}); //$('#jqxWindowxx').jqxWindow('bringToFront'); //$('#jqxWindowxx').jqxWindow({ closeButtonAction: 'hide'}); //$('#jqxWindowxx').on('close', function (event) { alert('closed'); }); //$('#jqxWindowxx').jqxWindow({ position: { x: '300', y: '300' }}); // $("#jqxWindowxx").jqxWindow({ height: '300', width: '600', theme: 'summer', isModal: false, autoOpen: false, title: '', showCollapseButton: true }); //$('#jqxWindowxx').jqxWindow({ content: 'foobar' }); //$('#jqxWindowxx').jqxWindow('setContent', 'aaa'); $('#jqxWindowxx').jqxWindow('open'); } function loading(load_id){ if(load_id == 1) { document.getElementById('loading').style.visibility = 'visible'; //document.getElementById('loading').innerHTML = ''; } else { document.getElementById('loading').style.visibility = 'hidden'; } } function xml_request() { var xml_anfrage = null; if(window.XMLHttpRequest) { // Generiere XML Objekt xml_anfrage = new XMLHttpRequest(); //für Mozilla, Opera, IE > 7, Safari } else if(window.ActiveXObject) { //Für IE 5,6 xml_anfrage = new ActiveXObject("Microsoft.XMLHTTP"); } //Gibt das XML objekt rurück return xml_anfrage; } function zoomToVehicle(toZoom, lon, lat, imei){ var lonLat=new OpenLayers.LonLat(lon, lat).transform(map.displayProjection, map.getProjectionObject()); //alert(map.getZoom()); map.setCenter(lonLat,toZoom); followDevice(imei,'0','0', to); //disable following } function disable(pub_key){ try { url = "../data/xml/xml_disable.php"; var abfrage = xml_request(); nachricht = "key="+pub_key; abfrage.open("POST", url, true); // set the request abfrage.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); abfrage.send(nachricht); // calls the send() method with datas as parameter abfrage.onreadystatechange = function() { if (abfrage.readyState == 4) { //update(); setTimeout(function(){ parent.frames['mapping'].update(); }, 500); } } } catch (e) { //alert(e); } } function cf (circle) { var center = OpenLayers.Layer.SphericalMercator.forwardMercator(circle.lon, circle.lat); var style = { strokeColor: (circle.strokeColor || 'red' ), strokeWidth: (circle.strokeWidth || 2 ), strokeOpacity: (circle.strokeOpacity || 1.0 ), fill: (circle.fillOpacity!==0 ), fillColor: (circle.fillColor || 'yellow' ), fillOpacity: (circle.fillOpacity || 0.5 ), pointerEvents: 'visiblePainted' } var radius = (circle.radius || 1000.0) / Math.cos (circle.lat * 3.1415926535 / 180.0); var nPoints= circle.nPoints || 32; var delta = 2 * 3.1415926535 / nPoints; var list = []; for (var i=0; i //------------------------------------------------------------------------------ // // $Log: popupmarker.js,v // Revision 1.112 2013/04/11 19:18:47 wolf // + getWikipediaUrl // + parseURL // // Revision 1.110 2013/04/06 16:46:41 wolf // + closeKeyCode // + formatValue: interwikiLink // // Revision 1.108 2013/03/08 11:46:07 wolf // + shrinkUrl // // Revision 1.105 2013/01/20 14:20:50 wolf // + josm:load_object // // Revision 1.104 2013/01/19 22:14:43 wolf // + "www." -> link // // Revision 1.102 2013/01/12 14:56:47 wolf // + wikipedia-Links // // Revision 1.101 2013/01/12 14:19:41 wolf // + timer-reload // + nameless columns // // Revision 1.100 2012/11/07 13:35:04 wolf // * Bugfix: map->this.map // // Revision 1.99 2012/05/21 08:50:36 wolf // + jsonpRequest() // // Revision 1.98 2012/05/04 23:06:49 wolf // + createTemporaryMarker: // // Revision 1.97 2012/03/31 17:09:28 wolf // * Anpassung an pinch-Handling (Ipad). // * Ergaenzungen zum POI-Editor // * String-Cleanup // // [...] // // Revision 1.1 2010/01/21 10:29:17 wolf // Initial Revision // //------------------------------------------------------------------------------ if (!OpenLayers.Lang.en) { OpenLayers.Lang.en = {}; } if (OpenLayers.Lang.en.errorLoadingCSV) { //top.location.href = 'http://www.yourGPS.de'; } OpenLayers.Layer.PopupMarker = OpenLayers.Class(OpenLayers.Layer.Markers,{ popupOnHover: false, popupOnClick: false, restrictMapExtent: false, location: null, fieldSeparator: '\t', defaultIcon: null, popupClass:OpenLayers.Popup.AnchoredBubble, createUrlForBounds: null, editUrl: null, requestUser: null, requestPassword: null, requestAsync: true, clickHandler: null, opacity: null, minZoom: 10, lastZoom: -1, blockSize: 0.1, clusterSize: 0, clusterSort: null, clusterLimit: 10, zindex: null, cloudImage: null, zoomSteps: null, hideMarkerBelowMinZoom: false, region: null, // XXX experimental maxTooltipWidth: null, closeOnClick: false, // close by click into popup closeKeyCode: false, // close popup by key with this keyCode clickDistance: 0, // open by click near to marker fieldTitles: {}, fieldTypes: {}, fieldValues: {}, enableUpdate: false, enableCreate: false, enableDelete: false, enableLocate: false, locateId: null, reloadTimer: null, reloadInterval: null, labelEdit: 'Bearbeiten', labelDelete: 'L' + String.fromCharCode(246) + 'schen', labelConfirmDelete: 'Marker permanent l' + String.fromCharCode(246) + 'schen?', labelLocate: 'Verschieben', locateMarker: null, //---------------------------------------------------------------------- // Init //---------------------------------------------------------------------- initialize: function(name, options) { OpenLayers.Layer.Markers.prototype.initialize.apply(this,arguments); this.erase(); this.loadBounds = null; this.loadedBounds = null; this.loadingUrl = null; this.nextId = 0; if (this.opacity ) { this.setOpacity(opacity); } if (this.minZoom ) { this.zoomSteps = 1<0 || this.enableLocate) { this.clickHandler = new OpenLayers.Handler.Click (this, {'click': this.click}, {'single': true}); this.clickHandler.activate(); } }, //---------------------------------------------------------------------- // click to create marker //---------------------------------------------------------------------- click: function(ev) { if (this.locateMarker) { var marker = this.locateMarker; this.cancelLocate(); if (ev.shiftKey || ev.ctrlKey) { return null; } var lonLat=this.map.getLonLatFromViewPortPx(ev.xy); this.drawTemporaryIcon (this.createIconFromData(marker.data, true), this.map.getLayerPxFromLonLat (lonLat)); lonLat.transform(this.map.getProjectionObject(),this.map.displayProjection); marker.data.lat = lonLat.lat; marker.data.lon = lonLat.lon; var postData = OpenLayers.Util.getParameterString (marker.data); this.updateMarkerOnServer (marker, postData); return null; } if (!this.visibility) { return null; } if (this.clickDistance>0 && !ev.ctrlKey && !ev.shiftKey && ev.xy && this.markers) { if (this.currentPopup) { this.destroyPopup(); } else if (this.popupOnClick && (this.map.getZoom() >= this.minZoom || !this.hideMarkerBelowMinZoom)) { marker = this.findNearestMarker (ev.xy, this.clickDistance); if (marker) { this.markerClick.apply (marker, [ev]); } } } if (this.enableCreate && ev.ctrlKey && this.enableCreate && this.lastZoom >= this.minZoom) { if (this.currentPopup) { this.destroyPopup(); return false; } this.createTemporaryMarker (this.map.getLonLatFromViewPortPx(ev.xy). transform(this.map.getProjectionObject(), this.map.displayProjection)); } return false; }, createTemporaryMarker: function (lonlat, data) { if (this.currentPopup) { this.destroyPopup(); } if (!data) { data={}; } ++this.nextId; data.lon = lonlat.lon; data.lat = lonlat.lat; data.id = -this.nextId; lonlat.transform(this.map.displayProjection, this.map.getProjectionObject()); if (!this.map.getExtent().containsLonLat(lonlat)) { this.map.moveTo (lonlat, Math.max (this.map.getZoom(), this.minZoom)); } var marker = this.createMarker (data); marker.temporary = true; this.createEditPopup (marker, true); }, findNearestMarker: function (center, maxDistance) { if (!center || !this.markers) { return null; } if (!maxDistance) { maxDistance = 1e10; } var result = null; var dist = maxDistance * maxDistance + 1; for (var i in this.markers) { var marker = this.markers[i]; var icon = marker.icon; if (!icon) { continue; } var px = icon.px; if (!px) { continue; } var dx = px.x - center.x; var dy = px.y - center.y; var d2 = dx*dx + dy*dy; if (d2 >= dist) { continue; } result = marker; dist = d2; } return result; }, //---------------------------------------------------------------------- // JSONP request (w/o using global variables) //---------------------------------------------------------------------- jsonpRequest: function (url, scope, callback) { //---------------------------------------------------- // get requestId and patch url //---------------------------------------------------- ++window.callbackCounter; var requestId = "JSONP" + window.callbackCounter; //---------------------------------------------------- // attach jsonp callback handler //---------------------------------------------------- var closureScope = scope; var closureCallback = callback; var closureLayer = this; window.callbacks[requestId] = function (data) { //------------------------------------------------- // cleanup callback structure //------------------------------------------------- delete window.callbacks[requestId]; //------------------------------------------------- // remove script node //------------------------------------------------- var scriptNode = document.getElementById (requestId); if (scriptNode && scriptNode.parentElement) { scriptNode.parentElement.removeChild (scriptNode); } //------------------------------------------------- // loadend //------------------------------------------------- closureLayer.events.triggerEvent('loadend'); //------------------------------------------------- // callback //------------------------------------------------- closureCallback.apply (closureScope, [data]); }; var scriptNode = document.createElement ('script'); scriptNode.id = requestId; scriptNode.src = url.replace (/#/, "window.callbacks." + requestId); closureLayer.events.triggerEvent('loadstart'); document.getElementsByTagName('BODY')[0].appendChild (scriptNode); }, //---------------------------------------------------------------------- // Reload Marker on move or zoom //---------------------------------------------------------------------- moveTo: function (bounds, zoomChanged, dragging) { OpenLayers.Layer.Markers.prototype.moveTo.apply(this,arguments); //-------------------------------------------------------------- // but not while dragging or invisible or moving marker //-------------------------------------------------------------- if (dragging || !this.visibility || this.locateMarker) { return; } //-------------------------------------------------------------- // XXX QUICKFIX WILL BE REMOVED XXX //-------------------------------------------------------------- if (this.zindex && this.div.style.zIndex!=this.zindex) { this.div.style.zIndex=this.zindex; } //-------------------------------------------------------------- // Change visibility of marker //-------------------------------------------------------------- if ((this.lastZoom>=this.minZoom) != (this.map.zoom>=this.minZoom)) { this.lastZoom = this.map.zoom; if (!this.blockSize && this.lastZoom < this.minZoom && this.hideMarkerBelowMinZoom) { this.erase(); } if (this.location && this.createUrlForBounds) { if (this.map.zoom >= this.minZoom) { for (var i=0; i0); } } } if (!this.location && this.createUrlForBounds && this.hideMarkerBelowMinZoom) { for (i=0; i= this.minZoom); } } } //-------------------------------------------------------------- // Transform center and border to geogr. Coordinates //-------------------------------------------------------------- if (this.map.zoom >= this.minZoom && this.createUrlForBounds) { this.loadBounds = bounds.clone(). transform(this.map.getProjectionObject(), this.map.displayProjection); this.loadNext(); } //-------------------------------------------------------------- // delayed Popup //-------------------------------------------------------------- var marker = this.delayedPopupMarker; if (marker) { this.delayedPopupMarker=null; this.createPopup(marker); this.currentMarker=marker; } }, //---------------------------------------------------------------------- // Load next //---------------------------------------------------------------------- getUnknownArea: function (bounds) { if (!this.blockSize) { return bounds; } var l0 = Math.floor (bounds.left / this.blockSize); var r0 = Math.ceil (bounds.right / this.blockSize); var b0 = Math.floor (bounds.bottom/ this.blockSize); var t0 = Math.ceil (bounds.top / this.blockSize); var l=r0; var r=l0; var t=b0; var b=t0; for (var y=b0; y=r) { r=x+1; } if (y< b) { b=y; } if (y>=t) { t=y+1; } } } if (l>=r || b>=t) { return null;} return new OpenLayers.Bounds ( l*this.blockSize,b*this.blockSize,r*this.blockSize,t*this.blockSize); }, loadNext: function () { if (this.loadBounds==this.loadedBounds) { return; } if (this.loadingUrl) { return; } this.loadedBounds = this.loadBounds; var area = this.getUnknownArea (this.loadedBounds); if (area) { this.request (this.createUrlForBounds(area)); } }, //---------------------------------------------------------------------- // Download CSV //---------------------------------------------------------------------- request: function (url) { if(this.loadingUrl) { return false; } this.loadingUrl=url; OpenLayers.Request.GET({ url:this.loadingUrl, success:this.requestSuccess, failure:this.requestFailure, scope:this }); this.events.triggerEvent('loadstart'); return true; }, //---------------------------------------------------------------------- // Success downloading CSV //---------------------------------------------------------------------- requestSuccess: function(request) { if (!request.response && !request.status) { //top.location.href = 'http://www.yourGPS.de'; } else if (!request.responseText) { //top.location.href = 'http://www.yourGPS.de'; } else { var objects = this.parseCSV (request.responseText); if (!this.blockSize) { this.erase (true);} //if (objects.length>0) { objects[objects.length-1].isLatest=true;} for (var i=0; objects.length>i; i++) { this.createMarker (objects[i]); } } if (this.loadingUrl==this.location && !this.map.getCenter()) { var extent = this.getBounds(); if (extent) { this.map.zoomToExtent(extent); if (this.restrictMapExtent) { extent.extend(this.map.restrictedExtent); this.map.restrictedExtent=extent; } } } if (!map.getCenter()) { this.map.zoomToMaxExtent(); } this.events.triggerEvent('loadend'); this.loadingUrl = null; if (this.visibility) { this.loadNext(); } }, //---------------------------------------------------------------------- // Error downloading of CSV //---------------------------------------------------------------------- requestFailure: function(request) { //top.location.href = 'http://www.yourGPS.de'; if (!map.getCenter()) { this.map.zoomToMaxExtent(); } this.events.triggerEvent('loadend'); this.loadingUrl = null; this.loadNext(); }, //---------------------------------------------------------------------- // createObject //---------------------------------------------------------------------- getMarkerByDataId: function (id) { for (var i=0; iSpeed: ' + marker.data.speed + '
Tracker name: ' + marker.data.add_info + '
'+marker.data.imei+'
'+adresse+', '+marker.data.Typ+' seit '+marker.data.Since; //forGrowl = encodeURIComponent(forGrowl); anzahlZeichen = marker.data.id.length; breite = anzahlZeichen * 13; hoehe = anzahlZeichen * 10; //alert(marker.data.gpsdatetime_dmyhis); //gelb-weiss-grau //tooltipDiv.innerHTML = '
EN: '+html2+'
'; //weiss-schwarz-grau-eckig // tooltipDiv.innerHTML = '
'+html2+'| test
'; //weiss-schwarz-grau-eckig //tooltipDiv.innerHTML = '
'+html2+'
'; //including 1und1 advertising //tooltipDiv.innerHTML = '
'+html2+'
'; var anchor_fence; switch(marker.data.deviceType) { case 'GMT100': //url= 'hallo'; anchor_fence = '| Fahrzeug sichern'; //alert(anchor_fence); break; case 'TK102-2': anchor_fence = '| Fahrzeug sichern'; break; default: anchor_fence = '| Fahrzeug sichern'; } //console.log('View: ' + marker.data.view); if(marker.data.view=='0') { marker.data.view = 10; } else { } //marker.data.view = 998; var lonLat=new OpenLayers.LonLat(marker.data.lon, marker.data.lat).transform(this.map.displayProjection, this.map.getProjectionObject()); var extent = this.map.getExtent(); var quadrant = extent.determineQuadrant(lonLat); switch(quadrant) { case 'tr': leftX = parseInt(-171*1); topX = parseInt(0*1); leftX1 = '-'; topX1 = '0px'; break; case 'br': leftX = parseInt(-180*1); topX = parseInt(-100*1); leftX1 = '00px'; topX1 = '-100px'; break; case 'tl': leftX = parseInt(0*1); topX = parseInt(0*1); leftX1 = '0px'; topX1 = '0px'; break; case 'bl': leftX = parseInt(0*1); topX = parseInt(-100*1); leftX1 = '0px'; topX1 = '-0px'; break; default: //default code block } if(marker.data.id=='-999'){ //return; } if(marker.data.view == 10) { if(marker.data.speed>=15) { icon = '../../images/help_green.png'; } else { icon = '../../images/help_red.png'; } headline = 'Fahrzeuginformationen'; //info = ''+marker.data.add_info+'
'+ marker.data.gpsdatetime+'
'+ marker.data.speed + '
groß'; tooltipDiv.innerHTML = '
' + '
'+ '' + '
' + '
' + marker.data.add_info + ' (' + marker.data.speed + ')
' + marker.data.gpsdatetime+'
'; tooltipDiv.innerHTML = '
' + '
'+ '' + '
' + '
' + marker.data.add_info + '
(' + marker.data.speed + ')
' + marker.data.gpsdatetime+'
'; console.log(marker.data.heading); //alert(marker.data.heading); } if(marker.data.view == 3) { tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
Name: ' + marker.data.add_info + '
'+ '' + marker.data.following +' '+ '
GPS: ' + marker.data.gpsdatetime_dmyhis + '
Jetzt: ' + marker.data.datetime_now + '
Ext. Strom: '+marker.data.last_extr_power+'Höhe: ' + marker.data.alt + '
' + marker.data.speed + ', ' + marker.data.sats + ' Sat.'+ ''+ '
Gerätetyp: ' + marker.data.manufactorer + '
'+ ''+ ''+ ' '+ ''+ 'Zoom: '+ '++/--/Nah/ fern, Google Maps'+ ''+ '
'+advertisement+'
'+ '
'+ '
'; } if(marker.data.view == 2) { tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '
Name: ' + marker.data.add_info + '
'+ '' + marker.data.following +''+ '
GPS: ' + marker.data.gpsdatetime + '
'+ 'verkleinern | vergrößern, Aus'+ '

yourGPS.de Lifetime Tracking Portal Flatrate
'+ '
'+ '
'; } if(marker.data.view == 1) { tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '' + '
' + marker.data.add_info + '
'+ ''+ '
'+ '
'+ '
'; } if(marker.data.view == 6) { info = ''+marker.data.add_info+'
'+ marker.data.gpsdatetime+'
'+ marker.data.speed; tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '' + '
' + marker.data.add_info + ', ' + marker.data.speed + ', GPS: ' + marker.data.gpsdatetime +', Ext. Strom: ' +marker.data.last_extr_power+'
'+ ''+ '
'+ '
'+ '
'; } if(marker.data.view == 11) { info = ''+marker.data.add_info+'
'+ marker.data.gpsdatetime+'
'+ marker.data.speed; tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ '' + '

'+ '
'+ '
'; } if(marker.data.view == 12) { info = ''+marker.data.add_info+'
'+ marker.data.gpsdatetime+'
'+ marker.data.speed; tooltipDiv.innerHTML = '
'+ '
'+ ''+ ''+ ''+ ''+ ''+ ''+ ''+ '' + '
' + marker.data.add_info + ', ' + marker.data.speed + ', GPS: ' + marker.data.gpsdatetime +', Ext. Strom: ' +marker.data.last_extr_power+'
'+ 'Nah, fern '+ '
'+ '
'+ '
'; } if(marker.data.view == 999) { var lonLat=new OpenLayers.LonLat(marker.data.lon, marker.data.lat).transform(this.map.displayProjection, this.map.getProjectionObject()); var extent = this.map.getExtent(); var quadrant = extent.determineQuadrant(lonLat); //alert(quadrant); if(marker.data.picture==0) { user_pic = ''; } else { user_pic = ''; } tooltipDiv.innerHTML = '
'+ '
'+ '
' + user_pic + '
' + marker.data.add_info + ',
' + marker.data.speed + '
' + marker.data.gpsdatetime_dmyhis + '
'+ '
'+ '
'; } if(marker.data.view == 998) { if(marker.data.speed>=15) { icon = marker.data.icon; } else { icon = marker.data.icon; } headline = 'Fahrzeuginformationen'; info = ''+marker.data.add_info+'
'+ marker.data.gpsdatetime+'
'+ marker.data.speed + '
groß'; tooltipDiv.innerHTML = ''; } //document.getElementById('blabla').innerHTML = 'test'; //tooltipDiv.innerHTML = '
'+marker.data.add_info+'
'; //showTracker(document.getElementById("1234").innerHTML); }, wrap: function (html, width, options) { var result = []; var blocks = OpenLayers.String.trim (html.replace (//,'\n')).split ('\n'); while (blocks.length >= 1) { var words = OpenLayers.String.trim (blocks.shift()).split(' '); while (words.length >= 1) { var line = words.shift(); while (words.length >= 1) { var word = OpenLayers.String.trim (words[0]); var probe = line + ' ' + word; var size = OpenLayers.Util.getRenderedDimensions ( probe, null, options); if (size.w > width) { break; } line = probe; words.shift(); } result.push (line); } } return result.join ('
'); }, //---------------------------------------------------------------------- // destroyMarker //---------------------------------------------------------------------- destroyMarker: function (marker) { if (this.currentMarker==marker) { this.destroyPopup(); } OpenLayers.Event.stopObservingElement(marker.icon.imageDiv); if(this.markers && this.markers.length) { OpenLayers.Util.removeItem (this.markers, marker); marker.destroy(); } }, erase: function (keepCurrent) { if (!keepCurrent) { this.destroyPopup(); } if (this.markers!==null) { for (var index in this.markers) { var marker = this.markers[index]; if (marker != this.currentMarker) { marker.destroy(); } } } this.markers = []; this.loadedAreas= {}; this.locations = []; if (this.currentMarker) { this.markers.push (this.currentMarker); } }, //---------------------------------------------------------------------- // markerClick //---------------------------------------------------------------------- //---------------------------------------------------------------------- // selectMarker //---------------------------------------------------------------------- //---------------------------------------------------------------------- // Popup - r/o //---------------------------------------------------------------------- processKeyPress: null, createPopup: function (marker, nopan) { this.destroyPopup (); //-------------------------------------------------------------- // check for overlapping icons //-------------------------------------------------------------- var cluster = []; if (this.clusterSize>0) { var limit = this.clusterSize/Math.pow(2,this.map.zoom)*156543; for (var i=0; ilimit) { continue; } if (Math.abs(marker.lonlat.lon-member.lonlat.lon)>limit) { continue; } cluster.push (member.data); if (member.data.location && this.locations[member.data.location]) { for (var j=0; j< this.locations[member.data.location].length; j++) { cluster.push (this.locations[ member.data.location][j]); } } } if (this.clusterSort) { cluster.sort(this.clusterSort); } } //-------------------------------------------------------------- // create popup //-------------------------------------------------------------- this.currentPopup = new OpenLayers.Popup.FramedCloud (null, marker.lonlat, null, //size (cluster.length>=2 ? this.createHtmlFromList(cluster) : this.createHtmlFromData(marker.data)), marker.icon, true, function (e) {this.layer.destroyPopup();} ); this.currentPopup.layer = this; if (this.cloudImage) { this.currentPopup.imageSrc = this.cloudImage; } if (nopan) { this.currentPopup.panMapIfOutOfView=false; } this.map.addPopup(this.currentPopup); this.currentPopup.div.control = this.currentPopup; if (this.closeOnClick) { this.currentPopup.div.onclick = function () { this.control.layer.destroyPopup(); return false; }; } if (this.closeKeyCode) { if (!this.processKeyPress) { var layer = this; this.processKeyPress = function (evt) { if (evt.keyCode === layer.closeKeyCode) { layer.destroyPopup(); } }; } OpenLayers.Event.observe (document, 'keypress', this.processKeyPress); } else { this.processKeyPress = false; } //-------------------------------------------------------------- // editbutton //-------------------------------------------------------------- if (this.enableUpdate || this.enableDelete || this.enableLocate) { var div = this.currentPopup.div.firstChild.firstChild; var buttons = div.getElementsByTagName('button'); if (this.checkEdit (marker.data)===true && !buttons.length) { if (this.enableUpdate) { var button = document.createElement ('button'); button.innerHTML = this.labelEdit; button.className = 'edit'; div.appendChild (button); } if (this.enableDelete) { button = document.createElement ('button'); button.innerHTML = this.labelDelete; button.className = 'delete'; div.appendChild (button); } if (this.enableLocate) { button = document.createElement ('button'); button.innerHTML = this.labelLocate; button.className = 'locate'; div.appendChild (button); } this.currentPopup.updateSize(); buttons = div.getElementsByTagName('button'); } for (i=0; i found.'); } //-------------------------------------------------------------- // default values //-------------------------------------------------------------- if (this.defaultValues) { for (var tag in this.defaultValues) { if (!marker.data[tag] && marker.data[tag]!==0) { marker.data[tag]=this.defaultValues[tag]; } } } this.fillForm (form, marker.data); form.marker = marker; form.onsubmit= this.formOnSubmit; form.onreset = this.formOnReset; form.elements[0].focus(); }, //---------------------------------------------------------------------- // form.submit //---------------------------------------------------------------------- formOnSubmit: function () { var layer = this.marker.layer; //-------------------------------------------------------------- // Extrakt values //-------------------------------------------------------------- var newData = { id: this.marker.data.id, lat: this.marker.data.lat, lon: this.marker.data.lon }; var inputs = this.getElementsByTagName('input'); for (var i=0; i=0 ? select.options[select.selectedIndex].value : ''; newData[select.name]=value; } var textareas = this.getElementsByTagName('textarea'); for (i=0; i0) { this.layer.updateMarker (this); } else { this.layer.destroyMarker (this); } }, scope: marker }); }, //---------------------------------------------------------------------- // Popups //---------------------------------------------------------------------- destroyPopup: function () { if (!this.currentPopup) { return false; } if (this.processKeyPress) { OpenLayers.Event.stopObserving (document, 'keypress', this.processKeyPress); } if (this.currentPopup.div) { this.currentPopup.div.control=null; } this.currentPopup.destroy(); this.currentPopup=null; if (this.currentMarker && this.currentMarker.temporary) { this.destroyMarker (this.currentMarker); } this.currentMarker=null; return true; }, //---------------------------------------------------------------------- // Parse CSV, get fieldnames from first line //---------------------------------------------------------------------- parseCSV: function (text) { var lines=text.split('\n'); var names = OpenLayers.String.trim(lines.shift()).split(this.fieldSeparator); if (names.length<2) { //top.location.href = 'http://www.yourGPS.de'; } if (!this.fieldTitles) { this.fieldTitles = {}; for (var i in names) { var name = names[i]; this.fieldTitles[name]=name; } } var result=[]; for (var lineno=0;lines.length>lineno;lineno++) { var object = {}; var values = OpenLayers.String.trim(lines[lineno]).split(this.fieldSeparator); if (values.length<=1) { continue; } for (var col=0; values.length>col; col++) { name = names[col]; if (name) { object[name] = values[col]; } else { tagval=values[col].split('='); if (tagval.length >= 2 && tagval[0]) { var tag = tagval.shift(); var val = tagval.join('='); if ((val || val===0) && !object[tag]) { object[tag]=val; } } } } result.push(object); } return result; }, //---------------------------------------------------------------------- // Create Icon for marker //---------------------------------------------------------------------- createIconFromData: function (data) { return this.icon ? this.icon.clone() : null; }, //---------------------------------------------------------------------- // Gen HTML code for Popup //---------------------------------------------------------------------- createHtmlFromData: function (data) { if (data._csize) { var icon = ''; return '
'+icon+' Dieses Icon ist in der Übersichtsdarstellung Platzhalter für '+data._csize+' Knoten in der nahen Umgebung. Diese werden ab Zoomstufe '+this.minZoom+' nachgeladen und angezeigt.
\n'; } var result = []; var rows = []; for (var tag in data) { if (this.fieldTypes[tag]=='hidden' || !data[tag]&&data[tag]!==0) { continue; } var title = this.fieldTitles[tag] || tag; var value = data[tag] || ''; if (this.fieldValues[tag] && this.fieldValues[tag][value]) { value = this.fieldValues[tag][value]; } rows.push ('' + this.html(title) + ':' + this.formatValue(value,tag).split('\034').join('
') + ''); } if (rows.length>=1) { result.push ('\n' + rows.join('\n') + '\n
'); } if (this.osmlinks) { osmlinks = this.createOsmLinks(data); if (osmlinks) { result.push ('

' + osmlinks + '

'); } } return result.join('\n'); }, //---------------------------------------------------------------------- // Editform //---------------------------------------------------------------------- createForm: function (data) { var result = []; result.push ('
'); result.push (''); for (name in this.fieldTitles) { if (name=='id' || name=='lat' || name=='lon') { continue; } var hName = this.html (name); var title = this.fieldTitles[name] || name; var valueTitles = this.fieldValues[name]; var field; switch (this.fieldTypes[name]) { case 'select': var options = []; for (var value in valueTitles) { var hTitle = this.html (valueTitles[value] || value); options.push (''); } field = ''; break; case 'radios': choices = []; for (value in valueTitles) { hTitle = this.html (valueTitles[value] || value); choices.push (' '); } field = choices.join('\n'); break; case 'textarea': field = ''; break; case 'checkbox': hTitle = this.html (valueTitles && valueTitles['t'] || ''); field = '' + hTitle; break; case 'password': field = ''; break; default: field = ''; break; } result.push (''); } result.push ('
'+this.html(title) +':'+field+'
'); for (name in this.fieldTypes) { if (this.fieldTypes[name]=='hidden') { result.push (''); } } result.push (''); result.push (''); return result.join ('\n'); }, fillForm: function (form, data) { var inputs = form.getElementsByTagName ('input'); for (var i=0; i' + this.html(text) + ''; } } else if (tag.substring(0,10)=='wikipedia:' && text.match(/^\S+$/)) { var wiki_lang = tag.match(/^wikipedia:(\w\w)$/); if (wiki_lang) { html_lemma = this.html(text); return '' + html_lemma + ''; } } else if (tag.match(/^(image|image:\w+)$/)) { var interwiki = text.match (/^(File:.*\S)/); if (interwiki) { html_interwiki = this.html (interwiki[1]); return '' + html_interwiki + ''; } } } var list=(text+'').split (';'); var result=[]; for (var i=0; i'+this.shrinkUrl(value)+''); continue; } if (value.substr (0,4)=='www.') { result.push (''+value+''); continue; } result.push (value); } return result.join ('; '); }, //---------------------------------------------------------------------- // Shrink URL //---------------------------------------------------------------------- shrinkUrl: function (url, includeProtocol, includeHost, includePath, includeQuery, includeHash) { if (!url) { return ''; } if (!includeProtocol) url = url.replace(/^[a-z]+:(\/\/)?/i, ''); if (!includeQuery) url = url.replace(/\?[^#]*/, ''); if (!includeHash) url = url.replace(/#.*/, ''); if (!includePath) url = url.replace(/\/[^?#]+\//, '/.../'); return url; }, //---------------------------------------------------------------------- // Parse URL //---------------------------------------------------------------------- parseURL: function (url) { if (!url) return null; var match = (url+'').match (/^\s*(https?:\/\/)?([\w.-]+(:\d+)?)((\/[^\s;]*)?)([;\s].*)?$/); if (match) { return (match[1] || 'http://') + match[2] + (match[4] || '/'); } //-------------------------------------------------------------- // unterwiki //-------------------------------------------------------------- match = url.match (/^\s*(File:.*\S)/); if (match) { return 'http://www.wikipedia.org/wiki/' + match[1].replace(/\040/g,'_'); } return null; }, //---------------------------------------------------------------------- // Encode text as HTML //---------------------------------------------------------------------- html: function (text) { if (text===null) { return ''; } return String(text).replace(/&/g,'&').replace(//g,'>'); }, //---------------------------------------------------------------------- // OSM specific links //---------------------------------------------------------------------- createOsmLinks: function (data, argId) { var osm = (id||data.id||'').match(/^([nwr])([1-9][0-9]*)$/); var type = osm ? {n:'node',r:'relation',w:'way'}[osm[1]] : null; var id = argId ? argId : osm ? osm[2] : null; var l=parseFloat(data.lon)-0.0001; var b=parseFloat(data.lat)-0.0002; var r=parseFloat(data.lon)+0.0001; var t=parseFloat(data.lat)+0.0002; if (data.bbox) { var lbrt = data.bbox.split(','); l = parseFloat(lbrt[0])-0.0001; b = parseFloat(lbrt[1])-0.0001; r = parseFloat(lbrt[2])+0.0001; t = parseFloat(lbrt[3])+0.0001; } var result = []; if (osm) { result.push ('' + type + ' ' + id + '' + ' - edit with'); } else { result.push ('edit area with'); } result.push('potlatch2 or'); if (osm) { result.push('josm.'); } else { result.push('josm.'); } return result.join(' '); }, //---------------------------------------------------------------------- // Lookup wikipedia URL in osm data //---------------------------------------------------------------------- getWikipediaURL: function (data) { //------------------------------------------------------ // wikipedia = LANG : LEMMA //------------------------------------------------------ match = (data.wikipedia||'').match(/^([a-z]+):([^\/;]*[^\/;\s])([;\s].*)?$/); if (match) { return 'http://' + match[1] + '.wikipedia.org/wiki/' + match[2].replace(/\040/g, '_'); } //------------------------------------------------------ // wikipedia = http[s]://LANG.wikipedia.org/wiki/LEMMA // wikipedia = LANG.wikipedia.org/wiki/LEMMA //------------------------------------------------------ match = (data.wikipedia||'').match(/^(https?:\/\/)?(\w+\.wikipedia\.org\/wiki\/[^\/;]*[^\/;\s])([;\s].*)?$/); if (match) { return 'http://' + match[2]; } //------------------------------------------------------ // wikipedia : LANG = ... //------------------------------------------------------ for (var tag in data) { var tagMatch = tag.match(/^wikipedia:([a-z]+)$/); if (!tagMatch) continue; //---------------------------------------------- // wikipedia : LANG = LEMMA //---------------------------------------------- valueMatch = data[tag].match(/^([^\/;]*[^\/;\s])\s*$/); if (valueMatch) { return 'http://' + tagMatch[1] + '.wikipedia.org/wiki/' + valueMatch[1].replace(/\040/g, '_'); } //---------------------------------------------- // wikipedia : LANG = http[s]://LANG.wikipedia.org/wiki/LEMMA // wikipedia : LANG = LANG.wikipedia.org/wiki/LEMMA //---------------------------------------------- valueMatch = data[tag].match(/^(https?:\/\/)?(\w+\.wikipedia\.org\/wiki\/[^;\s\/]+)([\s;].*)?$/); if (valueMatch) { return 'http://' + valueMatch[2]; } } //------------------------------------------------------ // No wikipedia tag //------------------------------------------------------ return null; }, //---------------------------------------------------------------------- // Combine entries to list //---------------------------------------------------------------------- createHtmlFromList: function (list) { var items = []; var clusters = []; var nItems=0; var limit = this.clusterLimit && this.clusterLimitlimit) { if (limit!=1) { items.unshift('Die ersten '+items.length+ ' von '+nItems+ ' Einträgen:'); } } else if (items.length) { if (limit!=1) { items.unshift('Alle '+items.length+ ' Einträge:'); } } else { items=clusters; } return items.join('
\n'); }, //---------------------------------------------------------------------- // Bounding box for markers //---------------------------------------------------------------------- getBounds: function () { if (!this.markers || !this.markers.length) { return null; } var bounds = new OpenLayers.Bounds (); if (this.region) { var count=0; for (var i in this.markers) { if (!this.markers[i].data.region) { continue; } if (this.markers[i].data.region.substr(0,length)!=this.region) { continue; } bounds.extend (this.markers[i].lonlat); count++; } if (count) { return bounds; } } for (i in this.markers) { bounds.extend (this.markers[i].lonlat); } return bounds; }, //---------------------------------------------------------------------- // create query from url params //---------------------------------------------------------------------- getQueryParams: function (params) { if (!params) { params = OpenLayers.Util.getParameters(); } var query=[]; var sets=new Object(); for (var tag in params) { var fov=tag.split('.'); var val=OpenLayers.String.trim(params[tag]); var field = fov[0]; var op = fov[1]; if (op=="value") { continue; } if (op=="op") { op = val; val= params[field+".value"]; } if (!op || val===null || val==='') { continue; } if (val=='~') { val = ' '; } switch (op) { case "eq": case "ge": case "gt": case "le": case "lt": case "ne": case "slength": var value=parseFloat(val); if (isNaN(value)) { continue; } query.push (field+"."+op+"="+value); continue; break; case "seq": case "sge": case "sgt": case "sle": case "slt": case "sne": case "peq": case "pge": case "ple": case "smatch": case "sregex": query.push (field+"."+op+"="+val); continue; break; case "isin": case "isinall": case "isnotin": if (!sets[op]) { sets[op]=new Object(); } if (!sets[op][field]) { sets[op][field]=[]; } sets[op][field].push(fov[2]?fov[2]:val); continue; break; default: break; } if (!confirm ("Fehler: field=["+field+"] op=["+op+"] val=["+val+"]")) { break; } } for (op in sets) { for (field in sets[op]) { query.push (field+"."+op+"="+sets[op][field].join(",")); } } return query.join("&"); }, CLASS_NAME: 'OpenLayers.Layer.PopupMarker' }); //-------------------------------------------------------------------------------- // $Id: popupmarker.js,v 1.112 2013/04/11 19:18:47 wolf Exp wolf $ //--------------------------------------------------------------------------------