From ed566617d82ce1be66ad4a2499cbd55a6bb17f58 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 17 Jul 2018 15:54:06 +0000 Subject: [PATCH] Bug 16111: (follow-up) Fixes for simplicity and validation This patch simplifies the OPAC search results feed template by adding BLOCKs for a couple of repeated sections. The same is done for the feed URL in the search results template. This patch also makes some changes to the markup of the rss and Atom feeds to improve their validity. To test, apply the patch and perform a search in the OPAC. Clicking the RSS icon at the top of the search results page should bring up the RSS feed, which should render correctly. If you validate the source it should return only a couple of "recommendations:" - "Self reference doesn't match document location" - "Unregistered link relationship: search" Perform the same test with the Atom feed by modifying the URL of the RSS feed in your browser so that it ends in "format=atom" instead of "format=rss" The Atom feed has some more serious validation issues but should be functional. --- .../bootstrap/en/modules/opac-opensearch.tt | 241 ++++++++++++--------- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 10 +- 2 files changed, 147 insertions(+), 104 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt index 5aafb25..3d25b94 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-opensearch.tt @@ -1,109 +1,150 @@ [% USE Koha %] +[% BLOCK item_description %] + + [% END %] + [% END %] + [% IF ( SyndeticsEnabled ) %] + [% IF ( SyndeticsCoverImages ) %] + [% IF ( SEARCH_RESULT.content_identifier_exists ) %] + + [% ELSE %] + + [% END %] + [% END %] + [% END %] + [% bt_id = ( SEARCH_RESULT.normalized_upc || SEARCH_RESULT.normalized_isbn ) %] + [% IF ( BakerTaylorEnabled ) %] + [% IF bt_id %] + See Baker & Taylor + [% END %] + [% END %] +

+ [% 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 %] +

+ [% IF Koha.Preference( 'RequestOnOpac' ) == 1 %] +

Place Hold on [% SEARCH_RESULT.title | html %]

+ [% END %] + ]]> +[% END %] +[% BLOCK feed_url %][% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi |uri %]&count=[% countrss |uri %]&offset=[% offset %]&sort_by=acqdate_dsc&format=[% END %] + [% IF ( opensearchdescription ) %] - - [% LibraryName | html %] Search - Search the [% LibraryName | html %] - koha opac [% LibraryName | html %] - [% KohaAdminEmailAddress | html %] - - -[% ELSE %] + + [% LibraryName | html %] Search + Search the [% LibraryName | html %] + koha opac [% LibraryName | html %] + [% KohaAdminEmailAddress | html %] + + -[% IF ( rss ) %] - - - <![CDATA[[% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %]]]> - [% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&format=rss - - - [% total | html %] - [% offset | html %] - [% IF ( results_per_page ) %] - [% results_per_page | html %] - [% ELSE %] - 20 - [% END %] - [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - - -[% END %] + [% IF ( atom ) %] + + [% OPACBaseURL | html %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&format=atom + [% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %] + + [% IF ( timestamp ) %][% timestamp | html %][% END %] + + [% LibraryName | html %] + + + [% total | html %] + [% page | html %] + [% IF ( results_per_page ) %] + [% results_per_page | html %] + [% ELSE %] + 20 + [% END %] + + + + + + + + -[% IF ( atom ) %] - - [% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi | html %][% limit_cgi | html %]&format=atom - [% LibraryName | html %] Search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %] with limit(s): '[% limit_desc | html %]'[% END %] - - [% timestamp %] - - [% LibraryName | html %] - - - [% total | html %] - [% page | html %] - [% IF ( results_per_page ) %] - [% results_per_page | html %] - [% ELSE %] - 20 - [% END %] - - - - - - - - + [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] + + [% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %] + [% IF ( SEARCH_RESULT.BiblioDefaultViewmarc ) %] + + [% ELSE %] + [% IF ( SEARCH_RESULT.BiblioDefaultViewisbd ) %] + + [% ELSE %] + + [% END %] + [% END %] + [% IF ( SEARCH_RESULT.dateaccessioned ) %][% SEARCH_RESULT.dateaccessioned | html %][% END %] + [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %] + + [% PROCESS item_description %] + + + [% END %] + + [% END # /IF atom %] - [% FOREACH SEARCH_RESULT IN SEARCH_RESULTS %] - - [% SEARCH_RESULT.title | html %] [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %] - [% 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 %] - - [% SEARCH_RESULT.timestamp | html %] - [% OPACBaseURL | html %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %] - - - - - [% END %] - -[% END %] - -[% END %] +[% END # /IF opensearchdescription %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 60202fe8..055a206 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -17,8 +17,10 @@ [% Asset.css("css/jquery.rating.css") | $raw %] [% END %] [% END %] - - +[% BLOCK rss_feed %] + [% OPACBaseURL %]/cgi-bin/koha/opac-search.pl?[% query_cgi | url %][% limit_cgi |uri %]&count=[% countrss |uri %]&offset=[% offset | html %]&sort_by=acqdate_dsc&format=rss +[% END %] + [% INCLUDE 'bodytag.inc' bodyid='results' bodyclass='scrollto' %] @@ -43,7 +45,7 @@ No results found!

[% IF ( searchdesc ) %] - No results found for that in [% LibraryName | html %] catalog. Subscribe to this search + No results found for that in [% LibraryName | html %] catalog. Subscribe to this search [% ELSE %] You did not specify any search criteria. [% END %] @@ -87,7 +89,7 @@ [% END %] ). [% END %] - Subscribe to this search + Subscribe to this search [% END # / IF total %]

[% END # / IF searchdesc %] -- 2.1.4