Bug 29609: Centralized code to build the link to a biblio detail page
[srvgit] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-opensearch.tt
1 <?xml version='1.0' encoding='utf-8' ?>
2 [%- USE raw -%]
3 [%- USE Koha -%]
4
5 [% IF ( opensearchdescription ) %]
6     <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
7         <ShortName>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Library catalog[% END %]</ShortName>
8         <Description>Search the [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha library[% END %] catalog</Description>
9         <InputEncoding>UTF-8</InputEncoding>
10         <Image width="16" height="16" type="image/x-icon">
11             [% IF ( Koha.Preference('OpacFavicon') ) %]
12                 [% Koha.Preference('OpacFavicon') | url %]
13             [% ELSE %]
14                 [% Koha.Preference('OPACBaseURL') | url %][% interface | url %]/[% theme | url %]/images/favicon.ico
15             [% END %]
16         </Image>
17         <Url method="get" type="text/html" template="[% Koha.Preference('OPACBaseURL') | url %]/cgi-bin/koha/opac-search.pl?q={searchTerms}" />
18         <Query role="example" searchTerms="cat" />
19     </OpenSearchDescription>
20 [% ELSE %]
21
22 [% IF ( rss ) %]
23 <rss version="2.0"
24       xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"
25       xmlns:dc="http://purl.org/dc/elements/1.1/"
26       xmlns:atom="http://www.w3.org/2005/Atom">
27    <channel>
28      <title><![CDATA[[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]]]></title>
29      <link>[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=rss</link>
30      <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"/>
31      <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>
32      <opensearch:totalResults>[% total | html %]</opensearch:totalResults>
33      <opensearch:startIndex>[% offset | html %]</opensearch:startIndex>
34      [% IF ( results_per_page ) %]
35        <opensearch:itemsPerPage>[% results_per_page | html %]</opensearch:itemsPerPage>
36      [% ELSE %]
37        <opensearch:itemsPerPage>20</opensearch:itemsPerPage>
38      [% END %]
39          [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
40      <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"/>
41      <opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc |uri %][% SEARCH_RESULT.limit_desc |uri %]" startPage="[% SEARCH_RESULT.page | html %]" />
42      <item>
43        <title>[% INCLUDE 'biblio-title-head.inc' biblio=SEARCH_RESULT %]</title>
44        <dc:identifier>ISBN:[% SEARCH_RESULT.isbn | html %]</dc:identifier>
45         <link>[% OPACBaseURL | url %][% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]</link>
46        <description><![CDATA[
47 [% 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 %]
48 [% 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="" />
49
50 [% ELSE %]
51 <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="" />
52 [% END %][% END %][% END %]
53
54 [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %]
55 [% 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 %]
56
57 [% IF Koha.Preference('OPACCustomCoverImages') AND Koha.Preference('CustomCoverImagesURL') %]
58     [% SET custom_cover_image_url = SEARCH_RESULT.biblio_object.custom_cover_image_url %]
59     [% IF custom_cover_image_url %]
60         <img alt="Cover image" src="[% custom_cover_image_url | url %]" />
61     [% END %]
62 [% END %]
63
64            <p>[% IF ( SEARCH_RESULT.author ) %]By [% SEARCH_RESULT.author | html %]. [% END %]
65            [% 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 %]
66                     [% ELSE %][% IF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate | html %][% END %][% END %]
67                         [% IF ( SEARCH_RESULT.pages ) %]. [% SEARCH_RESULT.pages | html %][% END %]
68                         [% IF ( SEARCH_RESULT.notes ) %], [% SEARCH_RESULT.notes | html %][% END %]
69                         [% IF ( SEARCH_RESULT.size ) %] [% SEARCH_RESULT.size | html %]. [% END %]
70                         [% IF ( SEARCH_RESULT.isbn ) %] [% SEARCH_RESULT.isbn | html %][% END %]
71        </p>
72 [% IF Koha.Preference( 'OPACHoldRequests' ) == 1 %]
73 <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>
74 [% END %]
75                                                 ]]></description>
76        <guid>[% OPACBaseURL | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]</guid>
77      </item>
78          [% END %]
79    </channel>
80 </rss>
81 [% END %]
82
83 [% IF ( atom ) %]
84 <feed xmlns="http://www.w3.org/2005/Atom"
85        xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
86    <id>[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=atom</id>
87    <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>
88     <link href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&amp;format=rss"/>
89    <updated>[% timestamp | html %]</updated>
90    <author>
91      <name>[% LibraryName | html %]</name>
92    </author>
93    <!-- <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id> -->
94    <opensearch:totalResults>[% total | html %]</opensearch:totalResults>
95    <opensearch:startIndex>[% page | html %]</opensearch:startIndex>
96    [% IF ( results_per_page ) %]
97      <opensearch:itemsPerPage>[% results_per_page | html %]</opensearch:itemsPerPage>
98    [% ELSE %]
99      <opensearch:itemsPerPage>20</opensearch:itemsPerPage>
100    [% END %]
101    <opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc | uri %] [% SEARCH_RESULT.limit_desc | uri %]" startPage="[% page | html %]" />
102    <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"/>
103    <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"/>
104    <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"/>
105    <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"/>
106    <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"/>
107    <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"/>
108    <link rel="search" type="application/opensearchdescription+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?format=opensearchdescription"/>
109
110    [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
111    <entry>
112      <title>[% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %]</title>
113      <link>[% OPACBaseURL | url %][% PROCESS biblio_a_href biblionumber => SEARCH_RESULT.biblionumber %]</link>
114      <!-- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> -->
115      <updated>[% SEARCH_RESULT.timestamp | html %]</updated>
116      <id>[% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]</id>
117      <content type="text">
118
119      </content>
120    </entry>
121    [% END %]
122  </feed>
123 [% END %]
124
125 [% END %]