From: Tom Hughes Date: Sat, 13 Aug 2011 17:33:22 +0000 (+0100) Subject: First pass at banishing the words "bug" and "OpenStreetBugs" X-Git-Tag: live~5058^2~138 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/a12b0878bc338cd5ec3c315c14148b1ea07b362a First pass at banishing the words "bug" and "OpenStreetBugs" --- diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index b4719f671..fa790dbb1 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -20,7 +20,7 @@ @@ -123,7 +123,7 @@ end <%= javascript_include_tag '/openlayers/OpenLayers.js' %> <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %> -<%= javascript_include_tag 'openstreetbugs.js' %> +<%= javascript_include_tag 'notes.js' %> <%= javascript_include_tag 'map.js' %> <%= render :partial => 'resize' %> @@ -146,24 +146,19 @@ end map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData); map.addLayer(map.dataLayer); - map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("Notes", { - serverURL: "/api/0.6/", - iconOpen: new OpenLayers.Icon("<%= image_path "open_note_marker.png" %>", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), - iconClosed: new OpenLayers.Icon("<%= image_path "closed_noe_marker.png" %>", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), - readonly: false, + map.noteLayer = new OpenLayers.Layer.Notes("Notes", { setCookie: false, permalinkURL: "http://www.openstreetmap.org/", - theme: "<%= stylesheet_path "openstreetbugs" %>", visibility: <%= params[:notes] == "yes" %> }); - map.addLayer(map.osbLayer); + map.addLayer(map.noteLayer); - map.osbControl = new OpenLayers.Control.OpenStreetBugs(map.osbLayer); - map.addControl(map.osbControl); + map.noteControl = new OpenLayers.Control.Notes(map.noteLayer); + map.addControl(map.noteControl); - $("reportbuganchor").observe("click", addBug); + $("createnoteanchor").observe("click", addNote); - map.events.register("zoomend", map, allowBugReports); + map.events.register("zoomend", map, allowNoteReports); <% end %> <% unless object_zoom %> @@ -292,16 +287,16 @@ end <% end %> } - function addBug() { - map.osbControl.activate(); - map.osbControl.addTemporaryMarker(map.getCenter()); + function addNote() { + map.noteControl.activate(); + map.noteControl.addTemporaryMarker(map.getCenter()); } - function allowBugReports() { + function allowNoteReports() { if (map.getZoom() > 11) { - $("reportbuganchor").style.visibility = "visible"; + $("createnoteanchor").style.visibility = "visible"; } else { - $("reportbuganchor").style.visibility = "hidden"; + $("createnoteanchor").style.visibility = "hidden"; } } diff --git a/config/locales/en.yml b/config/locales/en.yml index 685974ff9..2f558eb4d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1956,25 +1956,23 @@ en: history_tooltip: View edits for this area history_disabled_tooltip: Zoom in to view edits for this area history_zoom_alert: You must zoom in to view edits for this area - osb: - Fixed Error: Fixed Error - Unresolved Error: Unresolved Error - Description: Description - Comment: Comment - Has been fixed: This error has been fixed already. However, it might take a couple of days before the map image is updated. - Comment/Close: Comment/Close - Nickname: Nickname - Add comment: Add comment - Mark as fixed: Mark as fixed - Cancel: Cancel - Create OpenStreetBug: Create OpenStreetBug - Create bug: Report a problem with the map - Bug description: Problem description - Create: Report problem - Permalink: Permalink - Login: Login - Details: Details + note: + closed: Closed Note + open: Open Note + details: Details + permalink: Permalink + description: Description + comment: Comment + render_warning: This error has been fixed already. However, it might take a couple of days before the map image is updated. + update: Update + nickname: Nickname + login: Login + add_comment: Add Comment + close: Close + cancel: Cancel + create: Create Note + create_title: Report a problem with the map + create_help1: Please drag the marker to the location of the problem + create_help2: and descripe it as accurate as possible + report: Report Problem edityourself: You can also edit the map directly your self - draghelp1: Please drag the marker to the location of the problem - draghelp2: and descripe it as accurate as possible - diff --git a/public/images/icon_error_add.png b/public/images/icon_note_add.png similarity index 100% rename from public/images/icon_error_add.png rename to public/images/icon_note_add.png diff --git a/public/javascripts/notes.js b/public/javascripts/notes.js new file mode 100644 index 000000000..473498582 --- /dev/null +++ b/public/javascripts/notes.js @@ -0,0 +1,926 @@ +/* + Dervied from the OpenStreetBugs client, which is available + under the following license. + + 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. +*/ + +OpenLayers.Layer.Notes = new OpenLayers.Class(OpenLayers.Layer.Markers, { + /** + * The URL of the OpenStreetMap API. + * + * @var String + */ + serverURL : "/api/0.6/", + + /** + * Associative array (index: note ID) that is filled with the notes + * loaded in this layer. + * + * @var String + */ + notes : { }, + + /** + * The username to be used to change or create notes on OpenStreetMap. + * + * @var String + */ + username : "NoName", + + /** + * The icon to be used for an open note. + * + * @var OpenLayers.Icon + */ + iconOpen : new OpenLayers.Icon("/images/open_note_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), + + /** + * The icon to be used for a closed note. + * + * @var OpenLayers.Icon + */ + iconClosed : new OpenLayers.Icon("/images/closed_note_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)), + + /** + * The projection of the coordinates sent by the OpenStreetMap API. + * + * @var OpenLayers.Projection + */ + apiProjection : new OpenLayers.Projection("EPSG:4326"), + + /** + * If this is set to true, the user may not commit comments or close notes. + * + * @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 : "/stylesheets/notes.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.loadNotes); + + var cookies = document.cookie.split(/;\s*/); + for(var i=0; i/); + for(var i=0; i").replace(/&/g, "&"); + putAJAXMarker.notes[id] = [ + new OpenLayers.LonLat(lon, lat), + comments, + closed + ]; + for(var i=0; i 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. -*/ - -/** 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 - */ - serverURL : "/api/0.6/", - - /** - * 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("/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 - */ - 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. - * @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