Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt
Owen Leonard 2621f28376
Bug 32114: Add missing html_helpers.inc
This patch makes a minor modification to the OPAC
search results RSS template so that an error isn't
triggered. The html_helpers include was missing.

To test, apply the patch and perform a catalog
search in the OPAC which will return results.

At the end of the "Your search results" heading
you should see an orange RSS icon. Clicking on it
should take you to an RSS feed instead of an
error page.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2022-11-09 10:03:34 -03:00

125 lines
9.3 KiB
XML

<?xml version='1.0' encoding='utf-8' ?>
[%- USE raw -%]
[%- USE Koha -%]
[%- PROCESS 'html_helpers.inc' -%]
[% IF ( opensearchdescription ) %]
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
<ShortName>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Library catalog[% END %]</ShortName>
<Description>Search the [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha library[% END %] catalog</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">
[% IF ( Koha.Preference('OpacFavicon') ) %]
[% Koha.Preference('OpacFavicon') | url %]
[% ELSE %]
[% Koha.Preference('OPACBaseURL') | url %][% interface | url %]/[% theme | url %]/images/favicon.ico
[% END %]
</Image>
<Url method="get" type="text/html" template="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-search.pl?q={searchTerms}" />
<Query role="example" searchTerms="cat" />
</OpenSearchDescription>
[% ELSE %]
[% IF ( rss ) %]
<rss version="2.0"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title><![CDATA[[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]]]></title>
<link>[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=rss</link>
<atom:link rel="self" type="application/rss+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;sort_by=[% sort_by | uri %]&amp;format=atom"/>
<description><![CDATA[ Search results [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %] at [% LibraryName | html %]]]></description>
<opensearch:totalResults>[% total | html %]</opensearch:totalResults>
<opensearch:startIndex>[% offset | html %]</opensearch:startIndex>
[% IF ( results_per_page ) %]
<opensearch:itemsPerPage>[% results_per_page | html %]</opensearch:itemsPerPage>
[% ELSE %]
<opensearch:itemsPerPage>20</opensearch:itemsPerPage>
[% END %]
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<atom:link rel="search" type="application/opensearchdescription+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]&amp;sort_by=[% SEARCH_RESULT.sort_by |uri %]&amp;format=opensearchdescription"/>
<opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc |uri %][% SEARCH_RESULT.limit_desc |uri %]" startPage="[% SEARCH_RESULT.page | html %]" />
<item>
<title>[% INCLUDE 'biblio-title-head.inc' biblio=SEARCH_RESULT %]</title>
<dc:identifier>ISBN:[% SEARCH_RESULT.isbn | html %]</dc:identifier>
<link>[% OPACBaseURL | url %][% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]</link>
<description><![CDATA[
[% IF ( OPACAmazonCoverImages ) %][% IF ( SEARCH_RESULT.normalized_isbn ) %]<img src="https://images-na.ssl-images-amazon.com/images/P/[% SEARCH_RESULT.normalized_isbn | uri %].01.TZZZZZZZ.jpg" alt="" />[% END %][% END %]
[% IF ( SyndeticsEnabled ) %][% IF ( SyndeticsCoverImages ) %][% IF ( SEARCH_RESULT.content_identifier_exists ) %]<img src="http://www.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]/SC.GIF&amp;client=[% SEARCH_RESULT.SyndeticsClientCode | uri %]&amp;type=xw10[% IF ( SEARCH_RESULT.normalized_upc ) %]&amp;upc=[% SEARCH_RESULT.normalized_upc | uri %][% END %][% IF ( SEARCH_RESULT.normalized_oclc ) %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc | uri %][% END %]" alt="" />
[% ELSE %]
<img src="http://www.syndetics.com/index.aspx?isbn=[% SEARCH_RESULT.normalized_isbn | uri %]/SC.GIF&amp;client=[% SyndeticsClientCode | uri %]&amp;type=xw10&amp;upc=[% SEARCH_RESULT.normalized_upc | uri %]&amp;oclc=[% SEARCH_RESULT.normalized_oclc | uri %]" alt="" />
[% END %][% END %][% END %]
[% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
[% IF ( BakerTaylorEnabled ) %][% IF bt_id %]<a href="https://[% BakerTaylorBookstoreURL |url %][% bt_id | uri %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL |url %][% bt_id | uri %]" /></a>[% END %][% END %]
[% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
[% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
[% IF custom_cover_image_url %]
<img alt="Cover image" src="[% custom_cover_image_url | url %]" />
[% END %]
[% END %]
<p>[% IF ( SEARCH_RESULT.author ) %]By [% SEARCH_RESULT.author | html %]. [% END %]
[% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place | html %] [% END %][% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode | html %][% END %][% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear | html %]
[% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate | html %][% END %][% END %]
[% IF ( SEARCH_RESULT.pages ) %]. [% SEARCH_RESULT.pages | html %][% END %]
[% IF ( SEARCH_RESULT.notes ) %], [% SEARCH_RESULT.notes | html %][% END %]
[% IF ( SEARCH_RESULT.size ) %] [% SEARCH_RESULT.size | html %]. [% END %]
[% IF ( SEARCH_RESULT.isbn ) %] [% SEARCH_RESULT.isbn | html %][% END %]
</p>
[% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]
<p><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]">Place hold on <em>[% SEARCH_RESULT.title | html %]</em></a></p>
[% END %]
]]></description>
<guid>[% OPACBaseURL | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]</guid>
</item>
[% END %]
</channel>
</rss>
[% END %]
[% IF ( atom ) %]
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
<id>[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=atom</id>
<title>[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]</title>
<link href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=rss"/>
<updated>[% timestamp | html %]</updated>
<author>
<name>[% LibraryName | html %]</name>
</author>
<!-- <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> -->
<opensearch:totalResults>[% total | html %]</opensearch:totalResults>
<opensearch:startIndex>[% page | html %]</opensearch:startIndex>
[% IF ( results_per_page ) %]
<opensearch:itemsPerPage>[% results_per_page | html %]</opensearch:itemsPerPage>
[% ELSE %]
<opensearch:itemsPerPage>20</opensearch:itemsPerPage>
[% END %]
<opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc | uri %] [% SEARCH_RESULT.limit_desc | uri %]" startPage="[% page | html %]" />
<link rel="alternate" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=[% page | uri %]&amp;format=atom" type="application/atom+xml"/>
<link rel="self" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]&amp;format=atom" type="application/atom+xml"/>
<link rel="first" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=1&amp;format=atom" type="application/atom+xml"/>
<link rel="previous" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=2&amp;format=atom" type="application/atom+xml"/>
<link rel="next" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=4&amp;format=atom" type="application/atom+xml"/>
<link rel="last" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=42299&amp;format=atom" type="application/atom+xml"/>
<link rel="search" type="application/opensearchdescription+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?format=opensearchdescription"/>
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
<entry>
<title>[% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %]</title>
<link>[% OPACBaseURL | url %][% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]</link>
<!-- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> -->
<updated>[% SEARCH_RESULT.timestamp | html %]</updated>
<id>[% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]</id>
<content type="text">
</content>
</entry>
[% END %]
</feed>
[% END %]
[% END %]