From 7fd9cd2fefc4d91224d7054319d6ec33b84b97ab 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 Content-Type: text/plain; charset="UTF-8" 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. --- koha-tmpl/opac-tmpl/prog/en/css/opac.css | 7 ++++++ .../prog/en/includes/opac-detail-sidebar.inc | 6 +++++ koha-tmpl/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(+), 0 deletions(-) diff --git a/koha-tmpl/opac-tmpl/prog/en/css/opac.css b/koha-tmpl/opac-tmpl/prog/en/css/opac.css index d4e7071..1cb2672 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 85d44d7..0f16f3a 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 5e2b55e..7c872bb 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 %]