@@ -, +, @@ results on the staff interface --- ...add-system-preference-HighlightedWords.perl | 8 ++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../modules/admin/preferences/searching.pref | 8 ++++++++ .../prog/en/modules/catalogue/results.tt | 9 ++++++--- .../intranet-tmpl/prog/js/pages/results.js | 18 ++++++++++++------ 5 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/add-system-preference-HighlightedWords.perl --- a/installer/data/mysql/atomicupdate/add-system-preference-HighlightedWords.perl +++ a/installer/data/mysql/atomicupdate/add-system-preference-HighlightedWords.perl @@ -0,0 +1,8 @@ +$DBversion = 'XXX'; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`,`value`,`options`,`explanation`,`type`) + VALUES ('HighlightedWords','0','','Activate or not highlighting of search terms in results','YesNo') + }); + NewVersion( $DBversion, '20398', 'Add system preference HighlightedWords'); +} --- a/installer/data/mysql/mandatory/sysprefs.sql +++ a/installer/data/mysql/mandatory/sysprefs.sql @@ -236,6 +236,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('hidelostitems','0','','If ON, disables display of\"lost\" items in OPAC.','YesNo'), ('HidePatronName','0','','If this is switched on, patron\'s cardnumber will be shown instead of their name on the holds and catalog screens','YesNo'), ('hide_marc','0',NULL,'If ON, disables display of MARC fields, subfield codes & indicators (still shows data)','YesNo'), +('HighlightedWords','0','','Highlight search terms in results','YesNo'), ('HoldFeeMode','not_always','any_time_is_placed|not_always|any_time_is_collected','Set the hold fee mode','Choice'), ('HoldsAutoFill','0',NULL,'If on, librarian will not be asked if hold should be filled, it will be filled automatically','YesNo'), ('HoldsAutoFillPrintSlip','0',NULL,'If on, hold slip print dialog will be displayed automatically','YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -132,6 +132,14 @@ Searching: 0: "don't use" - 'the operator "phr" in the callnumber and standard number staff interface searches.' Results display: + - + - pref: HighlightedWords + type: boolean + default: yes + choices: + 1: Highlight + 0: "Don't highlight" + - words the patron searched for in their search results and detail pages. - - pref: numSearchResultsDropdown type: boolean --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -81,9 +81,11 @@ | Clear all | - Unhighlight - Highlight - | + [% IF Koha.Preference("HighlightedWords") == 1 %] + Unhighlight + Highlight + | + [% END %] [% IF (Koha.Preference("intranetbookbag")) %]
@@ -705,6 +707,7 @@ var CoceHost = "[% CoceHost | html %]"; var CoceProviders = "[% CoceProviders | html %]"; var PREF_BrowseResultSelection = parseInt( "[% Koha.Preference('BrowseResultSelection') | html %]", 10); + var PREF_HighlightedWords = "[% Koha.Preference('HighlightedWords') | html %]"; var PREF_NotHighlightedWords = "[% Koha.Preference('NotHighlightedWords') | html %]"; var biblionumber = "[% biblionumber | html %]"; var holdfor_cardnumber = "[% holdfor_cardnumber | html %]"; --- a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js +++ a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js @@ -1,4 +1,4 @@ -/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers holdfor_cardnumber holdforclub strQuery PREF_NotHighlightedWords __ */ +/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers holdfor_cardnumber holdforclub strQuery PREF_HighlightedWords PREF_NotHighlightedWords __ */ function verify_cover_images() { /* Loop over each container in the template which contains covers */ @@ -202,17 +202,23 @@ $(document).ready(function() { while ( q_array.length > 0 && q_array[q_array.length-1] == "") { q_array = q_array.splice(0,-1); } - highlightOn(); - $("#highlight_toggle_on" ).hide().click(function(e) { + $("#highlight_toggle_off" ).hide().click(function(e) { e.preventDefault(); - highlightOn(); + highlightOff(); }); - $("#highlight_toggle_off").show().click(function(e) { + $("#highlight_toggle_on").show().click(function(e) { e.preventDefault(); - highlightOff(); + highlightOn(); }); } + if( PREF_HighlightedWords == 1 ){ + highlightOn(); + } else { + highlightOff(); + } + + if( SEARCH_RESULTS ){ var browser = KOHA.browser( search_result.searchid, parseInt( biblionumber, 10)); browser.create( search_result.first_result_number, search_result.query_cgi, search_result.limit_cgi, search_result.sort_by, new_results_browser, search_result.total ); --