]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/site/_potlatch2.html.erb
Potlatch 2 compiled with Flex 4.5 requires Flash 10.2.0 or above
[rails.git] / app / views / site / _potlatch2.html.erb
index ceb92558c590ddacf8274674a646a4d585f05025..04ada57a5650b3358c7ee14257ef2a647b3a3f1a 100644 (file)
@@ -1,5 +1,5 @@
 <div id="map">
 <div id="map">
-  <div id="potlatch"><%= t 'site.edit.flash_player_required' %></div>
+  <div id="potlatch"><%= raw t 'site.edit.flash_player_required' %></div>
 </div>
 
 <%= javascript_include_tag 'swfobject.js' %>
 </div>
 
 <%= javascript_include_tag 'swfobject.js' %>
@@ -13,7 +13,6 @@
 <% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
 
 <script type="text/javascript" defer="defer">
 <% locale = request.compatible_language_from(Potlatch2::LOCALES.keys) || "en" %>
 
 <script type="text/javascript" defer="defer">
-  var brokenContentSize = $("content").offsetWidth == 0;
   var changesaved=true;
   
   window.onbeforeunload=function() {
   var changesaved=true;
   
   window.onbeforeunload=function() {
     attributes.id = "potlatch";
     attributes.bgcolor = "#FFFFFF";
 
     attributes.id = "potlatch";
     attributes.bgcolor = "#FFFFFF";
 
-    swfobject.embedSWF("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "10.1.85","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
+    swfobject.embedSWF("<%= asset_path("/potlatch2/potlatch2.swf") %>", "potlatch", "100%", "100%", "10.2.0","<%= asset_path("expressInstall.swf") %>", flashvars, params, attributes);
     // 700,600 for fixed size, 100%,100% for resizable
   }
 
     // 700,600 for fixed size, 100%,100% for resizable
   }
 
+  <% if params[:node] -%>
+  <% bbox = Node.find(params[:node]).bbox.to_unscaled -%>
+  doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
+  <% elsif params[:way] -%>
+  <% bbox = Way.find(params[:way]).bbox.to_unscaled -%>
+  doSWF(<%= bbox.centre_lat %>,<%= bbox.centre_lon %>,16);
+  <% else -%>
   doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
   doSWF(<%= @lat || 'null' %>,<%= @lon || 'null' %>,<%= @zoom %>);
+  <% end -%>
 
   function setPosition(lat, lon, zoom) {
 
   function setPosition(lat, lon, zoom) {
-    $("potlatch").setPosition(lat, lon, Math.max(zoom || 15, 13));
+    $("#potlatch").each(function () {
+      this.setPosition(lat, lon, Math.max(zoom || 15, 13));
+    });
   }
 
   function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {
   }
 
   function mapMoved(lon, lat, zoom, minlon, minlat, maxlon, maxlat) {