View | Details | Raw Unified | Return to bug 10858
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (-1 / +3 lines)
Lines 85-90 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
85
</script>
85
</script>
86
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
86
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
87
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
87
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
88
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
89
<script type="text/javascript" src="[% interface %]/[% theme %]/js/commons.js"></script>
88
<script type="text/javascript">
90
<script type="text/javascript">
89
    Modernizr.load([
91
    Modernizr.load([
90
        // Test need for polyfill
92
        // Test need for polyfill
Lines 124-130 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
124
        var MSG_ITEM_IN_CART = _("In your cart");
126
        var MSG_ITEM_IN_CART = _("In your cart");
125
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
127
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
126
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
128
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
127
        var MSG_NO_RECORD_SELECTED = _("No item was selected");
129
        var MSG_NEED_COOKIE_ENABLED = _("Your browser does not accept cookies, you must accept them to browse selected results.");
128
    [% END %]
130
    [% END %]
129
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
131
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
130
        var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");
132
        var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc (-2 / +2 lines)
Lines 8-18 Link Here
8
            [% IF ( PAGE_NUMBER.highlight ) %]
8
            [% IF ( PAGE_NUMBER.highlight ) %]
9
                <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
9
                <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
10
            [% ELSE %]
10
            [% ELSE %]
11
                <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li>
11
                <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li>
12
            [% END %]
12
            [% END %]
13
        [% END %]
13
        [% END %]
14
        [% IF ( next_page_offset ) %]
14
        [% IF ( next_page_offset ) %]
15
            <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Next &raquo;</a></li>
15
            <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% next_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Next &raquo;</a></li>
16
        [% END %]
16
        [% END %]
17
        </ul>
17
        </ul>
18
    </div>
18
    </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-29 / +35 lines)
Lines 1075-1081 Link Here
1075
                                [% END %]
1075
                                [% END %]
1076
                            </li>
1076
                            </li>
1077
                            [%# busc is already URI encoded %]
1077
                            [%# busc is already URI encoded %]
1078
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li>
1078
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1079
                            <li class="right_results">
1079
                            <li class="right_results">
1080
                                [% IF ( nextBiblionumber ) %]
1080
                                [% IF ( nextBiblionumber ) %]
1081
                                    <a href="opac-detail.pl?biblionumber=[% nextBiblionumber %][% IF ( query_desc && OpacHighlightedWords ) %]&query_desc=[% query_desc |uri %][% END %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next &raquo;</a>
1081
                                    <a href="opac-detail.pl?biblionumber=[% nextBiblionumber %][% IF ( query_desc && OpacHighlightedWords ) %]&query_desc=[% query_desc |uri %][% END %]" title="See: [% IF ( nextTitle ) %][% nextTitle |html %][% ELSE %]next biblio[% END %]">Next &raquo;</a>
Lines 1098-1130 Link Here
1098
                    </div>
1098
                    </div>
1099
                [% END # / IF OpacBrowseResults && busc %]
1099
                [% END # / IF OpacBrowseResults && busc %]
1100
1100
1101
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1101
                <div id="sidebar">
1102
                    [% INCLUDE 'opac-detail-sidebar.inc' %]
1102
1103
1103
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1104
                    [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1104
                    <div id="NovelistSelect">
1105
                        <div id="NovelistSelect">
1105
                        <h4>Novelist Select</h4>
1106
                            <h4>Novelist Select</h4>
1106
                        <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1107
                            <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1107
                    </div>
1108
                        </div>
1108
                [% END %]
1109
                    [% END %]
1109
1110
1110
                [% IF ( Babeltheque ) %]
1111
                    [% IF ( Babeltheque ) %]
1111
                    <div class="babeltheque_adds">
1112
                        <div class="babeltheque_adds">
1112
                        <div id="BW_critiques_aj"></div>
1113
                            <div id="BW_critiques_aj"></div>
1113
                        <div id="BW_citations_aj"></div>
1114
                            <div id="BW_citations_aj"></div>
1114
                    </div>
1115
                        </div>
1115
                [% END %]
1116
                    [% END %]
1116
1117
1117
                [% IF ( SocialNetworks ) %]
1118
                    [% IF ( SocialNetworks ) %]
1118
                    <div id="social_networks" class="clearfix">
1119
                        <div id="social_networks" class="clearfix">
1119
                        <span>Share</span>
1120
                            <span>Share</span>
1120
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1121
                            <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1121
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1122
                            <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1122
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1123
                            <div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1123
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1124
                            <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1124
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1125
                            <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1125
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1126
                            <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title |url %]" data-lang="[% lang %]">Tweet</a></div>
1126
                    </div>
1127
                        </div>
1127
                [% END %]
1128
                    [% END %]
1129
                </div>
1128
            </div> <!-- / .ulactioncontainer -->
1130
            </div> <!-- / .ulactioncontainer -->
1129
        </div> <!-- / .span4 -->
1131
        </div> <!-- / .span4 -->
1130
    </div> <!-- / .row-fluid -->
1132
    </div> <!-- / .row-fluid -->
Lines 1472-1477 Link Here
1472
            renderPagIndexList(pag_index_ini, $("#listResults"));
1474
            renderPagIndexList(pag_index_ini, $("#listResults"));
1473
        }
1475
        }
1474
        $("#a_listResults").click(function(e) {
1476
        $("#a_listResults").click(function(e) {
1477
            $("#sidebar").toggle();
1475
            if (arrPagination.length > 0) {
1478
            if (arrPagination.length > 0) {
1476
                e.preventDefault();
1479
                e.preventDefault();
1477
                var navigation = $(".results-pagination");
1480
                var navigation = $(".results-pagination");
Lines 1491-1496 Link Here
1491
            e.preventDefault();
1494
            e.preventDefault();
1492
            var navigation = $(".results-pagination");
1495
            var navigation = $(".results-pagination");
1493
            navigation.hide();
1496
            navigation.hide();
1497
            $("#sidebar").toggle();
1494
        });
1498
        });
1495
    [% END %]
1499
    [% END %]
1496
[% IF ( OPACShelfBrowser ) %]
1500
[% IF ( OPACShelfBrowser ) %]
Lines 1661-1668 Link Here
1661
        var timeoutRFW;
1665
        var timeoutRFW;
1662
        var totalPagItemList = 10;
1666
        var totalPagItemList = 10;
1663
1667
1664
        function rewindList()
1668
        function rewindList(e)
1665
        {
1669
        {
1670
            e.preventDefault();
1666
            var ul = $("#listResults");
1671
            var ul = $("#listResults");
1667
            var li_ini = ul.children(':first').next();
1672
            var li_ini = ul.children(':first').next();
1668
            var index_ini = pag_index_ini;
1673
            var index_ini = pag_index_ini;
Lines 1680-1687 Link Here
1680
            }
1685
            }
1681
        }//rewindList
1686
        }//rewindList
1682
1687
1683
        function forwardList()
1688
        function forwardList(e)
1684
        {
1689
        {
1690
            e.preventDefault();
1685
            var ul = $("#listResults");
1691
            var ul = $("#listResults");
1686
            var li_ini = ul.children(':first').next();
1692
            var li_ini = ul.children(':first').next();
1687
            var index_ini = pag_index_ini;
1693
            var index_ini = pag_index_ini;
Lines 1712-1718 Link Here
1712
            var ini = index - 1;
1718
            var ini = index - 1;
1713
            var end = ini + totalPagItemList - 1;
1719
            var end = ini + totalPagItemList - 1;
1714
            li = $("<li />");
1720
            li = $("<li />");
1715
            html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList()' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>&laquo;</a>":"&laquo;";
1721
            html = (index > pag_index_ini)?"<a href='#' id='rew_list_index' onclick='rewindList(event)' title='" + _("Click to rewind the list to") + " " + ini + " - " + end + "'>&laquo;</a>":"&laquo;";
1716
            li.html(html);
1722
            li.html(html);
1717
            ul.append(li);
1723
            ul.append(li);
1718
            var title = "";
1724
            var title = "";
Lines 1734-1740 Link Here
1734
            li = $("<li />");
1740
            li = $("<li />");
1735
            ini = index + 1;
1741
            ini = index + 1;
1736
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1742
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1737
            html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList()' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>&raquo;</a>":"&raquo;";
1743
            html = (end <= arrPagination.length - 1 && (end - index) >= totalPagItemList)?"<a href='#' id='fw_list_index' onclick='forwardList(event)' title='" + _("Click to forward the list to") + " " + ini + " - " + end + "'>&raquo;</a>":"&raquo;";
1738
            li.html(html);
1744
            li.html(html);
1739
            ul.append(li);
1745
            ul.append(li);
1740
        }//renderPagIndexList
1746
        }//renderPagIndexList
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-3 / +51 lines)
Lines 175-180 Link Here
175
                                                    Tag status here.
175
                                                    Tag status here.
176
                                                </div>
176
                                                </div>
177
                                            [% END %]
177
                                            [% END %]
178
                                            [% IF Koha.Preference('OpacBrowseResults') %]
179
                                              <span class="details_link"></span>
180
                                            [% END %]
178
                                        </span> <!-- / .links -->
181
                                        </span> <!-- / .links -->
179
                                </div> <!-- / #selections-toolbar -->
182
                                </div> <!-- / #selections-toolbar -->
180
183
Lines 658-668 function tagAdded() { Link Here
658
661
659
function enableCheckboxActions(){
662
function enableCheckboxActions(){
660
    // Enable/disable controls if checkboxes are checked
663
    // Enable/disable controls if checkboxes are checked
661
    var checkedBoxes = $(".checkboxed input:checkbox:checked");
664
    var bibnums = getContextBiblioNumbers();
662
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
665
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
663
    if ($(checkedBoxes).size()) {
666
    if ( bibnums.length > 0 ) {
664
      $("#selections").html(_("With selected titles: "));
667
      $("#selections").html(_("With selected titles: "));
665
      $(controls).removeClass("disabled");
668
      $(controls).removeClass("disabled");
669
      // Hide or show details link
670
      // Update with first biblionumber in queue
671
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]);
666
    } else {
672
    } else {
667
      $("#selections").html(_("Select titles to: "));
673
      $("#selections").html(_("Select titles to: "));
668
      $(controls).addClass("disabled");
674
      $(controls).addClass("disabled");
Lines 691-696 function highlightOn() { Link Here
691
    $(".highlight_toggle").toggle();
697
    $(".highlight_toggle").toggle();
692
}
698
}
693
[% END %]
699
[% END %]
700
694
$(document).ready(function(){
701
$(document).ready(function(){
695
    [% IF ( OpacHighlightedWords ) %]
702
    [% IF ( OpacHighlightedWords ) %]
696
        $('a.title').each(function() {
703
        $('a.title').each(function() {
Lines 698-708 $(document).ready(function(){ Link Here
698
        });
705
        });
699
    [% END %]
706
    [% END %]
700
707
701
    $(".cb").click(function(){
708
    $(".cb").change(function(){
709
      [% IF Koha.Preference('OpacBrowseResults') %]
710
        if ( $(this).is(':checked') == true ) {
711
          addBibToContext( $(this).val() );
712
        } else {
713
          delBibToContext( $(this).val() );
714
        }
715
      [% END %]
702
      enableCheckboxActions();
716
      enableCheckboxActions();
703
    });
717
    });
718
719
    $("span.details_link").html("<a href=\"#\" class=\"disabled\">"+_("Browse selected records")+"<\/a>");
720
    $(".details_link a").click(function(e) {
721
      if ( $(this).hasClass("disabled") == true ) {
722
        e.preventDefault();
723
        var checkedBoxes = $(".searchresults :checkbox:checked");
724
        if ($(checkedBoxes).size() == 0) {
725
            alert(MSG_NO_RECORD_SELECTED);
726
        } else {
727
            alert(MSG_NEED_COOKIE_ENABLED);
728
        }
729
        return false;
730
      }
731
    });
704
    enableCheckboxActions();
732
    enableCheckboxActions();
705
733
734
735
    $("#bookbag_form").ready(function(){
736
      $("#bookbag_form").unCheckCheckboxes();
737
      var bibnums = getContextBiblioNumbers();
738
      if (bibnums) {
739
        for (var i=0; i < bibnums.length; i++) {
740
          var id = ('#bib' + bibnums[i]);
741
          if ($(id)) {
742
            $(id).attr('checked', true);
743
          }
744
        }
745
      }
746
    });
747
706
    [% IF ( IDreamBooksResults ) %]
748
    [% IF ( IDreamBooksResults ) %]
707
        $('.idbresult').each(function() {
749
        $('.idbresult').each(function() {
708
            var isbn = $(this).children('a').text().replace(/\s*/,'');
750
            var isbn = $(this).children('a').text().replace(/\s*/,'');
Lines 840-850 $(document).ready(function(){ Link Here
840
    $("#CheckAll").click(function(){
882
    $("#CheckAll").click(function(){
841
        $("#bookbag_form").checkCheckboxes();
883
        $("#bookbag_form").checkCheckboxes();
842
        enableCheckboxActions();
884
        enableCheckboxActions();
885
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
886
            $(this).change();
887
        } );
843
        return false;
888
        return false;
844
    });
889
    });
845
    $("#CheckNone").click(function(){
890
    $("#CheckNone").click(function(){
846
        $("#bookbag_form").unCheckCheckboxes();
891
        $("#bookbag_form").unCheckCheckboxes();
847
        enableCheckboxActions();
892
        enableCheckboxActions();
893
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
894
            $(this).change();
895
        } );
848
        return false;
896
        return false;
849
    });
897
    });
850
898
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js (-13 / +29 lines)
Lines 157-173 function SelectAll(){ Link Here
157
}
157
}
158
158
159
function addMultiple(){
159
function addMultiple(){
160
    var bibnums = getContextBiblioNumbers();
160
    var c_value = "";
161
    var c_value = "";
161
    if(document.bookbag_form.biblionumber.length > 0) {
162
    if ( bibnums.length > 0 ) {
162
        for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
163
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
163
            if (document.bookbag_form.biblionumber[i].checked) {
164
            c_value = c_value + bibnums[i] + "/";
164
                c_value = c_value + document.bookbag_form.biblionumber[i].value + "/";
165
            }
166
        }
165
        }
167
        addSelRecords(c_value);
166
        addSelRecords(c_value);
168
    } else {
167
    } else {
169
        c_value = c_value + document.bookbag_form.biblionumber.value + "/";
168
        if(document.bookbag_form.biblionumber.length > 0) {
170
        addSelRecords(c_value);
169
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
170
                if (document.bookbag_form.biblionumber[i].checked) {
171
                    c_value = c_value + document.bookbag_form.biblionumber[i].value + "/";
172
                }
173
            }
174
            addSelRecords(c_value);
175
        } else {
176
            c_value = c_value + document.bookbag_form.biblionumber.value + "/";
177
            addSelRecords(c_value);
178
        }
171
    }
179
    }
172
}
180
}
173
181
Lines 437-456 function addSelToShelf() { Link Here
437
///  vShelfAdd()  builds url string for multiple-biblio adds.
445
///  vShelfAdd()  builds url string for multiple-biblio adds.
438
446
439
function vShelfAdd() {
447
function vShelfAdd() {
440
        bibs= new Array;
448
    var bibnums = getContextBiblioNumbers();
449
    bibs = new Array;
450
    if ( bibnums.length > 0 ) {
451
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
452
            bibs.push("biblionumber=" + bibnums[i]);
453
        }
454
        return bibs.join("&");
455
    } else {
441
        if(document.bookbag_form.biblionumber.length > 0) {
456
        if(document.bookbag_form.biblionumber.length > 0) {
442
                for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
457
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
443
                        if (document.bookbag_form.biblionumber[i].checked) {
458
                if (document.bookbag_form.biblionumber[i].checked) {
444
                                bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
459
                    bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
445
                        }
446
                }
460
                }
447
        if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
461
            }
462
            if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
448
            return bibs.join("&");
463
            return bibs.join("&");
449
        } else {
464
        } else {
450
            if (document.bookbag_form.biblionumber.checked) {
465
            if (document.bookbag_form.biblionumber.checked) {
451
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
466
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
452
            }
467
            }
453
        }
468
        }
469
    }
454
}
470
}
455
471
456
function showCart(){
472
function showCart(){
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/commons.js (+69 lines)
Line 0 Link Here
1
// Extends jQuery API
2
// http://www.wskidmore.com/downloads/jquery-uniqueArray.min.js
3
jQuery.extend({uniqueArray:function(e){if($.isArray(e)){var c={};var a,b;for(b=0,a=e.length;b<a;b++){var d=e[b].toString();if(c[d]){e.splice(b,1);a--;b--}else{c[d]=true}}}return(e)}});
4
5
function removeByValue(arr, val) {
6
    for(var i=0; i<arr.length; i++) {
7
        if(arr[i] == val) {
8
            arr.splice(i, 1);
9
            break;
10
        }
11
    }
12
}
13
14
function paramOfUrl( url, param ) {
15
    param = param.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
16
    var regexS = "[\\?&]"+param+"=([^&#]*)";
17
    var regex = new RegExp( regexS );
18
    var results = regex.exec( url );
19
    if( results == null ) {
20
        return "";
21
    } else {
22
        return results[1];
23
    }
24
}
25
26
function addBibToContext( bibnum ) {
27
    var bibnums = getContextBiblioNumbers();
28
    bibnums.push(bibnum);
29
    setContextBiblioNumbers( bibnums );
30
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
31
}
32
33
function delBibToContext( bibnum ) {
34
    var bibnums = getContextBiblioNumbers();
35
    removeByValue( bibnums, bibnum );
36
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
37
}
38
39
function setContextBiblioNumbers( bibnums ) {
40
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
41
}
42
43
function getContextBiblioNumbers() {
44
    var r = $.cookie('bibs_selected');
45
    if ( r ) {
46
        return JSON.parse(r);
47
    }
48
    r = new Array();
49
    return r;
50
}
51
52
function resetSearchContext() {
53
    setContextBiblioNumbers( new Array() );
54
}
55
56
$(document).ready(function(){
57
    // forms with action leading to search
58
    $("form[action*='opac-search.pl']").submit(function(){
59
        resetSearchContext();
60
    });
61
    // any link to launch a search except navigation links
62
    $("[href*='opac-search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
63
        resetSearchContext();
64
    });
65
    // any link to a detail page from the results page.
66
    $("#bookbag_form a[href*='opac-detail.pl?']").click(function(){
67
        resetSearchContext();
68
    });
69
});
(-)a/opac/opac-detail.pl (-4 / +17 lines)
Lines 25-30 use warnings; Link Here
25
25
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use C4::Acquisition qw( SearchOrders );
27
use C4::Acquisition qw( SearchOrders );
28
use JSON;
28
use C4::Auth qw(:DEFAULT get_session);
29
use C4::Auth qw(:DEFAULT get_session);
29
use C4::Branch;
30
use C4::Branch;
30
use C4::Koha;
31
use C4::Koha;
Lines 243-253 if ($session->param('busc')) { Link Here
243
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
244
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
244
        }
245
        }
245
    }
246
    }
247
246
    my $searchAgain = 0;
248
    my $searchAgain = 0;
249
    my ( $offset, $results_per_page );
250
251
    my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' );
252
    if ( scalar( @$bibnums ) ) {
253
        $arrParamsBusc{count} = scalar( @$bibnums );
254
        $arrParamsBusc{listBiblios} = join ',', @$bibnums;
255
        $results_per_page = $arrParamsBusc{count};
256
        $offset = 0;
257
    } else {
258
    $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
247
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
259
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
248
    my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
260
    $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
249
    $arrParamsBusc{'count'} = $results_per_page;
261
    $arrParamsBusc{'count'} = $results_per_page;
250
    my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
251
    # The value OPACnumSearchResults has changed and the search has to be rebuild
262
    # The value OPACnumSearchResults has changed and the search has to be rebuild
252
    if ($count != $results_per_page) {
263
    if ($count != $results_per_page) {
253
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
264
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
Lines 307-312 if ($session->param('busc')) { Link Here
307
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
318
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
308
        }
319
        }
309
    }
320
    }
321
322
    } # end if cookie bibs_selected exists
323
310
    my $buscParam = '';
324
    my $buscParam = '';
311
    my $j = 0;
325
    my $j = 0;
312
    # Rebuild the query for the button "back to results"
326
    # Rebuild the query for the button "back to results"
Lines 373-379 if ($session->param('busc')) { Link Here
373
        }
387
        }
374
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
388
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
375
    }
389
    }
376
    if ($searchAgain) {
390
    if ($searchAgain and not scalar( @$bibnums )) {
377
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
391
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
378
        my @newresults = @$newresultsRef;
392
        my @newresults = @$newresultsRef;
379
        # build the new listBiblios
393
        # build the new listBiblios
380
- 

Return to bug 10858