<div id="permalink">
<a href="/" id="permalinkanchor"><%= t 'site.index.permalink' %></a><br/>
- <a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a>
+ <a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a><br/>
+ <a href="#" id="reportbuganchor">Report a problem</a>
</div>
<div id="attribution">
end
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']
bbox = true
minlon = h(params['minlon'])
minlat = h(params['minlat'])
maxlon = h(params['maxlon'])
maxlat = h(params['maxlat'])
+ layers = h(params['layers'])
box = true if params['box']=="yes"
object_zoom = false
-end
-
-# Decide on a lat lon to initialise the map with. Various ways of doing this
-if params['lon'] and params['lat']
+elsif params['lon'] and params['lat']
lon = h(params['lon'])
lat = h(params['lat'])
zoom = h(params['zoom'] || '5')
<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
+<%= javascript_include_tag 'openstreetbugs.js' %>
<%= javascript_include_tag 'map.js' %>
<script type="text/javascript" defer="defer">
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.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,
+ setCookie: false,
+ permalinkURL: "http://www.openstreetmap.org/",
+ theme: "<%= stylesheet_path "openstreetbugs" %>",
+ visibility: false
+ });
+ map.addLayer(map.osbLayer);
+
+ map.osbControl = new OpenLayers.Control.OpenStreetBugs(map.osbLayer);
+ map.addControl(map.osbControl);
+
+ $("reportbuganchor").observe("click", addBug);
+
+ map.events.register("zoomend", map, allowBugReports);
<% end %>
<% unless object_zoom %>
$("linkloader").src = "http://127.0.0.1:8111/load_and_zoom?left=" + extent.left + "&top=" + extent.top + "&right=" + extent.right + "&bottom=" + extent.bottom;
setTimeout(function () {
- if (!loaded) alert("<%= t('site.index.remote_failed') %>");
+ if (!loaded) alert("<%= escape_javascript(t('site.index.remote_failed')) %>");
}, 1000);
event.stop();
<% end %>
}
+ function addBug() {
+ map.osbControl.activate();
+ map.osbControl.addTemporaryMarker(map.getCenter());
+ }
+
+ function allowBugReports() {
+ if (map.getZoom() > 11) {
+ $("reportbuganchor").style.visibility = "visible";
+ } else {
+ $("reportbuganchor").style.visibility = "hidden";
+ }
+ }
+
mapInit();
Event.observe(window, "load", installEditHandler);