Convert openstreetbugs javascript to new style api
This commit is contained in:
parent
59a6ed0e20
commit
aa61dfb1ae
2 changed files with 20 additions and 14 deletions
|
@ -126,6 +126,11 @@ end
|
||||||
|
|
||||||
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
|
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
|
||||||
|
|
||||||
|
function createBugCallBack() {
|
||||||
|
map.osbControl.deactivate();
|
||||||
|
document.getElementById("map_OpenLayers_Container").style.cursor = "default";
|
||||||
|
}
|
||||||
|
|
||||||
function mapInit(){
|
function mapInit(){
|
||||||
map = createMap("map");
|
map = createMap("map");
|
||||||
|
|
||||||
|
@ -135,7 +140,7 @@ end
|
||||||
map.addLayer(map.dataLayer);
|
map.addLayer(map.dataLayer);
|
||||||
|
|
||||||
map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("OpenStreetBugs", {
|
map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("OpenStreetBugs", {
|
||||||
serverURL : "/api/0.6/bugs/",
|
serverURL : "/api/0.6/",
|
||||||
iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
|
iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
|
||||||
iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
|
iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
|
||||||
readonly : false,
|
readonly : false,
|
||||||
|
|
|
@ -246,11 +246,11 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
|
||||||
if(!bounds) return false;
|
if(!bounds) return false;
|
||||||
bounds.transform(this.map.getProjectionObject(), this.apiProjection);
|
bounds.transform(this.map.getProjectionObject(), this.apiProjection);
|
||||||
|
|
||||||
this.apiRequest("getBugs"
|
this.apiRequest("bugs"
|
||||||
+ "?t="+this.round(bounds.top, 5)
|
+ "?bbox="+this.round(bounds.left, 5)
|
||||||
+ "&r="+this.round(bounds.right, 5)
|
+ ","+this.round(bounds.bottom, 5)
|
||||||
+ "&b="+this.round(bounds.bottom, 5)
|
+ ","+this.round(bounds.right, 5)
|
||||||
+ "&l="+this.round(bounds.left, 5));
|
+ ","+this.round(bounds.top, 5));
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -448,12 +448,14 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
|
||||||
* @param String description
|
* @param String description
|
||||||
*/
|
*/
|
||||||
createBug: function(lonlat, description) {
|
createBug: function(lonlat, description) {
|
||||||
this.apiRequest("addPOIexec"
|
this.apiRequest("bug/create"
|
||||||
+ "?lat="+encodeURIComponent(lonlat.lat)
|
+ "?lat="+encodeURIComponent(lonlat.lat)
|
||||||
+ "&lon="+encodeURIComponent(lonlat.lon)
|
+ "&lon="+encodeURIComponent(lonlat.lon)
|
||||||
+ "&text="+encodeURIComponent(description + " [" + this.getUserName() + "]")
|
+ "&text="+encodeURIComponent(description)
|
||||||
|
+ "&name="+encodeURIComponent(this.getUserName())
|
||||||
+ "&format=js"
|
+ "&format=js"
|
||||||
);
|
);
|
||||||
|
createBugCallBack();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -462,9 +464,9 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
|
||||||
* @param String comment
|
* @param String comment
|
||||||
*/
|
*/
|
||||||
submitComment: function(id, comment) {
|
submitComment: function(id, comment) {
|
||||||
this.apiRequest("editPOIexec"
|
this.apiRequest("bug/"+encodeURIComponent(id)+"/comment"
|
||||||
+ "?id="+encodeURIComponent(id)
|
+ "?text="+encodeURIComponent(comment)
|
||||||
+ "&text="+encodeURIComponent(comment + " [" + this.getUserName() + "]")
|
+ "&name="+encodeURIComponent(this.getUserName())
|
||||||
+ "&format=js"
|
+ "&format=js"
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -474,9 +476,8 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
|
||||||
* @param Number id
|
* @param Number id
|
||||||
*/
|
*/
|
||||||
closeBug: function(id) {
|
closeBug: function(id) {
|
||||||
this.apiRequest("closePOIexec"
|
this.apiRequest("bug/"+encodeURIComponent(id)+"/close"
|
||||||
+ "?id="+encodeURIComponent(id)
|
+ "?format=js"
|
||||||
+ "&format=js"
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue