1 <% if API_STATUS == :offline %>
2 <p>The OpenStreetMap database is currently offline while
3 essential database maintenance work is carried out.
5 <% elsif API_STATUS == :readonly %>
6 <p>The OpenStreetMap database is currently in read-only mode while
7 essential database maintenance work is carried out.
10 <% content_for :greeting do %>
11 <% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
12 <%= link_to_function 'home', "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)" %> |
16 <%= render :partial => 'search', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
18 <% session[:token] = @user.tokens.create.token unless session[:token] %>
20 <% if params['mlon'] and params['mlat'] %>
21 <% lon = params['mlon'] %>
22 <% lat = params['mlat'] %>
23 <% zoom = params['zoom'] || '12' %>
24 <% elsif @user and params['lon'].nil? and params['lat'].nil? %>
25 <% lon = @user.home_lon %>
26 <% lat = @user.home_lat %>
29 <% lon = params['lon'] || '-0.1' %>
30 <% lat = params['lat'] || '51.5' %>
31 <% zoom = params['zoom'] || '12' %>
34 <div id="map">You need a Flash player to use Potlatch, the
35 OpenStreetMap Flash editor. You can <a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">download Flash Player from Adobe.com</a>.
37 <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
38 for editing OpenStreetMap.
40 <script type="text/javascript" src="/javascripts/swfobject.js"></script>
41 <script type="text/javascript">
42 var brokenContentSize = $("content").offsetWidth == 0;
43 var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "700", "600", "6", "#FFFFFF");
45 function doSWF(lat,lon,sc) {
47 fo.addVariable('lat',lat);
48 fo.addVariable('long',lon);
49 fo.addVariable('scale',sc);
50 fo.addVariable('token','<%= session[:token] %>');
51 <% if params['gpx'] %> fo.addVariable('gpx','<%= params['gpx']+"/data" %>'); <% end %>
55 doSWF(<%= lat %>,<%= lon %>,<%= zoom %>);
57 function setPosition(lat, lon, zoom) {
58 doSWF(lat, lon, zoom);
61 function resizeContent() {
62 var content = $("content");
63 var rightMargin = parseInt(getStyle(content, "right"));
64 var bottomMargin = parseInt(getStyle(content, "bottom"));
66 content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
67 content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
70 function resizeMap() {
71 var search_results_width = $("search_results").offsetWidth;
73 if (search_results_width > 0) {
74 search_results_width = search_results_width + 5
77 $("map").style.left = (search_results_width) + "px";
78 $("map").style.width = ($("content").offsetWidth - search_results_width) + "px";
79 $("map").style.height = ($("content").offsetHeight - 2) + "px";
82 function handleResize() {
83 if (brokenContentSize) {
90 window.onresize = handleResize;
91 window.onload = handleResize;