/* This OpenStreetBugs client is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. */ /** * A fully functional OpenStreetBugs layer. See http://openstreetbugs.schokokeks.org/. * Even though the OpenStreetBugs API originally does not intend this, you can create multiple instances of this Layer and add them to different maps (or to one single map for whatever crazy reason) without problems. */ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers, { /** * The URL of the OpenStreetBugs API. * @var String */ serverURL : "http://openstreetbugs.schokokeks.org/api/0.1/", /** * Associative array (index: bug ID) that is filled with the bugs loaded in this layer * @var String */ bugs : { }, /** * The username to be used to change or create bugs on OpenStreetBugs * @var String */ username : "NoName", /** * The icon to be used for an open bug * @var OpenLayers.Icon */ iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), /** * The icon to be used for a closed bug * @var OpenLayers.Icon */ iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), /** * The projection of the coordinates sent by the OpenStreetBugs API. * @var OpenLayers.Projection */ apiProjection : new OpenLayers.Projection("EPSG:4326"), /** * If this is set to true, the user may not commit comments or close bugs. * @var Boolean */ readonly : false, /** * When the layer is hidden, all open popups are stored in this array in order to be re-opened again when the layer is made visible again. */ reopenPopups : [ ], /** * The user name will be saved in a cookie if this isn’t set to false. * @var Boolean */ setCookie : true, /** * The lifetime of the user name cookie in days. * @var Number */ cookieLifetime : 1000, /** * The path where the cookie will be available on this server. * @var String */ cookiePath : null, /** * A URL to append lon=123&lat=123&zoom=123 for the Permalinks. * @var String */ permalinkURL : "http://www.openstreetmap.org/", /** * A CSS file to be included. Set to null if you don’t need this. * @var String */ theme : "http://osm.cdauth.de/map/openstreetbugs.css", /** * @param String name */ initialize : function(name, options) { OpenLayers.Layer.Markers.prototype.initialize.apply(this, [ name, OpenLayers.Util.extend({ opacity: 0.7, projection: new OpenLayers.Projection("EPSG:4326") }, options) ]); putAJAXMarker.layers.push(this); this.events.addEventType("markerAdded"); this.events.register("visibilitychanged", this, this.updatePopupVisibility); this.events.register("visibilitychanged", this, this.loadBugs); var cookies = document.cookie.split(/;\s*/); for(var i=0; i/); for(var i=0; i").replace(/&/g, "&"); putAJAXMarker.bugs[id] = [ new OpenLayers.LonLat(lon, lat), comments, closed ]; for(var i=0; i