<div id="map">
<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 id="ReportBug">Report a problem</a>
</div>
</div>
end
%>
-<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
+<!--Use stock OpenLayers for now, as the OSM one is missing some needed classes-->
+<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
+<!-- < %= 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 %>");
+ function createBugCallBack() {
+ map.osbControl.deactivate();
+ document.getElementById("map_OpenLayers_Container").style.cursor = "default";
+ }
+
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("OpenStreetBugs", {
+ serverURL : "/api/0.6/",
+ iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
+ iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
+ readonly : false,
+ setCookie : false,
+ cookieLifetime : 1000,
+ cookiePath : "/my/map/",
+ permalinkURL : "http://www.openstreetmap.org/",
+ theme : "http://osm.cdauth.de/map/openstreetbugs.css"
+ });
+
+ map.addLayer(map.osbLayer);
+
+ map.osbControl = new OpenLayers.Control.OpenStreetBugs(map.osbLayer);
+ map.addControl(map.osbControl);
+
+ var lBug = document.getElementById('ReportBug');
+ lBug.addEventListener('click',function (e) {
+ map.osbControl.activate(); document.getElementById("map_OpenLayers_Container").style.cursor = "crosshair"; if (e.stopPropagation) e.stopPropagation(); },false);
+
+
<% end %>
<% unless object_zoom %>
url += "/full";
<% end %>
- addObjectToMap(url, <%= object_zoom %>);
+ // IE requires Vector layers be initialised on page load, and not under deferred script conditions
+ Event.observe(window, 'load', function() { addObjectToMap(url, <%= object_zoom %>) });
<% end %>
map.events.register("moveend", map, updateLocation);
function toggleData() {
if (map.dataLayer.visibility) {
<%= remote_function :url => { :controller => 'browse', :action => 'start' } %>
- } else {
+ } else if (map.dataLayer.active) {
closeSidebar();
}
}