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 => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
17 <%= render :partial => 'search' %>
19 <% session[:token] = @user.tokens.create.token unless session[:token] %>
21 <% if params['mlon'] and params['mlat'] %>
22 <% lon = params['mlon'] %>
23 <% lat = params['mlat'] %>
24 <% zoom = params['zoom'] || '12' %>
25 <% elsif @user and params['lon'].nil? and params['lat'].nil? %>
26 <% lon = @user.home_lon %>
27 <% lat = @user.home_lat %>
30 <% lon = params['lon'] || '-0.1' %>
31 <% lat = params['lat'] || '51.5' %>
32 <% zoom = params['zoom'] || '12' %>
35 <div id="map">You need a Flash player to use Potlatch, the
36 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>.
38 <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
39 for editing OpenStreetMap.
41 <script type="text/javascript" src="/javascripts/swfobject.js"></script>
42 <script type="text/javascript">
43 var brokenContentSize = $("content").offsetWidth == 0;
44 var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "700", "600", "6", "#FFFFFF");
46 function doSWF(lat,lon,sc) {
48 fo.addVariable('lat',lat);
49 fo.addVariable('long',lon);
50 fo.addVariable('scale',sc);
51 fo.addVariable('token','<%= session[:token] %>');
52 <% if params['gpx'] %> fo.addVariable('gpx','<%= params['gpx']+"/data" %>'); <% end %>
56 doSWF(<%= lat %>,<%= lon %>,<%= zoom %>);
58 function setPosition(lat, lon, zoom) {
59 doSWF(lat, lon, zoom);
62 function resizeContent() {
63 var content = $("content");
64 var rightMargin = parseInt(getStyle(content, "right"));
65 var bottomMargin = parseInt(getStyle(content, "bottom"));
67 content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
68 content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
71 function resizeMap() {
72 var sidebar_width = $("sidebar").offsetWidth;
74 if (sidebar_width > 0) {
75 sidebar_width = sidebar_width + 5
78 $("map").style.left = (sidebar_width) + "px";
79 $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
80 $("map").style.height = ($("content").offsetHeight - 2) + "px";
83 function handleResize() {
84 if (brokenContentSize) {
91 window.onresize = handleResize;
92 window.onload = handleResize;
95 <% unless @user.data_public? %>
96 var warningtext ="<div style='padding-left:8px;padding-right:8px;'><p>You haven't set your edits to be public.</p><p><b>From mid-November, you will no longer be able to use the online editor unless you do so.</b> You can set your edits as public from your ";
97 var warningtext=warningtext+'<%= link_to 'user page', {:controller => 'user', :action => 'account', :display_name => @user.display_name}%>.</p>';
98 var warningtext=warningtext+'<p>(<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">Find out why this is changing.</a>)</p></div>';
99 updateSidebar("Warning",warningtext);