From 9d9a002432554913bc21f91cae031b3afa9077f9 Mon Sep 17 00:00:00 2001 From: Fridolin SOMERS Date: Fri, 10 Jan 2014 11:42:06 +0100 Subject: [PATCH] Bug 11516: make OPAC search term highlighting work in results browser MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When OpacHighlightedWords syspref is on, the current search terms are highlighted in results and detail pages. This workes in detail page with the URL param 'query_desc'. This parameter must be managed in results browser (appears when OpacBrowseResults syspref is on) links. This patch adds query_desc parameter in results list and changes next nd previous links to be build into TT instead of perl to manage query_desc parameter only into TT. Test plan : - Edit sysprefs : OpacHighlightedWords on, OpacBrowseResults on. - Perform a search with a term existing into title => You see the term highlighted in search results - Go to detail of a result with highlight => You see the term highlighted - Click on "Next" => you see query_desc in URL, and if search term is present it is highlighted - Same for "Previous" - Click on "Browse results" - Click on a result => you see query_desc in URL, and if search term is present it is highlighted Signed-off-by: Aurélie Signed-off-by: Kyle M Hall Signed-off-by: Galen Charlton --- .../bootstrap/en/modules/opac-detail.tt | 13 ++++++++--- .../opac-tmpl/prog/en/modules/opac-detail.tt | 23 ++++++++++++++++--- opac/opac-detail.pl | 17 +++++++------- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index 8c85f3b401..6afb2407d1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -1024,14 +1024,16 @@
  • - [% IF ( previous ) %]« Previous + [% IF ( previousBiblionumber ) %] + « Previous [% ELSE %] Previous [% END %]
  • Back to results
  • - [% IF ( next ) %]Next » + [% IF ( nextBiblionumber ) %] + Next » [% ELSE %] Next [% END %] @@ -1255,7 +1257,12 @@ var pag_index_ini = [% indexPag %]; [% IF ( listResults ) %] [% FOREACH listResult IN listResults %] - arrPagination[[% listResult.index %]] = {url:"[% listResult.url %]", title:"[% listResult.title|remove('\n')|html %]", author:"[% listResult.author|html %]", biblionumber:[% listResult.biblionumber %]}; + arrPagination[[% listResult.index %]] = { + url:"[% listResult.url %][% IF ( listResult.url && query_desc && OpacHighlightedWords ) %]&query_desc=[% query_desc |uri %][% END %]", + title:"[% listResult.title|remove('\n')|html %]", + author:"[% listResult.author|html %]", + biblionumber:[% listResult.biblionumber %] + }; [% END %] [% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index f60b3d7d8a..fce873cb2c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -43,7 +43,12 @@ var pag_index_ini = [% indexPag %]; [% IF ( listResults ) %] [% FOREACH listResult IN listResults %] - arrPagination[[% listResult.index %]] = {url:"[% listResult.url %]", title:"[% listResult.title|remove('\n')|html %]", author:"[% listResult.author|html %]", biblionumber:[% listResult.biblionumber %]}; + arrPagination[[% listResult.index %]] = { + url:"[% listResult.url %][% IF ( listResult.url && query_desc && OpacHighlightedWords ) %]&query_desc=[% query_desc |uri %][% END %]", + title:"[% listResult.title|remove('\n')|html %]", + author:"[% listResult.author|html %]", + biblionumber:[% listResult.biblionumber %] + }; [% END %] [% END %] [% END %] @@ -1417,9 +1422,21 @@ YAHOO.util.Event.onContentReady("furtherm", function () {