From f89f8c91fc21c3d4a91ba00267aeb9244200a9f1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 20 Feb 2014 16:48:49 +0100 Subject: [PATCH] Bug 10858: Handle JS deactivated and cookies disabled Content-Type: text/plain; charset=utf-8 If JS is deactivated, the "browse" link should not be displayed. Same if cookies are disabled, the feature does not work. Signed-off-by: Marcel de Rooy --- .../bootstrap/en/includes/opac-bottom.inc | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index b48161b..be94b4f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -124,7 +124,7 @@ var MSG_ITEM_IN_CART = _("In your cart"); var MSG_IN_YOUR_CART = _("Items in your cart: "); var MSG_ITEM_NOT_IN_CART = _("Add to your cart"); - var MSG_NO_RECORD_SELECTED = _("No item was selected"); + var MSG_NEED_COOKIE_ENABLED = _("Your browser does not accept cookies, you must accept them to browse selected results."); [% END %] [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %] var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system."); 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 f0863d3..6aaa422 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -163,7 +163,7 @@ [% END %] [% IF Koha.Preference('OpacBrowseResults') %] - Browse selected records + [% END %] @@ -681,10 +681,17 @@ $(document).ready(function(){ [% END %] enableCheckboxActions(); }); + + $("span.details_link").html(""+_("Browse selected records")+"<\/a>"); $(".details_link a").click(function(e) { if ( $(this).hasClass("disabled") == true ) { e.preventDefault(); - alert(MSG_NO_RECORD_SELECTED); + var checkedBoxes = $(".searchresults :checkbox:checked"); + if ($(checkedBoxes).size() == 0) { + alert(MSG_NO_RECORD_SELECTED); + } else { + alert(MSG_NEED_COOKIE_ENABLED); + } return false; } }); -- 1.7.7.6