]> git.openstreetmap.org Git - rails.git/commitdiff
Update OpenSearch plugin to work with new search system.
authorTom Hughes <tom@compton.nu>
Wed, 8 Aug 2007 08:47:29 +0000 (08:47 +0000)
committerTom Hughes <tom@compton.nu>
Wed, 8 Aug 2007 08:47:29 +0000 (08:47 +0000)
app/views/layouts/site.rhtml
app/views/site/_search.rhtml
public/opensearch/osm-postcode.xml [deleted file]
public/opensearch/osm.xml

index 673e12706e9eaf8b9d04b6dba62c3da32e7c0605..194ea5239f756d2662ff0c2cb386f747db8d6256 100644 (file)
@@ -5,8 +5,7 @@
     <%= javascript_include_tag 'site' %>
     <!--[if lt IE 7]><%= javascript_include_tag 'pngfix' %><![endif]--> <!-- thanks, microsoft! -->
     <%= stylesheet_link_tag 'site' %>
-    <%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Placename Search", :href => "/opensearch/osm.xml" }) %>
-    <%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Postcode Search", :href => "/opensearch/osm-postcode.xml" }) %>
+    <%= tag("link", { :rel => "search", :type => "application/opensearchdescription+xml", :title => "OpenStreetMap Search", :href => "/opensearch/osm.xml" }) %>
     <title>OpenStreetMap<%= ' | '+@title if @title %></title>
   </head>
   <body>
index 8e5a8b764a8d1cfbe5ef126115bebc0925a8aed7..f6d9cb5902c8966043a873ad15c3e3dcd94c6f29 100644 (file)
@@ -1,10 +1,42 @@
+<div id="search_results">
+  <table class="search_results_title" width="100%">
+    <tr>
+      <td align="left">Search Results</td>
+      <td align="right"><a href="javascript:closeSearchResults()">Close</a></td>
+    </tr>
+  </table>
+  <div id="search_results_content">
+  </div>
+</div>
+
+<script type="text/javascript">
+<!--
+  function openSearchResults() {
+    $("search_results").style.display = "block";
+    $("search_results_content").innerHTML = "<p class='search_results_entry'>Searching...</p>";
+    <%= onopen %>
+  }
+
+  function closeSearchResults() {
+    $("search_results").style.display = "none";
+    <%= onclose %>
+  }
+
+  <% if params[:query] %>
+  <%= remote_function(:update => :search_results_content, 
+                      :loading => "openSearchResults()",
+                      :url => { :controller => :geocoder, :action => :search, :query => params[:query] }) %>
+  <% end %>
+// -->
+</script>
+
 <% content_for "optionals" do %>
   <div class="optionalbox">
     <span class="oboxheader">Search</span>
     <% form_remote_tag(:update => :search_results_content, 
                        :loading => "openSearchResults()",
-                       :url => { :controller => :geocoder, :action => :search } ) do %>
-      <%= text_field_tag :query, nil, :size => 16 %>
+                       :url => { :controller => :geocoder, :action => :search }) do %>
+      <%= text_field_tag :query, params[:query] %>
     <% end %>
     <p class="search_help">
       examples: 'Alkmaar', 'Regent Street, Cambridge', 'CB2 5AQ',
       <a href="http://wiki.openstreetmap.org/index.php/Name_finder#Searching_for_things">more examples...</a>
     </p>
   </div>
-  <script type="text/javascript">
-  <!--
-    function openSearchResults() {
-      $("search_results").style.display = "block";
-      $("search_results_content").innerHTML = "<p class='search_results_entry'>Searching...</p>";
-      <%= onopen %>
-    }
-
-    function closeSearchResults() {
-      $("search_results").style.display = "none";
-      <%= onclose %>
-    }
-  // -->
-  </script>
 <% end %>
-
-<div id="search_results">
-  <table class="search_results_title" width="100%">
-    <tr>
-      <td align="left">Search Results</td>
-      <td align="right"><a href="javascript:closeSearchResults()">Close</a></td>
-    </tr>
-  </table>
-  <div id="search_results_content">
-  </div>
-</div>
diff --git a/public/opensearch/osm-postcode.xml b/public/opensearch/osm-postcode.xml
deleted file mode 100644 (file)
index 8bc295d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"\r
-                       xmlns:moz="http://www.mozilla.org/2006/browser/search/">\r
-       <ShortName>OpenStreetMap Postcodes</ShortName>\r
-       <LongName>OpenStreetMap Postcode search</LongName>\r
-       <Description>Search for a postcode in OpenStreetMap, the Wiki World Map</Description>\r
-       <InputEncoding>UTF-8</InputEncoding>\r
-       <OutputEncoding>UTF-8</OutputEncoding>\r
-       <Image width="16" height="16">data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%19tEXtSoftware%00www.inkscape.org%9B%EE%3C%1A%00%00%01'IDATx%9C%9D%93%B1q%C30%0CE%1F%5Dd%80l%90I%C4*%A7%22%95%CF%85J%97%AE%B2%82%3DC%CE%03%A0%B3%9B%B8f%95%A3%17H%93%05%5C%A7%C8%0A%3F%05E%8A%92l%E7.%D0%E9N%02%81%07%E0Cr%FCaf%A6%FC%BC%5E%AF%DD%F4%3C%3Bt%C5%87%99)%84P%0E%DA%B6%BD%0AI%00%A1%A8%A8%1E%263S%D7u%C9'F%FE%9B%80%0C%C9%C9%22%BD'%B0%0A%AC%86%2CJ%DB%0E%22%11%8F%2F%D4%B3%22%8D%F34%CE%13u%06R%0C%40%D7u%AA%01%C5r%40%0Dq%88%C6%F9i%E8%7C%8CX%5D%A9M%95%D6%A3%A2Ti%C3Xx%CA%9C%F5mf3h%11%B6%07%B8%0APh%97%DD%1E%9E%5E%08!%D0%B6m%F1%87%108%1E%8EY5%007%03%5Cv%7B%00%3E%BF%3E%F8~x%1E%CD%B89l%00%F0I%0FWw%00%20%DB%AEJr%B6%E5%FB%09%80%C6y%CE%7D%91%1AP%B6p%2B%D9%BB%06%18V%3A%B5E%9F%AC%5B%95%AFY%3F%EE%20%A2mW%AA%93%DFN%3F%A0%E1%9B%F0u%E5%BC%BC%89%88%BC.%1F%D5'%DF%FD%C1%EE%F8%FFg%BFp%96%DF%E2%DCw%25%2B%00%00%00%00IEND%AEB%60%82</Image>\r
-       <Url type="text/html" method="post" template="http://www.openstreetmap.org/geocoder/search">\r
-         <Param name="next_controller" value="site"/>\r
-         <Param name="next_action" value="index"/>\r
-         <Param name="query[postcode]" value="{searchTerms}"/>\r
-       </Url>\r
-       <Query role="example" searchTerms="SW1A 1AA" />\r
-       <Developer>Jonathan Bennett</Developer>\r
-       <AdultContent>false</AdultContent>\r
-       <Attribution>Data &amp;copy; OpenStreetMap contributors, Some Rights Reserved. CC by-sa 2.0. Geolocation provided by npemap.org.uk, geocoder.us, geocoder.ca and geonames.org.  </Attribution>\r
-</OpenSearchDescription>
\ No newline at end of file
index 4b24dcd03605cb18913e46457ba08f96abfc69c4..a060ce7eebcccb4a834d3b783f57ef8ed56b0e28 100644 (file)
@@ -2,18 +2,16 @@
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"\r
                        xmlns:moz="http://www.mozilla.org/2006/browser/search/">\r
        <ShortName>OpenStreetMap</ShortName>\r
-       <LongName>OpenStreetMap placename search</LongName>\r
+       <LongName>OpenStreetMap Search</LongName>\r
        <Description>Search for a place in OpenStreetMap, the Wiki World Map</Description>\r
        <InputEncoding>UTF-8</InputEncoding>\r
        <OutputEncoding>UTF-8</OutputEncoding>\r
        <Image width="16" height="16">data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%10%00%00%00%10%08%06%00%00%00%1F%F3%FFa%00%00%00%19tEXtSoftware%00www.inkscape.org%9B%EE%3C%1A%00%00%01'IDATx%9C%9D%93%B1q%C30%0CE%1F%5Dd%80l%90I%C4*%A7%22%95%CF%85J%97%AE%B2%82%3DC%CE%03%A0%B3%9B%B8f%95%A3%17H%93%05%5C%A7%C8%0A%3F%05E%8A%92l%E7.%D0%E9N%02%81%07%E0Cr%FCaf%A6%FC%BC%5E%AF%DD%F4%3C%3Bt%C5%87%99)%84P%0E%DA%B6%BD%0AI%00%A1%A8%A8%1E%263S%D7u%C9'F%FE%9B%80%0C%C9%C9%22%BD'%B0%0A%AC%86%2CJ%DB%0E%22%11%8F%2F%D4%B3%22%8D%F34%CE%13u%06R%0C%40%D7u%AA%01%C5r%40%0Dq%88%C6%F9i%E8%7C%8CX%5D%A9M%95%D6%A3%A2Ti%C3Xx%CA%9C%F5mf3h%11%B6%07%B8%0APh%97%DD%1E%9E%5E%08!%D0%B6m%F1%87%108%1E%8EY5%007%03%5Cv%7B%00%3E%BF%3E%F8~x%1E%CD%B89l%00%F0I%0FWw%00%20%DB%AEJr%B6%E5%FB%09%80%C6y%CE%7D%91%1AP%B6p%2B%D9%BB%06%18V%3A%B5E%9F%AC%5B%95%AFY%3F%EE%20%A2mW%AA%93%DFN%3F%A0%E1%9B%F0u%E5%BC%BC%89%88%BC.%1F%D5'%DF%FD%C1%EE%F8%FFg%BFp%96%DF%E2%DCw%25%2B%00%00%00%00IEND%AEB%60%82</Image>\r
-       <Url type="text/html" method="post" template="http://www.openstreetmap.org/geocoder/search">\r
-         <Param name="next_controller" value="site"/>\r
-         <Param name="next_action" value="index"/>\r
-         <Param name="query[place_name]" value="{searchTerms}"/>\r
+       <Url type="text/html" method="post" template="http://www.openstreetmap.org/">\r
+         <Param name="query" value="{searchTerms}"/>\r
        </Url>\r
        <Query role="example" searchTerms="Reigate" />\r
        <Developer>Jonathan Bennett</Developer>\r
        <AdultContent>false</AdultContent>\r
-       <Attribution>Data &amp;copy; OpenStreetMap contributors, Some Rights Reserved. CC by-sa 2.0. Geolocation provided by npemap.org.uk, geocoder.us, geocoder.ca and geonames.org.  </Attribution>\r
-</OpenSearchDescription>
\ No newline at end of file
+       <Attribution>Data &amp;copy; OpenStreetMap contributors, Some Rights Reserved. CC by-sa 2.0. Geolocation provided by npemap.org.uk, geocoder.us, geocoder.ca and geonames.org.</Attribution>\r
+</OpenSearchDescription>\r