<div id="map">
<div id="permalink">
- <a href="/" id="permalinkanchor"><%= t 'site.index.permalink' %></a><br/>
+ <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' %>
-<script type="text/javascript" defer="defer">
+<script type="text/javascript">
var marker;
var map;
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);
+
+ $("createnoteanchor").observe("click", addNote);
+
+ map.events.register("zoomend", map, allowNoteReports);
<% end %>
<% unless object_zoom %>
setMapExtent(bbox);
<% if box %>
- // IE requires Vector layers be initialised on page load, and not under deferred script conditions
- Event.observe(window, 'load', function() { addBoxToMap(bbox) });
+ Event.observe(window, "load", function() { addBoxToMap(bbox) });
<% end %>
<% else %>
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
url += "/full";
<% end %>
- // IE requires Vector layers be initialised on page load, and not under deferred script conditions
- Event.observe(window, 'load', function() { addObjectToMap(url, <%= object_zoom %>) });
+ Event.observe(window, "load", function() { addObjectToMap(url, <%= object_zoom %>) });
<% end %>
map.events.register("moveend", map, updateLocation);
<% end %>
}
- mapInit();
+ function addNote() {
+ map.noteLayer.addNote(map.getCenter());
+ }
+
+ function allowNoteReports() {
+ if (map.getZoom() > 11) {
+ $("createnoteanchor").style.visibility = "visible";
+ } else {
+ $("createnoteanchor").style.visibility = "hidden";
+ }
+ }
- Event.observe(window, "load", installEditHandler);
- Event.observe(window, "load", handleResize);
+ document.observe("dom:loaded", mapInit);
+ document.observe("dom:loaded", installEditHandler);
+ document.observe("dom:loaded", handleResize);
Event.observe(window, "resize", function() {
var centre = map.getCenter();