]> git.openstreetmap.org Git - rails.git/blob - app/views/site/edit.rhtml
purge area layer when purging ways
[rails.git] / app / views / site / edit.rhtml
1 <% if API_STATUS == :offline %>
2 <p>The OpenStreetMap database is currently offline while
3    essential database maintenance work is carried out.
4 </p>
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.
8 </p>
9 <% else %>
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)" %> |
13 <% end %>
14 <% end %>
15
16 <%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
17 <%= render :partial => 'search' %>
18
19 <% session[:token] = @user.tokens.create.token unless session[:token] %>
20
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 %>
28 <% zoom = '12' %>
29 <%else%>
30 <% lon =  params['lon'] || '-0.1' %>
31 <% lat =  params['lat'] || '51.5' %>
32 <% zoom =  params['zoom'] || '12' %>
33 <% end %>
34
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>.
37
38     <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
39     for editing OpenStreetMap.
40 </div>
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");
45
46   function doSWF(lat,lon,sc) {
47     if (sc < 11) sc = 11;
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 %>
53     fo.write("map");
54   }
55
56   doSWF(<%= lat %>,<%= lon %>,<%= zoom %>);
57
58   function setPosition(lat, lon, zoom) {
59     doSWF(lat, lon, zoom);
60   }
61
62   function resizeContent() {
63     var content = $("content");
64     var rightMargin = parseInt(getStyle(content, "right"));
65     var bottomMargin = parseInt(getStyle(content, "bottom"));
66
67     content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
68     content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
69   }
70   
71   function resizeMap() {
72     var sidebar_width = $("sidebar").offsetWidth;
73
74     if (sidebar_width > 0) {
75       sidebar_width = sidebar_width + 5
76     }
77
78     $("map").style.left = (sidebar_width) + "px";
79     $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
80     $("map").style.height = ($("content").offsetHeight - 2) + "px";
81   }
82
83   function handleResize() {
84     if (brokenContentSize) {
85       resizeContent();
86     }
87
88     resizeMap();
89   }
90
91   window.onresize = handleResize;
92   window.onload = handleResize;
93
94
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);
100         openSidebar();
101 <% end %>
102
103
104 </script>
105 <% end %>