From ba9c71f04ff34c88d6773257b1ae7c4c26bc2d97 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Mon, 30 Jul 2012 17:16:07 -0400 Subject: [PATCH] Bug 8525: highlight matches on OPAC detail page After doing a search and going to the details page, it can sometimes be difficult to see exactly *why* a record was returned by a search. By highlighting matches on the detail page as well as the results page, we make it much easier to figure that out. This patch uses a query_desc CGI parameter which is inserted into links from the results page with javascript. This serves to avoid the potential privacy implications of a cookie, and ensures that users without javascript enabled see no change whatsoever. To test: 1) Do a search (or two) in the OPAC with OpacHighlightedWords on. 2) View a record or two of the results, and ensure that the correct words are highlighted. 3) Disable OpacHighlightedWords and do another search (or two), this time ensuring that no words are highlighted. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 7 ++++++ .../prog/en/includes/opac-detail-sidebar.inc | 6 +++++ .../opac-tmpl/prog/en/modules/opac-detail.tt | 23 +++++++++++++++++++ .../prog/en/modules/opac-results-grouped.tt | 6 +++++ .../opac-tmpl/prog/en/modules/opac-results.tt | 6 +++++ opac/opac-detail.pl | 4 ++++ 6 files changed, 52 insertions(+) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index 68dc01b1bd..021238d309 100644 --- a/koha-tmpl/opac-tmpl/prog/en/css/opac.css +++ b/koha-tmpl/opac-tmpl/prog/en/css/opac.css @@ -434,6 +434,13 @@ a .term { background-repeat: no-repeat; } +#action a.highlight_toggle { + background-image: url("../../images/sprite.png"); /* place hold icon */ + background-position: -5px -841px; + background-repeat: no-repeat; + display: none; +} + #action a#furthersearches { background-image: url("../../images/sprite.png"); background-position: 106px -295px; diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc index 85d44d73e2..0f16f3aa8d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc +++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-detail-sidebar.inc @@ -27,6 +27,12 @@
  • Add to your cart
  • [% END %] [% END %] + [% IF ( OpacHighlightedWords && query_desc ) %] +
  • + Unhighlight + Highlight +
  • + [% END %]
  • More searches
  • 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 6c4ecdceb9..fa81977e59 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -12,6 +12,7 @@ [% IF ( OpacStarRatings != 'disable' ) %] [% END %] +[% IF ( OpacHighlightedWords ) %][% END %]