From: Tom Hughes Date: Wed, 28 Jul 2010 20:39:46 +0000 (+0100) Subject: Merge branch 'master' into openid X-Git-Tag: live~7177 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/03fb042591bf60cd74aa277ee3de98f02d8486d3?hp=81f5c72c76f36e7c712bac0ad54b37d945caa51f Merge branch 'master' into openid --- diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c7c6c4add..1605e1133 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -249,18 +249,18 @@ class ApplicationController < ActionController::Base options = actions.extract_options! cache_path = options[:cache_path] || Hash.new - options[:cache_path] = Proc.new do |controller| - user = controller.instance_variable_get("@user") - - case - when user.nil? then user = :none - when user.display_name == controller.params[:display_name] then user = :self - when user.administrator? then user = :administrator - when user.moderator? then user = :moderator - else user = :other - end + options[:unless] = case options[:unless] + when NilClass then Array.new + when Array then options[:unless] + else unlessp = [ options[:unless] ] + end + + options[:unless].push(Proc.new do |controller| + controller.params.include?(:page) + end) - cache_path.merge(controller.params).merge(:locale => I18n.locale, :user => user) + options[:cache_path] = Proc.new do |controller| + cache_path.merge(controller.params).merge(:locale => I18n.locale) end actions.push(options) @@ -271,8 +271,9 @@ class ApplicationController < ActionController::Base ## # extend expire_action to expire all variants def expire_action(options = {}) - path = ActionCachePath.path_for(self, options, false).gsub('?', '.').gsub(':', '.') - expire_fragment(Regexp.new(Regexp.escape(path) + "\\..*")) + I18n.available_locales.each do |locale| + super options.merge(:locale => locale) + end end ## diff --git a/app/controllers/trace_controller.rb b/app/controllers/trace_controller.rb index c51f54c5e..abd59aeb2 100644 --- a/app/controllers/trace_controller.rb +++ b/app/controllers/trace_controller.rb @@ -15,18 +15,17 @@ class TraceController < ApplicationController before_filter :offline_redirect, :only => [:create, :edit, :delete, :data, :api_data, :api_create] around_filter :api_call_handle_error, :only => [:api_details, :api_data, :api_create] - caches_action :list, :unless => :logged_in?, :layout => false - caches_action :view, :layout => false + caches_action :list, :view, :layout => false caches_action :georss, :layout => true cache_sweeper :trace_sweeper, :only => [:create, :edit, :delete, :api_create], :unless => OSM_STATUS == :database_offline cache_sweeper :tracetag_sweeper, :only => [:create, :edit, :delete, :api_create], :unless => OSM_STATUS == :database_offline # Counts and selects pages of GPX traces for various criteria (by user, tags, public etc.). # target_user - if set, specifies the user to fetch traces for. if not set will fetch all traces - def list(target_user = nil, action = "list") + def list # from display name, pick up user id if one user's traces only display_name = params[:display_name] - if target_user.nil? and !display_name.blank? + if !display_name.blank? target_user = User.find(:first, :conditions => { :status => ["active", "confirmed"], :display_name => display_name }) if target_user.nil? @title = t'trace.no_such_user.title' @@ -103,7 +102,7 @@ class TraceController < ApplicationController end # final helper vars for view - @action = action + @target_user = target_user @display_name = target_user.display_name if target_user @all_tags = tagset.values @trace = Trace.new(:visibility => default_visibility) if @user @@ -143,6 +142,10 @@ class TraceController < ApplicationController logger.info("id is #{@trace.id}") flash[:notice] = t 'trace.create.trace_uploaded' + if @user.traces.count(:conditions => { :inserted => false }) > 4 + flash[:warning] = t 'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => { :inserted => false }) + end + redirect_to :action => 'mine' end else diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5fa021bcf..2ccfcca2b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -40,14 +40,53 @@ module ApplicationHelper return js end + def style_rules + css = "" + + css << ".hidden { display: none }"; + css << ".hide_unless_logged_in { display: none }" unless @user; + css << ".hide_if_logged_in { display: none }" if @user; + css << ".hide_if_user_#{@user.id} { display: none }" if @user; + css << ".show_if_user_#{@user.id} { display: inline }" if @user; + css << ".hide_unless_administrator { display: none }" unless @user and @user.administrator?; + + return content_tag(:style, css) + end + + def if_logged_in(tag = :div, &block) + concat(content_tag(tag, capture(&block), :class => "hide_unless_logged_in")) + end + + def if_not_logged_in(tag = :div, &block) + concat(content_tag(tag, capture(&block), :class => "hide_if_logged_in")) + end + + def if_user(user, tag = :div, &block) + if user + concat(content_tag(tag, capture(&block), :class => "hidden show_if_user_#{user.id}")) + end + end + + def unless_user(user, tag = :div, &block) + if user + concat(content_tag(tag, capture(&block), :class => "hide_if_user_#{user.id}")) + else + concat(content_tag(tag, capture(&block))) + end + end + + def if_administrator(tag = :div, &block) + concat(content_tag(tag, capture(&block), :class => "hide_unless_administrator")) + end + def describe_location(lat, lon, zoom = nil, language = nil) zoom = zoom || 14 language = language || request.user_preferred_languages.join(',') url = "http://nominatim.openstreetmap.org/reverse?lat=#{lat}&lon=#{lon}&zoom=#{zoom}&accept-language=#{language}" begin - Timeout::timeout(4) do - response = REXML::Document.new(Net::HTTP.get(URI.parse(url))) + response = Timeout::timeout(4) do + REXML::Document.new(Net::HTTP.get(URI.parse(url))) end rescue Exception response = nil diff --git a/app/models/notifier.rb b/app/models/notifier.rb index de0ad21d6..364463336 100644 --- a/app/models/notifier.rb +++ b/app/models/notifier.rb @@ -48,7 +48,7 @@ class Notifier < ActionMailer::Base def message_notification(message) common_headers message.recipient from_header message.sender.display_name, "m", message.id, message.digest - subject message.title + subject I18n.t('notifier.message_notification.subject_header', :subject => message.title, :locale => locale) body :to_user => message.recipient.display_name, :from_user => message.sender.display_name, :body => message.body, diff --git a/app/models/user.rb b/app/models/user.rb index f99ad3b40..d5b75d073 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -29,6 +29,8 @@ class User < ActiveRecord::Base validates_email_format_of :email validates_email_format_of :new_email, :allow_blank => true validates_format_of :display_name, :with => /^[^\/;.,?]*$/ + validates_format_of :display_name, :with => /^\S/, :message => "has leading whitespace" + validates_format_of :display_name, :with => /\S$/, :message => "has trailing whitespace" validates_numericality_of :home_lat, :allow_nil => true validates_numericality_of :home_lon, :allow_nil => true validates_numericality_of :home_zoom, :only_integer => true, :allow_nil => true diff --git a/app/views/diary_entry/_diary_comment.html.erb b/app/views/diary_entry/_diary_comment.html.erb index 77238b4d3..a0e75ecce 100644 --- a/app/views/diary_entry/_diary_comment.html.erb +++ b/app/views/diary_entry/_diary_comment.html.erb @@ -1,7 +1,7 @@ <%= user_thumbnail diary_comment.user, :style => "float: right" %>

<%= t('diary_entry.diary_comment.comment_from', :link_user => (link_to h(diary_comment.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_comment.user.display_name), :comment_created_at => l(diary_comment.created_at, :format => :friendly)) %>

<%= htmlize(diary_comment.body) %> -<% if @user && @user.administrator? %> -<%= link_to t('diary_entry.diary_comment.hide_link'), {:action => 'hidecomment', :display_name => @user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id}, {:confirm => t('diary_entry.diary_comment.confirm')} %> +<% if_administrator(:span) do %> + <%= link_to t('diary_entry.diary_comment.hide_link'), {:action => 'hidecomment', :display_name => diary_comment.diary_entry.user.display_name, :id => diary_comment.diary_entry.id, :comment => diary_comment.id}, {:confirm => t('diary_entry.diary_comment.confirm')} %> <% end %>
diff --git a/app/views/diary_entry/_diary_entry.html.erb b/app/views/diary_entry/_diary_entry.html.erb index 8991e1d54..d6e21869f 100644 --- a/app/views/diary_entry/_diary_entry.html.erb +++ b/app/views/diary_entry/_diary_entry.html.erb @@ -1,25 +1,30 @@ <%= link_to h(diary_entry.title), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id %>
+
-<%= htmlize(diary_entry.body) %> + <%= htmlize(diary_entry.body) %>
+ <% if diary_entry.latitude and diary_entry.longitude %> -<%= render :partial => "location", :object => diary_entry %> -
+ <%= render :partial => "location", :object => diary_entry %> +
<% end %> + <%= t 'diary_entry.diary_entry.posted_by', :link_user => (link_to h(diary_entry.user.display_name), :controller => 'user', :action => 'view', :display_name => diary_entry.user.display_name), :created => l(diary_entry.created_at, :format => :friendly), :language_link => (link_to h(diary_entry.language.name), :controller => 'diary_entry', :action => 'list', :language => diary_entry.language_code) %> + <% if params[:action] == 'list' %> -
-<%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %> -| -<%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :title => "Re: #{diary_entry.title}" %> -| -<%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %> +
+ <%= link_to t('diary_entry.diary_entry.comment_link'), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'newcomment' %> + | + <%= link_to t('diary_entry.diary_entry.reply_link'), :controller => 'message', :action => 'new', :display_name => diary_entry.user.display_name, :title => "Re: #{diary_entry.title}" %> + | + <%= link_to t('diary_entry.diary_entry.comment_count', :count => diary_entry.visible_comments.count), :action => 'view', :display_name => diary_entry.user.display_name, :id => diary_entry.id, :anchor => 'comments' %> <% end %> -<% if @user == diary_entry.user %> -| <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => @user.display_name, :id => diary_entry.id %> +<% if_user(diary_entry.user, :span) do %> + | <%= link_to t('diary_entry.diary_entry.edit_link'), :action => 'edit', :display_name => diary_entry.user.display_name, :id => diary_entry.id %> <% end %> -<% if @user && @user.administrator? %> -| <%= link_to t('diary_entry.diary_entry.hide_link'), {:action => 'hide', :display_name => @user.display_name, :id => diary_entry.id}, {:confirm => t('diary_entry.diary_entry.confirm')} %> +<% if_administrator(:span) do %> + | <%= link_to t('diary_entry.diary_entry.hide_link'), {:action => 'hide', :display_name => diary_entry.user.display_name, :id => diary_entry.id}, {:confirm => t('diary_entry.diary_entry.confirm')} %> <% end %> +

diff --git a/app/views/diary_entry/list.html.erb b/app/views/diary_entry/list.html.erb index 9fbb9ca32..1be32fd21 100644 --- a/app/views/diary_entry/list.html.erb +++ b/app/views/diary_entry/list.html.erb @@ -5,11 +5,11 @@

<%= h(@title) %>

<% if @this_user %> - <% if @user == @this_user %> + <% if_user(@this_user) do %> <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('diary_entry.list.new_title')} %> <% end %> <% else %> - <% if @user %> + <% if_logged_in do %> <%= link_to image_tag("new.png", :border=>0) + t('diary_entry.list.new'), {:controller => 'diary_entry', :action => 'new'}, {:title => t('diary_entry.list.new_title')} %> <% end %> <% end %> diff --git a/app/views/diary_entry/view.html.erb b/app/views/diary_entry/view.html.erb index 312b7b81a..c3e49a227 100644 --- a/app/views/diary_entry/view.html.erb +++ b/app/views/diary_entry/view.html.erb @@ -8,19 +8,19 @@ <%= render :partial => 'diary_comment', :collection => @entry.visible_comments %> -<% if @user %> - -

<%= t 'diary_entry.view.leave_a_comment' %>

-<%= error_messages_for 'diary_comment' %> -<% form_for :diary_comment, @diary_comment, :url => { :action => 'comment' } do |f| %> -<%= f.text_area :body, :cols => 80, :rows => 5 %> -
-
-<%= submit_tag t('diary_entry.view.save_button') %> -<% end %> +<% if_logged_in(:div) do %> +

<%= t 'diary_entry.view.leave_a_comment' %>

-<% else %> + <%= error_messages_for 'diary_comment' %> -

<%= t("diary_entry.view.login_to_leave_a_comment", :login_link => link_to(t("diary_entry.view.login"), :controller => 'user', :action => 'login', :referer => request.request_uri)) %>

+ <% form_for :diary_comment, @diary_comment, :url => { :action => 'comment' } do |f| %> + <%= f.text_area :body, :cols => 80, :rows => 5 %> +
+
+ <%= submit_tag t('diary_entry.view.save_button') %> + <% end %> +<% end %> +<% if_not_logged_in(:div) do %> +

<%= t("diary_entry.view.login_to_leave_a_comment", :login_link => link_to(t("diary_entry.view.login"), :controller => 'user', :action => 'login', :referer => request.request_uri)) %>

<% end %> diff --git a/app/views/layouts/site.html.erb b/app/views/layouts/site.html.erb index cecf5acc2..6a820ef26 100644 --- a/app/views/layouts/site.html.erb +++ b/app/views/layouts/site.html.erb @@ -13,6 +13,7 @@ <%= stylesheet_link_tag 'print', :media => "print" %> <%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %> <%= tag("meta", { :name => "description", :content => "OpenStreetMap is the free wiki world map." }) %> + <%= style_rules %> <%= yield :head %> <%= t 'layouts.project_name.title' %><%= ' | '+ h(@title) if @title %> @@ -123,10 +124,6 @@ <%= yield :left_menu %> -
- <%= link_to image_tag("sotm.png", :alt => t('layouts.sotm2010'), :title => t('layouts.sotm2010'), :border => "0"), "http://www.stateofthemap.org/register/" %> -
- <%= yield :optionals %>
diff --git a/app/views/trace/_trace_form.html.erb b/app/views/trace/_trace_form.html.erb deleted file mode 100644 index 3d93b65e8..000000000 --- a/app/views/trace/_trace_form.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<% if @user.traces.count(:conditions => ["inserted=?", false]) > 4 %> -

<%= t'trace.trace_header.traces_waiting', :count => @user.traces.count(:conditions => ["inserted=?", false]) %>

-<% end %> - -<% form_for :trace, @trace, :url => { :action => "create" }, :html => { :multipart => true } do |f| %> - - - - - - -
<%= t'trace.trace_form.upload_gpx' %><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %>
<%= t'trace.trace_form.description' %><%= f.text_field :description, :size => 50, :maxlength => 255 %>
<%= t'trace.trace_form.tags' %><%= f.text_field :tagstring, :size => 50, :maxlength => 255 %> (<%= t'trace.trace_form.tags_help' %>)
<%= t'trace.trace_form.visibility' %><%= f.select :visibility, [[t('trace.visibility.private'),"private"],[t('trace.visibility.public'),"public"],[t('trace.visibility.trackable'),"trackable"],[t('trace.visibility.identifiable'),"identifiable"]] %> (<%= t'trace.trace_form.visibility_help' %>)
<%= submit_tag t('trace.trace_form.upload_button') %> | <%= t'trace.trace_form.help' %>
-<% end %> diff --git a/app/views/trace/_trace_header.html.erb b/app/views/trace/_trace_header.html.erb deleted file mode 100644 index 85de77396..000000000 --- a/app/views/trace/_trace_header.html.erb +++ /dev/null @@ -1,18 +0,0 @@ -

<%= h(@title) %>

- -<% content_for :head do %> -<%= auto_discovery_link_tag :atom, :action => 'georss', :display_name => @display_name, :tag => @tag %> -<% end %> - -

- <%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %> - <% if @user.nil? or @display_name.nil? or @user.display_name != @display_name %> - | <%= link_to t('trace.trace_header.see_just_your_traces'), :action => 'mine' %> - <% end %> - <% if @tag or @display_name %> - | <%= link_to t('trace.trace_header.see_all_traces'), :controller => 'trace', :action => 'list' %> - <% end %> - <% if @tag and @user and @user.display_name == @display_name %> - | <%= link_to t('trace.trace_header.see_your_traces'), :controller => 'trace', :action => 'mine' %> - <% end %> -

diff --git a/app/views/trace/_trace_list.html.erb b/app/views/trace/_trace_list.html.erb deleted file mode 100644 index 968fd85be..000000000 --- a/app/views/trace/_trace_list.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<%= render :partial => 'trace_paging_nav' %> - - - - - - - <%= render :partial => 'trace', :collection => @traces unless @traces.nil? %> -
- -<%= render :partial => 'trace_paging_nav' %> - -<%= render :partial => 'trace_optionals' %> diff --git a/app/views/trace/create.html.erb b/app/views/trace/create.html.erb index 140b74918..ba8b8e700 100644 --- a/app/views/trace/create.html.erb +++ b/app/views/trace/create.html.erb @@ -2,4 +2,12 @@ <%= error_messages_for 'trace' %> -<%= render :partial => 'trace_form' %> +<% form_for :trace, @trace, :url => { :action => "create" }, :html => { :multipart => true } do |f| %> + + + + + + +
<%= t'trace.trace_form.upload_gpx' %><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %>
<%= t'trace.trace_form.description' %><%= f.text_field :description, :size => 50, :maxlength => 255 %>
<%= t'trace.trace_form.tags' %><%= f.text_field :tagstring, :size => 50, :maxlength => 255 %> (<%= t'trace.trace_form.tags_help' %>)
<%= t'trace.trace_form.visibility' %><%= f.select :visibility, [[t('trace.visibility.private'),"private"],[t('trace.visibility.public'),"public"],[t('trace.visibility.trackable'),"trackable"],[t('trace.visibility.identifiable'),"identifiable"]] %> (<%= t'trace.trace_form.visibility_help' %>)
<%= submit_tag t('trace.trace_form.upload_button') %> | <%= t'trace.trace_form.help' %>
+<% end %> diff --git a/app/views/trace/list.html.erb b/app/views/trace/list.html.erb index fe7e5a13a..78d203756 100644 --- a/app/views/trace/list.html.erb +++ b/app/views/trace/list.html.erb @@ -1,5 +1,35 @@ -<%= render :partial => 'trace_header' %> -<% if @user and @user.display_name == @display_name %> - <%= render :partial => 'trace_form' %> +

<%= h(@title) %>

+ +<% content_for :head do %> +<%= auto_discovery_link_tag :atom, :action => 'georss', :display_name => @display_name, :tag => @tag %> <% end %> -<%= render :partial => 'trace_list' %> + +

+ <%= rss_link_to :action => 'georss', :display_name => @display_name, :tag => @tag %> + <% unless_user(@target_user, :span) do %> + | <%= link_to t('trace.trace_header.your_traces'), :action => 'mine' %> + <% end %> + | <%= link_to t('trace.trace_header.upload_trace'), :action => 'create' %> + <% if @tag %> + <% if @display_name %> + | <%= link_to t('trace.trace_header.see_all_traces'), :controller => 'trace', :action => 'list' %> + <% end %> + <% if_user(@target_user, :span) do %> + | <%= link_to t('trace.trace_header.see_your_traces'), :controller => 'trace', :action => 'mine' %> + <% end %> + <% end %> +

+ +<%= render :partial => 'trace_paging_nav' %> + + + + + + + <%= render :partial => 'trace', :collection => @traces unless @traces.nil? %> +
+ +<%= render :partial => 'trace_paging_nav' %> + +<%= render :partial => 'trace_optionals' %> diff --git a/app/views/trace/view.html.erb b/app/views/trace/view.html.erb index 73638cb3d..bfef5d901 100644 --- a/app/views/trace/view.html.erb +++ b/app/views/trace/view.html.erb @@ -52,13 +52,11 @@

- - - <% if @trace.user == @user %> - - <% end %> - <% if @trace.user == @user %> - - <% end %> - -
<%= button_to t('trace.view.edit_track'), :controller => 'trace', :action => 'edit', :id => @trace.id %><%= button_to t('trace.view.delete_track'), :controller => 'trace', :action => 'delete', :id => @trace.id %>
+<% if_user(@trace.user) do %> + + + + + +
<%= button_to t('trace.view.edit_track'), :controller => 'trace', :action => 'edit', :id => @trace.id %><%= button_to t('trace.view.delete_track'), :controller => 'trace', :action => 'delete', :id => @trace.id %>
+<% end %> diff --git a/app/views/user/suspended.html.erb b/app/views/user/suspended.html.erb index fd6a4f441..0ea1cb50d 100644 --- a/app/views/user/suspended.html.erb +++ b/app/views/user/suspended.html.erb @@ -2,4 +2,4 @@

<%= t "user.suspended.heading" %>

-<%= t "user.suspended.body", link_to t("user.suspended.webmaster"), "mailto:webmaster@openstreetmap.org" %> +<%= t "user.suspended.body", :webmaster => link_to(t("user.suspended.webmaster"), "mailto:webmaster@openstreetmap.org") %> diff --git a/config/application.yml b/config/application.yml index 1b38f8f74..95037f83e 100644 --- a/config/application.yml +++ b/config/application.yml @@ -28,7 +28,10 @@ standard_settings: &standard_settings spam_threshold: 50 # Default legale (jurisdiction location) for contributor terms default_legale: GB - + # Memory limits (in Mb) + #soft_memory_limit: 512 + #hard_memory_limit: 2048 + development: <<: *standard_settings diff --git a/config/environment.rb b/config/environment.rb index de5852fc4..61d068ab7 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -89,7 +89,7 @@ Rails::Initializer.run do |config| # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the session table with 'rake db:sessions:create') - unless OSM_STATUS == :database_offline + unless OSM_STATUS == :database_offline or OSM_STATUS == :database_readonly config.action_controller.session_store = :sql_session_store end diff --git a/config/initializers/abstract_adapter.rb b/config/initializers/abstract_adapter.rb index d96742ee5..f9b711f6c 100644 --- a/config/initializers/abstract_adapter.rb +++ b/config/initializers/abstract_adapter.rb @@ -1,4 +1,4 @@ -if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdaptor) +if defined?(ActiveRecord::ConnectionAdaptors::AbstractAdapter) module ActiveRecord module ConnectionAdapters class AbstractAdapter diff --git a/config/initializers/limits.rb b/config/initializers/limits.rb deleted file mode 100644 index 9862036f7..000000000 --- a/config/initializers/limits.rb +++ /dev/null @@ -1,4 +0,0 @@ -# Set a hard limit of 1Gb on the virtual size of the process -if Process.const_defined?(:RLIMIT_AS) - Process.setrlimit Process::RLIMIT_AS, 1024*1024*1024, Process::RLIM_INFINITY -end diff --git a/config/initializers/memory_limits.rb b/config/initializers/memory_limits.rb new file mode 100644 index 000000000..6f553aff6 --- /dev/null +++ b/config/initializers/memory_limits.rb @@ -0,0 +1,42 @@ +# Setup any specified hard limit on the virtual size of the process +if APP_CONFIG.include?('hard_memory_limit') and Process.const_defined?(:RLIMIT_AS) + Process.setrlimit Process::RLIMIT_AS, APP_CONFIG['hard_memory_limit']*1024*1024, Process::RLIM_INFINITY +end + +# If we're running under passenger and a soft memory limit is +# configured then setup some rack middleware to police the limit +if APP_CONFIG.include?('soft_memory_limit') and defined?(PhusionPassenger) + # Define some rack middleware to police the soft memory limit + class MemoryLimit + def initialize(app) + @app = app + end + + def call(env) + # Process this requst + status, headers, body = @app.call(env) + + # Restart if we've hit our memory limit + if resident_size > APP_CONFIG['soft_memory_limit'] + Process.kill("USR1", 0) + end + + # Return the result of this request + [status, headers, body] + end + private + def resident_size + # Read statm to get process sizes. Format is + # Size RSS Shared Text Lib Data + fields = File.open("/proc/self/statm") do |file| + fields = file.gets.split(" ") + end + + # Return resident size in megabytes + return fields[1].to_i / 256 + end + end + + # Install the memory limit checker + Rails.configuration.middleware.use MemoryLimit +end diff --git a/config/locales/af.yml b/config/locales/af.yml index 0a0cb66ae..9fcdc6442 100644 --- a/config/locales/af.yml +++ b/config/locales/af.yml @@ -873,7 +873,6 @@ af: footer1: U kan ook die boodskap by {{readurl}} lees footer2: en u kan antwoord by {{replyurl}} hi: Hallo {{to_user}}, - subject: "[OpenStreetMap] {{user}} het 'n nuwe boodskap aan u gestuur" signup_confirm: subject: "[OpenStreetMap] Bevestig u e-posadres" signup_confirm_html: diff --git a/config/locales/aln.yml b/config/locales/aln.yml index 48f433c19..9c09dfe33 100644 --- a/config/locales/aln.yml +++ b/config/locales/aln.yml @@ -1052,7 +1052,6 @@ aln: footer2: dhe ju muni me ju përgjigj tek {{replyurl}} header: "{{from_user}} ju ka dërgu një mesazh përmes OpenStreetMap me titullin {{subject}}:" hi: Tung {{to_user}}, - subject: "[OpenStreetMap] {{user}} ju ka dërgu juve një mesazh të ri" signup_confirm: subject: "[OpenStreetMap] Konfirmoje email adresën tonde" signup_confirm_html: diff --git a/config/locales/ar.yml b/config/locales/ar.yml index a9e4f498c..7b92869bb 100644 --- a/config/locales/ar.yml +++ b/config/locales/ar.yml @@ -1056,7 +1056,6 @@ ar: footer2: ويمكنك الرد على {{replyurl}} header: "{{from_user}} قام بإرسال رسالة لك عبر خريطة الشارع المفتوحة بالعنوان {{subject}}:" hi: مرحبًا {{to_user}}، - subject: "[خريطة الشارع المفتوحة] {{user}} أرسل لك رسالة جديدة" signup_confirm: subject: "[خريطة الشارع المفتوحة] أكّد عنوان بريدك الإلكتروني" signup_confirm_html: diff --git a/config/locales/arz.yml b/config/locales/arz.yml index 2fe5b7d1a..ad3f1d11c 100644 --- a/config/locales/arz.yml +++ b/config/locales/arz.yml @@ -973,7 +973,6 @@ arz: footer2: ويمكنك الرد على {{replyurl}} header: "{{from_user}} قام بإرسال رساله لك عبر خريطه الشارع المفتوحه بالعنوان {{subject}}:" hi: مرحبًا {{to_user}}، - subject: "[خريطه الشارع المفتوحة] {{user}} أرسل لك رساله جديدة" signup_confirm: subject: "[خريطه الشارع المفتوحة] أكّد عنوان بريدك الإلكتروني" signup_confirm_html: diff --git a/config/locales/be.yml b/config/locales/be.yml index 924c8e816..b576d7c55 100644 --- a/config/locales/be.yml +++ b/config/locales/be.yml @@ -428,7 +428,6 @@ be: footer2: і вы можаце адказаць на {{replyurl}} header: "{{from_user}} адправіў вам паведамленне з тэмай {{subject}} праз OpenStreetMap:" hi: Прывітанне, {{to_user}}, - subject: "[OpenStreetMap] {{user}} даслаў вам новае паведамленне" signup_confirm: subject: "[OpenStreetMap] Пацвердзіце ваш адрас электроннай пошты" signup_confirm_html: diff --git a/config/locales/br.yml b/config/locales/br.yml index 9d822a636..877dfbae8 100644 --- a/config/locales/br.yml +++ b/config/locales/br.yml @@ -1039,7 +1039,6 @@ br: footer2: ha gallout a rit respont da {{replyurl}} header: "{{from_user}} en deus kaset deoc'h ur gemennadenn dre OpenStreetMap gant an danvez {{subject}} :" hi: Demat {{to_user}}, - subject: "[OpenStreetMap] {{user}} en deus kaset ur gemennadenn deoc'h" signup_confirm: subject: "[OpenStreetMap] Kadarnaat ho chomlec'h postel" signup_confirm_html: diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 74e00acfc..1a74813c6 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -381,10 +381,15 @@ cs: secondary: Silnice II. třídy steps: Schody historic: + battlefield: Bojiště + memorial: Památník museum: Muzeum + wreck: Vrak landuse: + allotments: Zahrádkářská kolonie cemetery: Hřbitov construction: Staveniště + landfill: Skládka vineyard: Vinice leisure: garden: Zahrada @@ -424,7 +429,12 @@ cs: village: Vesnice railway: halt: Železniční zastávka + level_crossing: Železniční přejezd + light_rail: Rychlodráha + monorail: Monorail + narrow_gauge: Úzkorozchodná dráha subway: Stanice metra + subway_entrance: Vstup do metra shop: hairdresser: Kadeřnictví tourism: @@ -498,6 +508,7 @@ cs: shop_tooltip: Obchod se zbožím s logem OpenStreetMap sign_up: zaregistrovat se sign_up_tooltip: Vytvořit si uživatelský účet pro editaci + sotm2010: Přijeďte na konferenci OpenStreetMap 2010 – Zpráva o stavu mapy, 9.–11. července v Gironě! tag_line: Otevřená wiki-mapa světa user_diaries: Deníčky user_diaries_tooltip: Zobrazit deníčky uživatelů @@ -514,9 +525,12 @@ cs: inbox: date: Datum from: Od + my_inbox: Má doručená pošta no_messages_yet: Zatím nemáte žádné zprávy. Co třeba kontaktovat nějaké {{people_mapping_nearby_link}}? + outbox: odeslaná pošta people_mapping_nearby: uživatele poblíž subject: Předmět + title: Doručená pošta you_have: Máte {{new_count}} nových a {{old_count}} starých zpráv mark: as_read: Zpráva označena jako přečtená @@ -536,12 +550,22 @@ cs: title: Odeslat zprávu outbox: date: Datum + inbox: doručená pošta + my_inbox: Má {{inbox_link}} + no_sent_messages: Nemáte žádné odeslané zprávy. Co třeba kontaktovat nějaké {{people_mapping_nearby_link}}? + outbox: odeslaná pošta + people_mapping_nearby: uživatele poblíž subject: Předmět + title: Odeslaná pošta to: Komu you_have_sent_messages: Máte {{count}} odeslaných zpráv read: + back_to_inbox: Zpět do přijatých zpráv + back_to_outbox: Zpět do odeslaných zpráv date: Datum from: Od + reading_your_messages: Čtení zpráv + reading_your_sent_messages: Čtení odeslaných zpráv reply_button: Odpovědět subject: Předmět to: Komu @@ -568,7 +592,6 @@ cs: footer2: a můžete odpovědět na {{replyurl}} header: "{{from_user}} vám poslal(a) prostřednictvím OpenStreetMap zprávu s předmětem {{subject}}:" hi: Dobrý den, uživateli {{to_user}}, - subject: "[OpenStreetMap] {{user}} vám poslal novou zprávu" signup_confirm_plain: the_wiki_url: http://wiki.openstreetmap.org/wiki/Cs:Beginners_Guide?uselang=cs wiki_signup_url: http://wiki.openstreetmap.org/index.php?title=Special:UserLogin&type=signup&returnto=Cs:Main_Page&uselang=cs diff --git a/config/locales/de.yml b/config/locales/de.yml index 37dbbde59..75bef5fd1 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -1067,7 +1067,6 @@ de: footer2: und hier {{replyurl}} antworten header: "{{from_user}} hat dir eine Nachricht über OpenStreetMap mit dem Betreff {{subject}} gesendet:" hi: Hallo {{to_user}}, - subject: "[OpenStreetMap] {{user}} hat dir eine Nachricht gesendet" signup_confirm: subject: "[OpenStreetMap] Deine E-Mail-Adresse bestätigen" signup_confirm_html: diff --git a/config/locales/dsb.yml b/config/locales/dsb.yml index 50f9c4cd5..947ebed86 100644 --- a/config/locales/dsb.yml +++ b/config/locales/dsb.yml @@ -1062,7 +1062,6 @@ dsb: footer2: a na {{replyurl}} wótegroniś header: "{{from_user}} jo śi pósłał powěsć pśez OpenStreetMap z temowym nadpismom {{subject}}:" hi: Witaj {{to_user}}, - subject: "[OpenStreetMap] {{user}} jo śi nowu powěsć pósłał" signup_confirm: subject: "[OpenStreetMap] Twóju e-mailowu adresu wobkšuśiś" signup_confirm_html: diff --git a/config/locales/en.yml b/config/locales/en.yml index 2a8479a22..972e52708 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -933,7 +933,6 @@ en: shop: Shop shop_tooltip: Shop with branded OpenStreetMap merchandise shop_url: http://wiki.openstreetmap.org/wiki/Merchandise - sotm2010: 'Come to the 2010 OpenStreetMap Conference, The State of the Map, July 9-11 in Girona!' license: alt: CC by-sa 2.0 title: OpenStreetMap data is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic License @@ -1062,6 +1061,7 @@ en: header: "{{from_user}} has commented on your recent OpenStreetMap diary entry with the subject {{subject}}:" footer: "You can also read the comment at {{readurl}} and you can comment at {{commenturl}} or reply at {{replyurl}}" message_notification: + subject_header: "[OpenStreetMap] {{subject}}" hi: "Hi {{to_user}}," header: "{{from_user}} has sent you a message through OpenStreetMap with the subject {{subject}}:" footer1: "You can also read the message at {{readurl}}" @@ -1351,7 +1351,8 @@ en: help: "Help" help_url: "http://wiki.openstreetmap.org/wiki/Upload" trace_header: - see_just_your_traces: "See just your traces, or upload a trace" + your_traces: "See just your traces" + upload_trace: "Upload a trace" see_all_traces: "See all traces" see_your_traces: "See all your traces" traces_waiting: "You have {{count}} traces waiting for upload. Please consider waiting for these to finish before uploading any more, so as not to block the queue for other users." diff --git a/config/locales/es.yml b/config/locales/es.yml index fea06ca5b..a538264d2 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1054,7 +1054,6 @@ es: footer2: y puedes responder en {{replyurl}} header: "{{from_user}} te ha enviado un mensaje a través de OpenStreetMap con el asunto {{subject}}:" hi: Hola {{to_user}}, - subject: "[OpenStreetMap] {{user}} te ha enviado un nuevo mensaje" signup_confirm: subject: "[OpenStreetMap] Confirme su dirección de correo electrónico" signup_confirm_html: diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 6ddb6a1a8..5fe1fcf57 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -843,7 +843,6 @@ fi: greeting: Hei, message_notification: hi: Hei {{to_user}}, - subject: "[OpenStreetMap] {{user}} on lähettänyt sinulle viestin" signup_confirm: subject: "[OpenStreetMap] Sähköpostiosoitteen vahvistus" signup_confirm_html: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 9d3b93775..ca281b5a4 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -1057,7 +1057,6 @@ fr: footer2: et vous pouvez répondre sur {{replyurl}} header: "{{from_user}} vous a envoyé un message depuis OpenStreetMap avec le sujet {{subject}} :" hi: Bonjour {{to_user}}, - subject: "[OpenStreetMap] {{user}} vous a envoyé un message" signup_confirm: subject: "[OpenStreetMap] Confirmer votre adresse de courriel" signup_confirm_html: diff --git a/config/locales/hr.yml b/config/locales/hr.yml index afdc035d9..d8d5639a8 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -1052,7 +1052,6 @@ hr: footer2: i možete odgovoriti na {{replyurl}} header: "{{from_user}} ti je poslao poruku preko OpenStreetMap sa predmetom {{subject}}:" hi: Bok {{to_user}}, - subject: "[OpenStreetMap] {{user}} ti je poslao novu poruku" signup_confirm: subject: "[OpenStreetMap] potvrdi email adresu" signup_confirm_html: diff --git a/config/locales/hsb.yml b/config/locales/hsb.yml index 77e9ae15c..3e14b5498 100644 --- a/config/locales/hsb.yml +++ b/config/locales/hsb.yml @@ -1063,7 +1063,6 @@ hsb: footer2: a móžeš na {{replyurl}} wotmołwić header: "{{from_user}} je ći přez OpenStreetMap powěsć z temowym nadpismom {{subject}} pósłał:" hi: Witaj {{to_user}}, - subject: "[OpenStreetMap] {{user}} je ći nowu powěsć pósłał" signup_confirm: subject: "[OpenStreetMap] Twoju e-mejlowu adresu wobkrućić" signup_confirm_html: diff --git a/config/locales/hu.yml b/config/locales/hu.yml index f7139fbc1..f9abda5aa 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -920,7 +920,7 @@ hu: shop_tooltip: Bolt márkás OpenStreetMap árukkal sign_up: regisztráció sign_up_tooltip: Új felhasználói fiók létrehozása szerkesztéshez - sotm2010: Gyere a 2010-es OpenStreetMap konferenciára, The State of the Map, július 9-11. Amszterdamban! + sotm2010: Gyere a 2010-es OpenStreetMap konferenciára, The State of the Map, július 9-11. Gironában! tag_line: A szabad világtérkép user_diaries: Naplók user_diaries_tooltip: Felhasználói naplók megtekintése @@ -1056,7 +1056,6 @@ hu: footer2: "és válaszolhatsz rá itt: {{replyurl}}" header: "{{from_user}} küldött neked egy üzenetet az OpenStreetMapon keresztül {{subject}} tárggyal:" hi: Szia {{to_user}}! - subject: "[OpenStreetMap] {{user}} küldött neked egy új üzenetet" signup_confirm: subject: "[OpenStreetMap] E-mail cím megerősítése" signup_confirm_html: diff --git a/config/locales/ia.yml b/config/locales/ia.yml index cdfafceec..eb310ad0f 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -1052,7 +1052,6 @@ ia: footer2: e tu pote responder a {{replyurl}} header: "{{from_user}} te ha inviate un message per OpenStreetMap con le subjecto {{subject}}:" hi: Salute {{to_user}}, - subject: "[OpenStreetMap] {{user}} te ha inviate un nove message" signup_confirm: subject: "[OpenStreetMap] Confirma tu adresse de e-mail" signup_confirm_html: diff --git a/config/locales/is.yml b/config/locales/is.yml index 9921af72a..6c50d94f2 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -740,7 +740,6 @@ is: footer2: og svarað á {{replyurl}} header: "{{from_user}} hefur send þér skilaboð á OpenStreetMap með titlinum „{{subject}}“:" hi: Hæ {{to_user}}, - subject: "[OpenStreetMap] {{user}} sendi þér ný skilaboð" signup_confirm: subject: "[OpenStreetMap] Staðfestu netfangið þitt" signup_confirm_html: diff --git a/config/locales/it.yml b/config/locales/it.yml index e1c3150ac..e00fb092c 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -747,7 +747,6 @@ it: footer2: e puoi rispondere a {{replyurl}} header: "{{from_user}} ti ha inviato un messaggio tramite OpenStreetMap con l'oggetto {{subject}}:" hi: Ciao {{to_user}}, - subject: "[OpenStreetMap] {{user}} ti ha inviato un nuovo messaggio" signup_confirm: subject: "[OpenStreetMap] Conferma il tuo indirizzo email" signup_confirm_html: diff --git a/config/locales/mk.yml b/config/locales/mk.yml index 4d0521a3d..cf555b9e1 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -928,7 +928,7 @@ mk: english_link: англискиот оригинал text: Во случај на конфликт помеѓу оваа преведена страница и {{english_original_link}}, предност има англиската страница title: За овој превод - legal_babble: "

Авторски права и лиценца

\n

\n OpenStreetMap има отворени податоци, лиценциран е под Криејтив\n Комонс Наведи извор-Сподели под исти услови 2.0 (CC-BY-SA).\n

\n

\n Слободно можете да ги копирате, дистрибуирате, јавно прикажувате и адаптирате нашите карти\n и податоци, под услов да го наведете OpenStreetMap и неговите\n учесници. Ако ги менувате или темелите дела врз нашите карти и податоци\n резултатите можете да ги дистрибуирате само под истата лиценца.\n Во полниот законски\n правилник се објаснети вашите права и должности.\n

\n\n

Како да го наведувате OpenStreetMap

\n

\n Доколку користите слики од карти на OpenStreetMap, бараме\n наводот да содржи барем “© Учесници на\n OpenStreetMap, CC-BY-SA”. Ако користите само податоци од картите,\n бараме наводот да гласи “Картографски податоци © Учесници на OpenStreetMap,\n CC-BY-SA”.\n

\n

\n Кадешто е можно, OpenStreetMap треба да има хиперврска http://www.openstreetmap.org/\n и CC-BY-SA до http://creativecommons.org/licenses/by-sa/2.0/deed.mk. Доколку\n користите медиум кадешто не може да се ставаат врски (како на пр.\n печатено издание), ви препорачуваме да ги наведете корисниците на\n www.openstreetmap.org (на пр. со проширување на\n ‘OpenStreetMap’ со полнава адреса) и до\n www.creativecommons.org.\n

\n\n

Како да дознаете повеќе

\n

\n Прочитајте повеќе за користењето на нашите податоци на Правните\n ЧПП.\n

\n

\n Учесниците во OSM се потсетуваат никогаш да не ставаат податоци од\n извори заштитени со авторски права (на пр. Google Карти или печатени карти) без\n јасна дозвола од имателите на авторските права.\n

\n

\n Иако OpenStreetMap има отворени податоци, ние сепак не можеме бесплатно да \n го нудиме картографскиот програм на развивачи кои се трети лица.\n\n Погледајте ги нашите Правила на користење на програмот,\n Правила на користење на полињата\n и Правила на користење на Nominatim.\n

\n\n

Нашите учесници

\n

\n Нашата лиценца CC-BY-SA бара да “го наведете изворниот\n автор разумно за медиумот или средството што го\n користите”. Поединечните картографи на OSM не бараат да\n бидат наведувани посебно, туку само како “Учесници на\n OpenStreetMap”, но онаму кадешто OpenStreetMap содржи податоци\n од некоја државна картографска установа или друг важен извор,\n веројатно би било разумно да ги наведете нив директно,\n наведувајќи ги како што тие обично се наведуваат, или ставајќи врска до нивната страница.\n

\n\n\n\n\n\n

\n Поставањето на податоци во OpenStreetMap не подразбира дека изворниот \n добавувач на податоци го поддржува и застапува OpenStreetMap, дека дава било каква гаранција, или пак\n дека прифаќа било каква одговорност.\n

" + legal_babble: "

Авторски права и лиценца

\n

\n OpenStreetMap има отворени податоци, лиценциран е под Creative\n Commons Наведи извор-Сподели под исти услови 2.0 (CC-BY-SA).\n

\n

\n Слободно можете да ги копирате, дистрибуирате, јавно прикажувате и адаптирате нашите карти\n и податоци, под услов да го наведете OpenStreetMap и неговите\n учесници. Ако ги менувате или темелите дела врз нашите карти и податоци\n резултатите можете да ги дистрибуирате само под истата лиценца.\n Во полниот законски\n правилник се објаснети вашите права и должности.\n

\n\n

Како да го наведувате OpenStreetMap

\n

\n Доколку користите слики од карти на OpenStreetMap, бараме\n наводот да содржи барем “© Учесници на\n OpenStreetMap, CC-BY-SA”. Ако користите само податоци од картите,\n бараме наводот да гласи “Картографски податоци © Учесници на OpenStreetMap,\n CC-BY-SA”.\n

\n

\n Кадешто е можно, OpenStreetMap треба да има хиперврска http://www.openstreetmap.org/\n и CC-BY-SA до http://creativecommons.org/licenses/by-sa/2.0/deed.mk. Доколку\n користите медиум кадешто не може да се ставаат врски (како на пр.\n печатено издание), ви препорачуваме да ги наведете корисниците на\n www.openstreetmap.org (на пр. со проширување на\n ‘OpenStreetMap’ со полнава адреса) и до\n www.creativecommons.org.\n

\n\n

Како да дознаете повеќе

\n

\n Прочитајте повеќе за користењето на нашите податоци на Правните\n ЧПП.\n

\n

\n Учесниците во OSM се потсетуваат никогаш да не ставаат податоци од\n извори заштитени со авторски права (на пр. Google Карти или печатени карти) без\n јасна дозвола од имателите на авторските права.\n

\n

\n Иако OpenStreetMap има отворени податоци, ние сепак не можеме бесплатно да \n го нудиме картографскиот програм на развивачи кои се трети лица.\n\n Погледајте ги нашите Правила на користење на програмот,\n Правила на користење на полињата\n и Правила на користење на Nominatim.\n

\n\n

Нашите учесници

\n

\n Нашата лиценца CC-BY-SA бара да “го наведете изворниот\n автор разумно за медиумот или средството што го\n користите”. Поединечните картографи на OSM не бараат да\n бидат наведувани посебно, туку само како “Учесници на\n OpenStreetMap”, но онаму кадешто OpenStreetMap содржи податоци\n од некоја државна картографска установа или друг важен извор,\n веројатно би било разумно да ги наведете нив директно,\n наведувајќи ги како што тие обично се наведуваат, или ставајќи врска до нивната страница.\n

\n\n\n\n\n\n

\n Поставањето на податоци во OpenStreetMap не подразбира дека изворниот \n добавувач на податоци го поддржува и застапува OpenStreetMap, дека дава било каква гаранција, или пак\n дека прифаќа било каква одговорност.\n

" native: mapping_link: почнете со изработка на карти native_link: македонската верзија @@ -1052,7 +1052,6 @@ mk: footer2: и можете да одговорите на {{replyurl}} header: "{{from_user}} ви испрати порака преку OpenStreetMap со насловот {{subject}}:" hi: Здраво {{to_user}}, - subject: "[OpenStreetMap] {{user}} ви испрати нова порака" signup_confirm: subject: "[OpenStreetMap] Потврдете ја вашата е-поштенска адреса" signup_confirm_html: diff --git a/config/locales/nl.yml b/config/locales/nl.yml index d8acf7a3e..2508d629d 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -1053,7 +1053,6 @@ nl: footer2: en u kunt antwoorden op {{replyurl}} header: "{{from_user}} heeft u een bericht gezonden via OpenStreetMap met het onderwerp {{subject}}:" hi: Hallo {{to_user}}, - subject: "[OpenStreetMap] {{user}} heeft u een nieuw bericht gezonden" signup_confirm: subject: "[OpenStreetMap] Bevestig uw e-mailadres" signup_confirm_html: diff --git a/config/locales/no.yml b/config/locales/no.yml index dd4981ba0..c357f3a75 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -953,7 +953,6 @@ footer2: og du kan svare til {{replyurl}} header: "{{from_user}} har sendt deg en melding gjennom OpenStreetMap med emnet {{subject}}:" hi: Hei {{to_user}}, - subject: "[OpenStreetMap] {{user}} sendte deg en melding" signup_confirm: subject: "[OpenStreetMap] Bekreft din e-postadresse" signup_confirm_html: diff --git a/config/locales/pl.yml b/config/locales/pl.yml index feb326221..fa84ea3af 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -1034,7 +1034,6 @@ pl: footer2: możesz odpowiedzieć pod adresem {{replyurl}} header: "{{from_user}} wysłał do Ciebie wiadomość z OpenStreetMap o temacie {{subject}}:" hi: Witaj {{to_user}}, - subject: "[OpenStreetMap] Użytkownik {{user}} przysłał nową wiadomość" signup_confirm: subject: "[OpenStreetMap] Prośba o potwierdzenie adresu e-mail" signup_confirm_html: diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index c55f5ee05..9c7f64f45 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -1082,7 +1082,6 @@ pt-BR: footer2: e pode respondê-la em {{replyurl}} header: "{{from_user}} enviou uma mensagem pelo OpenStreetMap para você com o assunto {{subject}}:" hi: Olá {{to_user}}, - subject: "[OpenStreetMap] {{user}} enviou uma mensagem para você" signup_confirm: subject: "[OpenStreetMap] Confirme seu endereço de e-mail" signup_confirm_html: @@ -1527,7 +1526,7 @@ pt-BR: webmaster: webmaster terms: agree: Concordo - consider_pd: Desejo que minhas contribuições sejam de Domínio Público + consider_pd: Em adição ao disposto acima, eu desejo que minhas contribuições sejam de Domínio Público consider_pd_why: o que é isso? decline: Discordo heading: Termos do Colaborador diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 3f0204cd4..c54b36efc 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -1064,7 +1064,6 @@ ru: footer2: и вы можете ответить на {{replyurl}} header: "{{from_user}} отправил вам сообщение с темой {{subject}} через OpenStreetMap:" hi: Привет, {{to_user}}, - subject: "[OpenStreetMap] {{user}} прислал вам новое сообщение" signup_confirm: subject: "[OpenStreetMap] Подтвердите ваш адрес электронной почты" signup_confirm_html: diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 8ea9fdc69..51ab9bdc5 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -982,7 +982,6 @@ sk: footer2: a môžete odpovedať na {{replyurl}} header: "{{from_user}} vám zaslal správu cez OpenStreetMap s predmetom {{subject}}:" hi: Ahoj {{to_user}}, - subject: "[OpenStreetMap] {{user}} pošleme vám novú správu" signup_confirm: subject: "[OpenStreetMap] Potvrďte svoju e-mailovú adresu" signup_confirm_html: diff --git a/config/locales/sl.yml b/config/locales/sl.yml index b47ecd5df..10214e7f6 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -628,7 +628,6 @@ sl: footer2: in nanj odgovorite na naslovu {{replyurl}} header: "Uporabnik {{from_user}} vam je prek OpenStreetMap poslal novo sporočilo glede {{subject}}:" hi: Pozdravljeni, {{to_user}}, - subject: "[OpenStreetMap] {{user}} vam je poslal novo sporočilo" signup_confirm: subject: "[OpenStreetMap] Potrdite svoj elektronski naslov" signup_confirm_html: diff --git a/config/locales/sr-EC.yml b/config/locales/sr-EC.yml index 718a599f1..b849d954a 100644 --- a/config/locales/sr-EC.yml +++ b/config/locales/sr-EC.yml @@ -734,7 +734,6 @@ sr-EC: message_notification: footer2: и можете одговорити на њу {{replyurl}} hi: Поздрав {{to_user}}, - subject: "[OpenStreetMap] {{user}} вам је послао нову поруку" signup_confirm: subject: "[OpenStreetMap] Потврдите вашу адресу е-поште" signup_confirm_html: diff --git a/config/locales/uk.yml b/config/locales/uk.yml index a2c76782c..81c86037b 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -3,6 +3,7 @@ # Export driver: syck # Author: AS # Author: Andygol +# Author: KEL # Author: Prima klasy4na # Author: Yurkoy # Author: Тест @@ -925,6 +926,7 @@ uk: shop_tooltip: Магазин з фірмовою символікою OpenStreetMap sign_up: реєстрація sign_up_tooltip: Створити обліковий запис для редагування + sotm2010: Запрошуємо на конференцію OpenStreetMap 2010 "The State of the Map", яка проходить 10-12 липня в Амстердамі! tag_line: Вільна Вікі-мапа Світу user_diaries: Щоденники user_diaries_tooltip: Подивитись щоденники @@ -1061,7 +1063,6 @@ uk: footer2: і ви можете відповісти на {{replyurl}} header: "{{from_user}} надіслав вам повідомлення через OpenStreetMap з темою {{subject}}:" hi: Привіт, {{to_user}}, - subject: "[OpenStreetMap] {{user}} надіслав вам нове повідомлення" signup_confirm: subject: "[OpenStreetMap] Підтвердіть вашу адресу електронної пошти" signup_confirm_html: @@ -1497,7 +1498,7 @@ uk: webmaster: веб-майстер terms: agree: Приймаю - consider_pd: Я вважаю, що мій внесок є суспільним надбанням + consider_pd: На додаток до зазначеної угоди, я вважаю, що мій внесок є суспільним надбанням consider_pd_why: що це? decline: Відхилити heading: Умови співпраці diff --git a/config/locales/vi.yml b/config/locales/vi.yml index b0e4ab4fd..4fce2f1c7 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -960,7 +960,6 @@ vi: footer2: và trả lời tại {{replyurl}} header: "{{from_user}} đã gửi thư cho bạn dùng OpenStreetMap có tiêu đề {{subject}}:" hi: Chào {{to_user}}, - subject: "[OpenStreetMap] {{user}} đã gửi thư mới cho bạn" signup_confirm: subject: "[OpenStreetMap] Xác nhận địa chỉ thư điện tử của bạn" signup_confirm_html: diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 99613a383..1405e8430 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -360,7 +360,6 @@ zh-CN: footer2: 并且您可以在{{replyurl}}回复 header: "{{from_user}}已经通过OpenStreetMap向您发送标题为{{subject}}的消息:" hi: 您好{{to_user}}, - subject: "[OpenStreetMap] {{user}}给您发送新消息" signup_confirm_html: click_the_link: 如果是您本人,那么欢迎您!请点击一下链接确认帐户并阅读更多关于OpenStreetMap的信息 current_user: 一个基于其所处位置的,当前用户分类列表可从这里获得Category:Users_by_geographical_region. diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index c8e67549f..0d71f76c9 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -536,7 +536,6 @@ zh-TW: footer2: 並在 {{replyurl}} 回覆 header: "{{from_user}} 透過 OpenStreetMap 寄給您主旨為 {{subject}} 的訊息:" hi: "{{to_user}}您好," - subject: "[OpenStreetMap] {{user}} 寄給您新的訊息" signup_confirm: subject: "[OpenStreetMap] 確認您的電子郵件" signup_confirm_html: diff --git a/config/potlatch/locales/uk.yml b/config/potlatch/locales/uk.yml index cd6a7b9c5..9b4f34106 100644 --- a/config/potlatch/locales/uk.yml +++ b/config/potlatch/locales/uk.yml @@ -3,6 +3,7 @@ # Export driver: syck # Author: AS # Author: Andygol +# Author: KEL # Author: Prima klasy4na uk: a_poi: $1 об’єкта (POI) @@ -136,6 +137,7 @@ uk: option_layer_os_streetview: "В.БРИТАНІЯ: OS StreetView" option_layer_osmarender: OSM — Osmarender option_layer_streets_haiti: "Гаїті: назви вулиць" + option_layer_surrey_air_survey: "UK: Surrey Air Survey" option_layer_tip: Оберіть фон option_limitways: Попереджати при завантаженні\nвеликих обсягів даних option_microblog_id: "Ім'я мікроблогу:" diff --git a/lib/diff_reader.rb b/lib/diff_reader.rb index 0b1593158..9b3e01b86 100644 --- a/lib/diff_reader.rb +++ b/lib/diff_reader.rb @@ -104,7 +104,7 @@ class DiffReader # take the first element and check that it is an osmChange element @reader.read - raise APIBadUserInput.new("Document element should be 'osmChange'.") if @reader.name != 'osmChange' + raise OSM::APIBadUserInput.new("Document element should be 'osmChange'.") if @reader.name != 'osmChange' result = OSM::API.new.get_xml_doc result.root.name = "diffResult" @@ -185,7 +185,7 @@ class DiffReader # delete doesn't have to contain a full payload, according to # the wiki docs, so we just extract the things we need. new_id = xml['id'].to_i - raise API::APIBadXMLError.new(model, xml, "ID attribute is required") if new_id.nil? + raise OSM::APIBadXMLError.new(model, xml, "ID attribute is required") if new_id.nil? # if the ID is a placeholder then map it to the real ID model_sym = model.to_s.downcase.to_sym diff --git a/public/images/sotm.png b/public/images/sotm.png deleted file mode 100644 index af2d049bc..000000000 Binary files a/public/images/sotm.png and /dev/null differ diff --git a/public/javascripts/map.js b/public/javascripts/map.js index fd45d9304..272913d20 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -34,21 +34,24 @@ function createMap(divName, options) { var mapnik = new OpenLayers.Layer.OSM.Mapnik(i18n("javascripts.map.base.mapnik"), { keyid: "mapnik", displayOutsideMaxExtent: true, - wrapDateLine: true + wrapDateLine: true, + layerCode: "M" }); map.addLayer(mapnik); var osmarender = new OpenLayers.Layer.OSM.Osmarender(i18n("javascripts.map.base.osmarender"), { keyid: "osmarender", displayOutsideMaxExtent: true, - wrapDateLine: true + wrapDateLine: true, + layerCode: "O" }); map.addLayer(osmarender); var cyclemap = new OpenLayers.Layer.OSM.CycleMap(i18n("javascripts.map.base.cycle_map"), { keyid: "cyclemap", displayOutsideMaxExtent: true, - wrapDateLine: true + wrapDateLine: true, + layerCode: "C" }); map.addLayer(cyclemap); @@ -60,16 +63,11 @@ function createMap(divName, options) { ], { displayOutsideMaxExtent: true, wrapDateLine: true, - numZoomLevels: 19 + numZoomLevels: 19, + layerCode: "N" }); map.addLayer(noname); - var maplint = new OpenLayers.Layer.OSM.Maplint(i18n("javascripts.map.overlays.maplint"), { - displayOutsideMaxExtent: true, - wrapDateLine: true - }); - map.addLayer(maplint); - var numZoomLevels = Math.max(mapnik.numZoomLevels, osmarender.numZoomLevels); markers = new OpenLayers.Layer.Markers("Markers", { @@ -226,39 +224,53 @@ function getEventPosition(event) { function getMapLayers() { var layerConfig = ""; - for (var layers = map.getLayersBy("isBaseLayer", true), i = 0; i < layers.length; i++) { - layerConfig += layers[i] == map.baseLayer ? "B" : "0"; - } - - for (var layers = map.getLayersBy("isBaseLayer", false), i = 0; i < layers.length; i++) { - layerConfig += layers[i].getVisibility() ? "T" : "F"; + for (var i = 0; i < map.layers.length; i++) { + if (map.layers[i].layerCode && map.layers[i].getVisibility()) { + layerConfig += map.layers[i].layerCode; + } } return layerConfig; } function setMapLayers(layerConfig) { - var l = 0; + if (layerConfig.charAt(0) == "B" || layerConfig.charAt(0) == "0") { + var l = 0; - for (var layers = map.getLayersBy("isBaseLayer", true), i = 0; i < layers.length; i++) { - var c = layerConfig.charAt(l++); + for (var layers = map.getLayersBy("isBaseLayer", true), i = 0; i < layers.length; i++) { + var c = layerConfig.charAt(l++); - if (c == "B") { - map.setBaseLayer(layers[i]); + if (c == "B") { + map.setBaseLayer(layers[i]); + } } - } - while (layerConfig.charAt(l) == "B" || layerConfig.charAt(l) == "0") { - l++; - } + while (layerConfig.charAt(l) == "B" || layerConfig.charAt(l) == "0") { + l++; + } - for (var layers = map.getLayersBy("isBaseLayer", false), i = 0; i < layers.length; i++) { - var c = layerConfig.charAt(l++); + for (var layers = map.getLayersBy("isBaseLayer", false), i = 0; i < layers.length; i++) { + var c = layerConfig.charAt(l++); - if (c == "T") { - layers[i].setVisibility(true); - } else if(c == "F") { - layers[i].setVisibility(false); + if (c == "T") { + layers[i].setVisibility(true); + } else if(c == "F") { + layers[i].setVisibility(false); + } + } + } else { + for (var i = 0; i < map.layers.length; i++) { + if (map.layers[i].layerCode) { + if (layerConfig.indexOf(map.layers[i].layerCode) >= 0) { + if (map.layers[i].isBaseLayer) { + map.setBaseLayer(map.layers[i]); + } else { + map.layers[i].setVisibility(true); + } + } else { + map.layers[i].setVisibility(false); + } + } } } } diff --git a/public/javascripts/site.js b/public/javascripts/site.js index 0a5aae4ad..0e2c5aeb7 100644 --- a/public/javascripts/site.js +++ b/public/javascripts/site.js @@ -107,10 +107,8 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj args[objtype] = objid; } - // This is a hack to omit the default mapnik layer (B000FTF) from - // the shortlink. B000FTFT is then the "Object" layer which we get - // on /?{node,way,relation}=id - if (layers && (layers != "B000FTF") && (layers != "B000FTFT")) { + // This is a hack to omit the default mapnik layer from the shortlink. + if (layers && layers != "M") { args["layers"] = layers; } else { diff --git a/public/openlayers/OpenStreetMap.js b/public/openlayers/OpenStreetMap.js index ce8a6e81f..69f141806 100644 --- a/public/openlayers/OpenStreetMap.js +++ b/public/openlayers/OpenStreetMap.js @@ -111,31 +111,3 @@ OpenLayers.Layer.OSM.CycleMap = OpenLayers.Class(OpenLayers.Layer.OSM, { CLASS_NAME: "OpenLayers.Layer.OSM.CycleMap" }); - -/** - * Class: OpenLayers.Layer.OSM.Maplint - * - * Inherits from: - * - - */ -OpenLayers.Layer.OSM.Maplint = OpenLayers.Class(OpenLayers.Layer.OSM, { - /** - * Constructor: OpenLayers.Layer.OSM.Maplint - * - * Parameters: - * name - {String} - * options - {Object} Hashtable of extra options to tag onto the layer - */ - initialize: function(name, options) { - var url = [ - "http://d.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png", - "http://e.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png", - "http://f.tah.openstreetmap.org/Tiles/maplint/${z}/${x}/${y}.png" - ]; - options = OpenLayers.Util.extend({ numZoomLevels: 18, isBaseLayer: false, visibility: false }, options); - var newArguments = [name, url, options]; - OpenLayers.Layer.OSM.prototype.initialize.apply(this, newArguments); - }, - - CLASS_NAME: "OpenLayers.Layer.OSM.Maplint" -}); diff --git a/public/stylesheets/browse.css b/public/stylesheets/browse.css index 68bef6cc5..19d31d9c1 100644 --- a/public/stylesheets/browse.css +++ b/public/stylesheets/browse.css @@ -1,5 +1,6 @@ .node { padding-left: 25px; } .way { padding-left: 25px; } +.relation { padding-left: 25px; } .deleted { text-decoration: line-through; } diff --git a/script/deliver-message b/script/deliver-message index 3df09f85f..85519b299 100755 --- a/script/deliver-message +++ b/script/deliver-message @@ -23,7 +23,7 @@ mail = TMail::Mail.parse(STDIN.readlines.join) message = Message.new(:sender => from, :recipient => to, :sent_on => Time.now.getutc, - :title => mail.subject, + :title => mail.subject.sub(/\[OpenStreetMap\] */, ""), :body => mail.body) message.save! diff --git a/test/functional/diary_entry_controller_test.rb b/test/functional/diary_entry_controller_test.rb index bd65088e4..38c7bddcd 100644 --- a/test/functional/diary_entry_controller_test.rb +++ b/test/functional/diary_entry_controller_test.rb @@ -137,7 +137,9 @@ class DiaryEntryControllerTest < ActionController::TestCase assert_select "p", :text => /#{new_body}/, :count => 1 assert_select "abbr[class=geo][title=#{number_with_precision(new_latitude, :precision => 4)}; #{number_with_precision(new_longitude, :precision => 4)}]", :count => 1 # As we're not logged in, check that you cannot edit - assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 0 + assert_select "span[class=hidden show_if_user_#{users(:normal_user).id}]", :count => 1 do + assert_select "a[href='/user/#{users(:normal_user).display_name}/diary/#{diary_entries(:normal_user_entry_1).id}/edit']", :text => "Edit this entry", :count => 1 + end end end end