<div id="permalink">
<a href="/" id="permalinkanchor" class="geolink llz layers object"><%= t 'site.index.permalink' %></a><br/>
<a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a>
+ <a href="#" id="createnoteanchor">Report a problem</a>
</div>
</div>
end
# Decide on a lat lon to initialise the map with. Various ways of doing this
-if params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
+if params['bbox']
+ bbox = true
+ minlon, minlat, maxlon, maxlat = h(params['bbox']).split(",")
+ layers = h(params['layers'])
+ box = true if params['box']=="yes"
+ object_zoom = false
+elsif params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
bbox = true
minlon = h(params['minlon'])
minlat = h(params['minlat'])
<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
+<%= javascript_include_tag 'notes.js' %>
<%= javascript_include_tag 'map.js' %>
<%= render :partial => 'resize' %>
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
+ <% if @user %>
+ var loginName = "<%= @user.display_name %>"
+ <% end %>
+
function mapInit(){
map = createMap("map");
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.Notes("Notes", {
+ setCookie: false,
+ permalinkURL: "http://www.openstreetmap.org/",
+ visibility: <%= params[:notes] == "yes" %>
+ });
+ map.addLayer(map.noteLayer);
+
+ map.noteControl = new OpenLayers.Control.Notes(map.noteLayer);
+ map.addControl(map.noteControl);
+
+ $("createnoteanchor").observe("click", addNote);
+
+ map.events.register("zoomend", map, allowNoteReports);
<% end %>
<% unless object_zoom %>
<% end %>
}
+ function addNote() {
+ map.noteControl.activate();
+ map.noteControl.addTemporaryMarker(map.getCenter());
+ }
+
+ function allowNoteReports() {
+ if (map.getZoom() > 11) {
+ $("createnoteanchor").style.visibility = "visible";
+ } else {
+ $("createnoteanchor").style.visibility = "hidden";
+ }
+ }
+
document.observe("dom:loaded", mapInit);
document.observe("dom:loaded", installEditHandler);
document.observe("dom:loaded", handleResize);