- <% unless OSM_STATUS == :api_offline or OSM_STATUS == :database_offline %>
- map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", { "visibility": false });
- map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
- map.addLayer(map.dataLayer);
+ <% unless STATUS == :api_offline or STATUS == :database_offline %>
+ map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", { "visibility": false });
+ map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
+ map.addLayer(map.dataLayer);
+
+ map.noteLayer = new OpenLayers.Layer.Vector("Notes", {
+ visibility: false,
+ projection: new OpenLayers.Projection("EPSG:4326"),
+ styleMap: new OpenLayers.StyleMap(new OpenLayers.Style({
+ graphicWidth: 22,
+ graphicHeight: 22,
+ graphicOpacity: 0.7,
+ graphicXOffset: -11,
+ graphicYOffset: -11
+ }, {
+ rules: [
+ new OpenLayers.Rule({
+ filter: new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "status",
+ value: "open"
+ }),
+ symbolizer: {
+ externalGraphic: "<%= image_path 'open_note_marker.png' %>"
+ }
+ }),
+ new OpenLayers.Rule({
+ filter: new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "status",
+ value: "closed"
+ }),
+ symbolizer: {
+ externalGraphic: "<%= image_path 'closed_note_marker.png' %>"
+ }
+ })
+ ]
+ })),
+ strategies: [
+ new OpenLayers.Strategy.BBOX()
+ ],
+ protocol: new OpenLayers.Protocol.HTTP({
+ url: "<%= url_for :controller => :note, :action => :list, :format => :json %>",
+ format: new OpenLayers.Format.GeoJSON(),
+ callback: noteCallback
+ })
+ });
+ map.noteLayer.events.register("featureselected", map, noteSelected);
+ map.noteLayer.events.register("featureunselected", map, noteUnselected);
+ map.addLayer(map.noteLayer);
+
+ var noteControl = new OpenLayers.Control.SelectFeature(map.noteLayer, {
+ autoActivate: true
+ });
+ map.addControl(noteControl);
+
+ <% if params[:notes] == "yes" -%>
+ map.noteLayer.setVisibility(true);
+ <% end -%>
+
+ $("createnoteanchor").observe("click", addNote);
+
+ map.events.register("zoomend", map, allowNoteReports);