]> git.openstreetmap.org Git - rails.git/commitdiff
Merge 16891:17044 from trunk.
authorTom Hughes <tom@compton.nu>
Thu, 13 Aug 2009 17:18:08 +0000 (17:18 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 13 Aug 2009 17:18:08 +0000 (17:18 +0000)
33 files changed:
app/controllers/api_controller.rb
app/controllers/diary_entry_controller.rb
app/controllers/trace_controller.rb
app/models/node.rb
app/models/relation.rb
app/models/trace.rb
app/models/tracepoint.rb
app/models/user.rb
app/models/way.rb
app/views/changeset/list.atom.builder
app/views/trace/_trace_form.html.erb
app/views/trace/edit.html.erb
app/views/trace/view.html.erb
app/views/user/_friend_map.html.erb
config/locales/en.yml
config/locales/hu.yml
config/locales/is.yml
config/locales/vi.yml
config/potlatch/localised/en/help.html
config/routes.rb
db/migrate/039_add_more_controls_to_gpx_files.rb [new file with mode: 0644]
db/migrate/040_create_oauth_tables.rb [moved from db/migrate/039_create_oauth_tables.rb with 100% similarity]
db/migrate/041_add_fine_o_auth_permissions.rb [moved from db/migrate/040_add_fine_o_auth_permissions.rb with 100% similarity]
db/migrate/042_add_foreign_keys_to_oauth_tables.rb [moved from db/migrate/041_add_foreign_keys_to_oauth_tables.rb with 100% similarity]
public/javascripts/site.js
public/potlatch/potlatch.swf
test/fixtures/gps_points.yml
test/fixtures/gpx_files.yml
test/functional/api_controller_test.rb
test/functional/changeset_controller_test.rb
test/functional/node_controller_test.rb
test/unit/trace_test.rb
test/unit/tracepoint_test.rb

index 564f718993d2642433a7a44bbdfe7f4385f5f9a6..3e9e627db7fe02c2b7f5777f32f1429b13e9ed1d 100644 (file)
@@ -11,10 +11,7 @@ class ApiController < ApplicationController
   # within the specified bounding box, and in the specified page.
   def trackpoints
     #retrieve the page number
-    page = params['page'].to_i
-    unless page
-        page = 0;
-    end
+    page = params['page'].to_s.to_i
 
     unless page >= 0
         report_error("Page number must be greater than or equal to 0")
@@ -42,7 +39,7 @@ class ApiController < ApplicationController
     end
 
     # get all the points
-    points = Tracepoint.find_by_area(min_lat, min_lon, max_lat, max_lon, :offset => offset, :limit => APP_CONFIG['tracepoints_per_page'], :order => "timestamp DESC" )
+    points = Tracepoint.find_by_area(min_lat, min_lon, max_lat, max_lon, :offset => offset, :limit => APP_CONFIG['tracepoints_per_page'], :order => "gpx_id DESC, trackid ASC, timestamp ASC" )
 
     doc = XML::Document.new
     doc.encoding = XML::Encoding::UTF_8
@@ -53,14 +50,61 @@ class ApiController < ApplicationController
     
     doc.root = root
 
-    track = XML::Node.new 'trk'
-    doc.root << track
-
-    trkseg = XML::Node.new 'trkseg'
-    track << trkseg
+    # initialise these variables outside of the loop so that they
+    # stay in scope and don't get free'd up by the GC during the
+    # loop.
+    gpx_id = -1
+    trackid = -1
+    track = nil
+    trkseg = nil
+    anon_track = nil
+    anon_trkseg = nil
+    gpx_file = nil
+    timestamps = false
 
     points.each do |point|
-      trkseg << point.to_xml_node()
+      if gpx_id != point.gpx_id
+        gpx_id = point.gpx_id
+        trackid = -1
+        gpx_file = Trace.find(gpx_id)
+
+        if gpx_file.trackable?
+          track = XML::Node.new 'trk'
+          doc.root << track
+          timestamps = true
+
+          if gpx_file.identifiable?
+            track << (XML::Node.new("name") << gpx_file.name)
+            track << (XML::Node.new("desc") << gpx_file.description)
+            track << (XML::Node.new("url") << url_for(:controller => 'trace', :action => 'view', :id => gpx_file.id))
+          end
+        else
+          # use the anonymous track segment if the user hasn't allowed
+          # their GPX points to be tracked.
+          timestamps = false
+          if anon_track.nil? 
+            anon_track = XML::Node.new 'trk'
+            doc.root << anon_track
+          end
+          track = anon_track
+        end
+      end
+      
+      if trackid != point.trackid
+        if gpx_file.trackable?
+          trkseg = XML::Node.new 'trkseg'
+          track << trkseg
+          trackid = point.trackid
+        else
+          if anon_trkseg.nil? 
+            anon_trkseg = XML::Node.new 'trkseg'
+            anon_track << anon_trkseg
+          end
+          trkseg = anon_trkseg
+        end
+      end
+
+      trkseg << point.to_xml_node(timestamps)
     end
 
     response.headers["Content-Disposition"] = "attachment; filename=\"map.osm\""
index 48cdda8a03df2823b55684ccd63d3265b41496ce..52e287b9a1d9fe65ad55038e6f6542a5c6276b39 100644 (file)
@@ -103,8 +103,8 @@ class DiaryEntryController < ApplicationController
 
       if user
         @entries = DiaryEntry.find(:all, :conditions => ['user_id = ?', user.id], :order => 'created_at DESC', :limit => 20)
-        @title = "OpenStreetMap diary entries for #{user.display_name}"
-        @description = "Recent OpenStreetmap diary entries from #{user.display_name}"
+        @title = I18n.t('diary_entry.feed.user.title', :user => user.display_name, :locale => I18n.locale)
+        @description = I18n.t('diary_entry.feed.user.description', :user => user.display_name)
         @link = "http://#{SERVER_URL}/user/#{user.display_name}/diary"
       else
         render :nothing => true, :status => :not_found
@@ -113,15 +113,15 @@ class DiaryEntryController < ApplicationController
       @entries = DiaryEntry.find(:all, :include => :user,
         :conditions => ["users.visible = ? AND diary_entries.language_code = ?", true, params[:language]],
         :order => 'created_at DESC', :limit => 20)
-      @title = "OpenStreetMap diary entries in #{Language.find(params[:language]).english_name}"
-      @description = "Recent diary entries from users of OpenStreetMap in #{Language.find(params[:language]).english_name}"
+      @title = I18n.t('diary_entry.feed.language.title', Language.find(params[:language]).english_name)
+      @description = I18n.t('diary_entry.feed.language.description', Language.find(params[:language]).english_name)
       @link = "http://#{SERVER_URL}/diary/#{params[:language]}"
     else
       @entries = DiaryEntry.find(:all, :include => :user,
                                  :conditions => ["users.visible = ?", true],
                                  :order => 'created_at DESC', :limit => 20)
-      @title = "OpenStreetMap diary entries"
-      @description = "Recent diary entries from users of OpenStreetMap"
+      @title = I18n.t('diary_entry.feed.all.title')
+      @description = I18n.t('diary_entry.feed.all.description')
       @link = "http://#{SERVER_URL}/diary"
     end
   end
index 17b66796923f9e4021bb29a93733913e99f95fdc..f06a162fbc00b850d03b971cc7a59ae9ad60ec62 100644 (file)
@@ -3,10 +3,10 @@ class TraceController < ApplicationController
 
   before_filter :authorize_web
   before_filter :set_locale
-  before_filter :require_user, :only => [:mine, :create, :edit, :delete, :make_public]
+  before_filter :require_user, :only => [:mine, :create, :edit, :delete]
   before_filter :authorize, :only => [:api_details, :api_data, :api_create]
   before_filter :check_database_readable, :except => [:api_details, :api_data, :api_create]
-  before_filter :check_database_writable, :only => [:create, :edit, :delete, :make_public]
+  before_filter :check_database_writable, :only => [:create, :edit, :delete]
   before_filter :check_api_readable, :only => [:api_details, :api_data]
   before_filter :check_api_writable, :only => [:api_create]
   before_filter :require_allow_read_gpx, :only => [:api_details, :api_data]
@@ -45,15 +45,15 @@ class TraceController < ApplicationController
     # 4 - user's traces, not logged in as that user = all user's public traces
     if target_user.nil? # all traces
       if @user
-        conditions = ["(gpx_files.public = ? OR gpx_files.user_id = ?)", true, @user.id] #1
+        conditions = ["(gpx_files.visibility <> 'private' OR gpx_files.user_id = ?)", @user.id] #1
       else
-        conditions  = ["gpx_files.public = ?", true] #2
+        conditions  = ["gpx_files.visibility <> 'private'"] #2
       end
     else
       if @user and @user == target_user
         conditions = ["gpx_files.user_id = ?", @user.id] #3 (check vs user id, so no join + can't pick up non-public traces by changing name)
       else
-        conditions = ["gpx_files.public = ? AND gpx_files.user_id = ?", true, target_user.id] #4
+        conditions = ["gpx_files.public <> 'private' AND gpx_files.user_id = ?", target_user.id] #4
       end
     end
     
@@ -98,10 +98,13 @@ class TraceController < ApplicationController
   def mine
     # Load the preference of whether the user set the trace public the last time
     @trace = Trace.new
-    if @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
-      @trace.public = false
+    visibility = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
+    if visibility
+      @trace.visibility = visibility.v
+    elsif @user.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"}).nil?
+      @trace.visibility = "private"
     else 
-      @trace.public = true
+      @trace.visibility = "public"
     end
     list(@user, "mine")
   end
@@ -126,7 +129,7 @@ class TraceController < ApplicationController
       logger.info(params[:trace][:gpx_file].class.name)
       if params[:trace][:gpx_file].respond_to?(:read)
         do_create(params[:trace][:gpx_file], params[:trace][:tagstring],
-                  params[:trace][:description], params[:trace][:public])
+                  params[:trace][:description], params[:trace][:visibility])
 
         if @trace.id
           logger.info("id is #{@trace.id}")
@@ -138,7 +141,7 @@ class TraceController < ApplicationController
         @trace = Trace.new({:name => "Dummy",
                             :tagstring => params[:trace][:tagstring],
                             :description => params[:trace][:description],
-                            :public => params[:trace][:public],
+                            :visibility => params[:trace][:visibility],
                             :inserted => false, :user => @user,
                             :timestamp => Time.now.getutc})
         @trace.valid?
@@ -172,6 +175,7 @@ class TraceController < ApplicationController
       if params[:trace]
         @trace.description = params[:trace][:description]
         @trace.tagstring = params[:trace][:tagstring]
+        @trace.visibility = params[:trace][:visibility]
         if @trace.save
           redirect_to :action => 'view'
         end        
@@ -202,27 +206,8 @@ class TraceController < ApplicationController
     render :nothing => true, :status => :not_found
   end
 
-  def make_public
-    trace = Trace.find(params[:id])
-
-    if @user and trace.user == @user
-      if request.post? and !trace.public?
-        trace.public = true
-        trace.save
-        flash[:notice] = t 'trace.make_public.made_public'
-        redirect_to :controller => 'trace', :action => 'view', :id => params[:id]
-      else
-        render :nothing => true, :status => :bad_request
-      end
-    else
-      render :nothing => true, :status => :forbidden
-    end
-  rescue ActiveRecord::RecordNotFound
-    render :nothing => true, :status => :not_found
-  end
-
   def georss
-    conditions = ["gpx_files.public = ?", true]
+    conditions = ["gpx_files.visibility <> 'private'"]
 
     if params[:display_name]
       conditions[0] += " AND users.display_name = ?"
@@ -251,7 +236,7 @@ class TraceController < ApplicationController
 
     if trace.inserted?
       if trace.public? or (@user and @user == trace.user)
-        expires_in 7.days, :private => !trace.public, :public => trace.public
+        expires_in 7.days, :private => !trace.public?, :public => trace.public?
         send_file(trace.large_picture_name, :filename => "#{trace.id}.gif", :type => 'image/gif', :disposition => 'inline')
       else
         render :nothing => true, :status => :forbidden
@@ -268,7 +253,7 @@ class TraceController < ApplicationController
 
     if trace.inserted?
       if trace.public? or (@user and @user == trace.user)
-        expires_in 7.days, :private => !trace.public, :public => trace.public
+        expires_in 7.days, :private => !trace.public?, :public => trace.public?
         send_file(trace.icon_picture_name, :filename => "#{trace.id}_icon.gif", :type => 'image/gif', :disposition => 'inline')
       else
         render :nothing => true, :status => :forbidden
@@ -308,10 +293,14 @@ class TraceController < ApplicationController
     if request.post?
       tags = params[:tags] || ""
       description = params[:description] || ""
-      pub = params[:public] || false
+      visibility = params[:visibility] || false
+
+      if params[:public] && !visibility
+        visibility = "public"
+      end
       
       if params[:file].respond_to?(:read)
-        do_create(params[:file], tags, description, pub)
+        do_create(params[:file], tags, description, visibility)
 
         if @trace.id
           render :text => @trace.id.to_s, :content_type => "text/plain"
@@ -330,7 +319,7 @@ class TraceController < ApplicationController
 
 private
 
-  def do_create(file, tags, description, public)
+  def do_create(file, tags, description, visibility)
     # Sanitise the user's filename
     name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_')
 
@@ -346,7 +335,7 @@ private
       :name => name,
       :tagstring => tags,
       :description => description,
-      :public => public,
+      :visibility => visibility,
       :inserted => true,
       :user => @user,
       :timestamp => Time.now.getutc
@@ -365,14 +354,12 @@ private
       FileUtils.rm_f(filename)
     end
     
-    # Finally save whether the user marked the trace as being public
-    if @trace.public?
-      if @user.trace_public_default.nil?
-        @user.preferences.create(:k => "gps.trace.public", :v => "default")
-      end
+    # Finally save the user's preferred previacy level
+    if pref = @user.preferences.find(:first, :conditions => {:k => "gps.trace.visibility"})
+      pref.v = visibility
+      pref.save
     else
-      pref = @user.trace_public_default
-      pref.destroy unless pref.nil?
+      @user.preferences.create(:k => "gps.trace.visibility", :v => visibility)
     end
     
   end
index dd8d96d12aa2116b56be6e2a3b1d986c3a884f9f..df6442b833405140075cb43b2f65b557551c5b80 100644 (file)
@@ -70,6 +70,7 @@ class Node < ActiveRecord::Base
       doc.find('//osm/node').each do |pt|
         return Node.from_xml_node(pt, create)
       end
+      raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/node element.")
     rescue LibXML::XML::Error, ArgumentError => ex
       raise OSM::APIBadXMLError.new("node", xml, ex.message)
     end
index 76cd86729cdc8ed3d3ce16600b799eb9b5813bdc..e3ba69b56386dae78e9df50a0f3225eb63ae2dda 100644 (file)
@@ -33,6 +33,7 @@ class Relation < ActiveRecord::Base
       doc.find('//osm/relation').each do |pt|
         return Relation.from_xml_node(pt, create)
       end
+      raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/relation element.")
     rescue LibXML::XML::Error, ArgumentError => ex
       raise OSM::APIBadXMLError.new("relation", xml, ex.message)
     end
index 7f2607b0f77aa4d6f4ff18e8423c1c01c33b4c7e..cbfd68996ff5a7944ecb5df197a01163fd670575 100644 (file)
@@ -6,8 +6,9 @@ class Trace < ActiveRecord::Base
   validates_length_of :name, :maximum => 255
   validates_length_of :description, :maximum => 255
 #  validates_numericality_of :latitude, :longitude
-  validates_inclusion_of :public, :inserted, :in => [ true, false]
-  
+  validates_inclusion_of :inserted, :in => [ true, false ]
+  validates_inclusion_of :visibility, :in => ["private", "public", "trackable", "identifiable"]
+
   belongs_to :user
   has_many :tags, :class_name => 'Tracetag', :foreign_key => 'gpx_id', :dependent => :delete_all
   has_many :points, :class_name => 'Tracepoint', :foreign_key => 'gpx_id', :dependent => :delete_all
@@ -24,7 +25,7 @@ class Trace < ActiveRecord::Base
   end
 
   def tagstring=(s)
-    if s.include?','
+    if s.include? ','
       self.tags = s.split(/\s*,\s*/).collect {|tag|
         tt = Tracetag.new
         tt.tag = tag
@@ -39,7 +40,19 @@ class Trace < ActiveRecord::Base
       }
     end
   end
-  
+
+  def public?
+    visibility == "public" || visibility == "identifiable"
+  end
+
+  def trackable?
+    visibility == "trackable" || visibility == "identifiable"
+  end
+
+  def identifiable?
+    visibility == "identifiable"
+  end
+
   def large_picture= (data)
     f = File.new(large_picture_name, "wb")
     f.syswrite(data)
@@ -139,7 +152,7 @@ class Trace < ActiveRecord::Base
     el1['lat'] = self.latitude.to_s
     el1['lon'] = self.longitude.to_s
     el1['user'] = self.user.display_name
-    el1['public'] = self.public.to_s
+    el1['visibility'] = self.visibility
     el1['pending'] = (!self.inserted).to_s
     el1['timestamp'] = self.timestamp.xmlschema
     return el1
index bf3cdd7c06557978e40614360394b22e85ba78db..d4ba39de39368419f2a2434c0ba5acfb2d8a6493 100644 (file)
@@ -11,10 +11,11 @@ class Tracepoint < ActiveRecord::Base
 
   belongs_to :trace, :foreign_key => 'gpx_id'
 
-  def to_xml_node
+  def to_xml_node(print_timestamp = false)
     el1 = XML::Node.new 'trkpt'
     el1['lat'] = self.lat.to_s
     el1['lon'] = self.lon.to_s
+    el1 << (XML::Node.new("time") << self.timestamp.xmlschema) if print_timestamp
     return el1
   end
 end
index 1e594479728bde84bdad8ae237b368c9820762a2..ae5b0b74f708b5b94ba5fc09242762b904c36955 100644 (file)
@@ -125,10 +125,6 @@ class User < ActiveRecord::Base
     return false
   end
 
-  def trace_public_default
-    return self.preferences.find(:first, :conditions => {:k => "gps.trace.public", :v => "default"})
-  end
-
   def delete
     self.active = false
     self.display_name = "user_#{self.id}"
index e2641873284d5e84de69b47a220ed4c7cfbd6655..639f4e69a770ad94e1d2ccda8884d90cabffa459 100644 (file)
@@ -34,6 +34,7 @@ class Way < ActiveRecord::Base
       doc.find('//osm/way').each do |pt|
         return Way.from_xml_node(pt, create)
       end
+      raise OSM::APIBadXMLError.new("node", xml, "XML doesn't contain an osm/way element.")
     rescue LibXML::XML::Error, ArgumentError => ex
       raise OSM::APIBadXMLError.new("way", xml, ex.message)
     end
index db53cdb080c381c534f452876cea97ee171ce30c..6dcdd4f1d78f80f331b12389efcefd959f46ec04 100644 (file)
@@ -29,7 +29,11 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
                  :href => changeset_download_url(changeset, :only_path => false),
                  :type => "application/osmChange+xml"
 
-      entry.title t('browse.changeset.title') + " " + h(changeset.id)
+      if !changeset.tags.empty? and changeset.tags.has_key? "comment"
+        entry.title t('browse.changeset.feed.title_comment', :id => h(changeset.id), :comment => h(changeset.tags['comment'])), :type => "html"
+      else
+        entry.title t('browse.changeset.feed.title', :id => h(changeset.id))
+      end
 
       if changeset.user.data_public?
         entry.author do |author|
index b178a7532a30a4fc8ccb62f133fbc7d48a30530f..194b8b2bc920135d9e30a12065ead1a9d48b07ee 100644 (file)
@@ -3,7 +3,7 @@
   <tr><td align="right"><%= t'trace.trace_form.upload_gpx' %></td><td><%= f.file_field :gpx_file, :size => 50, :maxlength => 255 %></td></tr>
   <tr><td align="right"><%= t'trace.trace_form.description' %></td><td><%= f.text_field :description, :size => 50, :maxlength => 255 %></td></tr>
   <tr><td align="right"><%= t'trace.trace_form.tags' %></td><td><%= f.text_field :tagstring, :size => 50, :maxlength => 255 %> (<%= t'trace.trace_form.tags_help' %>)</td></tr>
-  <tr><td align="right"><%= t'trace.trace_form.public' %></td><td><%= f.check_box :public %> <span class="minorNote">(<a href="<%= t'trace.trace_form.public_help_url' %>"><%= t'trace.trace_form.public_help' %></a>)</span></td></tr>
+  <tr><td align="right"><%= t'trace.trace_form.visibility' %></td><td><%= f.select :visibility, [[t('trace.visibility.private'),"private"],[t('trace.visibility.public'),"public"],[t('trace.visibility.trackable'),"trackable"],[t('trace.visibility.identifiable'),"identifiable"]] %> <span class="minorNote">(<a href="<%= t'trace.trace_form.visibility_help_url' %>"><%= t'trace.trace_form.visibility_help' %></a>)</span></td></tr>
   <tr><td></td><td><%= submit_tag t('trace.trace_form.upload_button') %> | <a href="<%= t'trace.trace_form.help_url' %>"><%= t'trace.trace_form.help' %></a></td></tr>
 </table>
 <% end %>
index e14e152dd1cab05fc10a704c9b527cad5ce2be4e..523607ae63b660094bcd930dbe92a175b261b105 100644 (file)
     <td><%= t'trace.edit.tags' %></td>
     <td><%= f.text_field :tagstring, :size => 50 %> (<%= t'trace.edit.tags_help' %>)</td>
   </tr>
+  <tr>
+    <td><%= t'trace.edit.visibility' %></td>
+    <td><%= f.select :visibility, [[t('trace.visibility.private'),"private"],[t('trace.visibility.public'),"public"],[t('trace.visibility.trackable'),"trackable"],[t('trace.visibility.identifiable'),"identifiable"]] %> (<a href="<%= t'trace.edit.visibility_help_url' %>"><%= t'trace.edit.visibility_help' %></a>)</td>
+  </tr>
 </table>
 
 <br /><br />
index 4ab46bd3ef5de04b7dda87d5d27fc1589af83090..47a9f8ad22f1f4fed9f8cea05252fefd4ece282a 100644 (file)
     <% end %>
     </td>
   </tr>
+  <tr>
+    <td><%= t'trace.view.visibility' %></td>
+    <td><%= t"trace.visibility.#{@trace.visibility}" %></td>
+  </tr>
 </table>
 
 <br /><br />
 
 <table>
   <tr>
-    <% unless @trace.public? %>
-    <td><%= button_to t('trace.view.make_public'), :controller => 'trace', :action => 'make_public', :id => @trace.id %></td>
-    <% end %>
     <% if @trace.user == @user %>
     <td><%= button_to t('trace.view.edit_track'), :controller => 'trace', :action => 'edit', :id => @trace.id %></td>
     <% end %>
index 72f02bd61163b6281de5012c0af6fe4de1cda7e1..75303f10d349b3e6fdd1288c2501a449114efb86 100644 (file)
@@ -2,7 +2,7 @@
 <% if !@user.home_lat.nil? and !@user.home_lon.nil? %>
   <% if !@user.nearby.empty? %>
     <% @user.nearby.each do |nearby| %>
-    <% nearest_str += "nearest.push( { 'display_name' : '#{nearby.display_name}', 'home_lat' : #{nearby.home_lat}, 'home_lon' : #{nearby.home_lon} } );\n" %>
+    <% nearest_str += "nearest.push( { 'display_name' : '#{escape_javascript(nearby.display_name)}', 'home_lat' : #{nearby.home_lat}, 'home_lon' : #{nearby.home_lon} } );\n" %>
     <% end %>
   <% end %>
 <% end %>
index 2cf7a3aa8f72e79ee6f07d703d6b7008d0e3d411..16f66dbbc12945ce3caffc28e0a4997fcc8ba90c 100644 (file)
@@ -87,6 +87,9 @@ en:
       download: "Download {{changeset_xml_link}} or {{osmchange_xml_link}}"
       changesetxml: "Changeset XML"
       osmchangexml: "osmChange XML"
+      feed:
+        title: "Changeset {{id}}"
+        title_comment: "Changeset {{id}} - {{comment}}"
     changeset_navigation:
       user:
         name_tooltip: "View edits by {{user}}"
@@ -317,6 +320,16 @@ en:
       edit_link: Edit this entry
     diary_comment:
       comment_from: "Comment from {{link_user}}  at {{comment_created_at}}"
+    feed:
+      user:
+        title: "OpenStreetMap diary entries for {{user}}"
+        description: "Recent OpenStreetmap diary entries from {{user}}"
+      language:
+        title: "OpenStreetMap diary entries in {{language_name}}"
+        description: "Recent diary entries from users of OpenStreetMap in {{language_name}}"
+      all:
+        title: "OpenStreetMap diary entries"
+        description: "Recent diary entries from users of OpenStreetMap"
   export:
     start:
       area_to_export: "Area to Export"
@@ -690,6 +703,11 @@ en:
           destination: "Destination access"
           construction: "Roads under construction"
   trace:
+    visibility:
+      private: "Private (only shared as anonymous, unordered points)"
+      public: "Public (shown in trace list and as anonymous, unordered points)"
+      trackable: "Trackable (only shared as anonymous, ordered points with timestamps)"
+      identifiable: "Identifiable (shown in trace list and as identifiable, ordered points with timestamps)"
     create:
       upload_trace: "Upload GPS Trace"
       trace_uploaded: "Your GPX file has been uploaded and is awaiting insertion in to the database. This will usually happen within half an hour, and an email will be sent to you on completion."
@@ -708,6 +726,9 @@ en:
       tags: "Tags:"
       tags_help: "comma delimited"
       save_button: "Save Changes"
+      visibility: "Visibility:"
+      visibility_help: "what does this mean?"
+      visibility_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
     no_such_user:
       title: "No such user"
       heading: "The user {{user}} does not exist"
@@ -717,9 +738,9 @@ en:
       description: "Description"
       tags: "Tags"
       tags_help: "comma delimited"
-      public: "Public?"
-      public_help: "what does this mean?"
-      public_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
+      visibility: "Visibility"
+      visibility_help: "what does this mean?"
+      visibility_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces"
       upload_button: "Upload"
       help: "Help"
       help_url: "http://wiki.openstreetmap.org/wiki/Upload"
@@ -745,10 +766,10 @@ en:
       description: "Description:"
       tags: "Tags:"
       none: "None"
-      make_public: "Make this track public permanently"
       edit_track: "Edit this track"
       delete_track: "Delete this track"
       trace_not_found: "Trace not found!"
+      visibility: "Visibility:"
     trace_paging_nav:
       showing: "Showing page"
       of: "of"
index 001cdcf6f4053dfad921182426222264d44bed59..d65033c46c9124814b4abd3a8abf01c808c5f17a 100644 (file)
@@ -239,6 +239,7 @@ hu:
       showing_page: "Jelenlegi oldal:"
       of: "összesen:"
     changeset:
+      id: "#{{id}}"
       still_editing: "(szerkesztés alatt)"
       anonymous: "Névtelen"
       no_comment: "(nincs)"
@@ -254,10 +255,19 @@ hu:
       area: "Terület"
     list:
       title: "Módosításcsomagok"
-      description: "Legutóbbi szerkesztések"
-      description_user: "{{user}} legutóbbi szerkesztései"
-      description_bbox: "Legutóbbi szerkesztések ezen belül: {{bbox}}"
-      description_user_bbox: "{{user}} legutóbbi szerkesztései ezen belül: {{bbox}}"
+      title_user: "{{user}} módosításcsomagjai"
+      title_bbox: "Módosításcsomagok ezen belül: {{bbox}}"
+      title_user_bbox: "{{user}} módosításcsomagjai ezen belül: {{bbox}}"
+
+      heading: "Módosításcsomagok"
+      heading_user: "Módosításcsomagok"
+      heading_bbox: "Módosításcsomagok"
+      heading_user_bbox: "Módosításcsomagok"
+
+      description: "Legutóbbi módosítások"
+      description_user: "{{user}} módosításcsomagjai"
+      description_bbox: "Módosításcsomagok ezen belül: {{bbox}}"
+      description_user_bbox: "{{user}} módosításcsomagjai ezen belül: {{bbox}}"
   diary_entry:
     new:
       title: Új naplóbejegyzés
@@ -538,6 +548,7 @@ hu:
       unread_button: "Jelölés olvasatlanként"
       read_button: "Jelölés olvasottként"
       reply_button: "Válasz"
+      delete_button: "Törlés"
     new:
       title: "Üzenet küldése"
       send_message_to: "Új üzenet küldése neki: {{name}}"
@@ -573,9 +584,13 @@ hu:
       reading_your_sent_messages: "Elküldött üzenetek olvasása"
       to: "Címzett"
       back_to_outbox: "Vissza az elküldött üzenetekhez"
+    sent_message_summary:
+      delete_button: "Törlés"
     mark:
-      as_read: "Üzenet jelölése olvasottként"
-      as_unread: "Üzenet jelölése olvasatlanként"
+      as_read: "Üzenet megjelölve olvasottként"
+      as_unread: "Üzenet megjelölve olvasatlanként"
+    delete:
+      deleted: "Üzenet törölve"
   site:
     index:
       js_1: "Vagy egy olyan böngészőt használsz, amely nem támogatja a javascriptet, vagy letiltottad a javascriptet."
@@ -773,15 +788,19 @@ hu:
       account not active: "Sajnálom, a felhasználói fiókod még nincs aktiválva.<br>Az aktiváláshoz, kattints a fiókodat megerősítő e-mailben lévő hivatkozásra."
       auth failure: "Sajnálom, ilyen adatokkal nem tudsz bejelentkezni."
     lost_password:
-      title: "elvesztett jelszó"
+      title: "Elvesztett jelszó"
       heading: "Elfelejtetted jelszavad?"
       email address: "E-mail cím:"
-      new password button: "Küldj nekem egy új jelszót"
+      new password button: "Jelszó alaphelyzetbe állítása"
       notice email on way: "Sajnálom, hogy elvesztetted :-( de már úton van egy e-mail, így nemsokára alaphelyzetbe állíthatod."
       notice email cannot find: "Az e-mail cím nem található, sajnálom."
     reset_password:
-      title: "jelszó alaphelyzetbe állítása"
-      flash changed check mail: "Jelszavad megváltozott, és úton van a postaládádba :-)"
+      title: "Jelszó alaphelyzetbe állítása"
+      heading: "{{user}} jelszavának alaphelyzetbe állítása"
+      password: "Jelszó: "
+      confirm password: "Jelszó megerősítése: "
+      reset: "Jelszó alaphelyzetbe állítása"
+      flash changed: "Jelszavad megváltozott."
       flash token bad: "Nem található ez az utalvány, ellenőrizd az URL-t."
     new:
       title: "Felhasználói fiók létrehozása"
index 59ae29b88a4ea94d00c654f18808d93378046be1..c38ae9ae17eb875f12f07b64987b0ff1ac49392c 100644 (file)
@@ -87,6 +87,9 @@ is:
       download: "Niðurhala breytingunni á {{changeset_xml_link}} eða á {{osmchange_xml_link}}"
       changesetxml: "Breytingarsetts XML sniði"
       osmchangexml: "osmChange XML sniði"
+      feed:
+        title: "Breytingarsett {{id}}"
+        title_comment: "Breytingarsett {{id}} - {{comment}}"
     changeset_navigation:
       user:
         name_tooltip: "Skoða breytingarsett eftir {{user}}"
@@ -315,6 +318,16 @@ is:
       edit_link: "Breyta þessari færslu"
     diary_comment:
       comment_from: "Athugasemd eftir {{link_user}} þann {{comment_created_at}}"
+    feed:
+      user:
+        title: "OpenStreetMap dagbókarfærslur eftir {{user}}"
+        description: "Nýjustu dagbókarfærslur eftir {{user}}"
+      language:
+        title: "OpenStreetMap dagbókarfærslur á {{language_name}}"
+        description: "Nýjustu dagbókarfærslur frá OpenStreetMap á {{language_name}}"
+      all:
+        title: "OpenStreetMap dagbókarfærslur"
+        description: "Nýjustu dagbókarfærslur frá OpenStreetMap"
   export:
     start:
       area_to_export: "Svæði til að niðurhala"
@@ -815,7 +828,7 @@ is:
       password: "Lykilorð: "
       confirm password: "Staðfestu lykilorðið: "
       signup: "Nýskrá"
-      flash create success message: "User was successfully created. Check your email for a confirmation note, and you\'ll be mapping in no time :-)<br /><br />Please note that you won't 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."
+      flash create success message: "Nýr notandi var búinn til fyrir þig og staðfestingarpóstur sendur á netfangið sem þú gafst upp.<br /><br />Þú muntu ekki geta innskráð þig fyrr en þú ert búin(n) að fylgja leiðbeiningunum í staðfestingarpóstinum.<br /><br />Ef þú notar spamkerfi sem sendir staðfestingarbeðnir þegar það verður vart við nýja sendendur þarft þú að bæta webmaster@openstreetmap.org á hvítlista. Það netfang getur ekki svarað staðfestingarbeiðnum."
     no_such_user:
       title: "Notandi ekki til"
       heading: "Notandinn {{user}} er ekki til"
index 7c39618cb08335c369ad7a292815d8ed9b9311f7..715ad92c8967089b47d8b8f8aade5e7377f15775 100644 (file)
@@ -87,6 +87,17 @@ vi:
       download: "Tải xuống {{changeset_xml_link}} hoặc {{osmchange_xml_link}}"
       changesetxml: "Bộ thay đổi XML"
       osmchangexml: "osmChange XML"
+      feed:
+        title: "Bộ thay đổi {{id}}"
+        title_comment: "Bộ thay đổi {{id}} - {{comment}}"
+    changeset_navigation:
+      user:
+        name_tooltip: "Xem các đóng góp của {{user}}"
+        prev_tooltip: "Đóng góp trước của {{user}}"
+        next_tooltip: "Đóng góp sau của {{user}}"
+      all:
+        prev_tooltip: "Bộ thay đổi trước"
+        next_tooltip: "Bộ thay đổi sau"
     changeset_details:
       created_at: "Lúc Tạo:"
       closed_at: "Lúc Đóng:"
@@ -95,9 +106,15 @@ vi:
       no_bounding_box: "Không lưu hộp bao của bộ thay đổi này."
       show_area_box: "Hiện Hộp vùng"
       box: "hộp"
-      has_nodes: "Có {{count}} nốt sau:"
-      has_ways: "Có {{count}} lối sau:"
-      has_relations: "Có {{count}} quan hệ sau:"
+      has_nodes:
+        one: "Có {{count}} nốt sau:"
+        other: "Có {{count}} nốt sau:"
+      has_ways:
+        one: "Có {{count}} lối sau:"
+        other: "Có {{count}} lối sau:"
+      has_relations:
+        one: "Có {{count}} quan hệ sau:"
+        other: "Có {{count}} quan hệ sau:"
     common_details: 
       edited_at: "Lúc Sửa đổi:"
       edited_by: "Người Sửa đổi:"
@@ -145,6 +162,9 @@ vi:
     relation_history:
       relation_history: "Lịch sử Quan hệ"
       relation_history_title: "Lịch sử Quan hệ: {{relation_name}}"
+      download: "{{download_xml_link}} hoặc {{view_details_link}}"
+      download_xml: "Tải xuống XML"
+      view_details: "xem chi tiết"
     relation_member:
       entry: "{{type}} {{name}}"
       entry_role: "{{type}} {{name}} với vai trò {{role}}"
@@ -222,6 +242,7 @@ vi:
       showing_page: "Đang hiện trang"
       of: "trong"
     changeset:
+      id: "#{{id}}"
       still_editing: "(đang mở)"
       anonymous: "Vô danh"
       no_comment: "(không có)"
@@ -235,27 +256,22 @@ vi:
       user: "Người dùng"
       comment: "Miêu tả"
       area: "Vùng"
-    list_bbox:
-      history: "Lịch sử"
-      changesets_within_the_area: "Bộ thay đổi ở vùng:"
-      show_area_box: "xem hộp vùng"
-      no_changesets: "Không có bộ thay đổi"
-      all_changes_everywhere: "Xem các thay đổi ở mọi nơi tại {{recent_changes_link}}"
-      recent_changes: "Thay đổi Gần đây"
-      no_area_specified: "Không định rõ vùng"
-      first_use_view: "Trước tiên dùng {{view_tab_link}} để chuyển và phóng to một vùng, rồi nhấn chuột vào thẻ lịch sử."
-      view_the_map: "xem bản đồ"
-      view_tab: "thẻ Xem"
-      alternatively_view: "Hoặc xem tất cả các {{recent_changes_link}}"
     list:
-      recent_changes: "Thay đổi Gần đây"
-      recently_edited_changesets: "Bộ thay đổi được sửa đổi gần đây:"
-      for_more_changesets: 'Để xem thêm bộ thay đổi, chọn người dùng và xem danh sách sửa đổi của họ, hoặc xem "lịch sử" của một vùng.'
-    list_user:
-      edits_by_username: "Sửa đổi của {{username_link}}"
-      no_visible_edits_by: "{{name}} không có sửa đổi công khai."
-      for_all_changes: "Xem các thay đổi bởi mọi người dùng tại {{recent_changes_link}}"
-      recent_changes: "Thay đổi Gần đây"
+      title: "Các bộ thay đổi"
+      description: "Những đóng góp gần đây"
+      title_user: "Những bộ thay đổi của {{user}}"
+      title_bbox: "Những bộ thay đổi ở trong {{bbox}}"
+      title_user_bbox: "v bộ thay đổi của {{user}} ở trong {{bbox}}"
+
+      heading: "Các bộ thay đổi"
+      heading_user: "Các bộ thay đổi"
+      heading_bbox: "Các bộ thay đổi"
+      heading_user_bbox: "Các bộ thay đổi"
+
+      description: "Những thay đổi gần đây"
+      description_user: "Những bộ thay đổi của {{user}}"
+      description_bbox: "Những bộ thay đổi ở trong {{bbox}}"
+      description_user_bbox: "Những bộ thay đổi của {{user}} ở trong {{bbox}}"
   diary_entry:
     new:
       title: "Mục Nhật ký Mới"
@@ -305,6 +321,16 @@ vi:
       edit_link: "Sửa đổi mục này"
     diary_comment:
       comment_from: "Bình luận của {{link_user}} lúc {{comment_created_at}}"
+    feed:
+      user:
+        title: "Các mục nhật ký của {{user}}"
+        description: "Những mục gần đây trong nhật ký OpenStreetMap của {{user}}"
+      language:
+        title: "Các mục nhật ký OpenStreetMap bằng {{language_name}}"
+        description: "Những mục nhật ký gần đây của người dùng OpenStreetMap bằng {{language_name}}"
+      all:
+        title: "Các mục nhật ký OpenStreetMap"
+        description: "Những mục nhật ký gần đây của người dùng OpenStreetMap"
   export:
     start:
       area_to_export: "Vùng để Xuất"
@@ -536,6 +562,7 @@ vi:
       unread_button: "Đánh dấu là chưa đọc"
       read_button: "Đánh dấu là đã đọc"
       reply_button: "Trả lời"
+      delete_button: "Xóa"
     new:
       title: "Gửi thư"
       send_message_to: "Gửi thư mới cho {{name}}"
@@ -571,9 +598,13 @@ vi:
       reading_your_sent_messages: "Đọc thư đã gửi"
       to: "Tới"
       back_to_outbox: "Trở về hộp thư đã gửi"
+    sent_message_summary:
+      delete_button: "Xóa"
     mark:
       as_read: "Thư đã đọc"
       as_unread: "Thư chưa đọc"
+    delete:
+      deleted: "Đã xóa thư"
   site:
     index:
       js_1: "Hoặc trình duyệt của bạn không hỗ trợ JavaScript, hoặc bạn đã tắt JavaScript."
@@ -610,11 +641,11 @@ vi:
       table:
         heading: "Chú giải tại mức {{zoom_level}}"
         entry:
-          motorway: "Quốc lộ"
+          motorway: "Đường cao tốc"
           trunk: "Xa lộ"
-          primary: "Tỉnh lộ"
-          secondary: "Đường chính"
-          unclassified: "Đường lớn"
+          primary: "Đường chính"
+          secondary: "Đường lớn"
+          unclassified: "Đường không phân loại"
           unsurfaced: "Đường không lát"
           track: "Đường mòn"
           byway: "Đường mòn đa mốt"
@@ -689,6 +720,7 @@ vi:
       owner: "Tác giả:"
       description: "Miêu tả:"
       tags: "Thẻ:"
+      tags_help: "dấu phẩy phân cách"
       save_button: "Lưu các Thay đổi"
     no_such_user:
       title: "Người dùng không tồn tại"
@@ -698,6 +730,7 @@ vi:
       upload_gpx: "Tải lên Tập tin GPX"
       description: "Miêu tả"
       tags: "Thẻ"
+      tags_help: "dấu phẩy phân cách"
       public: "Công khai?"
       public_help: "có nghĩa là gì?"
       public_help_url: "http://wiki.openstreetmap.org/wiki/Visibility_of_GPS_traces?uselang=vi"
@@ -769,15 +802,19 @@ vi:
       account not active: "Rất tiếc, tài khoản của bạn chưa được kích hoạt.<br>Xin hãy nhấn chuột vào liên kết trong thư điện tử xác nhận tài khoản để kích hoạt tài khoản."
       auth failure: "Rất tiếc, không thể đăng nhập với những chi tiết đó."
     lost_password:
-      title: "quên mất mật khẩu"
+      title: "Quên mất mật khẩu"
       heading: "Quên mất Mật khẩu?"
       email address: "Địa chỉ Thư điện tử:"
-      new password button: "Gửi mật khẩu mới cho tôi"
+      new password button: "Đặt lại mật khẩu"
       notice email on way: "Đáng tiếc là bạn quên nó. :-( May là thư điện tử sắp tới để bạn đặt nó lại."
       notice email cannot find: "Rất tiếc, không tìm thấy địa chỉ thư điện tử."
     reset_password:
-      title: "đặt lại mật khẩu"
-      flash changed check mail: "Mật khẩu của bạn đã được đổi và mật khẩu mới sắp tới hộp thư của bạn. :-)"
+      title: "Đặt lại mật khẩu"
+      heading: "Đặt lại Mật khẩu của {{user}}"
+      password: "Mật khẩu: "
+      confirm password: "Xác nhận Mật khẩu: "
+      reset: "Đặt lại Mật khẩu"
+      flash changed: "Mật khẩu của bạn đã được thay đổi."
       flash token bad: "Không tìm thấy dấu hiệu đó. Có lẽ kiểm tra URL?"
     new:
       title: "Mở tài khoản"
@@ -875,5 +912,5 @@ vi:
       failed: "Rất tiếc, việc thêm {{name}} là người bạn bị thất bại."
       already_a_friend: "{{name}} đã là người bạn."
     remove_friend:
-      success: "{{name}} không còn người bạn."
+      success: "{{name}} không còn là người bạn."
       not_a_friend: "{{name}} đã không phải người bạn."
index e69f4b00fe6389d502a9b173c145ced628938873..55c4a515c23c6d1f494d3e2a1f0462d4688417e3 100644 (file)
@@ -74,7 +74,7 @@ The best type of GPS is one that records to the tracklog frequently (every secon
 <column/><headline>Uploading your track</headline>
 <bodyText>Now, you need to get your track off the GPS set. Maybe your GPS came with some software, or maybe it lets you copy the files off via USB. If not, try <a href="http://www.gpsbabel.org/" target="_blank">GPSBabel</a>. Whatever, you want the file to be in GPX format.
 
-Then use the 'GPS Traces' tab to upload your track to the OpenStreetMap server. But this is only the first bit - it won't appear on the map yet. You need to draw and name the roads yourself, using the track as a guide.</bodyText>
+Then use the 'GPS Traces' tab to upload your track to OpenStreetMap. But this is only the first bit - it won't appear on the map yet. You must draw and name the roads yourself, using the track as a guide.</bodyText>
 <headline>Using your track</headline>
 <bodyText>Find your uploaded track in the 'GPS Traces' listing, and click 'edit' <i>right next to it</i>. Potlatch will start with this track loaded, plus any waypoints. You're ready to draw!
 
@@ -156,13 +156,12 @@ You can 'revert' to a previously saved version of a way or point. Select it, the
 If you've accidentally deleted a way and saved it, press U (for 'undelete'). All the deleted ways will be shown. Choose the one you want; unlock it by clicking the padlock (by the ID); and save as usual.
 
 Think someone else has made a mistake? Send them a friendly message. Use the history option (H) to select their name, then click 'Mail'.
+
+Use the Inspector (in the 'Advanced' menu) for helpful information about the current way or point.
 </bodyText><column/><headline>FAQs</headline>
 <bodyText><b>How do I see my waypoints?</b>
 Waypoints only show up if you click 'edit' by the track name in 'GPS Traces'. The file has to have both waypoints and tracklog in it - the server rejects anything with waypoints alone.
 
-<b>Why can't I type text with accents?</b>
-<u>Linux users only</u>: This is a bug in Adobe Flash Player for Linux. We can't do anything until Adobe fixes it - sorry. Until then, you can copy and paste from elsewhere.
-
 More FAQs for <a href="http://wiki.openstreetmap.org/wiki/Potlatch/FAQs" target="_blank">Potlatch</a> and <a href="http://wiki.openstreetmap.org/wiki/FAQ" target="_blank">OpenStreetMap</a>.
 </bodyText>
 
@@ -202,6 +201,8 @@ Page 7: Quick reference
 C      Close <u>c</u>hangeset
 G      Show <u>G</u>PS tracks
 H      Show <u>h</u>istory
+I      Show <u>i</u>nspector
+J      <u>J</u>oin point to crossing ways
 K      Loc<u>k</u>/unlock current selection
 L      Show current <u>l</u>atitude/longitude
 M      <u>M</u>aximise editing window
index 0bc0d8cd390f17c2bc222730fbfd11f4fc67fcdc..b8d3fa1a089c48c9dd1c8ce917e50616a3cdd45a 100644 (file)
@@ -135,7 +135,6 @@ ActionController::Routing::Routes.draw do |map|
   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 '/trace/:id/make_public', :controller => 'trace', :action => 'make_public'
   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'
diff --git a/db/migrate/039_add_more_controls_to_gpx_files.rb b/db/migrate/039_add_more_controls_to_gpx_files.rb
new file mode 100644 (file)
index 0000000..133838a
--- /dev/null
@@ -0,0 +1,21 @@
+require 'lib/migrate'
+
+class AddMoreControlsToGpxFiles < ActiveRecord::Migration
+  def self.up
+    create_enumeration :gpx_visibility_enum, ["private", "public", "trackable", "identifiable"]
+    add_column :gpx_files, :visibility, :gpx_visibility_enum, :default => "public", :null => false
+    Trace.update_all("visibility = 'private'", { :public => false })
+    add_index :gpx_files, [:visible, :visibility], :name => "gpx_files_visible_visibility_idx"
+    remove_index :gpx_files, :name => "gpx_files_visible_public_idx"
+    remove_column :gpx_files, :public
+  end
+
+  def self.down
+    add_column :gpx_files, :public, :boolean, :default => true, :null => false
+    Trace.update_all("public = false", { :visibility => "private" })
+    add_index :gpx_files, [:visible, :public], :name => "gpx_files_visible_public_idx"
+    remove_index :gpx_files, :name => "gpx_files_visible_visibility_idx"
+    remove_column :gpx_files, :visibility
+    drop_enumeration :gpx_visibility_enum
+  end
+end
index 3e28e0c0a059ab0650c48e770aea2a6835121480..b6566fa810aea39da85fb4a61de998e37cf30ec6 100644 (file)
@@ -65,7 +65,7 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
       node.style.fontStyle = 'italic';
     }
   }
-  
+
   node = document.getElementById("historyanchor");
   if (node) {
     if (zoom >= 11) {
@@ -75,14 +75,14 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
          typeof minlat == "number" &&
          typeof maxlon == "number" &&
          typeof maxlat == "number") {
-      
+
         minlon = Math.round(minlon * decimals) / decimals;
         minlat = Math.round(minlat * decimals) / decimals;
         maxlon = Math.round(maxlon * decimals) / decimals;
         maxlat = Math.round(maxlat * decimals) / decimals;
         args.bbox = minlon + "," + minlat + "," + maxlon + "," + maxlat;
       }
-      
+
       node.href = setArgs("/history", args);
       node.style.fontStyle = 'normal';
     } else {
@@ -108,6 +108,9 @@ function updatelinks(lon,lat,zoom,layers,minlon,minlat,maxlon,maxlat,objtype,obj
     if (layers && (layers != "B000FTF") && (layers != "B000FTFT")) {
       args["layers"] = layers;
     }
+    else {
+      delete args["layers"];
+    }
 
     // Here we're assuming that all parameters but ?layers= and
     // ?{node,way,relation}= can be safely omitted from the shortlink
@@ -128,7 +131,7 @@ function shortlinkPrefix() {
   if (window.location.hostname.match(/^www\.openstreetmap\.org/i)) {
     return "http://osm.org";
   } else {
-    return "";     
+    return "";
   }
 }
 
@@ -201,12 +204,12 @@ function i18n(string, keys) {
   for (var key in keys) {
     var re_key = '\\[\\[' + key + '\\]\\]';
     var re = new RegExp(re_key, "g");
-      
+
     string = string.replace(re, keys[key]);
   }
-   
+
   return string;
-} 
+}
 
 function makeShortCode(lat, lon, zoom) {
     char_array = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@";
index 74e021a6f4612beaf129716566f6db377f065cec..6557e79202d4442d193373d1589c92beadef849f 100644 (file)
Binary files a/public/potlatch/potlatch.swf and b/public/potlatch/potlatch.swf differ
index 31bd90120fb99c0801f9bc09957bf8fcf161a5f3..b3171ac457ccae776ac4ca02224bdeaab7873413 100644 (file)
@@ -9,3 +9,27 @@ first_trace_1:
   timestamp: "2008-10-01 10:10:10"
   tile: <%= QuadTile.tile_for_point(1, 1) %>
   
+trackable_trace_1:
+  trackid: 1
+  latitude: <%= (51.510 * SCALE).to_i %>
+  longitude: <%= (-0.140 * SCALE).to_i %>
+  gpx_id: 3
+  timestamp: "2009-07-30 17:46:00"
+  tile: <%= QuadTile.tile_for_point(51.510, -0.140) %>
+
+trackable_trace_2:
+  trackid: 2
+  latitude: <%= (51.511 * SCALE).to_i %>
+  longitude: <%= (-0.141 * SCALE).to_i %>
+  gpx_id: 3
+  timestamp: "2009-07-30 17:47:00"
+  tile: <%= QuadTile.tile_for_point(51.511, -0.141) %>
+
+identifiable_trace_1:
+  trackid: 1
+  latitude: <%= (51.512 * SCALE).to_i %>
+  longitude: <%= (0.142 * SCALE).to_i %>
+  gpx_id: 4
+  timestamp: "2009-07-30 17:46:00"
+  tile: <%= QuadTile.tile_for_point(51.512, 0.142) %>
+
index ef0c004b4402b8bf301ea3c672ce8563e5812b24..08616bd99f9c496ea1957eda733f9c494ade6b9e 100644 (file)
@@ -7,7 +7,7 @@ public_trace_file:
   latitude: 1
   longitude: 1
   timestamp: "2008-10-29 10:10:10"
-  public: true
+  visibility: "public"
   description: This is a trace
   inserted: true
   
@@ -20,6 +20,32 @@ anon_trace_file:
   latitude: 51.3
   longitude: -0.56
   timestamp: "2009-05-06 13:34:34"
-  public: false
+  visibility: "private"
   description: This is an anonymous trace
   inserted: true
+
+trackable_trace_file:
+  id: 3
+  user_id: 2
+  visible: false
+  name: Trackable Trace.gpx
+  size: 123
+  latitude: 51.51
+  longitude: -0.14
+  timestamp: "2009-07-30 17:48:34"
+  visibility: "trackable"
+  description: This trace shows trksegs and timestamps, but no user details.
+  inserted: true
+
+identifiable_trace_file:
+  id: 4
+  user_id: 2
+  visible: false
+  name: Identifiable Trace.gpx
+  size: 123
+  latitude: 51.512
+  longitude: 0.142
+  timestamp: "2009-07-30 17:48:34"
+  visibility: "identifiable"
+  description: This trace shows trksegs, timestamps and user details.
+  inserted: true
index 866c7bd27fe55ba49788e28df33ee6b7afe41d02..ce4020ca7de92349fb72a5a1904bede5f0da39cd 100644 (file)
@@ -60,10 +60,10 @@ class ApiControllerTest < ActionController::TestCase
   
   def test_tracepoints
     point = gpx_files(:public_trace_file)
-    minlon = point.longitude-0.1
-    minlat = point.latitude-0.1
-    maxlon = point.longitude+0.1
-    maxlat = point.latitude+0.1
+    minlon = point.longitude-0.001
+    minlat = point.latitude-0.001
+    maxlon = point.longitude+0.001
+    maxlat = point.latitude+0.001
     bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
     get :trackpoints, :bbox => bbox
     #print @response.body
@@ -75,6 +75,53 @@ class ApiControllerTest < ActionController::TestCase
     end
   end
   
+  def test_tracepoints_trackable
+    point = gpx_files(:trackable_trace_file)
+    minlon = point.longitude-0.002
+    minlat = point.latitude-0.002
+    maxlon = point.longitude+0.002
+    maxlat = point.latitude+0.002
+    bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
+    get :trackpoints, :bbox => bbox
+    #print @response.body
+    assert_response :success
+    assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0/]:root", :count => 1 do
+      assert_select "trk", :count => 1 do
+        assert_select "trk > trkseg", :count => 2 do |trksegs|
+          trksegs.each do |trkseg|
+            assert_select trkseg, "trkpt", :count => 1 do |trkpt|
+              assert_select trkpt[0], "time", :count => 1
+            end
+          end
+        end
+      end
+    end
+  end
+  
+  def test_tracepoints_identifiable
+    point = gpx_files(:identifiable_trace_file)
+    minlon = point.longitude-0.002
+    minlat = point.latitude-0.002
+    maxlon = point.longitude+0.002
+    maxlat = point.latitude+0.002
+    bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}"
+    get :trackpoints, :bbox => bbox
+    #print @response.body
+    assert_response :success
+    assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0/]:root", :count => 1 do
+      assert_select "trk", :count => 1 do
+        assert_select "trk>name", :count => 1
+        assert_select "trk>desc", :count => 1
+        assert_select "trk>url", :count => 1
+        assert_select "trkseg", :count => 1 do
+          assert_select "trkpt", :count => 1 do
+            assert_select "time", :count => 1
+          end
+        end
+      end
+    end
+  end
+  
   def test_map_without_bbox
     ["trackpoints", "map"].each do |tq|
       get tq
index 8f0b2147786cebe98788bb3e76e3cf703956be6e..46f8a1a6a6990ed0a34658018399a06db8f312b8 100644 (file)
@@ -1507,7 +1507,7 @@ EOF
     user = users(:public_user)
     get :list, {:format => "html", :display_name => user.display_name}
     assert_response :success
-    assert_template "list"
+    assert_template "changeset/_user"
     ## FIXME need to add more checks to see which if edits are actually shown if your data is public
   end
   
index 0595f3d086827163ac3ad88905133b42747e90a9..b5f93c4587eb0381073fbe22a93ee5c10527ce6e 100644 (file)
@@ -75,6 +75,12 @@ class NodeControllerTest < ActionController::TestCase
     lat = 3.434
     lon = 3.23
     
+    # test that the upload is rejected when xml is valid, but osm doc isn't
+    content("<create/>")
+    put :create
+    assert_response :bad_request, "node upload did not return bad_request status"
+    assert_equal "Cannot parse valid node from xml string <create/>. XML doesn't contain an osm/node element.", @response.body
+
     # test that the upload is rejected when no lat is supplied
     # create a minimal xml file
     content("<osm><node lon='#{lon}' changeset='#{changeset.id}'/></osm>")
@@ -184,6 +190,12 @@ class NodeControllerTest < ActionController::TestCase
     assert_response :bad_request, 
        "should not be able to delete a node with a different ID from the XML"
 
+    # try to delete a node rubbish in the payloads
+    content("<delete/>")
+    delete :delete, :id => current_nodes(:visible_node).id
+    assert_response :bad_request, 
+       "should not be able to delete a node without a valid XML payload"
+
     # valid delete now takes a payload
     content(nodes(:public_visible_node).to_xml)
     delete :delete, :id => current_nodes(:public_visible_node).id
@@ -353,6 +365,12 @@ class NodeControllerTest < ActionController::TestCase
     assert_response :bad_request, 
        "should not be able to update a node with a different ID from the XML"
 
+    ## try an update with a minimal valid XML doc which isn't a well-formed OSM doc.
+    content "<update/>"
+    put :update, :id => current_nodes(:visible_node).id
+    assert_response :bad_request, 
+       "should not be able to update a node with non-OSM XML doc."
+
     ## finally, produce a good request which should work
     content current_nodes(:public_visible_node).to_xml
     put :update, :id => current_nodes(:public_visible_node).id
index a39aa4fa2848018c4291d757678671225fe797ba..0d72e553ea4e79df8c1a40b2cf08c4741300dcca 100644 (file)
@@ -4,7 +4,7 @@ class TraceTest < ActiveSupport::TestCase
   api_fixtures
   
   def test_trace_count
-    assert_equal 2, Trace.count
+    assert_equal 4, Trace.count
   end
   
 end
index 9f85b9c8cfba297fe9e50e16d07de6707c4bcde4..c49f9fbdcacde2134247aab632e4c14e1ecb673c 100644 (file)
@@ -4,7 +4,7 @@ class TracepointTest < ActiveSupport::TestCase
   api_fixtures
   
   def test_tracepoint_count
-    assert_equal 1, Tracepoint.count
+    assert_equal 4, Tracepoint.count
   end
   
 end