]> git.openstreetmap.org Git - rails.git/commitdiff
Merge branch 'master' into openstreetbugs
authorTom Hughes <tom@compton.nu>
Mon, 6 Sep 2010 11:51:50 +0000 (12:51 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 6 Sep 2010 11:51:50 +0000 (12:51 +0100)
Conflicts:
config/environment.rb
config/routes.rb

1  2 
app/views/site/index.html.erb
config/locales/en.yml
config/routes.rb
lib/map_boundary.rb
lib/osm.rb

index 9098c1a8853740ac175cbb424471d97eb125ff3c,ddd66a861553e79b32936b224a70b8bf16e1e876..fc1e1ec5cba597128c72ccebd3fdc6ed041e07c7
@@@ -19,8 -19,7 +19,8 @@@
  <div id="map">
    <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 id="ReportBug">Report a problem</a>  
    </div>
  </div> 
  
@@@ -111,11 -110,8 +111,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");
  
-     <% unless OSM_STATUS == :api_offline or OSM_STATUS == :database_offline %>
+     <% unless STATUS == :api_offline or STATUS == :database_offline %>
        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 %>
diff --combined config/locales/en.yml
index 6828e56c33cc4beb377aa2102fab991adeea3dc6,870ea3276025ffa81e7145df6eaa63cbb8bc652d..8e091a22cd0c2ead45946fdb86bc7a49c3707b3b
@@@ -262,17 -262,6 +262,17 @@@ en
        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}}"
        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
        auth failure: "Sorry, could not log in with those details."
+       notice: "<a href=\"http://www.osmfoundation.org/wiki/License/We_Are_Changing_The_License\">Find out more about OpenStreetMap's upcoming license change</a> (<a href=\"http://wiki.openstreetmap.org/wiki/ODbL/We_Are_Changing_The_License\">translations</a>) (<a href=\"http://wiki.openstreetmap.org/wiki/Talk:ODbL/Upcoming\">discussion</a>)"
      logout:
        title: "Logout"
        heading: "Logout from OpenStreetMap"
        confirm password: "Confirm Password:"
        continue: Continue
        flash create success message: "User was successfully created. Check your email for a confirmation note, and you will be mapping in no time :-)<br /><br />Please note that you will not be able to login until you've received and confirmed your email address.<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:
+       title: "Contributor terms"
        heading: "Contributor terms"
-       press accept button: "Please read the agreement below and press the agree button to create your account."
+       read and accept: "Please read the agreement below and press the agree button to confirm that you accept the terms of this agreement for your existing and future contributions."
        consider_pd: "In addition to the above agreement, I consider my contributions to be in the Public Domain"
        consider_pd_why: "what's this?"
-       consider_pd_why_url: http://wiki.openstreetmap.org/wiki/Why_would_I_want_my_contributions_to_be_public_domain
+       consider_pd_why_url: http://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
        agree: Agree
        declined: "http://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
        decline: "Decline"
        public editing note:
          heading: "Public editing"
          text: "Currently your edits are anonymous and people cannot send you messages or see your location. To show what you edited and allow people to contact you through the website, click the button below. <b>Since the 0.6 API changeover, only public users can edit map data</b>. (<a href=\"http://wiki.openstreetmap.org/wiki/Anonymous_edits\">find out why</a>).<ul><li>Your email address will not be revealed by becoming public.</li><li>This action cannot be reversed and all new users are now public by default.</li></ul>"
+       contributor terms:
+         heading: "Contributor Terms:"
+         agreed: "You have agreed to the new Contributor Terms."
+         not yet agreed: "You have not yet agreed to the new Contributor Terms."
+         review link text: "Please follow this link at your convenience to review and accept the new Contributor Terms."
+         agreed_with_pd: "You have also declared that you consider your edits to be in the Public Domain."
+         link: "http://www.osmfoundation.org/wiki/License/Contributor_Terms"
+         link text: "what is this?"
        profile description: "Profile Description:"
        preferred languages: "Preferred Languages:"
        image: "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:
diff --combined config/routes.rb
index 49b58c844c37b9f3695b03f47ed0340442de35fe,e2018784dd4162b8d5780001070ce66167106a79..3cd95c983426b40df822f6910367f4e49049f9c5
@@@ -64,36 -64,15 +64,36 @@@ ActionController::Routing::Routes.draw 
    map.connect "api/#{API_VERSION}/gpx/create", :controller => 'trace', :action => 'api_create'
    map.connect "api/#{API_VERSION}/gpx/:id/details", :controller => 'trace', :action => 'api_details'
    map.connect "api/#{API_VERSION}/gpx/:id/data", :controller => 'trace', :action => 'api_data'
+   map.connect "api/#{API_VERSION}/gpx/:id/data.:format", :controller => 'trace', :action => 'api_data'
    
    # AMF (ActionScript) API
    
    map.connect "api/#{API_VERSION}/amf/read", :controller =>'amf', :action =>'amf_read'
    map.connect "api/#{API_VERSION}/amf/write", :controller =>'amf', :action =>'amf_write'
    map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
 +
 +  # Map Bugs API  
 +  map.connect "api/#{API_VERSION}/bugs/getBugs", :controller =>'map_bugs', :action =>'get_bugs'
 +  map.connect "api/#{API_VERSION}/bugs/addPOIexec", :controller =>'map_bugs', :action =>'add_bug'
 +  map.connect "api/#{API_VERSION}/bugs/closePOIexec", :controller =>'map_bugs', :action =>'close_bug'
 +  map.connect "api/#{API_VERSION}/bugs/editPOIexec", :controller =>'map_bugs', :action =>'edit_bug'
 +  map.connect "api/#{API_VERSION}/bugs/getGPX", :controller =>'map_bugs', :action =>'gpx_bugs'
 +  map.connect "api/#{API_VERSION}/bugs/getRSSfeed", :controller =>'map_bugs', :action =>'rss'
 +
 +  map.connect "api/#{API_VERSION}/bugs", :controller => 'map_bugs', :action => 'get_bugs'
 +  map.connect "api/#{API_VERSION}/bugs/search", :controller => 'map_bugs', :action => 'search'
 +  map.connect "api/#{API_VERSION}/bugs/rss", :controller =>'map_bugs', :action =>'rss'
 +  map.connect "api/#{API_VERSION}/bug/create", :controller => 'map_bugs', :action => 'add_bug'
 +  map.connect "api/#{API_VERSION}/bug/:id/comment", :controller => 'map_bugs', :action => 'edit_bug', :id => /\d+/
 +  map.connect "api/#{API_VERSION}/bug/:id/close", :controller => 'map_bugs', :action => 'close_bug', :id => /\d+/
 +  map.connect "api/#{API_VERSION}/bug/:id", :controller => 'map_bugs', :action => 'read', :id => /\d+/, :conditions => { :method => :get }
 +  map.connect "api/#{API_VERSION}/bug/:id", :controller => 'map_bugs', :action => 'delete', :id => /\d+/, :conditions => { :method => :delete }
 +
 +  map.connect '/user/:display_name/bugs', :controller => 'map_bugs', :action => 'my_bugs'
 +  
 +
    
    # Data browsing
-   map.connect '/browse', :controller => 'changeset', :action => 'list'
    map.connect '/browse/start', :controller => 'browse', :action => 'start'
    map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
    map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
    map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
    map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
    map.changeset '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
-   map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
+   map.connect '/user/:display_name/edits/feed', :controller => 'changeset', :action => 'list', :format =>:atom
+   map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
    map.connect '/browse/changesets/feed', :controller => 'changeset', :action => 'list', :format => :atom
-   
+   map.connect '/browse/changesets', :controller => 'changeset', :action => 'list'
 +  map.connect '/browse/bug/:id', :controller => 'browse', :action => 'bug', :id => /\d+/
+   map.connect '/browse', :controller => 'changeset', :action => 'list'
    # web site
    map.root :controller => 'site', :action => 'index'
    map.connect '/', :controller => 'site', :action => 'index'
    map.connect '/go/:code', :controller => 'site', :action => 'permalink', :code => /[a-zA-Z0-9_@]+[=-]*/
  
    # traces  
-   map.connect '/traces', :controller => 'trace', :action => 'list'
-   map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
-   map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
-   map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
+   map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
+   map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
+   map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
+   map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
+   map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
+   map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
+   map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
+   map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
+   map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
    map.connect '/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
+   map.connect '/traces/tag/:tag', :controller => 'trace', :action => 'list'
+   map.connect '/traces/page/:page', :controller => 'trace', :action => 'list'
+   map.connect '/traces', :controller => 'trace', :action => 'list'
    map.connect '/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
-   map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
-   map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
-   map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
+   map.connect '/traces/rss', :controller => 'trace', :action => 'georss'
    map.connect '/traces/mine/tag/:tag/page/:page', :controller => 'trace', :action => 'mine'
+   map.connect '/traces/mine/tag/:tag', :controller => 'trace', :action => 'mine'
+   map.connect '/traces/mine/page/:page', :controller => 'trace', :action => 'mine'
+   map.connect '/traces/mine', :controller => 'trace', :action => 'mine'
    map.connect '/trace/create', :controller => 'trace', :action => 'create'
    map.connect '/trace/:id/data', :controller => 'trace', :action => 'data'
    map.connect '/trace/:id/data.:format', :controller => 'trace', :action => 'data'
    map.connect '/trace/:id/edit', :controller => 'trace', :action => 'edit'
    map.connect '/trace/:id/delete', :controller => 'trace', :action => 'delete'
-   map.connect '/user/:display_name/traces', :controller => 'trace', :action => 'list'
-   map.connect '/user/:display_name/traces/page/:page', :controller => 'trace', :action => 'list'
-   map.connect '/user/:display_name/traces/rss', :controller => 'trace', :action => 'georss'
-   map.connect '/user/:display_name/traces/tag/:tag', :controller => 'trace', :action => 'list'
-   map.connect '/user/:display_name/traces/tag/:tag/page/:page', :controller => 'trace', :action => 'list'
-   map.connect '/user/:display_name/traces/tag/:tag/rss', :controller => 'trace', :action => 'georss'
-   map.connect '/user/:display_name/traces/:id', :controller => 'trace', :action => 'view'
-   map.connect '/user/:display_name/traces/:id/picture', :controller => 'trace', :action => 'picture'
-   map.connect '/user/:display_name/traces/:id/icon', :controller => 'trace', :action => 'icon'
  
-   # user pages
-   map.connect '/user/:display_name', :controller => 'user', :action => 'view'
-   map.connect '/user/:display_name/edits', :controller => 'changeset', :action => 'list'
-   map.connect '/user/:display_name/edits/feed', :controller => 'changeset', :action => 'list', :format =>:atom
-   map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
-   map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
+   # diary pages
+   map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
+   map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
+   map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
+   map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
    map.connect '/user/:display_name/diary', :controller => 'diary_entry', :action => 'list'
+   map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
+   map.connect '/diary', :controller => 'diary_entry', :action => 'list'
    map.connect '/user/:display_name/diary/:id', :controller => 'diary_entry', :action => 'view', :id => /\d+/
    map.connect '/user/:display_name/diary/:id/newcomment', :controller => 'diary_entry', :action => 'comment', :id => /\d+/
-   map.connect '/user/:display_name/diary/rss', :controller => 'diary_entry', :action => 'rss'
    map.connect '/user/:display_name/diary/:id/edit', :controller => 'diary_entry', :action => 'edit', :id => /\d+/
    map.connect '/user/:display_name/diary/:id/hide', :controller => 'diary_entry', :action => 'hide', :id => /\d+/
    map.connect '/user/:display_name/diary/:id/hidecomment/:comment', :controller => 'diary_entry', :action => 'hidecomment', :id => /\d+/, :comment => /\d+/
+   # user pages
+   map.connect '/user/:display_name', :controller => 'user', :action => 'view'
+   map.connect '/user/:display_name/make_friend', :controller => 'user', :action => 'make_friend'
+   map.connect '/user/:display_name/remove_friend', :controller => 'user', :action => 'remove_friend'
    map.connect '/user/:display_name/account', :controller => 'user', :action => 'account'
    map.connect '/user/:display_name/set_status', :controller => 'user', :action => 'set_status'
    map.connect '/user/:display_name/delete', :controller => 'user', :action => 'delete'
-   map.connect '/diary/new', :controller => 'diary_entry', :action => 'new'
-   map.connect '/diary', :controller => 'diary_entry', :action => 'list'
-   map.connect '/diary/rss', :controller => 'diary_entry', :action => 'rss'
-   map.connect '/diary/:language', :controller => 'diary_entry', :action => 'list'
-   map.connect '/diary/:language/rss', :controller => 'diary_entry', :action => 'rss'
  
    # user lists
    map.connect '/users', :controller => 'user', :action => 'list'
    map.connect '/user/:display_name/role/:role/revoke', :controller => 'user_roles', :action => 'revoke'
    map.connect '/user/:display_name/blocks', :controller => 'user_blocks', :action => 'blocks_on'
    map.connect '/user/:display_name/blocks_by', :controller => 'user_blocks', :action => 'blocks_by'
+   map.connect '/blocks/new/:display_name', :controller => 'user_blocks', :action => 'new'
    map.resources :user_blocks, :as => 'blocks'
    map.connect '/blocks/:id/revoke', :controller => 'user_blocks', :action => 'revoke'
-   map.connect '/blocks/new/:display_name', :controller => 'user_blocks', :action => 'new'
  
    # fall through
    map.connect ':controller/:id/:action'
diff --combined lib/map_boundary.rb
index f2a0c0b520b515130479e7bca3d8289eb6c42cee,f3accf2da4e5b12241c0a0ac4091ec9d5791e929..7d20d2920ba06f25fe317bec859d02a8553fc6a0
@@@ -9,7 -9,7 +9,7 @@@ module MapBoundar
      return min_lon, min_lat, max_lon, max_lat
    end
  
 -  def check_boundaries(min_lon, min_lat, max_lon, max_lat)
 +  def check_boundaries(min_lon, min_lat, max_lon, max_lat, limit_small_area = :true)
      # check the bbox is sane
      unless min_lon <= max_lon
        raise OSM::APIBadBoundingBox.new("The minimum longitude must be less than the maximum longitude, but it wasn't")
        raise OSM::APIBadBoundingBox.new("The latitudes must be between -90 and 90, and longitudes between -180 and 180")
      end
  
 +      return unless limit_small_area == :true
 +
      # check the bbox isn't too large
      requested_area = (max_lat-min_lat)*(max_lon-min_lon)
-     if requested_area > APP_CONFIG['max_request_area']
-       raise OSM::APIBadBoundingBox.new("The maximum bbox size is " + APP_CONFIG['max_request_area'].to_s + 
+     if requested_area > MAX_REQUEST_AREA
+       raise OSM::APIBadBoundingBox.new("The maximum bbox size is " + MAX_REQUEST_AREA.to_s + 
          ", and your request was too large. Either request a smaller area, or use planet.osm")
      end
    end
diff --combined lib/osm.rb
index c34c928ffb350abdda8f340a124ff051d1b0c143,eaee7c328032f0373073b7f70aab777f20c169a0..78d32e739e39cb7a0c259665ff544e4b4352780e
@@@ -498,7 -498,7 +498,7 @@@ module OS
  
    # Return an SQL fragment to select a given area of the globe
    def self.sql_for_area(minlat, minlon, maxlat, maxlon, prefix = nil)
 -    tilesql = QuadTile.sql_for_area(minlat, minlon, maxlat, maxlon, prefix)
 +      tilesql = QuadTile.sql_for_area(minlat, minlon, maxlat, maxlon, prefix)
      minlat = (minlat * 10000000).round
      minlon = (minlon * 10000000).round
      maxlat = (maxlat * 10000000).round
      return "#{tilesql} AND #{prefix}latitude BETWEEN #{minlat} AND #{maxlat} AND #{prefix}longitude BETWEEN #{minlon} AND #{maxlon}"
    end
  
 +  # Return an SQL fragment to select a given area of the globe without using the quadtile index
 +  def self.sql_for_area_no_quadtile(minlat, minlon, maxlat, maxlon, prefix = nil, without_quadtile = :false)
 +    minlat = (minlat * 10000000).round
 +    minlon = (minlon * 10000000).round
 +    maxlat = (maxlat * 10000000).round
 +    maxlon = (maxlon * 10000000).round
 +
 +    return "#{prefix}latitude BETWEEN #{minlat} AND #{maxlat} AND #{prefix}longitude BETWEEN #{minlon} AND #{maxlon}"
 +  end
 +
    # Return a spam score for a chunk of text
    def self.spam_score(text)
      link_count = 0
  
    def self.legal_text_for_country(country_code)
      file_name = File.join(RAILS_ROOT, "config", "legales", country_code.to_s + ".yml")
-     file_name = File.join(RAILS_ROOT, "config", "legales", APP_CONFIG['default_legale'] + ".yml") unless File.exist? file_name
+     file_name = File.join(RAILS_ROOT, "config", "legales", DEFAULT_LEGALE + ".yml") unless File.exist? file_name
      YAML::load_file(file_name)
    end
  end