]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/openstreetbugs.js
Merge branch 'master' into openstreetbugs
[rails.git] / public / javascripts / openstreetbugs.js
index 888477e7f3094824c3e05a8aedbe49c481d1af0d..12bd7d8594f9a83b3785bf3f16a67d3e1972b453 100644 (file)
  * 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.
 */
 
  * 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.
 */
 
+/** This version has been adapted from the original javascript library to fit the openstreetmap rails_port implementation */
+
 OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers, {
        /**
         * The URL of the OpenStreetBugs API.
         * @var String
        */
 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/",
+       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 +40,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.
@@ -246,7 +248,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                if(!bounds) return false;
                bounds.transform(this.map.getProjectionObject(), this.apiProjection);
 
                if(!bounds) return false;
                bounds.transform(this.map.getProjectionObject(), this.apiProjection);
 
-               this.apiRequest("bugs"
+               this.apiRequest("notes"
                        + "?bbox="+this.round(bounds.left, 5)
             + ","+this.round(bounds.bottom, 5)
                    + ","+this.round(bounds.right, 5)                   
                        + "?bbox="+this.round(bounds.left, 5)
             + ","+this.round(bounds.bottom, 5)
                    + ","+this.round(bounds.right, 5)                   
@@ -292,8 +294,8 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                var marker = feature.createMarker();
                marker.feature = feature;
                marker.events.register("click", feature, this.markerClick);
                var marker = feature.createMarker();
                marker.feature = feature;
                marker.events.register("click", feature, this.markerClick);
-               marker.events.register("mouseover", feature, this.markerMouseOver);
-               marker.events.register("mouseout", feature, this.markerMouseOut);
+               //marker.events.register("mouseover", feature, this.markerMouseOver);
+               //marker.events.register("mouseout", feature, this.markerMouseOut);
                this.addMarker(marker);
 
                this.bugs[id] = feature;
                this.addMarker(marker);
 
                this.bugs[id] = feature;
@@ -315,13 +317,13 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                var newContent = document.createElement("div");
 
                el1 = document.createElement("h3");
                var newContent = document.createElement("div");
 
                el1 = document.createElement("h3");
-               el1.appendChild(document.createTextNode(closed ? OpenLayers.i18n("Fixed Error") : OpenLayers.i18n("Unresolved Error")));
+               el1.appendChild(document.createTextNode(putAJAXMarker.bugs[id][2] ? i18n("javascripts.osb.Fixed Error") : i18n("javascripts.osb.Unresolved Error")));
 
                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(i18n("javascripts.osb.Details")));
                el1.appendChild(el2);
                el1.appendChild(document.createTextNode("]"));
 
                el1.appendChild(el2);
                el1.appendChild(document.createTextNode("]"));
 
@@ -330,7 +332,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        el1.appendChild(document.createTextNode(" ["));
                        el2 = document.createElement("a");
                        el2.href = this.permalinkURL + (this.permalinkURL.indexOf("?") == -1 ? "?" : "&") + "lon="+putAJAXMarker.bugs[id][0].lon+"&lat="+putAJAXMarker.bugs[id][0].lat+"&zoom=15";
                        el1.appendChild(document.createTextNode(" ["));
                        el2 = document.createElement("a");
                        el2.href = this.permalinkURL + (this.permalinkURL.indexOf("?") == -1 ? "?" : "&") + "lon="+putAJAXMarker.bugs[id][0].lon+"&lat="+putAJAXMarker.bugs[id][0].lat+"&zoom=15";
-                       el2.appendChild(document.createTextNode(OpenLayers.i18n("Permalink")));
+                       el2.appendChild(document.createTextNode(i18n("javascripts.osb.Permalink")));
                        el1.appendChild(el2);
                        el1.appendChild(document.createTextNode("]"));
                }
                        el1.appendChild(el2);
                        el1.appendChild(document.createTextNode("]"));
                }
@@ -359,12 +361,13 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                {
                        el2 = document.createElement("dt");
                        el2.className = (i == 0 ? "osb-description" : "osb-comment");
                {
                        el2 = document.createElement("dt");
                        el2.className = (i == 0 ? "osb-description" : "osb-comment");
-                       el2.appendChild(document.createTextNode(i == 0 ? OpenLayers.i18n("Description") : OpenLayers.i18n("Comment")));
+                       el2.appendChild(document.createTextNode(i == 0 ? i18n("javascripts.osb.Description") : i18n("javascripts.osb.Comment")));
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        el2.className = (i == 0 ? "osb-description" : "osb-comment");
                        el2.appendChild(document.createTextNode(putAJAXMarker.bugs[id][1][i]));
                        el1.appendChild(el2);
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        el2.className = (i == 0 ? "osb-description" : "osb-comment");
                        el2.appendChild(document.createTextNode(putAJAXMarker.bugs[id][1][i]));
                        el1.appendChild(el2);
+            if (i == 0) { el2 = document.createElement("br"); el1.appendChild(el2);};
                }
                containerDescription.appendChild(el1);
 
                }
                containerDescription.appendChild(el1);
 
@@ -373,7 +376,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        el1 = document.createElement("p");
                        el1.className = "osb-fixed";
                        el2 = document.createElement("em");
                        el1 = document.createElement("p");
                        el1.className = "osb-fixed";
                        el2 = document.createElement("em");
-                       el2.appendChild(document.createTextNode(OpenLayers.i18n("Has been fixed.")));
+                       el2.appendChild(document.createTextNode(i18n("javascripts.osb.Has been fixed")));
                        el1.appendChild(el2);
                        containerDescription.appendChild(el1);
                }
                        el1.appendChild(el2);
                        containerDescription.appendChild(el1);
                }
@@ -383,7 +386,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        el2 = document.createElement("input");
                        el2.setAttribute("type", "button");
                        el2.onclick = function(){ displayChange(); };
                        el2 = document.createElement("input");
                        el2.setAttribute("type", "button");
                        el2.onclick = function(){ displayChange(); };
-                       el2.value = OpenLayers.i18n("Comment/Close");
+                       el2.value = i18n("javascripts.osb.Comment/Close");
                        el1.appendChild(el2);
                        containerDescription.appendChild(el1);
 
                        el1.appendChild(el2);
                        containerDescription.appendChild(el1);
 
@@ -392,32 +395,47 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
 
                        el1 = document.createElement("dl");
                        el2 = document.createElement("dt");
 
                        el1 = document.createElement("dl");
                        el2 = document.createElement("dt");
-                       el2.appendChild(document.createTextNode(OpenLayers.i18n("Nickname")));
+                       el2.appendChild(document.createTextNode(i18n("javascripts.osb.Nickname")));
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        var inputUsername = document.createElement("input");
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        var inputUsername = document.createElement("input");
-                       inputUsername.value = this.username;
+                       var inputUsername = document.createElement("input");;
+                       if (typeof loginName === 'undefined') {
+                               inputUsername.value = this.username;
+                       } else {
+                               inputUsername.value = loginName;
+                               inputUsername.setAttribute('disabled','true');
+                       }
                        inputUsername.className = "osbUsername";
                        inputUsername.onkeyup = function(){ layer.setUserName(inputUsername.value); };
                        el2.appendChild(inputUsername);
                        inputUsername.className = "osbUsername";
                        inputUsername.onkeyup = function(){ layer.setUserName(inputUsername.value); };
                        el2.appendChild(inputUsername);
-                       el1.appendChild(el2);
+                       el3 = document.createElement("a");
+                       el3.setAttribute("href","login");
+                       el3.className = "hide_if_logged_in";
+                       el3.appendChild(document.createTextNode(i18n("javascripts.osb.Login")));
+                       el2.appendChild(el3)
+                       el1.appendChild(el2);                   
 
                        el2 = document.createElement("dt");
 
                        el2 = document.createElement("dt");
-                       el2.appendChild(document.createTextNode(OpenLayers.i18n("Comment")));
+                       el2.appendChild(document.createTextNode(i18n("javascripts.osb.Comment")));
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        var inputComment = document.createElement("textarea");
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
                        var inputComment = document.createElement("textarea");
-                       inputComment.setAttribute("cols",40);                   
+                       inputComment.setAttribute("cols",40);
+            inputComment.setAttribute("rows",3);
+       
                        el2.appendChild(inputComment);
                        el1.appendChild(el2);
                        el2.appendChild(inputComment);
                        el1.appendChild(el2);
+                       
                        el_form.appendChild(el1);
 
                        el1 = document.createElement("ul");
                        el1.className = "buttons";
                        el2 = document.createElement("li");
                        el3 = document.createElement("input");
                        el_form.appendChild(el1);
 
                        el1 = document.createElement("ul");
                        el1.className = "buttons";
                        el2 = document.createElement("li");
                        el3 = document.createElement("input");
-                       el3.setAttribute("type", "submit");
-                       el3.value = OpenLayers.i18n("Add comment");
+                       el3.setAttribute("type", "button");
+            el3.onclick = function(){ this.form.onsubmit(); return false; };
+                       el3.value = i18n("javascripts.osb.Add comment");
                        el2.appendChild(el3);
                        el1.appendChild(el2);
 
                        el2.appendChild(el3);
                        el1.appendChild(el2);
 
@@ -425,7 +443,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        el3 = document.createElement("input");
                        el3.setAttribute("type", "button");
                        el3.onclick = function(){ this.form.onsubmit(); layer.closeBug(id); layer.bugs[id].popup.hide(); return false; };
                        el3 = document.createElement("input");
                        el3.setAttribute("type", "button");
                        el3.onclick = function(){ this.form.onsubmit(); layer.closeBug(id); layer.bugs[id].popup.hide(); return false; };
-                       el3.value = OpenLayers.i18n("Mark as fixed");
+                       el3.value = i18n("javascripts.osb.Mark as fixed");
                        el2.appendChild(el3);
                        el1.appendChild(el2);
                        el_form.appendChild(el1);
                        el2.appendChild(el3);
                        el1.appendChild(el2);
                        el_form.appendChild(el1);
@@ -435,7 +453,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        el2 = document.createElement("input");
                        el2.setAttribute("type", "button");
                        el2.onclick = function(){ displayDescription(); };
                        el2 = document.createElement("input");
                        el2.setAttribute("type", "button");
                        el2.onclick = function(){ displayDescription(); };
-                       el2.value = OpenLayers.i18n("Cancel");
+                       el2.value = i18n("javascripts.osb.Cancel");
                        el1.appendChild(el2);
                        containerChange.appendChild(el1);
                }
                        el1.appendChild(el2);
                        containerChange.appendChild(el1);
                }
@@ -449,14 +467,13 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
         * @param String description
        */
        createBug: function(lonlat, description) {
         * @param String description
        */
        createBug: function(lonlat, description) {
-               this.apiRequest("bug/create"
+               this.apiRequest("note/create"
                        + "?lat="+encodeURIComponent(lonlat.lat)
                        + "&lon="+encodeURIComponent(lonlat.lon)
                        + "&text="+encodeURIComponent(description)
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                );
                        + "?lat="+encodeURIComponent(lonlat.lat)
                        + "&lon="+encodeURIComponent(lonlat.lon)
                        + "&text="+encodeURIComponent(description)
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                );
-               createBugCallBack();
        },
 
        /**
        },
 
        /**
@@ -465,7 +482,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
         * @param String comment
        */
        submitComment: function(id, comment) {
         * @param String comment
        */
        submitComment: function(id, comment) {
-               this.apiRequest("bug/"+encodeURIComponent(id)+"/comment"
+               this.apiRequest("note/"+encodeURIComponent(id)+"/comment"
                        + "?text="+encodeURIComponent(comment)
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
                        + "?text="+encodeURIComponent(comment)
                        + "&name="+encodeURIComponent(this.getUserName())
                        + "&format=js"
@@ -477,7 +494,7 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
         * @param Number id
        */
        closeBug: function(id) {
         * @param Number id
        */
        closeBug: function(id) {
-               this.apiRequest("bug/"+encodeURIComponent(id)+"/close"
+               this.apiRequest("note/"+encodeURIComponent(id)+"/close"
                        + "?format=js"
                );
        },
                        + "?format=js"
                );
        },
@@ -576,7 +593,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.
@@ -590,7 +607,7 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
        initialize: function(osbLayer, options) {
                this.osbLayer = osbLayer;
 
        initialize: function(osbLayer, options) {
                this.osbLayer = osbLayer;
 
-               this.title = OpenLayers.i18n("Create OpenStreetBug");
+               this.title = i18n("javascripts.osb.Create OpenStreetBug");
 
                OpenLayers.Control.prototype.initialize.apply(this, [ options ]);
 
 
                OpenLayers.Control.prototype.initialize.apply(this, [ options ]);
 
@@ -621,10 +638,15 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
         * Map clicking event handler. Adds a temporary marker with a popup to the map, the popup contains the form to add a bug.
        */
        click: function(e) {
         * Map clicking event handler. Adds a temporary marker with a popup to the map, the popup contains the form to add a bug.
        */
        click: function(e) {
+               var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
+               this.addTemporaryMarker(lonlat);
+       },
+
+       addTemporaryMarker: function(lonlat) {
                if(!this.map) return true;
                if(!this.map) return true;
+               deactivateControl();
 
                var control = this;
 
                var control = this;
-               var lonlat = this.map.getLonLatFromViewPortPx(e.xy);
                var lonlatApi = lonlat.clone().transform(this.map.getProjectionObject(), this.osbLayer.apiProjection);
                var feature = new OpenLayers.Feature(this.osbLayer, lonlat, { icon: this.icon.clone(), autoSize: true });
                feature.popupClass = OpenLayers.Popup.FramedCloud.OpenStreetBugs;
                var lonlatApi = lonlat.clone().transform(this.map.getProjectionObject(), this.osbLayer.apiProjection);
                var feature = new OpenLayers.Feature(this.osbLayer, lonlat, { icon: this.icon.clone(), autoSize: true });
                feature.popupClass = OpenLayers.Popup.FramedCloud.OpenStreetBugs;
@@ -632,50 +654,105 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
                marker.feature = feature;
                this.osbLayer.addMarker(marker);
 
                marker.feature = feature;
                this.osbLayer.addMarker(marker);
 
+
+               /** Implement a drag and drop for markers */
+               /* TODO: veryfy that the scoping of variables works correctly everywhere */             
+               var dragging = false;
+               var dragFunction = function(e) {
+                       map.events.unregister("mouseup",map,dragFunction);
+                       lonlat = map.getLonLatFromViewPortPx(e.xy);
+                       lonlatApi = lonlat.clone().transform(map.getProjectionObject(), map.osbLayer.apiProjection);
+                       marker.moveTo(map.getLayerPxFromViewPortPx(e.xy));
+                       marker.popup.moveTo(map.getLayerPxFromViewPortPx(e.xy));                        
+                       marker.popup.updateRelativePosition();
+                       dragging = false;
+                       return false;
+               };
+
+               marker.events.register("mouseover", this,
+                               function(){ document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "move"; });
+               marker.events.register("mouseout", this,
+                               function(){ if (!dragging) {document.getElementById("OpenLayers.Map_18_OpenLayers_Container").style.cursor = "default"; }});
+               marker.events.register("mousedown", this,
+                               function() { dragging = true; map.events.register("mouseup",map, dragFunction); return false;});
+               
+
                var newContent = document.createElement("div");
                var el1,el2,el3;
                el1 = document.createElement("h3");
                var newContent = document.createElement("div");
                var el1,el2,el3;
                el1 = document.createElement("h3");
-               el1.appendChild(document.createTextNode(OpenLayers.i18n("Create bug")));
+               el1.appendChild(document.createTextNode(i18n("javascripts.osb.Create bug")));
                newContent.appendChild(el1);
                newContent.appendChild(el1);
+               newContent.appendChild(document.createTextNode(i18n("javascripts.osb.draghelp1")));
+               newContent.appendChild(document.createElement("br"));
+               newContent.appendChild(document.createTextNode(i18n("javascripts.osb.draghelp2")));
+               newContent.appendChild(document.createElement("br"));
+               newContent.appendChild(document.createElement("br"));
 
                var el_form = document.createElement("form");
 
                var el_form = document.createElement("form");
-               el_form.onsubmit = function() { control.osbLayer.createBug(lonlatApi, inputDescription.value); marker.feature = null; feature.destroy(); return false; };
 
                el1 = document.createElement("dl");
                el2 = document.createElement("dt");
 
                el1 = document.createElement("dl");
                el2 = document.createElement("dt");
-               el2.appendChild(document.createTextNode(OpenLayers.i18n("Nickname")));
+               el2.appendChild(document.createTextNode(i18n("javascripts.osb.Nickname")));
                el1.appendChild(el2);
                el2 = document.createElement("dd");
                el1.appendChild(el2);
                el2 = document.createElement("dd");
-               var inputUsername = document.createElement("input");
-               inputUsername.value = this.osbLayer.username;
+               var inputUsername = document.createElement("input");;
+               if (typeof loginName === 'undefined') {
+                   inputUsername.value = this.osbLayer.username;
+               } else {
+                       inputUsername.value = loginName;
+                       inputUsername.setAttribute('disabled','true');
+               }               
                inputUsername.className = "osbUsername";
                inputUsername.className = "osbUsername";
+               
                inputUsername.onkeyup = function(){ control.osbLayer.setUserName(inputUsername.value); };
                el2.appendChild(inputUsername);
                inputUsername.onkeyup = function(){ control.osbLayer.setUserName(inputUsername.value); };
                el2.appendChild(inputUsername);
+               el3 = document.createElement("a");
+               el3.setAttribute("href","login");
+               el3.className = "hide_if_logged_in";
+               el3.appendChild(document.createTextNode(i18n("javascripts.osb.Login")));
+               el2.appendChild(el3);
                el1.appendChild(el2);
                el1.appendChild(el2);
+               el2 = document.createElement("br");
+        el1.appendChild(el2);
 
                el2 = document.createElement("dt");
 
                el2 = document.createElement("dt");
-               el2.appendChild(document.createTextNode(OpenLayers.i18n("Bug description")));
+               el2.appendChild(document.createTextNode(i18n("javascripts.osb.Bug description")));
                el1.appendChild(el2);
                el2 = document.createElement("dd");
                var inputDescription = document.createElement("textarea");
                inputDescription.setAttribute("cols",40);
                el1.appendChild(el2);
                el2 = document.createElement("dd");
                var inputDescription = document.createElement("textarea");
                inputDescription.setAttribute("cols",40);
+               inputDescription.setAttribute("rows",3);
                el2.appendChild(inputDescription);
                el1.appendChild(el2);
                el_form.appendChild(el1);
 
                el1 = document.createElement("div");
                el2 = document.createElement("input");
                el2.appendChild(inputDescription);
                el1.appendChild(el2);
                el_form.appendChild(el1);
 
                el1 = document.createElement("div");
                el2 = document.createElement("input");
-               el2.setAttribute("type", "submit");
-               el2.value = OpenLayers.i18n("Create");
+               el2.setAttribute("type", "button");
+               el2.value = i18n("javascripts.osb.Create");
+        el2.onclick = function() { control.osbLayer.createBug(lonlatApi, inputDescription.value); marker.feature = null; feature.destroy(); return false; };
+               el1.appendChild(el2);
+               el2 = document.createElement("input");
+               el2.setAttribute("type", "button");
+               el2.value = i18n("javascripts.osb.Cancel");
+               el2.onclick = function(){ feature.destroy(); };
                el1.appendChild(el2);
                el_form.appendChild(el1);
                newContent.appendChild(el_form);
 
                el1.appendChild(el2);
                el_form.appendChild(el1);
                newContent.appendChild(el_form);
 
+               el2 = document.createElement("hr");
+               el1.appendChild(el2);
+               el2 = document.createElement("a");
+               el2.setAttribute("href","edit");
+               el2.appendChild(document.createTextNode(i18n("javascripts.osb.edityourself")));
+               el1.appendChild(el2);
+
                feature.data.popupContentHTML = newContent;
                var popup = feature.createPopup(true);
                popup.events.register("close", this, function(){ feature.destroy(); });
                this.map.addPopup(popup);
                popup.updateSize();
                feature.data.popupContentHTML = newContent;
                var popup = feature.createPopup(true);
                popup.events.register("close", this, function(){ feature.destroy(); });
                this.map.addPopup(popup);
                popup.updateSize();
+               marker.popup = popup;
        },
 
        CLASS_NAME: "OpenLayers.Control.OpenStreetBugs"
        },
 
        CLASS_NAME: "OpenLayers.Control.OpenStreetBugs"
@@ -747,24 +824,6 @@ OpenLayers.Popup.FramedCloud.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Po
        CLASS_NAME: "OpenLayers.Popup.FramedCloud.OpenStreetBugs"
 });
 
        CLASS_NAME: "OpenLayers.Popup.FramedCloud.OpenStreetBugs"
 });
 
-/**
- * Necessary improvement to the translate function: Fall back to default language if translated string is not
- * available (see http://trac.openlayers.org/ticket/2308).
-*/
-
-OpenLayers.i18n = OpenLayers.Lang.translate = function(key, context) {
-       var message = OpenLayers.Lang[OpenLayers.Lang.getCode()][key];
-       if(!message)
-       {
-               if(OpenLayers.Lang[OpenLayers.Lang.defaultCode][key])
-                       message = OpenLayers.Lang[OpenLayers.Lang.defaultCode][key];
-               else
-                       message = key;
-       }
-       if(context)
-               message = OpenLayers.String.format(message, context);
-       return message;
-};
 
 /**
  * This global function is executed by the OpenStreetBugs API getBugs script.
 
 /**
  * This global function is executed by the OpenStreetBugs API getBugs script.
@@ -804,9 +863,16 @@ 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 */
 
+/*
+
 OpenLayers.Lang.en = OpenLayers.Util.extend(OpenLayers.Lang.en, {
        "Fixed Error" : "Fixed Error",
        "Unresolved Error" : "Unresolved Error",
 OpenLayers.Lang.en = OpenLayers.Util.extend(OpenLayers.Lang.en, {
        "Fixed Error" : "Fixed Error",
        "Unresolved Error" : "Unresolved Error",
@@ -920,3 +986,4 @@ OpenLayers.Lang.ro = OpenLayers.Util.extend(OpenLayers.Lang.ro, {
        "Permalink" : "Permalink",
        "Zoom" : "Zoom"
 });
        "Permalink" : "Permalink",
        "Zoom" : "Zoom"
 });
+*/