]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/openstreetbugs.js
Deactivate OSB controller immediately after clicking a new bug
[rails.git] / public / javascripts / openstreetbugs.js
index fa3586ba39b375776333ceb274a9142eb459023f..b7a4685b93c3d2112df158c4ad7f032cb21dcb99 100644 (file)
@@ -20,7 +20,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
         * The URL of the OpenStreetBugs API.
         * @var String
        */
         * The URL of the OpenStreetBugs API.
         * @var String
        */
-       serverURL : "http://openstreetbugs.schokokeks.org/api/0.1/",
+       serverURL : "/api/0.6/",
 
        /**
         * Associative array (index: bug ID) that is filled with the bugs loaded in this layer
 
        /**
         * Associative array (index: bug ID) that is filled with the bugs loaded in this layer
@@ -38,13 +38,13 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
         * The icon to be used for an open bug
         * @var OpenLayers.Icon
        */
         * 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)),
+       iconOpen : new OpenLayers.Icon("/images/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
        */
 
        /**
         * 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)),
+       iconClosed : new OpenLayers.Icon("/images/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
 
        /**
         * The projection of the coordinates sent by the OpenStreetBugs API.
 
        /**
         * The projection of the coordinates sent by the OpenStreetBugs API.
@@ -319,9 +319,9 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
 
                el1.appendChild(document.createTextNode(" ["));
                el2 = document.createElement("a");
 
                el1.appendChild(document.createTextNode(" ["));
                el2 = document.createElement("a");
-               el2.href = "#";
+               el2.href = "/browse/bug/" + id;
                el2.onclick = function(){ layer.map.setCenter(putAJAXMarker.bugs[id][0].clone().transform(layer.apiProjection, layer.map.getProjectionObject()), 15); };
                el2.onclick = function(){ layer.map.setCenter(putAJAXMarker.bugs[id][0].clone().transform(layer.apiProjection, layer.map.getProjectionObject()), 15); };
-               el2.appendChild(document.createTextNode(OpenLayers.i18n("Zoom")));
+               el2.appendChild(document.createTextNode(OpenLayers.i18n("Details")));
                el1.appendChild(el2);
                el1.appendChild(document.createTextNode("]"));
 
                el1.appendChild(el2);
                el1.appendChild(document.createTextNode("]"));
 
@@ -468,7 +468,6 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                );
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                );
-               createBugCallBack();
        },
 
        /**
        },
 
        /**
@@ -588,7 +587,7 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
         * The icon to be used for the temporary markers that the “create bug” popup belongs to.
         * @var OpenLayers.Icon
        */
         * The icon to be used for the temporary markers that the “create bug” popup belongs to.
         * @var OpenLayers.Icon
        */
-       icon : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/icon_error_add.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
+       icon : new OpenLayers.Icon("/images/icon_error_add.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
 
        /**
         * An instance of the OpenStreetBugs layer that this control shall be connected to. Is set in the constructor.
 
        /**
         * An instance of the OpenStreetBugs layer that this control shall be connected to. Is set in the constructor.
@@ -634,6 +633,7 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
        */
        click: function(e) {
                if(!this.map) return true;
        */
        click: function(e) {
                if(!this.map) return true;
+               deactivateControl();
 
                var control = this;
                var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
 
                var control = this;
                var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
@@ -827,6 +827,11 @@ function osbResponse(error)
 putAJAXMarker.layers = [ ];
 putAJAXMarker.bugs = { };
 
 putAJAXMarker.layers = [ ];
 putAJAXMarker.bugs = { };
 
+function deactivateControl() { 
+    map.osbControl.deactivate(); 
+    document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default"; 
+  }
+
 
 /* Translations */
 
 
 /* Translations */