1 <% if OSM_STATUS == :database_offline or OSM_STATUS == :api_offline %>
 
   2 <p><%= t 'layouts.osm_offline' %>
 
   4 <% elsif OSM_STATUS == :database_readonly or OSM_STATUS == :api_readonly %>
 
   5 <p><%= t 'layouts.osm_read_only' %>
 
   7 <% elsif !@user.data_public? %>
 
   8 <p><%= t 'site.edit.not_public' %></p>
 
   9 <p><%= t 'site.edit.not_public_description', 
 
  10 :user_page => (link_to t('site.edit.user_page_link'), {:controller => 'user', :action => 'account', :display_name => @user.display_name, :anchor => 'public'}) %></p>
 
  11 <p><%= t 'site.edit.anon_edits', :link => link_to(t('site.edit.anon_edits_link_text'), t('site.edit.anon_edits_link')) %></p>
 
  13 <% content_for :greeting do %>
 
  14 <% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
 
  15 <%= link_to_function t('layouts.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)", { :title => t('layouts.home_tooltip') } %> |
 
  19 <%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
 
  20 <%= render :partial => 'search' %>
 
  23 session[:token] = @user.tokens.create.token unless session[:token]
 
  25 # Decide on a lat lon to initialise potlatch with. Various ways of doing this
 
  26 if params['lon'] and params['lat']
 
  27         lon =  h(params['lon']) 
 
  28         lat =  h(params['lat']) 
 
  29         zoom =  h(params['zoom'])
 
  31 elsif params['mlon'] and params['mlat'] 
 
  32         lon =  h(params['mlon']) 
 
  33         lat =  h(params['mlat']) 
 
  34         zoom =  h(params['zoom'])
 
  37         #use gpx id to locate (dealt with below)
 
  39 elsif cookies.key?("_osm_location")
 
  40         lon,lat,zoom,layers = cookies["_osm_location"].split("|")
 
  42 elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil? 
 
  47         #catch all.  Do nothing.  lat=nil, lon=nil
 
  48         #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
 
  51 zoom='14' if zoom.nil?
 
  55         <%= t 'site.edit.flash_player_required' %>
 
  58 <%= javascript_include_tag 'swfobject.js' %>
 
  59 <script type="text/javascript" defer="defer">
 
  60   var brokenContentSize = $("content").offsetWidth == 0;
 
  61   var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
 
  62   // 700,600 for fixed size, 100%,100% for resizable
 
  64   var winie=false; if (document.all && window.print) { winie=true; }
 
  66   window.onbeforeunload=function() {
 
  68       return '<%= escape_javascript(t('site.edit.potlatch_unsaved_changes')) %>';
 
  72   function markChanged(a) { changesaved=a; }
 
  74   function doSWF(lat,lon,sc) {
 
  76     fo.addVariable('winie',winie);
 
  77     fo.addVariable('scale',sc);
 
  78     fo.addVariable('token','<%= session[:token] %>');
 
  79     if (lat) { fo.addVariable('lat',lat); }
 
  80     if (lon) { fo.addVariable('long',lon); }
 
  81     <% if params['gpx']     %>fo.addVariable('gpx'     ,'<%= h(params['gpx']    ) %>');<% end %>
 
  82     <% if params['way']     %>fo.addVariable('way'     ,'<%= h(params['way']    ) %>');<% end %>
 
  83     <% if params['node']    %>fo.addVariable('node'    ,'<%= h(params['node']   ) %>');<% end %>
 
  84     <% if params['tileurl'] %>fo.addVariable('custombg','<%= h(params['tileurl']) %>');<% end %>
 
  88   doSWF(<%= lat || 'null' %>,<%= lon || 'null' %>,<%= zoom %>);
 
  90   function setPosition(lat, lon, zoom) {
 
  91     doSWF(lat, lon, zoom);
 
  94   function resizeContent() {
 
  95     var content = $("content");
 
  96     var rightMargin = parseInt(getStyle(content, "right"));
 
  97     var bottomMargin = parseInt(getStyle(content, "bottom"));
 
  99     content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
 
 100     content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
 
 103   function resizeMap() {
 
 104     var sidebar_width = $("sidebar").offsetWidth;
 
 106     if (sidebar_width > 0) {
 
 107       sidebar_width = sidebar_width + 5
 
 110     $("map").style.left = (sidebar_width) + "px";
 
 111     $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
 
 112     $("map").style.height = ($("content").offsetHeight - 2) + "px";
 
 115   function handleResize() {
 
 116     if (brokenContentSize) {
 
 123   function maximiseMap() {
 
 124     $("left").style.display = "none";
 
 125     $("greeting").style.display = "none";
 
 126     $("tabnav").style.display = "none";
 
 128     $("content").style.top = "10px";
 
 129     $("content").style.left = "10px";
 
 134   function minimiseMap() {
 
 135     $("left").style.display = "";
 
 136     $("greeting").style.display = "";
 
 137     $("tabnav").style.display = "";
 
 139     $("content").style.top = "35px";
 
 140     $("content").style.left = "192px";
 
 147   window.onload = handleResize;
 
 148   window.onresize = handleResize;