Bug 16111: Fix content type for RSS feed
Test plan: GET http://catalogue/cgi-bin/koha/opac-search.pl?idx=kw&q=perl&count=50&sort_by=acqdate_dsc&format=rss2 => Without this patch it returns content type text/html => With this patch it returns text/xml GET http://catalogue/cgi-bin/koha/opac-search.pl?idx=kw&q=perl&count=50&sort_by=acqdate_dsc&format=rss => Without this patch it does not work => With this patch it returns text/xml Bug 16111: Fix atom support Bug 16111: Remove 'rss2' which should be 'rss' or 'atom' Bug 16111: Replace <link> with <link href... Signed-off-by: Liz Rea <wizzyrea@gmail.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (cherry picked from commitb946e996ff) Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com> (cherry picked from commit5a30719f84) Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
2815387d25
commit
a3e2bfe51b
|
|
@ -11,20 +11,20 @@
|
|||
<Tags>koha opac [% LibraryName | html %]</Tags>
|
||||
<Contact>[% KohaAdminEmailAddress | html %]</Contact>
|
||||
<Url type="application/rss+xml"
|
||||
template="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?q={searchTerms}&pw={startPage?}&format=rss2"/>
|
||||
template="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?q={searchTerms}&pw={startPage?}&format=rss"/>
|
||||
</OpenSearchDescription>
|
||||
|
||||
[% ELSE %]
|
||||
|
||||
[% IF ( rss2 ) %]
|
||||
[% 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 | $raw %][% limit_cgi | url %]&format=rss2</link>
|
||||
<atom:link rel="self" type="application/rss+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]&sort_by=[% sort_by | uri %]&format=rss2"/>
|
||||
<link href=[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&format=rss</link>
|
||||
<atom:link rel="self" type="application/rss+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&sort_by=[% sort_by | uri %]&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>
|
||||
|
|
@ -34,12 +34,18 @@
|
|||
<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 | url %]&sort_by=[% SEARCH_RESULT.sort_by |uri %]&format=opensearchdescription"/>
|
||||
<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 %]&sort_by=[% SEARCH_RESULT.sort_by |uri %]&format=opensearchdescription"/>
|
||||
<opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc |uri %][% SEARCH_RESULT.limit_desc |uri %]" startPage="[% SEARCH_RESULT.page | html %]" />
|
||||
<item>
|
||||
<title>[% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %]</title>
|
||||
<dc:identifier>ISBN [% SEARCH_RESULT.isbn | html %]</dc:identifier>
|
||||
<link>[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %][% OPACBaseURL | html %]/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% ELSE %][% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %][% OPACBaseURL | html %]/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% ELSE %][% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% END %][% END %]</link>
|
||||
[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %]
|
||||
<link href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]" />
|
||||
[% ELSIF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %]
|
||||
<link href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]" />
|
||||
[% ELSE %]
|
||||
<link href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]" />
|
||||
[% END %]
|
||||
<description><![CDATA[
|
||||
[% IF ( AdlibrisEnabled && SEARCH_RESULT.normalized_isbn ) %]
|
||||
<img src="[% AdlibrisURL | html %]?isbn=[% SEARCH_RESULT.normalized_isbn | html %]" alt="Adlibris cover image" />
|
||||
|
|
@ -75,9 +81,9 @@
|
|||
[% IF ( atom ) %]
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||
xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/">
|
||||
<id>[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | html %]&format=atom</id>
|
||||
<id>[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&format=atom</id>
|
||||
<title>[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]</title>
|
||||
<link href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]&format=rss2"/>
|
||||
<link href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&format=rss2"/>
|
||||
<updated>[% timestamp | html %]</updated>
|
||||
<author>
|
||||
<name>[% LibraryName | html %]</name>
|
||||
|
|
@ -90,24 +96,25 @@
|
|||
[% ELSE %]
|
||||
<opensearch:itemsPerPage>20</opensearch:itemsPerPage>
|
||||
[% END %]
|
||||
<opensearch:Query role="request" searchTerms="[% query_desc | html %] [% limit_desc | html %]" startPage="[% page | html %]" />
|
||||
<link rel="alternate" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]pw=[% page | uri %]&format=atom" type="application/atom+xml"/>
|
||||
<link rel="self" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]&format=atom" type="application/atom+xml"/>
|
||||
<link rel="first" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]pw=1&format=atom" type="application/atom+xml"/>
|
||||
<link rel="previous" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]pw=2&format=atom" type="application/atom+xml"/>
|
||||
<link rel="next" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]pw=4&format=atom" type="application/atom+xml"/>
|
||||
<link rel="last" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | url %]pw=42299&format=atom" type="application/atom+xml"/>
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?format=opensearchdescription"/>
|
||||
<opensearch:Query role="request" searchTerms="[% SEARCH_RESULT.query_desc | html %] [% SEARCH_RESULT.limit_desc | html %]" startPage="[% page | html %]" />
|
||||
<link rel="alternate" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=[% page %]&format=atom" type="application/atom+xml"/>
|
||||
<link rel="self" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]&format=atom" type="application/atom+xml"/>
|
||||
<link rel="first" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=1&format=atom" type="application/atom+xml"/>
|
||||
<link rel="previous" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=2&format=atom" type="application/atom+xml"/>
|
||||
<link rel="next" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=4&format=atom" type="application/atom+xml"/>
|
||||
<link rel="last" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% SEARCH_RESULT.query_cgi | $raw %][% SEARCH_RESULT.limit_cgi | $raw %]pw=42299&format=atom" type="application/atom+xml"/>
|
||||
<link rel="search" type="application/opensearchdescription+xml" href="[% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?format=opensearchdescription"/>
|
||||
|
||||
[% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %]
|
||||
<entry>
|
||||
<title>[% SEARCH_RESULT.title | html %]</title>
|
||||
<link href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | uri %]"/>
|
||||
<title>[% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %]</title>
|
||||
<link>[% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %][% OPACBaseURL | html %]/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% ELSE %][% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %][% OPACBaseURL | html %]/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% ELSE %][% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %][% END %][% END %]</link>
|
||||
<!-- <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id> -->
|
||||
<updated>[% SEARCH_RESULT.timestamp | html %]</updated>
|
||||
<content type="text"><!-- put content here -->
|
||||
</content>
|
||||
<id>[% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]</id>
|
||||
<content type="text">
|
||||
|
||||
</content>
|
||||
</entry>
|
||||
[% END %]
|
||||
</feed>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
[% END %]
|
||||
[% END %]
|
||||
|
||||
<link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss |uri %]&sort_by=acqdate_dsc&format=rss2" />
|
||||
<link rel="alternate" type="application/rss+xml" title="[% LibraryName | html %] Search RSS feed" href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss |uri %]&sort_by=acqdate_dsc&format=rss" />
|
||||
</head>
|
||||
|
||||
[% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %]
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
<strong>No results found!</strong>
|
||||
<p>
|
||||
[% IF ( searchdesc ) %]
|
||||
No results found for that in [% LibraryName | html %] catalog. <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&format=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" class="rsssearchicon"/></a>
|
||||
No results found for that in [% LibraryName | html %] catalog. <a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&format=rss" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" border="0" class="rsssearchicon"/></a>
|
||||
[% ELSE %]
|
||||
You did not specify any search criteria.
|
||||
[% END %]
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
[% END %]
|
||||
).
|
||||
[% END %]
|
||||
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss2" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a>
|
||||
<a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss" class="rsssearchlink noprint"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a>
|
||||
[% END # / IF total %]
|
||||
</p>
|
||||
[% END # / IF searchdesc %]
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
<tr>
|
||||
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
|
||||
<td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
|
||||
<td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
|
||||
<td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
|
||||
<td>[% s.total | html %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
<tr>
|
||||
<td><input type="checkbox" name="id" value="[% s.id | html %]" /></td>
|
||||
<td><span title="[% s.time | html %]">[% s.time |$KohaDates with_hours => 1 %]</span></td>
|
||||
<td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss2" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
|
||||
<td><a href="[% OPACBaseURL | url %]/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&[% s.query_cgi | $raw %]&count=[% countrss | uri %]&sort_by=acqdate_dsc&format=rss" class="rsssearchlink"><img src="[% interface | html %]/[% theme | html %]/images/feed-icon-16x16.png" alt="Subscribe to this search" title="Subscribe to this search" class="rsssearchicon"/></a> <a href="/cgi-bin/koha/opac-search.pl?[% s.query_cgi | $raw %]">[% s.query_desc | html %]</a></td>
|
||||
<td>[% s.total | html %]</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ else {
|
|||
$template_name = 'opac-advsearch.tt';
|
||||
$template_type = 'advsearch';
|
||||
}
|
||||
|
||||
$format = 'rss' if $format =~ /rss/;
|
||||
|
||||
# load the template
|
||||
($template, $borrowernumber, $cookie) = get_template_and_user({
|
||||
template_name => $template_name,
|
||||
|
|
@ -142,7 +145,7 @@ if($cgi->cookie("bib_list")){
|
|||
@cart_list = split(/\//, $cart_list);
|
||||
}
|
||||
|
||||
if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom') {
|
||||
if ($format eq 'rss' or $format eq 'opensearchdescription' or $format eq 'atom') {
|
||||
$template->param($format => 1);
|
||||
$template->param(timestamp => strftime("%Y-%m-%dT%H:%M:%S-00:00", gmtime)) if ($format eq 'atom');
|
||||
# FIXME - the timestamp is a hack - the biblio update timestamp should be used for each
|
||||
|
|
@ -756,7 +759,7 @@ for (my $i=0;$i<@servers;$i++) {
|
|||
}
|
||||
|
||||
## If there's just one result, redirect to the detail page
|
||||
if ($total == 1 && $format ne 'rss2'
|
||||
if ($total == 1 && $format ne 'rss'
|
||||
&& $format ne 'opensearchdescription' && $format ne 'atom') {
|
||||
my $biblionumber=$newresults[0]->{biblionumber};
|
||||
if (C4::Context->preference('BiblioDefaultView') eq 'isbd') {
|
||||
|
|
|
|||
Loading…
Reference in New Issue