]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into openstreetbugs2
authorKai Krueger <kakrueger@gmail.com>
Wed, 20 Apr 2011 04:00:30 +0000 (22:00 -0600)
committerKai Krueger <kakrueger@gmail.com>
Wed, 20 Apr 2011 04:00:30 +0000 (22:00 -0600)
1  2 
app/controllers/browse_controller.rb
app/views/browse/_map.html.erb
app/views/site/index.html.erb
config/locales/en.yml

index 2962c6836a9a1a4f7e202c728a226e9a3f150ae0,a7dd5f5c95ff8b745b19fc3cac1831ac38c2177a..f6bd89d4de9396ef74b398dd9074aa2b93a42e0c
@@@ -72,18 -72,11 +72,20 @@@ class BrowseController < ApplicationCon
      @next = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id", { :id => @changeset.id }] ) 
      @prev = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id", { :id => @changeset.id }] )
  
-     @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
-     @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", {:id => @changeset.id, :user_id => @changeset.user_id }] )
+     if @changeset.user.data_public?
+       @next_by_user = Changeset.find(:first, :order => "id ASC", :conditions => [ "id > :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] )
+       @prev_by_user = Changeset.find(:first, :order => "id DESC", :conditions => [ "id < :id AND user_id = :user_id", { :id => @changeset.id, :user_id => @changeset.user_id }] )
+     end
    rescue ActiveRecord::RecordNotFound
      render :action => "not_found", :status => :not_found
    end
 +
 +  def bug
 +    @type = "bug"
 +    @bug = MapBug.find(params[:id])
 +    @next = MapBug.find(:first, :order => "id ASC", :conditions => [ "status != 'hidden' AND id > :id", { :id => @bug.id }] )
 +    @prev = MapBug.find(:first, :order => "id DESC", :conditions => [ "status != 'hidden' AND id < :id", { :id => @bug.id }] )
 +  rescue ActiveRecord::RecordNotFound
 +    render :action => "not_found", :status => :not_found
 +  end
  end
index 0b7f76f238b80daf3416433d3194f275cde38835,13a352820fc026366e12496d8e02c4dcb0ffb11c..2e20f07f38fc0a80ab7d1f1ca10a8f7d0676c379
@@@ -2,7 -2,7 +2,7 @@@
  <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
  <%= javascript_include_tag 'map.js' %>
  <div id="browse_map">
-   <% if map.instance_of? Changeset or map.visible %>
+   <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
    <div id="small_map">
    </div>
    <span id="loading"><%= t 'browse.map.loading' %></span>
@@@ -15,7 -15,7 +15,7 @@@
      <%= t 'browse.map.deleted' %>
    <% end %>
  </div>
- <% if map.instance_of? Changeset or map.visible %>
+ <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
    <script type="text/javascript">
      OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
  
  
          $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
          $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
 +      <% else if map.instance_of? MapBug %>
 +              $("loading").innerHTML = "";
 +              var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>);
 +        var zoom = 16;
 +        setMapCenter(centre, zoom);
 +              marker = addMarkerToMap(centre);
 +              $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>';
 +        $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
        <% else %>
          var obj_type = "<%= map.class.name.downcase %>";
          var obj_id = <%= map.id %>;
+         var obj_version = <%= map.version %>;
+         var obj_visible = <%= map.visible %>;
          var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
  
          if (obj_type != "node") {
            url += "/full";
+         } else if (!obj_visible) {
+           var previous_version = obj_version - 1;
+           url += "/" + previous_version;
          }
  
          addObjectToMap(url, true, function(extent) {
@@@ -72,7 -69,7 +77,7 @@@
              $("small_map").style.display = "none";
            }
          });
 -      <% end %>
 +      <% end end %>
      }
  
      window.onload = init;
index 305df63c0fd3212a4c1e0d4cbd9f7b6e6e04d668,0a0b7c1da5e873a9e2a9a450dee08e963773d77a..70402a1c94014a89fcb9e72e49fd4d2bd929d727
@@@ -1,6 -1,6 +1,6 @@@
  <% content_for :greeting do %>
  <% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
-   <%= link_to_function t('layouts.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)", { :title => t('layouts.home_tooltip') } %> |
+   <%= link_to_function t('layouts.home'), "setPosition(#{@user.home_lat}, #{@user.home_lon}, 15)", { :title => t('layouts.home_tooltip') } %> |
  <% end %>
  <% end %>
  
  <div id="map">
  </div>
  
+ <iframe id="linkloader" style="display: none">
+ </iframe>
  <div id="permalink">
    <a href="/" id="permalinkanchor"><%= t 'site.index.permalink' %></a><br/>
 -  <a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a>
 +  <a href="/" id="shortlinkanchor"><%= t 'site.index.shortlink' %></a><br/>
 +  <a href="/" id="ReportBug">Report a problem</a>     
  </div>
  
  <div id="attribution">
@@@ -64,18 -66,17 +67,17 @@@ if params['node'] or params['way'] or p
      end
  end
  
+ # Decide on a lat lon to initialise the map with. Various ways of doing this
  if params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat']
      bbox = true
      minlon = h(params['minlon'])
      minlat = h(params['minlat'])
      maxlon = h(params['maxlon'])
      maxlat = h(params['maxlat'])
+     layers = h(params['layers'])
      box = true if params['box']=="yes"
      object_zoom = false
- end
- # Decide on a lat lon to initialise the map with. Various ways of doing this
- if params['lon'] and params['lat']
+ elsif params['lon'] and params['lat']
      lon =  h(params['lon'])
      lat =  h(params['lat'])
      zoom =  h(params['zoom'] || '5')
@@@ -112,11 -113,8 +114,11 @@@ els
  end
  %>
  
 -<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
 +<!--Use stock OpenLayers for now, as the OSM one is missing some needed classes-->
 +<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
 +<!-- < %= javascript_include_tag '/openlayers/OpenLayers.js' % > -->
  <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
 +<%= javascript_include_tag 'openstreetbugs.js' %>
  <%= javascript_include_tag 'map.js' %>
  
  <script type="text/javascript" defer="defer">
  
    OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
  
 +  function createBugCallBack() {
 +      map.osbControl.deactivate();
 +      document.getElementById("map_OpenLayers_Container").style.cursor = "default";
 +  }
 +
    function mapInit(){
      map = createMap("map");
  
        map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", { "visibility": false });
        map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData);
        map.addLayer(map.dataLayer);
 +
 +      map.osbLayer = new OpenLayers.Layer.OpenStreetBugs("OpenStreetBugs", {
 +          serverURL : "/api/0.6/",
 +          iconOpen : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/open_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
 +          iconClosed : new OpenLayers.Icon("http://openstreetbugs.schokokeks.org/client/closed_bug_marker.png", new OpenLayers.Size(22, 22), new OpenLayers.Pixel(-11, -11)),
 +          readonly : false,
 +          setCookie : false,
 +          cookieLifetime : 1000, 
 +          cookiePath : "/my/map/", 
 +          permalinkURL : "http://www.openstreetmap.org/", 
 +          theme : "http://osm.cdauth.de/map/openstreetbugs.css" 
 +      });
 +
 +      map.addLayer(map.osbLayer);
 +
 +      map.osbControl = new OpenLayers.Control.OpenStreetBugs(map.osbLayer); 
 +      map.addControl(map.osbControl);
 +              
 +        var lBug = document.getElementById('ReportBug');
 +      lBug.addEventListener('click',function (e) {
 +              map.osbControl.activate(); document.getElementById("map_OpenLayers_Container").style.cursor = "crosshair"; if (e.stopPropagation) e.stopPropagation(); },false);
 +
 +
      <% end %>
  
      <% unless object_zoom %>
      resizeMap();
    }
  
+   function remoteEditHandler(event) {
+     var extent = getMapExtent();
+     var loaded = false;
+     $("linkloader").observe("load", function () { loaded = true; });
+     $("linkloader").src = "http://127.0.0.1:8111/load_and_zoom?left=" + extent.left + "&top=" + extent.top + "&right=" + extent.right + "&bottom=" + extent.bottom;
+     setTimeout(function () {
+       if (!loaded) alert("<%= escape_javascript(t('site.index.remote_failed')) %>");
+     }, 1000);
+     event.stop();
+   }
+   function installEditHandler() {
+     $("remoteanchor").observe("click", remoteEditHandler);
+     <% if preferred_editor == "remote" %>
+       $("editanchor").observe("click", remoteEditHandler);
+       <% if params[:action] == "edit" %>
+         remoteEditHandler();
+       <% end %>
+     <% end %>
+   }
    mapInit();
  
-   window.onload = handleResize;
-   window.onresize = handleResize;
+   Event.observe(window, "load", installEditHandler);
+   Event.observe(window, "load", handleResize);
+   Event.observe(window, "resize", handleResize);
  
    <% if params['action'] == 'export' %>
    <%= remote_function :url => { :controller => 'export', :action => 'start' } %>
diff --combined config/locales/en.yml
index 8d2a64564834cd0c8427040c2ebb79e75f7daa6a,7b341e7f452a01dd780f2a7c15ece999fdc7bf83..10e2eef7550664898ed6a40014561341369c4f17
@@@ -79,6 -79,17 +79,17 @@@ en
      with_id: "{{id}}"
      with_version: "{{id}}, v{{version}}"
      with_name: "{{name}} ({{id}})"
+   editor:
+     default: "Default (currently {{name}})"
+     potlatch:
+       name: "Potlatch 1"
+       description: "Potlatch 1 (in-browser editor)"
+     potlatch2:
+       name: "Potlatch 2"
+       description: "Potlatch 2 (in-browser editor)"
+     remote:
+       name: "Remote Control"
+       description: "Remote Control (JOSM or Merkaartor)"
    browse:
      changeset:
        title: "Changeset"
        zoom_or_select: "Zoom in or select an area of the map to view"
        drag_a_box: "Drag a box on the map to select an area"
        manually_select: "Manually select a different area"
+       hide_areas: "Hide areas"
+       show_areas: "Show areas"
        loaded_an_area_with_num_features: "You have loaded an area which contains [[num_features]] features. In general, some browsers may not cope well with displaying this quantity of data. Generally, browsers work best at displaying less than 100 features at a time: doing anything else may make your browser slow/unresponsive. If you are sure you want to display this data, you may do so by clicking the button below."
        load_data: "Load Data"
        unable_to_load_size: "Unable to load: Bounding box size of [[bbox_size]] is too large (must be smaller than {{max_bbox_size}})"
        download_xml: "Download XML"
        view_history: "view history"
        edit: "edit"
 +    bug:
 +      open_title: "Unresolved issue: {{bug_name}}"
 +      closed_title: "Resolved issue: {{bug_name}}"
 +      created_at: "Created at:"
 +      edited_at: "Edited at:"
 +      closed_at: "Closed at:"
 +      opened_by: "Opened by:"
 +      description: "Description:"
 +      comment_by: "Comment by: "
 +      comment: "Comment:"
 +      date: "Date:"
    changeset:
      changeset_paging_nav:
        showing_page: "Showing page {{page}}"
      gps_traces_tooltip: Manage GPS traces
      user_diaries: User Diaries
      user_diaries_tooltip: View user diaries
+     edit_with: Edit with {{editor}}
      tag_line: The Free Wiki World Map
      intro_1: "OpenStreetMap is a free editable map of the whole world. It is made by people like you."
      intro_2: "OpenStreetMap allows you to view, edit and use geographical data in a collaborative way from anywhere on Earth."
      osm_read_only: "The OpenStreetMap database is currently in read-only mode while essential database maintenance work is carried out."
      donate: "Support OpenStreetMap by {{link}} to the Hardware Upgrade Fund."
      donate_link_text: donating
-     help_and_wiki: "{{help}} & {{wiki}}"
      help: Help
+     help_centre: Help Centre
      help_url: http://help.openstreetmap.org/
      help_title: Help site for the project
      wiki: Wiki
      wiki_url: http://wiki.openstreetmap.org/
      wiki_title: Wiki site for the project
+     documentation: Documentation
+     documentation_title: Documentation for the project
      copyright: "Copyright &amp; License"
-     news_blog: "News blog"
-     news_blog_tooltip: "News blog about OpenStreetMap, free geographical data, etc."
-     shop: Shop
-     shop_tooltip: Shop with branded OpenStreetMap merchandise
-     shop_url: http://wiki.openstreetmap.org/wiki/Merchandise
+     community_blogs: "Community Blogs"
+     community_blogs_title: "Blogs from members of the OpenStreetMap community"
+     foundation: Foundation
+     foundation_title: The OpenStreetMap Foundation
+     sotm2011: 'Come to the 2011 OpenStreetMap Conference, The State of the Map, September 9-11th in Denver!'
      license:
        alt: CC by-sa 2.0
        title: OpenStreetMap data is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic License
            Resources Canada), CanVec (&copy; Department of Natural
            Resources Canada), and StatCan (Geography Division,
            Statistics Canada).</li>
+           <li><strong>France</strong>: Contains data sourced from
+           Direction Générale des Impôts.</i>
            <li><strong>New Zealand</strong>: Contains data sourced from
            Land Information New Zealand. Crown Copyright reserved.</li>
            <li><strong>Poland</strong>: Contains data from <a
          license_url: "http://creativecommons.org/licenses/by-sa/2.0/"
          project_name: "OpenStreetMap project"
          project_url: "http://openstreetmap.org"
+       remote_failed: "Editing failed - make sure JOSM or Merkaartor is loaded and the remote control option is enabled"
      edit:
        not_public: "You have not set your edits to be public."
        not_public_description: "You can no longer edit the map unless you do so. You can set your edits as public from your {{user_page}}."
        anon_edits_link_text: "Find out why this is the case."
        flash_player_required: 'You need a Flash player to use Potlatch, the 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>. <a href="http://wiki.openstreetmap.org/wiki/Editing">Several other options</a> are also available for editing OpenStreetMap.'
        potlatch_unsaved_changes: "You have unsaved changes. (To save in Potlatch, you should deselect the current way or point, if editing in live mode, or click save if you have a save button.)"
+       potlatch2_not_configured: "Potlatch 2 has not been configured - please see http://wiki.openstreetmap.org/wiki/The_Rails_Port#Potlatch_2 for more information"
+       potlatch2_unsaved_changes: "You have unsaved changes. (To save in Potlatch 2, you should click save.)"
+       no_iframe_support: "Your browser doesn't support HTML iframes, which are necessary for this feature."
      sidebar:
        search_results: Search Results
        close: Close
        submit_text: "Go"
        search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
      key:
-       map_key: "Map key"
+       map_key: "Map Key"
        map_key_tooltip: "Key for the map"
        table:
          entry:
        cookies_needed: "You appear to have cookies disabled - please enable cookies in your browser before continuing."
      setup_user_auth:
        blocked: "Your access to the API has been blocked. Please log-in to the web interface to find out more."
+       need_to_see_terms: "Your access to the API is temporarily suspended. Please log-in to the web interface to view the Contributor Terms. You do not need to agree, but you must view them."
    oauth:
      oauthorize:
        request_access: "The application {{app_name}} is requesting access to your account. Please check whether you would like the application to have the following capabilities. You may choose as many or as few as you like."
        remember: "Remember me:"
        lost password link: "Lost your password?"
        login_button: "Login"
+       register now: Register now
+       already have: Already have an OpenStreetMap account? Please login.
+       new to osm: New to OpenStreetMap?
+       to make changes: To make changes to the OpenStreetMap data, you must have an account.
+       create account minute: Create an account. It only takes a minute.
        account not active: "Sorry, your account is not active yet.<br />Please use the link in the account confirmation email to activate your account, or <a href=\"{{reconfirm}}\">request a new confirmation email</a>."
        account suspended: Sorry, your account has been suspended due to suspicious activity.<br />Please contact the {{webmaster}} if you wish to discuss this.
        webmaster: webmaster
        continue: Continue
        flash create success message: "Thanks for signing up. We've sent a confirmation note to {{email}} and as soon as you confirm your account you'll be able to get mapping.<br /><br />If you use an antispam system which sends confirmation requests then please make sure you whitelist webmaster@openstreetmap.org as we are unable to reply to any confirmation requests."
        terms accepted: "Thanks for accepting the new contributor terms!"
+       terms declined: "We are sorry that you have decided to not accept the new Contributor Terms. For more information, please see <a href=\"{{url}}\">this wiki page</a>."
+       terms declined url: http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined
      terms:
        title: "Contributor terms"
        heading: "Contributor terms"
        agree: Agree
        declined: "http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
        decline: "Decline"
+       you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue."
        legale_select: "Please select your country of residence:"
        legale_names:
          france: "France"
        add as friend: add as friend
        mapper since: "Mapper since:"
        ago: "({{time_in_words_ago}} ago)"
+       latest edit: "Latest edit {{ago}}:"
        email address: "Email address:"
        created from: "Created from:"
        status: "Status:"
          link text: "what is this?"
        profile description: "Profile Description:"
        preferred languages: "Preferred Languages:"
+       preferred editor: "Preferred Editor:"
        image: "Image:"
        new image: "Add an image"
        keep image: "Keep the current image"
        back: "View all blocks"
        revoker: "Revoker:"
        needs_view: "The user needs to log in before this block will be cleared."
 +  bugs:
 +    rss:
 +      description_area: "A list of bugs, reported, commented on or closed in your area [({{min_lat}}|{{min_lon}}) -- ({{max_lat}}|{{max_lon}})]"
 +      description_item: "An rss feed for bug {{id}}"
 +      closed: "closed bug (near {{place}})"
 +      new: "new bug (near {{place}})"
 +      comment: "new comment (near {{place}})"
 +    user:
 +      title_user: "Bugs submitted or commented on by {{user}}"
 +      heading_user: "{{user}}'s bugs"
 +      description_user: "Bugs submitted or commented on by {{user}}"
 +      id: "Id"
 +      last_changed: "Last changed"
 +
    javascripts:
      map:
        base: