]> git.openstreetmap.org Git - rails.git/commitdiff
Make the search box load each set of results separately so that one
authorTom Hughes <tom@compton.nu>
Thu, 2 Jul 2009 16:12:38 +0000 (16:12 +0000)
committerTom Hughes <tom@compton.nu>
Thu, 2 Jul 2009 16:12:38 +0000 (16:12 +0000)
service being slow doesn't delay the response from others.

29 files changed:
app/controllers/geocoder_controller.rb
app/views/geocoder/_description.html.erb [new file with mode: 0644]
app/views/geocoder/_results.html.erb [deleted file]
app/views/geocoder/_search.html.erb [new file with mode: 0644]
app/views/geocoder/error.html.erb [new file with mode: 0644]
app/views/geocoder/results.html.erb [new file with mode: 0644]
app/views/site/_search.html.erb
config/locales/be.yml
config/locales/de.yml
config/locales/en.yml
config/locales/es.yml
config/locales/fr.yml
config/locales/he.yml
config/locales/hi.yml
config/locales/is.yml
config/locales/it.yml
config/locales/ja.yml
config/locales/ko.yml
config/locales/nl.yml
config/locales/pl.yml
config/locales/pt-BR.yml
config/locales/ru.yml
config/locales/sl.yml
config/locales/yo.yml
config/locales/zh-CN.yml
config/locales/zh-TW.yml
config/routes.rb
public/images/searching.gif [new file with mode: 0644]
public/stylesheets/site.css

index 622e700afb01c055bf2eada01580e6fe049b3609..904e6bf74b2c7163e06a168744ddf3871fddfa68 100644 (file)
@@ -6,84 +6,67 @@ class GeocoderController < ApplicationController
   before_filter :set_locale
 
   def search
   before_filter :set_locale
 
   def search
-    query = params[:query]
-    results = Array.new
-
-    query.sub(/^\s+/, "")
-    query.sub(/\s+$/, "")
-
-    if query.match(/^[+-]?\d+(\.\d*)?\s*[\s,]\s*[+-]?\d+(\.\d*)?$/)
-      results.push search_latlon(query)
-    elsif query.match(/^\d{5}(-\d{4})?$/)
-      results.push search_us_postcode(query)
-    elsif query.match(/^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i)
-      results.push search_uk_postcode(query)
-      results.push search_osm_namefinder(query)
-    elsif query.match(/^[A-Z]\d[A-Z]\s*\d[A-Z]\d$/i)
-      results.push search_ca_postcode(query)
+    @query = params[:query]
+    @sources = Array.new
+
+    @query.sub(/^\s+/, "")
+    @query.sub(/\s+$/, "")
+
+    if @query.match(/^[+-]?\d+(\.\d*)?\s*[\s,]\s*[+-]?\d+(\.\d*)?$/)
+      @sources.push "latlon"
+    elsif @query.match(/^\d{5}(-\d{4})?$/)
+      @sources.push "us_postcode"
+    elsif @query.match(/^(GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])\s*[0-9][ABD-HJLNP-UW-Z]{2})$/i)
+      @sources.push "uk_postcode"
+      @sources.push "osm_namefinder"
+    elsif @query.match(/^[A-Z]\d[A-Z]\s*\d[A-Z]\d$/i)
+      @sources.push "ca_postcode"
     else
     else
-      results.push search_osm_namefinder(query)
-      results.push search_geonames(query)
+      @sources.push "osm_namefinder"
+      @sources.push "geonames"
     end
 
     end
 
-    results_count = count_results(results)
-
     render :update do |page|
     render :update do |page|
-      page.replace_html :sidebar_content, :partial => 'results', :object => results
-
-      if results_count == 1
-        position = results.collect { |s| s[:results] }.compact.flatten[0]
-        page.call "setPosition", position[:lat].to_f, position[:lon].to_f, position[:zoom].to_i
-      else
-        page.call "openSidebar"
-      end
-    end
-  end
-  
-  def description
-    results = Array.new
-
-    lat = params[:lat]
-    lon = params[:lon]
-
-    results.push description_osm_namefinder("cities", lat, lon, 2)
-    results.push description_osm_namefinder("towns", lat, lon, 4)
-    results.push description_osm_namefinder("places", lat, lon, 10)
-    results.push description_geonames(lat, lon)
-
-    render :update do |page|
-      page.replace_html :sidebar_content, :partial => 'results', :object => results
+      page.replace_html :sidebar_content, :partial => "search"
       page.call "openSidebar"
     end
   end
 
       page.call "openSidebar"
     end
   end
 
-private
+  def search_latlon
+    # get query parameters
+    query = params[:query]
 
 
-  def search_latlon(query)
-    results = Array.new
+    # create result array
+    @results = Array.new
 
     # decode the location
 
     # decode the location
-    if m = query.match(/^([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)$/)
+    if m = query.match(/^\s*([+-]?\d+(\.\d*)?)\s*[\s,]\s*([+-]?\d+(\.\d*)?)\s*$/)
       lat = m[1].to_f
       lon = m[3].to_f
     end
 
     # generate results
     if lat < -90 or lat > 90
       lat = m[1].to_f
       lon = m[3].to_f
     end
 
     # generate results
     if lat < -90 or lat > 90
-      return { :source => "Internal", :url => "http://openstreetmap.org/", :error => "Latitude #{lat} out of range" }
+      @error = "Latitude #{lat} out of range"
+      render :action => "error"
     elsif lon < -180 or lon > 180
     elsif lon < -180 or lon > 180
-      return { :source => "Internal", :url => "http://openstreetmap.org/", :error => "Longitude #{lon} out of range" }
+      @error = "Longitude #{lon} out of range"
+      render :action => "error"
     else
     else
-      results.push({:lat => lat, :lon => lon,
-                    :zoom => APP_CONFIG['postcode_zoom'],
-                    :name => "#{lat}, #{lon}"})
+      @results.push({:lat => lat, :lon => lon,
+                     :zoom => APP_CONFIG['postcode_zoom'],
+                     :name => "#{lat}, #{lon}"})
 
 
-      return { :source => "Internal", :url => "http://openstreetmap.org/", :results => results }
+      render :action => "results"
     end
   end
 
     end
   end
 
-  def search_us_postcode(query)
-    results = Array.new
+  def search_us_postcode
+    # get query parameters
+    query = params[:query]
+
+    # create result array
+    @results = Array.new
 
     # ask geocoder.us (they have a non-commercial use api)
     response = fetch_text("http://rpc.geocoder.us/service/csv?zip=#{escape_query(query)}")
 
     # ask geocoder.us (they have a non-commercial use api)
     response = fetch_text("http://rpc.geocoder.us/service/csv?zip=#{escape_query(query)}")
@@ -91,19 +74,24 @@ private
     # parse the response
     unless response.match(/couldn't find this zip/)
       data = response.split(/\s*,\s+/) # lat,long,town,state,zip
     # parse the response
     unless response.match(/couldn't find this zip/)
       data = response.split(/\s*,\s+/) # lat,long,town,state,zip
-      results.push({:lat => data[0], :lon => data[1],
-                    :zoom => APP_CONFIG['postcode_zoom'],
-                    :prefix => "#{data[2]}, #{data[3]}, ",
-                    :name => data[4]})
+      @results.push({:lat => data[0], :lon => data[1],
+                     :zoom => APP_CONFIG['postcode_zoom'],
+                     :prefix => "#{data[2]}, #{data[3]}, ",
+                     :name => data[4]})
     end
 
     end
 
-    return { :source => "Geocoder.us", :url => "http://geocoder.us/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :source => "Geocoder.us", :url => "http://geocoder.us/", :error => "Error contacting rpc.geocoder.us: #{ex.to_s}" }
+    @error = "Error contacting rpc.geocoder.us: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
-  def search_uk_postcode(query)
-    results = Array.new
+  def search_uk_postcode
+    # get query parameters
+    query = params[:query]
+
+    # create result array
+    @results = Array.new
 
     # ask npemap.org.uk to do a combined npemap + freethepostcode search
     response = fetch_text("http://www.npemap.org.uk/cgi/geocoder.fcgi?format=text&postcode=#{escape_query(query)}")
 
     # ask npemap.org.uk to do a combined npemap + freethepostcode search
     response = fetch_text("http://www.npemap.org.uk/cgi/geocoder.fcgi?format=text&postcode=#{escape_query(query)}")
@@ -114,36 +102,44 @@ private
       data = dataline.split(/,/) # easting,northing,postcode,lat,long
       postcode = data[2].gsub(/'/, "")
       zoom = APP_CONFIG['postcode_zoom'] - postcode.count("#")
       data = dataline.split(/,/) # easting,northing,postcode,lat,long
       postcode = data[2].gsub(/'/, "")
       zoom = APP_CONFIG['postcode_zoom'] - postcode.count("#")
-      results.push({:lat => data[3], :lon => data[4], :zoom => zoom,
-                    :name => postcode})
+      @results.push({:lat => data[3], :lon => data[4], :zoom => zoom,
+                     :name => postcode})
     end
 
     end
 
-    return { :source => "NPEMap / FreeThePostcode", :url => "http://www.npemap.org.uk/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :source => "NPEMap / FreeThePostcode", :url => "http://www.npemap.org.uk/", :error => "Error contacting www.npemap.org.uk: #{ex.to_s}" }
+    @error = "Error contacting www.npemap.org.uk: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
-  def search_ca_postcode(query)
-    results = Array.new
+  def search_ca_postcode
+    # get query parameters
+    query = params[:query]
+    @results = Array.new
 
     # ask geocoder.ca (note - they have a per-day limit)
     response = fetch_xml("http://geocoder.ca/?geoit=XML&postal=#{escape_query(query)}")
 
     # parse the response
     if response.get_elements("geodata/error").empty?
 
     # ask geocoder.ca (note - they have a per-day limit)
     response = fetch_xml("http://geocoder.ca/?geoit=XML&postal=#{escape_query(query)}")
 
     # parse the response
     if response.get_elements("geodata/error").empty?
-      results.push({:lat => response.get_text("geodata/latt").to_s,
-                    :lon => response.get_text("geodata/longt").to_s,
-                    :zoom => APP_CONFIG['postcode_zoom'],
-                    :name => query.upcase})
+      @results.push({:lat => response.get_text("geodata/latt").to_s,
+                     :lon => response.get_text("geodata/longt").to_s,
+                     :zoom => APP_CONFIG['postcode_zoom'],
+                     :name => query.upcase})
     end
 
     end
 
-    return { :source => "Geocoder.CA", :url => "http://geocoder.ca/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :source => "Geocoder.CA", :url => "http://geocoder.ca/", :error => "Error contacting geocoder.ca: #{ex.to_s}" }
+    @error = "Error contacting geocoder.ca: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
-  def search_osm_namefinder(query)
-    results = Array.new
+  def search_osm_namefinder
+    # get query parameters
+    query = params[:query]
+
+    # create result array
+    @results = Array.new
 
     # ask OSM namefinder
     response = fetch_xml("http://gazetteer.openstreetmap.org/namefinder/search.xml?find=#{escape_query(query)}")
 
     # ask OSM namefinder
     response = fetch_xml("http://gazetteer.openstreetmap.org/namefinder/search.xml?find=#{escape_query(query)}")
@@ -162,14 +158,14 @@ private
         prefix = ""
         name = type
       else
         prefix = ""
         name = type
       else
-        prefix =  t "geocoder.results.namefinder.prefix", :type => type
+        prefix =  t "geocoder.search_osm_namefinder.prefix", :type => type
       end
 
       if place
         distance = format_distance(place.attributes["approxdistance"].to_i)
         direction = format_direction(place.attributes["direction"].to_i)
         placename = format_name(place.attributes["name"].to_s)
       end
 
       if place
         distance = format_distance(place.attributes["approxdistance"].to_i)
         direction = format_direction(place.attributes["direction"].to_i)
         placename = format_name(place.attributes["name"].to_s)
-        suffix = t "geocoder.results.namefinder.suffix_place", :distance => distance, :direction => direction, :placename => placename
+        suffix = t "geocoder.search_osm_namefinder.suffix_place", :distance => distance, :direction => direction, :placename => placename
 
         if place.attributes["rank"].to_i <= 30
           parent = nil
 
         if place.attributes["rank"].to_i <= 30
           parent = nil
@@ -193,11 +189,11 @@ private
             parentname = format_name(parent.attributes["name"].to_s)
 
             if  place.attributes["info"].to_s == "suburb"
             parentname = format_name(parent.attributes["name"].to_s)
 
             if  place.attributes["info"].to_s == "suburb"
-              suffix = t "geocoder.results.namefinder.suffix_suburb", :suffix => suffix, :parentname => parentname
+              suffix = t "geocoder.search_osm_namefinder.suffix_suburb", :suffix => suffix, :parentname => parentname
             else
               parentdistance = format_distance(parent.attributes["approxdistance"].to_i)
               parentdirection = format_direction(parent.attributes["direction"].to_i)
             else
               parentdistance = format_distance(parent.attributes["approxdistance"].to_i)
               parentdirection = format_direction(parent.attributes["direction"].to_i)
-              suffix = t "geocoder.results.namefinder.suffix_parent", :suffix => suffix, :parentdistance => parentdistance, :parentdirection => parentdirection, :parentname => parentname
+              suffix = t "geocoder.search_osm_namefinder.suffix_parent", :suffix => suffix, :parentdistance => parentdistance, :parentdirection => parentdirection, :parentname => parentname
             end
           end
         end
             end
           end
         end
@@ -205,18 +201,23 @@ private
         suffix = ""
       end
 
         suffix = ""
       end
 
-      results.push({:lat => lat, :lon => lon, :zoom => zoom,
-                    :prefix => prefix, :name => name, :suffix => suffix,
-                    :description => description})
+      @results.push({:lat => lat, :lon => lon, :zoom => zoom,
+                     :prefix => prefix, :name => name, :suffix => suffix,
+                     :description => description})
     end
 
     end
 
-    return { :source => "OpenStreetMap Namefinder", :url => "http://gazetteer.openstreetmap.org/namefinder/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :source => "OpenStreetMap Namefinder", :url => "http://gazetteer.openstreetmap.org/namefinder/", :error => "Error contacting gazetteer.openstreetmap.org: #{ex.to_s}" }
+    @error = "Error contacting gazetteer.openstreetmap.org: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
-  def search_geonames(query)
-    results = Array.new
+  def search_geonames
+    # get query parameters
+    query = params[:query]
+
+    # create result array
+    @results = Array.new
 
     # ask geonames.org
     response = fetch_xml("http://ws.geonames.org/search?q=#{escape_query(query)}&maxRows=20")
 
     # ask geonames.org
     response = fetch_xml("http://ws.geonames.org/search?q=#{escape_query(query)}&maxRows=20")
@@ -227,19 +228,41 @@ private
       lon = geoname.get_text("lng").to_s
       name = geoname.get_text("name").to_s
       country = geoname.get_text("countryName").to_s
       lon = geoname.get_text("lng").to_s
       name = geoname.get_text("name").to_s
       country = geoname.get_text("countryName").to_s
-      results.push({:lat => lat, :lon => lon,
-                    :zoom => APP_CONFIG['geonames_zoom'],
-                    :name => name,
-                    :suffix => ", #{country}"})
+      @results.push({:lat => lat, :lon => lon,
+                     :zoom => APP_CONFIG['geonames_zoom'],
+                     :name => name,
+                     :suffix => ", #{country}"})
     end
 
     end
 
-    return { :source => "GeoNames", :url => "http://www.geonames.org/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :source => "GeoNames", :url => "http://www.geonames.org/", :error => "Error contacting ws.geonames.org: #{ex.to_s}" }
+    @error = "Error contacting ws.geonames.org: #{ex.to_s}"
+    render :action => "error"
   end
   end
+  
+  def description
+    @sources = Array.new
 
 
-  def description_osm_namefinder(types, lat, lon, max)
-    results = Array.new
+    @sources.push({ :name => "osm_namefinder", :types => "cities", :max => 2 })
+    @sources.push({ :name => "osm_namefinder", :types => "towns", :max => 4 })
+    @sources.push({ :name => "osm_namefinder", :types => "places", :max => 10 })
+    @sources.push({ :name => "geonames" })
+
+    render :update do |page|
+      page.replace_html :sidebar_content, :partial => "description"
+      page.call "openSidebar"
+    end
+  end
+
+  def description_osm_namefinder
+    # get query parameters
+    lat = params[:lat]
+    lon = params[:lon]
+    types = params[:types]
+    max = params[:max]
+
+    # create result array
+    @results = Array.new
 
     # ask OSM namefinder
     response = fetch_xml("http://gazetteer.openstreetmap.org/namefinder/search.xml?find=#{types}+near+#{lat},#{lon}&max=#{max}")
 
     # ask OSM namefinder
     response = fetch_xml("http://gazetteer.openstreetmap.org/namefinder/search.xml?find=#{types}+near+#{lat},#{lon}&max=#{max}")
@@ -256,18 +279,24 @@ private
       distance = format_distance(place.attributes["approxdistance"].to_i)
       direction = format_direction((place.attributes["direction"].to_i - 180) % 360)
       prefix = "#{distance} #{direction} of #{type} "
       distance = format_distance(place.attributes["approxdistance"].to_i)
       direction = format_direction((place.attributes["direction"].to_i - 180) % 360)
       prefix = "#{distance} #{direction} of #{type} "
-      results.push({:lat => lat, :lon => lon, :zoom => zoom,
-                    :prefix => prefix.capitalize, :name => name,
-                    :description => description})
+      @results.push({:lat => lat, :lon => lon, :zoom => zoom,
+                     :prefix => prefix.capitalize, :name => name,
+                     :description => description})
     end
 
     end
 
-    return { :type => types.capitalize, :source => "OpenStreetMap Namefinder", :url => "http://gazetteer.openstreetmap.org/namefinder/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :type => types.capitalize, :source => "OpenStreetMap Namefinder", :url => "http://gazetteer.openstreetmap.org/namefinder/", :error => "Error contacting gazetteer.openstreetmap.org: #{ex.to_s}" }
+    @error = "Error contacting gazetteer.openstreetmap.org: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
-  def description_geonames(lat, lon)
-    results = Array.new
+  def description_geonames
+    # get query parameters
+    lat = params[:lat]
+    lon = params[:lon]
+
+    # create result array
+    @results = Array.new
 
     # ask geonames.org
     response = fetch_xml("http://ws.geonames.org/countrySubdivision?lat=#{lat}&lng=#{lon}")
 
     # ask geonames.org
     response = fetch_xml("http://ws.geonames.org/countrySubdivision?lat=#{lat}&lng=#{lon}")
@@ -276,14 +305,17 @@ private
     response.elements.each("geonames/countrySubdivision") do |geoname|
       name = geoname.get_text("adminName1").to_s
       country = geoname.get_text("countryName").to_s
     response.elements.each("geonames/countrySubdivision") do |geoname|
       name = geoname.get_text("adminName1").to_s
       country = geoname.get_text("countryName").to_s
-      results.push({:prefix => "#{name}, #{country}"})
+      @results.push({:prefix => "#{name}, #{country}"})
     end
 
     end
 
-    return { :type => "Location", :source => "GeoNames", :url => "http://www.geonames.org/", :results => results }
+    render :action => "results"
   rescue Exception => ex
   rescue Exception => ex
-    return { :type => "Location", :source => "GeoNames", :url => "http://www.geonames.org/", :error => "Error contacting ws.geonames.org: #{ex.to_s}" }
+    @error = "Error contacting ws.geonames.org: #{ex.to_s}"
+    render :action => "error"
   end
 
   end
 
+private
+
   def fetch_text(url)
     return Net::HTTP.get(URI.parse(url))
   end
   def fetch_text(url)
     return Net::HTTP.get(URI.parse(url))
   end
@@ -293,18 +325,18 @@ private
   end
 
   def format_distance(distance)
   end
 
   def format_distance(distance)
-    return t("geocoder.results.distance", :count => distance)
+    return t("geocoder.distance", :count => distance)
   end
 
   def format_direction(bearing)
   end
 
   def format_direction(bearing)
-    return t("geocoder.results.direction.south_west") if bearing >= 22.5 and bearing < 67.5
-    return t("geocoder.results.direction.south") if bearing >= 67.5 and bearing < 112.5
-    return t("geocoder.results.direction.south_east") if bearing >= 112.5 and bearing < 157.5
-    return t("geocoder.results.direction.east") if bearing >= 157.5 and bearing < 202.5
-    return t("geocoder.results.direction.north_east") if bearing >= 202.5 and bearing < 247.5
-    return t("geocoder.results.direction.north") if bearing >= 247.5 and bearing < 292.5
-    return t("geocoder.results.direction.north_west") if bearing >= 292.5 and bearing < 337.5
-    return t("geocoder.results.direction.west")
+    return t("geocoder.direction.south_west") if bearing >= 22.5 and bearing < 67.5
+    return t("geocoder.direction.south") if bearing >= 67.5 and bearing < 112.5
+    return t("geocoder.direction.south_east") if bearing >= 112.5 and bearing < 157.5
+    return t("geocoder.direction.east") if bearing >= 157.5 and bearing < 202.5
+    return t("geocoder.direction.north_east") if bearing >= 202.5 and bearing < 247.5
+    return t("geocoder.direction.north") if bearing >= 247.5 and bearing < 292.5
+    return t("geocoder.direction.north_west") if bearing >= 292.5 and bearing < 337.5
+    return t("geocoder.direction.west")
   end
 
   def format_name(name)
   end
 
   def format_name(name)
diff --git a/app/views/geocoder/_description.html.erb b/app/views/geocoder/_description.html.erb
new file mode 100644 (file)
index 0000000..7d93179
--- /dev/null
@@ -0,0 +1,13 @@
+<% @sources.each do |source| %>
+  <% if source[:types] %>
+    <p class="search_results_heading"><%= t("geocoder.description.title.#{source[:name]}", :types => t("geocoder.description.types.#{source[:types]}")) %></p>
+  <% else %>
+    <p class="search_results_heading"><%= t("geocoder.description.title.#{source[:name]}") %></p>
+  <% end %>
+  <div class='search_results_entry' id='<%= "description_#{source[:name]}_#{source[:types]}" %>'>
+    <%= image_tag "searching.gif", :class => "search_searching" %>
+  </div>
+  <script type="text/javascript">
+    <%= remote_function :update => "description_#{source[:name]}_#{source[:types]}", :url => { :action => "description_#{source[:name]}", :lat => params[:lat], :lon => params[:lon], :types => source[:types], :max => source[:max] } %>
+  </script>
+<% end %>
diff --git a/app/views/geocoder/_results.html.erb b/app/views/geocoder/_results.html.erb
deleted file mode 100644 (file)
index bf42244..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<% results.each do |source| %>
-<% type = source[:type] || t('geocoder.results.results') %>
-<p class="search_results_heading"><%= t'geocoder.results.type_from_source', :type => type, :source_link => link_to(source[:source], source[:url]) %></p>
-<% if source[:results] %>
-<% if source[:results].empty? %>
-<p class="search_results_entry"><%= t'geocoder.results.no_results' %></p>
-<% else %>
-<% source[:results].each do |result| %>
-<p class="search_results_entry"><%= result_to_html(result) %></p>
-<% end %>
-<% end %>
-<% else %>
-<p class="search_results_error"><%= source[:error] %></p>
-<% end %>
-<% end %>
diff --git a/app/views/geocoder/_search.html.erb b/app/views/geocoder/_search.html.erb
new file mode 100644 (file)
index 0000000..0d0ed24
--- /dev/null
@@ -0,0 +1,9 @@
+<% @sources.each do |source| %>
+  <p class="search_results_heading"><%= t "geocoder.search.title.#{source}" %></p>
+  <div class='search_results_entry' id='<%= "search_#{source}" %>'>
+    <%= image_tag "searching.gif", :class => "search_searching" %>
+  </div>
+  <script type="text/javascript">
+    <%= remote_function :update => "search_#{source}", :url => { :action => "search_#{source}", :query => @query } %>
+  </script>
+<% end %>
diff --git a/app/views/geocoder/error.html.erb b/app/views/geocoder/error.html.erb
new file mode 100644 (file)
index 0000000..e2ce07b
--- /dev/null
@@ -0,0 +1 @@
+<p class="search_results_error"><%= @error %></p>
diff --git a/app/views/geocoder/results.html.erb b/app/views/geocoder/results.html.erb
new file mode 100644 (file)
index 0000000..70051c9
--- /dev/null
@@ -0,0 +1,7 @@
+<% if @results.empty? %>
+  <p class="search_results_entry"><%= t 'geocoder.results.no_results' %></p>
+<% else %>
+  <% @results.each do |result| %>
+    <p class="search_results_entry"><%= result_to_html(result) %></p>
+  <% end %>
+<% end %>
index d6c1e38fa08b24e8449be7c3292e4ae890c3e91a..12b8bccc558e5d10b07e7c56f594cd7f81b32c5e 100644 (file)
@@ -1,29 +1,19 @@
 <script type="text/javascript">
 <!--
   function startSearch() {
 <script type="text/javascript">
 <!--
   function startSearch() {
-    updateSidebar("<%= t 'site.sidebar.search_results' %>", "<p class='search_results_entry'><%= t 'site.search.searching' %><\/p>");
-
-    $("search_field").style.display = "none";
-    $("search_active").style.display = "inline";
-  }
-
-  function endSearch() {
-    $("search_field").style.display = "inline";
-    $("search_active").style.display = "none";
+    updateSidebar("<%= t 'site.sidebar.search_results' %>", "");
   }
 
   function describeLocation() {
     var position = getPosition();
 
     <%= remote_function(:loading => "startSearch()",
   }
 
   function describeLocation() {
     var position = getPosition();
 
     <%= remote_function(:loading => "startSearch()",
-                        :complete => "endSearch()",
                         :url => { :controller => :geocoder, :action => :description },
                         :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
   }
 
   <% if params[:query] %>
   <%= remote_function(:loading => "startSearch()",
                         :url => { :controller => :geocoder, :action => :description },
                         :with => "'lat=' + position.lat + '&lon=' + position.lon") %>
   }
 
   <% if params[:query] %>
   <%= remote_function(:loading => "startSearch()",
-                      :complete => "endSearch()",
                       :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
   <% end %>
 // -->
                       :url => { :controller => :geocoder, :action => :search, :query => h(params[:query]) }) %>
   <% end %>
 // -->
@@ -42,7 +32,6 @@
       <%= submit_tag t('site.search.submit_text') %>
     <% end %>
     </div>
       <%= submit_tag t('site.search.submit_text') %>
     <% end %>
     </div>
-    <p id="search_active"><%= t 'site.search.searching' %></p>
     </div>
     <p class="search_help">
       <%= t 'site.search.search_help' %>
     </div>
     <p class="search_help">
       <%= t 'site.search.search_help' %>
index 4eba9b4328c287d06ce2c3cf3f3f28caf8b3e728..ab79381615e887b4b3803c21f3ee1d131edfec1c 100644 (file)
@@ -286,9 +286,15 @@ be:
       add_marker: "Дадаць маркер на карту"
       view_larger_map: "Прагледзець большую карту"
   geocoder:
       add_marker: "Дадаць маркер на карту"
       view_larger_map: "Прагледзець большую карту"
   geocoder:
+    search:
+      title:
+        latlon: 'Рэзультаты з <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Рэзультаты з <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Рэзультаты з <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Рэзультаты з <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Рэзультаты з <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Рэзультаты з <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Рэзультаты"
-      type_from_source: "{{type}} з {{source_link}}"
       no_results: "Нічога не знойдзена"
   layouts:
     welcome_user: "Вітаем, {{user_link}}"
       no_results: "Нічога не знойдзена"
   layouts:
     welcome_user: "Вітаем, {{user_link}}"
@@ -432,7 +438,6 @@ be:
       search: Пошук
       where_am_i: "Дзе я?"
       submit_text: "=>"
       search: Пошук
       where_am_i: "Дзе я?"
       submit_text: "=>"
-      searching: "Пошук..."
       search_help: "напрыклад: 'Мінск', 'Regent Street, Cambridge', 'CB2 5AQ', ці 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>больш прыкладаў...</a>"
     key:
       map_key: "Ключ карты"
       search_help: "напрыклад: 'Мінск', 'Regent Street, Cambridge', 'CB2 5AQ', ці 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>больш прыкладаў...</a>"
     key:
       map_key: "Ключ карты"
index b3a5549ad7ea77945fcb5ae70918f863d4ab28a5..611935a2e83d5d2fd16a9746d34ed31313c7fee3 100644 (file)
@@ -338,9 +338,15 @@ de:
       add_marker: "Markierung zur Karte hinzufügen"
       view_larger_map: "Größere Karte anzeigen"
   geocoder:
       add_marker: "Markierung zur Karte hinzufügen"
       view_larger_map: "Größere Karte anzeigen"
   geocoder:
+    search:
+      title:
+        latlon: 'Suchergebnisse von <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Suchergebnisse von <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Suchergebnisse von <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Suchergebnisse von <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Suchergebnisse von <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Suchergebnisse von <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Suchergebnisse"
-      type_from_source: "{{type}} von {{source_link}}"
       no_results: "Keine Ergebnisse"
   layouts:
     project_name:
       no_results: "Keine Ergebnisse"
   layouts:
     project_name:
@@ -578,7 +584,6 @@ de:
       search: Suchen
       where_am_i: "Wo bin ich?"
       submit_text: "Go"
       search: Suchen
       where_am_i: "Wo bin ich?"
       submit_text: "Go"
-      searching: "Suche..."
       search_help: "Beispiele: 'München', 'Heinestraße, Würzburg', 'CB2 5AQ', oder 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>mehr Beispiele...</a>"
     key:
       map_key: "Legende"
       search_help: "Beispiele: 'München', 'Heinestraße, Würzburg', 'CB2 5AQ', oder 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>mehr Beispiele...</a>"
     key:
       map_key: "Legende"
index 35bb5a67cef939c8bdfb0ab2e55108a080e9269f..544dc52d7d3a84eea937c58ccde0611eb687348b 100644 (file)
@@ -338,28 +338,42 @@ en:
       add_marker: "Add a marker to the map"
       view_larger_map: "View Larger Map"
   geocoder:
       add_marker: "Add a marker to the map"
       view_larger_map: "View Larger Map"
   geocoder:
+    search:
+      title:
+        latlon: 'Results from <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Results from <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Results from <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Results from <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Results from <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Results from <a href="http://www.geonames.org/">GeoNames</a>'
+    search_osm_namefinder:
+      prefix: "{{type}} "
+      suffix_place: ", {{distance}} {{direction}} of {{placename}}"
+      suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} of {{parentname}})"
+      suffix_suburb: "{{suffix}}, {{parentname}}"
+    description:
+      title:
+        osm_namefinder: '{{types}} from <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Location from <a href="http://www.geonames.org/">GeoNames</a>'
+      types:
+        cities: Cities
+        towns: Towns
+        places: Places
     results:
     results:
-      results: "Results"
-      type_from_source: "{{type}} from {{source_link}}"
       no_results: "No results found"
       no_results: "No results found"
-      namefinder:
-        prefix: "{{type}} "
-        suffix_place: ", {{distance}} {{direction}} of {{placename}}"
-        suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} of {{parentname}})"
-        suffix_suburb: "{{suffix}}, {{parentname}}"
-      distance:
-        zero: "less than 1km"
-        one: "about 1km"
-        other: "about {{count}}km"
-      direction:
-        south_west: "south-west"
-        south: "south"
-        south_east: "south-east"
-        east: "east"
-        north_east: "north-east"
-        north: "north"
-        north_west: "north-west"
-        west: "west"
+    distance:
+      zero: "less than 1km"
+      one: "about 1km"
+      other: "about {{count}}km"
+    direction:
+      south_west: "south-west"
+      south: "south"
+      south_east: "south-east"
+      east: "east"
+      north_east: "north-east"
+      north: "north"
+      north_west: "north-west"
+      west: "west"
   layouts:
     project_name:
       # in <title>
   layouts:
     project_name:
       # in <title>
@@ -596,7 +610,6 @@ en:
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
-      searching: "Searching..."
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
index e36a7d9d5a5e93462eaeb59a5b9475e4e588592b..7516e0300fe30518febf776850763ecb421d4562 100644 (file)
@@ -309,9 +309,15 @@ es:
       add_marker: "Añadir un marcador al mapa"
       view_larger_map: "Ver mapa más grande"
   geocoder:
       add_marker: "Añadir un marcador al mapa"
       view_larger_map: "Ver mapa más grande"
   geocoder:
+    search:
+      title:
+        latlon: 'Resultados en <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Resultados en <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Resultados en <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Resultados en <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Resultados en <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Resultados en <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Resultados"
-      type_from_source: "{{type}} en {{source_link}}"
       no_results: "No se han encontrado resultados"
   layouts:
     project_name:
       no_results: "No se han encontrado resultados"
   layouts:
     project_name:
@@ -514,7 +520,6 @@ es:
       search: "Buscar"
       where_am_i: "¿Dónde estoy?"
       submit_text: "Ir"
       search: "Buscar"
       where_am_i: "¿Dónde estoy?"
       submit_text: "Ir"
-      searching: "Buscando..."
   trace:
     edit:
       points: "Puntos:"
   trace:
     edit:
       points: "Puntos:"
index 521ebe59b3a03d70f42ad084d0ec307f6c7ce049..83481d9f3e5322dd835b75538232193739139064 100644 (file)
@@ -163,7 +163,6 @@ fr:
       search: "Recherche"
       where_am_i: "Où suis-je ?"
       submit_text: "Envoyer"
       search: "Recherche"
       where_am_i: "Où suis-je ?"
       submit_text: "Envoyer"
-      searching: "En cours de recherche..."
       search_help: "exemples : 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', ou 'bureaux de poste près de Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>Autres d'exemples...</a>"
     key:
       map_key: "Légende de la carte"
       search_help: "exemples : 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', ou 'bureaux de poste près de Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>Autres d'exemples...</a>"
     key:
       map_key: "Légende de la carte"
index 3f7f38b09ad83bbbc13f4c3f8a3bcb26faf6b82c..45c1680285ad33f7f16822a62d80b761324ecfdf 100644 (file)
@@ -288,8 +288,6 @@ he:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
-      results: "Results"
-      type_from_source: "{{type}} from {{source_link}}"
       no_results: "No results found"
   layouts:
     welcome_user: "{{user_link}}ברוך הבא"
       no_results: "No results found"
   layouts:
     welcome_user: "{{user_link}}ברוך הבא"
@@ -435,7 +433,6 @@ he:
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
-      searching: "Searching..."
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
index e9f1b66111cc632dd2f2ab01b277d606b8615314..4374e5303dfbd7f5132ae2c06452e55c09f83e11 100644 (file)
@@ -315,8 +315,6 @@ hi:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
-      results: "Results"
-      type_from_source: "{{type}} from {{source_link}}"
       no_results: "No results found"
   layouts:
     welcome_user: "Welcome, {{user_link}}"
       no_results: "No results found"
   layouts:
     welcome_user: "Welcome, {{user_link}}"
@@ -499,7 +497,6 @@ hi:
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
-      searching: "Searching..."
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
index f18b3c49ed9e2ef4af29c1b86c5d1aecd76987f6..350bca8158d98300bf774d8633eff5b0b7a2aff0 100644 (file)
@@ -341,9 +341,15 @@ is:
       add_marker: "Bæta við punkt á kortið"
       view_larger_map: "Skoða á stærra korti"
   geocoder:
       add_marker: "Bæta við punkt á kortið"
       view_larger_map: "Skoða á stærra korti"
   geocoder:
+    search:
+      title:
+        latlon: 'Niðurstöður frá <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Niðurstöður frá <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Niðurstöður frá <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Niðurstöður frá <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Niðurstöður frá <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Niðurstöður frá <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Niðurstöður"
-      type_from_source: "{{type}} frá {{source_link}}"
       no_results: "Ekkert fannst"
       namefinder:
         prefix: "{{type}} "
       no_results: "Ekkert fannst"
       namefinder:
         prefix: "{{type}} "
@@ -597,7 +603,6 @@ is:
       search: "Leita"
       where_am_i: "Hvar er ég?"
       submit_text: "Ok"
       search: "Leita"
       where_am_i: "Hvar er ég?"
       submit_text: "Ok"
-      searching: "Leita..."
       search_help: "dæmi: „Akureyri“, „Laugavegur, Reykjavík“ eða „post offices near Lünen“. Sjá einnig <a href='http://wiki.openstreetmap.org/index.php?uselang=is&title=Search'>leitarhjálpina</a>."
     key:
       map_key: "Kortaskýringar"
       search_help: "dæmi: „Akureyri“, „Laugavegur, Reykjavík“ eða „post offices near Lünen“. Sjá einnig <a href='http://wiki.openstreetmap.org/index.php?uselang=is&title=Search'>leitarhjálpina</a>."
     key:
       map_key: "Kortaskýringar"
index a35ff34a1e96148cf8267ee4979d68547cdee9f8..d4c83fa7a3859a83741dff9d0c42f423c9a984dd 100644 (file)
@@ -287,9 +287,15 @@ it:
       add_marker: "Aggiungi un marcatore alla mappa"
       view_larger_map: "Visualizza una mappa più ampia"
   geocoder:
       add_marker: "Aggiungi un marcatore alla mappa"
       view_larger_map: "Visualizza una mappa più ampia"
   geocoder:
+    search:
+      title:
+        latlon: 'Risultati da <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Risultati da <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Risultati da <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Risultati da <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Risultati da <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Risultati da <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Risultati"
-      type_from_source: "{{type}} da {{source_link}}"
       no_results: "Nessun risultato"
   layouts:
     welcome_user: "Benvenuto, {{user_link}}"
       no_results: "Nessun risultato"
   layouts:
     welcome_user: "Benvenuto, {{user_link}}"
@@ -433,7 +439,6 @@ it:
       search: Cerca
       where_am_i: "Dove sono?"
       submit_text: "Vai"
       search: Cerca
       where_am_i: "Dove sono?"
       submit_text: "Vai"
-      searching: "Ricerca in corso..."
       search_help: "esempi: 'Trieste', 'Via Dante Alighieri, Trieste', 'CB2 5AQ', oppure 'post offices near Trieste' <a href='http://wiki.openstreetmap.org/wiki/Search'>altri esempi...</a>"
     key:
       map_key: "Legenda"
       search_help: "esempi: 'Trieste', 'Via Dante Alighieri, Trieste', 'CB2 5AQ', oppure 'post offices near Trieste' <a href='http://wiki.openstreetmap.org/wiki/Search'>altri esempi...</a>"
     key:
       map_key: "Legenda"
index 2864de141c0678f1bc25958b19dc0601c212ef5a..bf7c2e8a244d90764a3318274ef82eff2b587827 100644 (file)
@@ -318,9 +318,15 @@ ja:
       add_marker: "マーカーを地図に追加する"
       view_larger_map: "大きな地図を表示..."
   geocoder:
       add_marker: "マーカーを地図に追加する"
       view_larger_map: "大きな地図を表示..."
   geocoder:
+    search:
+      title:
+        latlon: '<a href="http://openstreetmap.org/">Internal</a>からの結果'
+        us_postcode: '<a href="http://geocoder.us/">Geocoder.us</a>からの結果'
+        uk_postcode: '<a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>からの結果'
+        ca_postcode: '<a href="http://geocoder.ca/">Geocoder.CA</a>からの結果'
+        osm_namefinder: '<a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>からの結果'
+        geonames: '<a href="http://www.geonames.org/">GeoNames</a>からの結果'
     results:
     results:
-      results: "結果"
-      type_from_source: "{{source_link}}からの{{type}}"
       no_results: "見つかりませんでした。"
   layouts:
     project_name:
       no_results: "見つかりませんでした。"
   layouts:
     project_name:
@@ -560,7 +566,6 @@ ja:
       search: "検索"
       where_am_i: "いまどこ?"
       submit_text: "行く"
       search: "検索"
       where_am_i: "いまどこ?"
       submit_text: "行く"
-      searching: "検索中..."
       search_help: "例: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>他の例...</a>"
       #いずれ、wiki.openstreetmap.org/wiki/Ja:Searchを作成すること
     key:
       search_help: "例: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>他の例...</a>"
       #いずれ、wiki.openstreetmap.org/wiki/Ja:Searchを作成すること
     key:
index 96634658de6c3474195d36f32a17b579fd15ec0a..26c5abcbddd4978032f8868341bfb3bd6a786b1e 100644 (file)
@@ -319,8 +319,6 @@ ko:
       view_larger_map: "큰 지도 보기"
   geocoder:
     results:
       view_larger_map: "큰 지도 보기"
   geocoder:
     results:
-      results: "Results"
-      type_from_source: "{{type}} from {{source_link}}"
       no_results: "No results found"
   layouts:
     project_name:
       no_results: "No results found"
   layouts:
     project_name:
@@ -557,7 +555,6 @@ ko:
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
       search: Search
       where_am_i: "Where am I?"
       submit_text: "Go"
-      searching: "Searching..."
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near L체nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near L체nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
index a96e6fd739bd8b68ced1d990b5b2d933dedc066d..9c07ce87b49eb7173f86425fb6797c3357aaca1d 100644 (file)
       add_marker: "Marker op de kaart zetten"
       view_larger_map: "Grotere kaart zien"
   geocoder:
       add_marker: "Marker op de kaart zetten"
       view_larger_map: "Grotere kaart zien"
   geocoder:
+    search:
+      title:
+        latlon: 'Resultaten van <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Resultaten van <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Resultaten van <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Resultaten van <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Resultaten van <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Resultaten van <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Resultaten"
-      type_from_source: "{{type}} van {{source_link}}"
       no_results: "Geen resultaten gevonden"
   layouts:
     welcome_user: "Welkom, {{user_link}}"
       no_results: "Geen resultaten gevonden"
   layouts:
     welcome_user: "Welkom, {{user_link}}"
       search: Zoeken
       where_am_i: "Waar ben ik?"
       submit_text: "Ga"
       search: Zoeken
       where_am_i: "Waar ben ik?"
       submit_text: "Ga"
-      searching: "Zoeken..."
       search_help: "voorbeelden: 'Alkmaar', 'Spui, Amsterdam', 'CB2 5AQ', of 'post offices near Leiden' <a href='http://wiki.openstreetmap.org/wiki/Search'>meer voorbeelden...</a>"
     key:
       map_key: "Legenda"
       search_help: "voorbeelden: 'Alkmaar', 'Spui, Amsterdam', 'CB2 5AQ', of 'post offices near Leiden' <a href='http://wiki.openstreetmap.org/wiki/Search'>meer voorbeelden...</a>"
     key:
       map_key: "Legenda"
index 859c26e1ae8396cfecc62145206ba33300929a39..8dd0345ffabcdf7d58ec312d4dd6864a777d65eb 100644 (file)
@@ -291,9 +291,15 @@ pl:
       add_marker: "Dodaj pinezkę na mapie"
       view_larger_map: "Większy widok mapy"
   geocoder:
       add_marker: "Dodaj pinezkę na mapie"
       view_larger_map: "Większy widok mapy"
   geocoder:
+    search:
+      title:
+        latlon: 'Wyniki z <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Wyniki z <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Wyniki z <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Wyniki z <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Wyniki z <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Wyniki z <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Wyniki"
-      type_from_source: "{{type}} z {{source_link}}"
       no_results: "Nie znaleziono"
   layouts:
     welcome_user: "Witaj, {{user_link}}"
       no_results: "Nie znaleziono"
   layouts:
     welcome_user: "Witaj, {{user_link}}"
@@ -447,7 +453,6 @@ pl:
       search: Wyszukiwanie
       where_am_i: "Gdzie jestem?"
       submit_text: "Szukaj"
       search: Wyszukiwanie
       where_am_i: "Gdzie jestem?"
       submit_text: "Szukaj"
-      searching: "Wyszukiwanie..."
       search_help: "przykłady: 'Wąchock', 'Franciszkańska, Poznań', 'CB2 5AQ', lub 'post offices near Mokotów' <a href='http://wiki.openstreetmap.org/wiki/Search'>więcej przykładów...</a>"
     key:
       map_key: "Legenda"
       search_help: "przykłady: 'Wąchock', 'Franciszkańska, Poznań', 'CB2 5AQ', lub 'post offices near Mokotów' <a href='http://wiki.openstreetmap.org/wiki/Search'>więcej przykładów...</a>"
     key:
       map_key: "Legenda"
index a5f1961b826fbeb22253cc7618aded95d2776e3a..602870877f1a0aeb12bbd718f92889396762e0ee 100644 (file)
@@ -318,9 +318,15 @@ pt-BR:
       add_marker: "Adicionar um marcador ao mapa"
       view_larger_map: "Ver Mapa Ampliado"
   geocoder:
       add_marker: "Adicionar um marcador ao mapa"
       view_larger_map: "Ver Mapa Ampliado"
   geocoder:
+    search:
+      title:
+        latlon: 'Resultados de <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Resultados de <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Resultados de <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Resultados de <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Resultados de <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Resultados de <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Resultados"
-      type_from_source: "{{type}} de {{source_link}}"
       no_results: "Não foram encontrados resultados"
   layouts:
     project_name:
       no_results: "Não foram encontrados resultados"
   layouts:
     project_name:
@@ -557,7 +563,6 @@ OpenStreetMap em:"
       search: "Buscar"
       where_am_i: "Onde estou?"
       submit_text: "Ir"
       search: "Buscar"
       where_am_i: "Onde estou?"
       submit_text: "Ir"
-      searching: "Buscando..."
       search_help: "exemplos: 'Belo Horizonte', 'Av. Paulista, São Paulo', 'CB2 5AQ', or 'post offices near Porto Alegre' <a href='http://wiki.openstreetmap.org/wiki/Pt-br:Search'>mais exemplos...</a>"
     key:
       map_key: "Map key"
       search_help: "exemplos: 'Belo Horizonte', 'Av. Paulista, São Paulo', 'CB2 5AQ', or 'post offices near Porto Alegre' <a href='http://wiki.openstreetmap.org/wiki/Pt-br:Search'>mais exemplos...</a>"
     key:
       map_key: "Map key"
index 24910c0f9389d5d3794ebab71ec84c6c89986040..700619645fac09166acfdbb2b5901bcee5bd0222 100644 (file)
@@ -287,9 +287,15 @@ ru:
       add_marker: "Добавить маркер на карту"
       view_larger_map: "Посмотреть бо&#769;льшую карту"
   geocoder:
       add_marker: "Добавить маркер на карту"
       view_larger_map: "Посмотреть бо&#769;льшую карту"
   geocoder:
+    search:
+      title:
+        latlon: 'Результаты из <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Результаты из <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Результаты из <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Результаты из <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Результаты из <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Результаты из <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "Результаты"
-      type_from_source: "{{type}} из {{source_link}}"
       no_results: "Ничего не найдено"
   layouts:
     welcome_user: "Добро пожаловать, {{user_link}}"
       no_results: "Ничего не найдено"
   layouts:
     welcome_user: "Добро пожаловать, {{user_link}}"
@@ -433,7 +439,6 @@ ru:
       search: Поиск
       where_am_i: "Где я?"
       submit_text: "->"
       search: Поиск
       where_am_i: "Где я?"
       submit_text: "->"
-      searching: "Поиск..."
       search_help: "примеры: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', или 'post offices near LУМnen' <a href='http://wiki.openstreetmap.org/wiki/Search'>больше примеров...</a>"
     key:
       map_key: "Легенда"
       search_help: "примеры: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', или 'post offices near LУМnen' <a href='http://wiki.openstreetmap.org/wiki/Search'>больше примеров...</a>"
     key:
       map_key: "Легенда"
index 1004e32fba892c68dd8bb1894dc457925233d0c3..962d2e0644bd9e59f5a211fa8e1896531476d95d 100644 (file)
@@ -346,28 +346,34 @@ sl:
       add_marker: "Dodaj zaznamek na zemljevid"
       view_larger_map: "Večji zemljevid" 
   geocoder:
       add_marker: "Dodaj zaznamek na zemljevid"
       view_larger_map: "Večji zemljevid" 
   geocoder:
+    search:
+      title:
+        latlon: 'Zadetki iz <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: 'Zadetki iz <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: 'Zadetki iz <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: 'Zadetki iz <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: 'Zadetki iz <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: 'Zadetki iz <a href="http://www.geonames.org/">GeoNames</a>'
+    search_osm_namefinder:
+      prefix: "{{type}} "
+      suffix_place: ", {{distance}} {{direction}} od {{placename}}"
+      suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} od {{parentname}})"
+      suffix_suburb: "{{suffix}}, {{parentname}}"
     results:
     results:
-      results: "Zadetki"
-      type_from_source: "{{type}} iz {{source_link}}"
       no_results: "Ni zadetkov"
       no_results: "Ni zadetkov"
-      namefinder:
-        prefix: "{{type}} "
-        suffix_place: ", {{distance}} {{direction}} od {{placename}}"
-        suffix_parent: "{{suffix}} ({{parentdistance}} {{parentdirection}} od {{parentname}})"
-        suffix_suburb: "{{suffix}}, {{parentname}}"
-      distance:
-        zero: "manj kot 1 km"
-        one: "približno {{count}} km"
-        other: "približno {{count}} km"
-      direction:
-        south_west: "jugozahodno"
-        south: "južno"
-        south_east: "jugovzhodno"
-        east: "vzhodno"
-        north_east: "severovzhodno"
-        north: "severno"
-        north_west: "severozahodno"
-        west: "zahodno"
+    distance:
+      zero: "manj kot 1 km"
+      one: "približno {{count}} km"
+      other: "približno {{count}} km"
+    direction:
+      south_west: "jugozahodno"
+      south: "južno"
+      south_east: "jugovzhodno"
+      east: "vzhodno"
+      north_east: "severovzhodno"
+      north: "severno"
+      north_west: "severozahodno"
+      west: "zahodno"
   layouts:
     project_name:
       # in <title>
   layouts:
     project_name:
       # in <title>
@@ -606,7 +612,6 @@ sl:
       search: Iskanje
       where_am_i: "Kje sem?"
       submit_text: "Išči"
       search: Iskanje
       where_am_i: "Kje sem?"
       submit_text: "Išči"
-      searching: "Iščem..."
       search_help: "primeri: 'Bovec', 'Prešernova, Celje', 'Živalski vrt' ali 'vzpenjača' <a href='http://wiki.openstreetmap.org/wiki/Search'>Več primerov...</a>"
     key:
       map_key: "Legenda"
       search_help: "primeri: 'Bovec', 'Prešernova, Celje', 'Živalski vrt' ali 'vzpenjača' <a href='http://wiki.openstreetmap.org/wiki/Search'>Več primerov...</a>"
     key:
       map_key: "Legenda"
index c0a009c65ed7313b44e9fab13342ad2cf114f0fd..bc207113bbc5fadc952bc7a438f4472a550c3d1f 100644 (file)
@@ -319,8 +319,6 @@ yo:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
       view_larger_map: "View Larger Map"
   geocoder:
     results:
-      results: "Results"
-      type_from_source: "{{type}} from {{source_link}}"
       no_results: "No results found"
   layouts:
     project_name:
       no_results: "No results found"
   layouts:
     project_name:
@@ -557,7 +555,6 @@ yo:
       search: Search
       where_am_i: "Ni bo ni mo wa?"
       submit_text: "Lo"
       search: Search
       where_am_i: "Ni bo ni mo wa?"
       submit_text: "Lo"
-      searching: "Searching..."
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
       search_help: "examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', or 'post offices near Lünen' <a href='http://wiki.openstreetmap.org/wiki/Search'>more examples...</a>"
     key:
       map_key: "Map key"
index 9c69010dfe9bff6e6361dd03e1a3d40d10a0986e..b1ef83dc21104637618cc1f27d1ef5d599ec3a2f 100644 (file)
@@ -291,9 +291,15 @@ zh-CN:
       add_marker: "标记地图"
       view_larger_map: "查看放大地图"
   geocoder:
       add_marker: "标记地图"
       view_larger_map: "查看放大地图"
   geocoder:
+    search:
+      title:
+        latlon: '结果 从 <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: '结果 从 <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: '结果 从 <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: '结果 从 <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: '结果 从 <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: '结果 从 <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "结果"
-      type_from_source: "{{type}} 从 {{source_link}}"
       no_results: "没有发现结果"
   layouts:
     welcome_user: "欢迎, {{user_link}}"
       no_results: "没有发现结果"
   layouts:
     welcome_user: "欢迎, {{user_link}}"
@@ -458,7 +464,6 @@ zh-CN:
       search: 搜索
       where_am_i: "我在哪儿?"
       submit_text: "开始"
       search: 搜索
       where_am_i: "我在哪儿?"
       submit_text: "开始"
-      searching: "搜索中..."
       search_help: "例如: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', 或者 'post offices near L??nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>更多例子...</a>"
     key:
       map_key: "地图符号"
       search_help: "例如: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', 或者 'post offices near L??nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>更多例子...</a>"
     key:
       map_key: "地图符号"
index 57b90c589a4ca45ad4daeacc9344cf7a9efbf6cd..104137e4ba315f414871f8f8f331461b0e84ba32 100644 (file)
@@ -318,9 +318,15 @@ zh-TW:
       add_marker: "加入標記至地圖"
       view_larger_map: "檢視較大的地圖"
   geocoder:
       add_marker: "加入標記至地圖"
       view_larger_map: "檢視較大的地圖"
   geocoder:
+    search:
+      title:
+        latlon: '結果 從 <a href="http://openstreetmap.org/">Internal</a>'
+        us_postcode: '結果 從 <a href="http://geocoder.us/">Geocoder.us</a>'
+        uk_postcode: '結果 從 <a href="http://www.npemap.org.uk/">NPEMap / FreeThe Postcode</a>'
+        ca_postcode: '結果 從 <a href="http://geocoder.ca/">Geocoder.CA</a>'
+        osm_namefinder: '結果 從 <a href="http://gazetteer.openstreetmap.org/namefinder/">OpenStreetMap Namefinder</a>'
+        geonames: '結果 從 <a href="http://www.geonames.org/">GeoNames</a>'
     results:
     results:
-      results: "結果"
-      type_from_source: "{{type}} 從 {{source_link}}"
       no_results: "找不到任何結果"
   layouts:
     project_name:
       no_results: "找不到任何結果"
   layouts:
     project_name:
@@ -557,7 +563,6 @@ zh-TW:
       search: "搜尋"
       where_am_i: "我在哪裡?"
       submit_text: "走"
       search: "搜尋"
       where_am_i: "我在哪裡?"
       submit_text: "走"
-      searching: "搜尋中..."
       search_help: "範例: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', 或 'post offices near L羹nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>更多範例...</a>"
     key:
       map_key: "圖例"
       search_help: "範例: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ', 或 'post offices near L羹nen' <a href='http://wiki.openstreetmap.org/wiki/Search'>更多範例...</a>"
     key:
       map_key: "圖例"
index 6dd3860dcf0f74221afeea9446bb9253280ece5a..23d323596a8caa5325f404ae9c5abcfb6abfef9b 100644 (file)
@@ -169,7 +169,15 @@ ActionController::Routing::Routes.draw do |map|
 
   # geocoder
   map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
 
   # geocoder
   map.connect '/geocoder/search', :controller => 'geocoder', :action => 'search'
+  map.connect '/geocoder/search_latlon', :controller => 'geocoder', :action => 'search_latlon'
+  map.connect '/geocoder/search_us_postcode', :controller => 'geocoder', :action => 'search_uk_postcode'
+  map.connect '/geocoder/search_uk_postcode', :controller => 'geocoder', :action => 'search_us_postcode'
+  map.connect '/geocoder/search_ca_postcode', :controller => 'geocoder', :action => 'search_ca_postcode'
+  map.connect '/geocoder/search_osm_namefinder', :controller => 'geocoder', :action => 'search_osm_namefinder'
+  map.connect '/geocoder/search_geonames', :controller => 'geocoder', :action => 'search_geonames'
   map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
   map.connect '/geocoder/description', :controller => 'geocoder', :action => 'description'
+  map.connect '/geocoder/description_osm_namefinder', :controller => 'geocoder', :action => 'description_osm_namefinder'
+  map.connect '/geocoder/description_geonames', :controller => 'geocoder', :action => 'description_geonames'
 
   # export
   map.connect '/export/start', :controller => 'export', :action => 'start'
 
   # export
   map.connect '/export/start', :controller => 'export', :action => 'start'
diff --git a/public/images/searching.gif b/public/images/searching.gif
new file mode 100644 (file)
index 0000000..5b33f7e
Binary files /dev/null and b/public/images/searching.gif differ
index 86b38f8ace41b1f65f8e302e2b42d634c8b8b394..c44d54bcea0b18bae8acbf5472381984b2a9bf50 100644 (file)
@@ -402,11 +402,6 @@ hr {
   padding-bottom: 6px;
 }
 
   padding-bottom: 6px;
 }
 
-#search_active {
-  display: none;
-  color: red;
-}
-
 .rsssmall {
   position: relative;
   top: 4px;
 .rsssmall {
   position: relative;
   top: 4px;
@@ -514,6 +509,11 @@ hr {
   margin-bottom: 0px;
 }
 
   margin-bottom: 0px;
 }
 
+.search_searching {
+  margin-top: 5px;
+  margin-bottom: 5px;
+}
+
 .olControlAttribution {
   display: none !important;
 }
 .olControlAttribution {
   display: none !important;
 }