Restore OpenSearch support and use TPAC search
authorDan Scott <dscott@laurentian.ca>
Wed, 15 Jan 2014 04:46:41 +0000 (23:46 -0500)
committerBen Shum <bshum@biblio.org>
Thu, 6 Feb 2014 05:28:59 +0000 (00:28 -0500)
This enables users to easily add the Evergreen search engine to their browser's
built-in set of search engines, and most importantly directs searches to the
TPAC instead of the weird old Supercat interface.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/SuperCat.pm
Open-ILS/src/templates/opac/parts/base.tt2

index 3888226..873b956 100644 (file)
@@ -1201,6 +1201,7 @@ sub opensearch_osd {
     my $lib = shift;
     my $class = shift;
     my $base = shift;
+    my $host = shift;
 
     if ($version eq '1.0') {
         print <<OSD;
@@ -1243,7 +1244,7 @@ Content-type: application/opensearchdescription+xml; charset=utf-8
   <Url type="application/x-marcxml+xml"
        template="$base/1.1/$lib/marcxml/$class/?searchTerms={searchTerms}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
   <Url type="text/html"
-       template="$base/1.1/$lib/html-full/$class/?searchTerms={searchTerms}&amp;startPage={startPage?}&amp;startIndex={startIndex?}&amp;count={count?}&amp;searchLang={language?}"/>
+       template="https://$host/eg/opac/results?locg=$lib;query={searchTerms};page={startPage?};startIndex={startIndex?};count={count?};searchLang={language?}"/>
   <LongName>Search $lib</LongName>
   <Query role="example" searchTerms="harry+potter" />
   <Developer>Mike Rylander for GPLS/PINES</Developer>
@@ -1301,7 +1302,7 @@ sub opensearch_feed {
             $class = 'keyword';
         }
 
-        return opensearch_osd($version, $lib, $class, $base);
+        return opensearch_osd($version, $lib, $class, $base, $host);
     }
 
 
index ae44122..eaed67e 100644 (file)
@@ -13,6 +13,7 @@
         <link rel="stylesheet" type="text/css" href="[% ctx.opac_root %]/css/style.css" />
         <title>[% l('Catalog - [_1]', ctx.page_title) %]</title>
         <link rel="unapi-server" type="application/xml" title="unAPI" href="/opac/extras/unapi" />
+        <link type="application/opensearchdescription+xml" rel='search' title="[% l('Evergreen OpenSearch') %]" href="/opac/extras/opensearch/1.1/[% ctx.get_aou(ctx.search_ou).shortname %]/-/osd.xml" />
         [% IF want_dojo %]
         <style type="text/css">
             @import "[% ctx.media_prefix %]/js/dojo/dijit/themes/tundra/tundra.css";