]> git.openstreetmap.org Git - rails.git/blobdiff - public/javascripts/openstreetbugs.js
Remove references to old server location
[rails.git] / public / javascripts / openstreetbugs.js
index 72eeb60cfde165cb949364f14320586fc42649c5..fff37eec1479c37334f801cae47ddee54c8cebed 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("]"));
 
@@ -396,19 +396,32 @@ OpenLayers.Layer.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Layer.Markers,
                        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(OpenLayers.i18n("Login")));
+                       el2.appendChild(el3)
+                       el1.appendChild(el2);                   
 
                        el2 = document.createElement("dt");
                        el2.appendChild(document.createTextNode(OpenLayers.i18n("Comment")));
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
 
                        el2 = document.createElement("dt");
                        el2.appendChild(document.createTextNode(OpenLayers.i18n("Comment")));
                        el1.appendChild(el2);
                        el2 = document.createElement("dd");
-                       var inputComment = document.createElement("input");
+                       var inputComment = document.createElement("textarea");
+                       inputComment.setAttribute("cols",40);                   
                        el2.appendChild(inputComment);
                        el1.appendChild(el2);
                        el2.appendChild(inputComment);
                        el1.appendChild(el2);
+                       
                        el_form.appendChild(el1);
 
                        el1 = document.createElement("ul");
                        el_form.appendChild(el1);
 
                        el1 = document.createElement("ul");
@@ -575,7 +588,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.
@@ -645,18 +658,30 @@ OpenLayers.Control.OpenStreetBugs = new OpenLayers.Class(OpenLayers.Control, {
                el2.appendChild(document.createTextNode(OpenLayers.i18n("Nickname")));
                el1.appendChild(el2);
                el2 = document.createElement("dd");
                el2.appendChild(document.createTextNode(OpenLayers.i18n("Nickname")));
                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(OpenLayers.i18n("Login")));
+               el2.appendChild(el3);
                el1.appendChild(el2);
 
                el2 = document.createElement("dt");
                el2.appendChild(document.createTextNode(OpenLayers.i18n("Bug description")));
                el1.appendChild(el2);
                el2 = document.createElement("dd");
                el1.appendChild(el2);
 
                el2 = document.createElement("dt");
                el2.appendChild(document.createTextNode(OpenLayers.i18n("Bug description")));
                el1.appendChild(el2);
                el2 = document.createElement("dd");
-               var inputDescription = document.createElement("input");
+               var inputDescription = document.createElement("textarea");
+               inputDescription.setAttribute("cols",40);
                el2.appendChild(inputDescription);
                el1.appendChild(el2);
                el_form.appendChild(el1);
                el2.appendChild(inputDescription);
                el1.appendChild(el2);
                el_form.appendChild(el1);