From 4151392765460ca3260d45e3ee5ae395ceef6060 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 25 Nov 2013 12:47:14 +0100 Subject: [PATCH] Bug 10858: Browse selected biblios - bootstrap Content-Type: text/plain; charset=utf-8 Add the changes from bug 10858 to the bootstrap theme. Test plan: - Launch a search at the OPAC - Check some biblios - Go on another page - Check some biblios - Come back to the first page and check that already checked biblio is automatically checked. - Click on the "Browse selected biblios >>" link - Check that you are able to browse results you had checked. In addition to prog and ccsr templates, this patch allows to add selected biblios (from multiple pages) to the cart or a list. To test: - check some biblios from several pages - add them to the cart - add them to a list Signed-off-by: Marcel de Rooy --- .../bootstrap/en/includes/opac-bottom.inc | 3 + .../bootstrap/en/includes/page-numbers.inc | 4 +- .../opac-tmpl/bootstrap/en/modules/opac-detail.tt | 70 +++++++++++--------- .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 36 +++++++++- koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 42 ++++++++---- koha-tmpl/opac-tmpl/bootstrap/js/commons.js | 71 ++++++++++++++++++++ .../lib/jquery/plugins/jquery.cookie.min.js | 1 + 7 files changed, 176 insertions(+), 51 deletions(-) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/commons.js create mode 100644 koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js 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 8bb4ccd..cada559 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -79,6 +79,9 @@ + + + diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js index 675dc0a..d3a1c9b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js @@ -157,17 +157,25 @@ function SelectAll(){ } function addMultiple(){ + var bibnums = getContextBiblioNumbers(); var c_value = ""; - if(document.bookbag_form.biblionumber.length > 0) { - for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { - if (document.bookbag_form.biblionumber[i].checked) { - c_value = c_value + document.bookbag_form.biblionumber[i].value + "/"; - } + if ( bibnums.length > 0 ) { + for ( var i = 0 ; i < bibnums.length ; i++ ) { + c_value = c_value + bibnums[i] + "/"; } addSelRecords(c_value); } else { - c_value = c_value + document.bookbag_form.biblionumber.value + "/"; - addSelRecords(c_value); + if(document.bookbag_form.biblionumber.length > 0) { + for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { + if (document.bookbag_form.biblionumber[i].checked) { + c_value = c_value + document.bookbag_form.biblionumber[i].value + "/"; + } + } + addSelRecords(c_value); + } else { + c_value = c_value + document.bookbag_form.biblionumber.value + "/"; + addSelRecords(c_value); + } } } @@ -433,20 +441,28 @@ function addSelToShelf() { /// vShelfAdd() builds url string for multiple-biblio adds. function vShelfAdd() { - bibs= new Array; + var bibnums = getContextBiblioNumbers(); + bibs = new Array; + if ( bibnums.length > 0 ) { + for ( var i = 0 ; i < bibnums.length ; i++ ) { + bibs.push("biblionumber=" + bibnums[i]); + } + return bibs.join("&"); + } else { if(document.bookbag_form.biblionumber.length > 0) { - for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { - if (document.bookbag_form.biblionumber[i].checked) { - bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); - } + for (var i=0; i < document.bookbag_form.biblionumber.length; i++) { + if (document.bookbag_form.biblionumber[i].checked) { + bibs.push("biblionumber=" + document.bookbag_form.biblionumber[i].value); } - if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } + } + if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); } return bibs.join("&"); } else { if (document.bookbag_form.biblionumber.checked) { return "biblionumber=" + document.bookbag_form.biblionumber.value; } } + } } function showCart(){ diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js new file mode 100644 index 0000000..6661a61 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/js/commons.js @@ -0,0 +1,71 @@ +// Extends jQuery API +// http://www.wskidmore.com/downloads/jquery-uniqueArray.min.js +jQuery.extend({uniqueArray:function(e){if($.isArray(e)){var c={};var a,b;for(b=0,a=e.length;b