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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+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 127-132 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
127
        var MSG_ITEM_IN_CART = _("In your cart");
129
        var MSG_ITEM_IN_CART = _("In your cart");
128
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
130
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
129
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
131
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
132
        var MSG_NEED_COOKIE_ENABLED = _("Your browser does not accept cookies, you must accept them to browse selected results.");
130
    [% END %]
133
    [% END %]
131
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
134
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
132
        var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");
135
        var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc (-3 / +3 lines)
Lines 9-20 Link Here
9
                [% IF ( PAGE_NUMBER.highlight ) %]
9
                [% IF ( PAGE_NUMBER.highlight ) %]
10
                    <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
10
                    <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li>
11
                [% ELSE %]
11
                [% ELSE %]
12
                    <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>
12
                    <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>
13
                [% END %]
13
                [% END %]
14
            [% END %]
14
            [% END %]
15
            [% IF ( next_page_offset ) %]
15
            [% IF ( next_page_offset ) %]
16
                <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>
16
                <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>
17
                <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Last</a></li>
17
                <li><a class="nav" href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&amp;offset=[% last_page_offset %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by |html %][% END %]">Last</a></li>
18
            [% END %]
18
            [% END %]
19
        </ul>
19
        </ul>
20
    </div>
20
    </div>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-29 / +35 lines)
Lines 1093-1099 Link Here
1093
                                [% END %]
1093
                                [% END %]
1094
                            </li>
1094
                            </li>
1095
                            [%# busc is already URI encoded %]
1095
                            [%# busc is already URI encoded %]
1096
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li>
1096
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1097
                            <li class="right_results">
1097
                            <li class="right_results">
1098
                                [% IF ( nextBiblionumber ) %]
1098
                                [% IF ( nextBiblionumber ) %]
1099
                                    <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>
1099
                                    <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 1116-1148 Link Here
1116
                    </div>
1116
                    </div>
1117
                [% END # / IF OpacBrowseResults && busc %]
1117
                [% END # / IF OpacBrowseResults && busc %]
1118
1118
1119
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1119
                <div id="sidebar">
1120
                    [% INCLUDE 'opac-detail-sidebar.inc' %]
1120
1121
1121
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %]
1122
                    [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %]
1122
                    <div id="NovelistSelect">
1123
                        <div id="NovelistSelect">
1123
                        <h4>Novelist Select</h4>
1124
                            <h4>Novelist Select</h4>
1124
                        <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div>
1125
                            <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div>
1125
                    </div>
1126
                        </div>
1126
                [% END %]
1127
                    [% END %]
1127
1128
1128
                [% IF ( Babeltheque ) %]
1129
                    [% IF ( Babeltheque ) %]
1129
                    <div class="babeltheque_adds">
1130
                        <div class="babeltheque_adds">
1130
                        <div id="BW_critiques_aj"></div>
1131
                            <div id="BW_critiques_aj"></div>
1131
                        <div id="BW_citations_aj"></div>
1132
                            <div id="BW_citations_aj"></div>
1132
                    </div>
1133
                        </div>
1133
                [% END %]
1134
                    [% END %]
1134
1135
1135
                [% IF ( SocialNetworks ) %]
1136
                    [% IF ( SocialNetworks ) %]
1136
                    <div id="social_networks" class="clearfix">
1137
                        <div id="social_networks" class="clearfix">
1137
                        <span>Share</span>
1138
                            <span>Share</span>
1138
                        <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>
1139
                            <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>
1139
                        <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>
1140
                            <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>
1140
                        <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>
1141
                            <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>
1141
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1142
                            <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1142
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1143
                            <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1143
                        <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>
1144
                            <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>
1144
                    </div>
1145
                        </div>
1145
                [% END %]
1146
                    [% END %]
1147
                </div>
1146
            </div> <!-- / .ulactioncontainer -->
1148
            </div> <!-- / .ulactioncontainer -->
1147
        </div> <!-- / .span4 -->
1149
        </div> <!-- / .span4 -->
1148
    </div> <!-- / .row-fluid -->
1150
    </div> <!-- / .row-fluid -->
Lines 1542-1547 Link Here
1542
            renderPagIndexList(pag_index_ini, $("#listResults"));
1544
            renderPagIndexList(pag_index_ini, $("#listResults"));
1543
        }
1545
        }
1544
        $("#a_listResults").click(function(e) {
1546
        $("#a_listResults").click(function(e) {
1547
            $("#sidebar").toggle();
1545
            if (arrPagination.length > 0) {
1548
            if (arrPagination.length > 0) {
1546
                e.preventDefault();
1549
                e.preventDefault();
1547
                var navigation = $(".results-pagination");
1550
                var navigation = $(".results-pagination");
Lines 1561-1566 Link Here
1561
            e.preventDefault();
1564
            e.preventDefault();
1562
            var navigation = $(".results-pagination");
1565
            var navigation = $(".results-pagination");
1563
            navigation.hide();
1566
            navigation.hide();
1567
            $("#sidebar").toggle();
1564
        });
1568
        });
1565
    [% END %]
1569
    [% END %]
1566
[% IF ( OPACShelfBrowser ) %]
1570
[% IF ( OPACShelfBrowser ) %]
Lines 1731-1738 Link Here
1731
        var timeoutRFW;
1735
        var timeoutRFW;
1732
        var totalPagItemList = 10;
1736
        var totalPagItemList = 10;
1733
1737
1734
        function rewindList()
1738
        function rewindList(e)
1735
        {
1739
        {
1740
            e.preventDefault();
1736
            var ul = $("#listResults");
1741
            var ul = $("#listResults");
1737
            var li_ini = ul.children(':first').next();
1742
            var li_ini = ul.children(':first').next();
1738
            var index_ini = pag_index_ini;
1743
            var index_ini = pag_index_ini;
Lines 1750-1757 Link Here
1750
            }
1755
            }
1751
        }//rewindList
1756
        }//rewindList
1752
1757
1753
        function forwardList()
1758
        function forwardList(e)
1754
        {
1759
        {
1760
            e.preventDefault();
1755
            var ul = $("#listResults");
1761
            var ul = $("#listResults");
1756
            var li_ini = ul.children(':first').next();
1762
            var li_ini = ul.children(':first').next();
1757
            var index_ini = pag_index_ini;
1763
            var index_ini = pag_index_ini;
Lines 1782-1788 Link Here
1782
            var ini = index - 1;
1788
            var ini = index - 1;
1783
            var end = ini + totalPagItemList - 1;
1789
            var end = ini + totalPagItemList - 1;
1784
            li = $("<li />");
1790
            li = $("<li />");
1785
            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;";
1791
            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;";
1786
            li.html(html);
1792
            li.html(html);
1787
            ul.append(li);
1793
            ul.append(li);
1788
            var title = "";
1794
            var title = "";
Lines 1804-1810 Link Here
1804
            li = $("<li />");
1810
            li = $("<li />");
1805
            ini = index + 1;
1811
            ini = index + 1;
1806
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1812
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1807
            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;";
1813
            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;";
1808
            li.html(html);
1814
            li.html(html);
1809
            ul.append(li);
1815
            ul.append(li);
1810
        }//renderPagIndexList
1816
        }//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 666-676 function tagAdded() { Link Here
666
669
667
function enableCheckboxActions(){
670
function enableCheckboxActions(){
668
    // Enable/disable controls if checkboxes are checked
671
    // Enable/disable controls if checkboxes are checked
669
    var checkedBoxes = $(".checkboxed input:checkbox:checked");
672
    var bibnums = getContextBiblioNumbers();
670
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
673
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
671
    if ($(checkedBoxes).size()) {
674
    if ( bibnums.length > 0 ) {
672
      $("#selections").html(_("With selected titles: "));
675
      $("#selections").html(_("With selected titles: "));
673
      $(controls).removeClass("disabled");
676
      $(controls).removeClass("disabled");
677
      // Hide or show details link
678
      // Update with first biblionumber in queue
679
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]);
674
    } else {
680
    } else {
675
      $("#selections").html(_("Select titles to: "));
681
      $("#selections").html(_("Select titles to: "));
676
      $(controls).addClass("disabled");
682
      $(controls).addClass("disabled");
Lines 699-704 function highlightOn() { Link Here
699
    $(".highlight_toggle").toggle();
705
    $(".highlight_toggle").toggle();
700
}
706
}
701
[% END %]
707
[% END %]
708
702
$(document).ready(function(){
709
$(document).ready(function(){
703
    [% IF ( OpacHighlightedWords ) %]
710
    [% IF ( OpacHighlightedWords ) %]
704
        $('a.title').each(function() {
711
        $('a.title').each(function() {
Lines 706-716 $(document).ready(function(){ Link Here
706
        });
713
        });
707
    [% END %]
714
    [% END %]
708
715
709
    $(".cb").click(function(){
716
    $(".cb").change(function(){
717
      [% IF Koha.Preference('OpacBrowseResults') %]
718
        if ( $(this).is(':checked') == true ) {
719
          addBibToContext( $(this).val() );
720
        } else {
721
          delBibToContext( $(this).val() );
722
        }
723
      [% END %]
710
      enableCheckboxActions();
724
      enableCheckboxActions();
711
    });
725
    });
726
727
    $("span.details_link").html("<a href=\"#\" class=\"disabled\">"+_("Browse selected records")+"<\/a>");
728
    $(".details_link a").click(function(e) {
729
      if ( $(this).hasClass("disabled") == true ) {
730
        e.preventDefault();
731
        var checkedBoxes = $(".searchresults :checkbox:checked");
732
        if ($(checkedBoxes).size() == 0) {
733
            alert(MSG_NO_RECORD_SELECTED);
734
        } else {
735
            alert(MSG_NEED_COOKIE_ENABLED);
736
        }
737
        return false;
738
      }
739
    });
712
    enableCheckboxActions();
740
    enableCheckboxActions();
713
741
742
743
    $("#bookbag_form").ready(function(){
744
      $("#bookbag_form").unCheckCheckboxes();
745
      var bibnums = getContextBiblioNumbers();
746
      if (bibnums) {
747
        for (var i=0; i < bibnums.length; i++) {
748
          var id = ('#bib' + bibnums[i]);
749
          if ($(id)) {
750
            $(id).attr('checked', true);
751
          }
752
        }
753
      }
754
    });
755
714
    [% IF ( IDreamBooksResults ) %]
756
    [% IF ( IDreamBooksResults ) %]
715
        $('.idbresult').each(function() {
757
        $('.idbresult').each(function() {
716
            var isbn = $(this).children('a').text().replace(/\s*/,'');
758
            var isbn = $(this).children('a').text().replace(/\s*/,'');
Lines 854-864 $(document).ready(function(){ Link Here
854
    $("#CheckAll").click(function(){
896
    $("#CheckAll").click(function(){
855
        $("#bookbag_form").checkCheckboxes();
897
        $("#bookbag_form").checkCheckboxes();
856
        enableCheckboxActions();
898
        enableCheckboxActions();
899
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
900
            $(this).change();
901
        } );
857
        return false;
902
        return false;
858
    });
903
    });
859
    $("#CheckNone").click(function(){
904
    $("#CheckNone").click(function(){
860
        $("#bookbag_form").unCheckCheckboxes();
905
        $("#bookbag_form").unCheckCheckboxes();
861
        enableCheckboxActions();
906
        enableCheckboxActions();
907
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
908
            $(this).change();
909
        } );
862
        return false;
910
        return false;
863
    });
911
    });
864
912
(-)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 442-461 function addSelToShelf() { Link Here
442
///  vShelfAdd()  builds url string for multiple-biblio adds.
450
///  vShelfAdd()  builds url string for multiple-biblio adds.
443
451
444
function vShelfAdd() {
452
function vShelfAdd() {
445
        bibs= new Array;
453
    var bibnums = getContextBiblioNumbers();
454
    bibs = new Array;
455
    if ( bibnums.length > 0 ) {
456
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
457
            bibs.push("biblionumber=" + bibnums[i]);
458
        }
459
        return bibs.join("&");
460
    } else {
446
        if(document.bookbag_form.biblionumber.length > 0) {
461
        if(document.bookbag_form.biblionumber.length > 0) {
447
                for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
462
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
448
                        if (document.bookbag_form.biblionumber[i].checked) {
463
                if (document.bookbag_form.biblionumber[i].checked) {
449
                                bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
464
                    bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
450
                        }
451
                }
465
                }
452
        if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
466
            }
467
            if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
453
            return bibs.join("&");
468
            return bibs.join("&");
454
        } else {
469
        } else {
455
            if (document.bookbag_form.biblionumber.checked) {
470
            if (document.bookbag_form.biblionumber.checked) {
456
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
471
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
457
            }
472
            }
458
        }
473
        }
474
    }
459
}
475
}
460
476
461
function showCart(){
477
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 24-29 use Modern::Perl; Link Here
24
24
25
use CGI qw ( -utf8 );
25
use CGI qw ( -utf8 );
26
use C4::Acquisition qw( SearchOrders );
26
use C4::Acquisition qw( SearchOrders );
27
use JSON;
27
use C4::Auth qw(:DEFAULT get_session);
28
use C4::Auth qw(:DEFAULT get_session);
28
use C4::Koha;
29
use C4::Koha;
29
use C4::Serials;    #uses getsubscriptionfrom biblionumber
30
use C4::Serials;    #uses getsubscriptionfrom biblionumber
Lines 267-277 if ($session->param('busc')) { Link Here
267
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
268
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
268
        }
269
        }
269
    }
270
    }
271
270
    my $searchAgain = 0;
272
    my $searchAgain = 0;
273
    my ( $offset, $results_per_page );
274
275
    my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' );
276
    if ( scalar( @$bibnums ) ) {
277
        $arrParamsBusc{count} = scalar( @$bibnums );
278
        $arrParamsBusc{listBiblios} = join ',', @$bibnums;
279
        $results_per_page = $arrParamsBusc{count};
280
        $offset = 0;
281
    } else {
282
    $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
271
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
283
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
272
    my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
284
    $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
273
    $arrParamsBusc{'count'} = $results_per_page;
285
    $arrParamsBusc{'count'} = $results_per_page;
274
    my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
275
    # The value OPACnumSearchResults has changed and the search has to be rebuild
286
    # The value OPACnumSearchResults has changed and the search has to be rebuild
276
    if ($count != $results_per_page) {
287
    if ($count != $results_per_page) {
277
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
288
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
Lines 331-336 if ($session->param('busc')) { Link Here
331
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
342
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
332
        }
343
        }
333
    }
344
    }
345
346
    } # end if cookie bibs_selected exists
347
334
    my $buscParam = '';
348
    my $buscParam = '';
335
    my $j = 0;
349
    my $j = 0;
336
    # Rebuild the query for the button "back to results"
350
    # Rebuild the query for the button "back to results"
Lines 397-403 if ($session->param('busc')) { Link Here
397
        }
411
        }
398
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
412
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
399
    }
413
    }
400
    if ($searchAgain) {
414
    if ($searchAgain and not scalar( @$bibnums )) {
401
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
415
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
402
        my @newresults = @$newresultsRef;
416
        my @newresults = @$newresultsRef;
403
        # build the new listBiblios
417
        # build the new listBiblios
404
- 

Return to bug 10858