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 83-88 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
83
</script>
83
</script>
84
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
84
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/bootstrap/js/bootstrap.min.js"></script>
85
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
85
<script type="text/javascript" src="[% interface %]/[% theme %]/js/global.js"></script>
86
<script type="text/javascript" src="[% interface %]/[% theme %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
87
<script type="text/javascript" src="[% interface %]/[% theme %]/js/commons.js"></script>
86
<script type="text/javascript">
88
<script type="text/javascript">
87
    Modernizr.load([
89
    Modernizr.load([
88
        // Test need for polyfill
90
        // Test need for polyfill
Lines 122-128 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
122
        var MSG_ITEM_IN_CART = _("In your cart");
124
        var MSG_ITEM_IN_CART = _("In your cart");
123
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
125
        var MSG_IN_YOUR_CART = _("Items in your cart: ");
124
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
126
        var MSG_ITEM_NOT_IN_CART = _("Add to your cart");
125
        var MSG_NO_RECORD_SELECTED = _("No item was selected");
127
        var MSG_NEED_COOKIE_ENABLED = _("Your browser does not accept cookies, you must accept them to browse selected results.");
126
    [% END %]
128
    [% END %]
127
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
129
    [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) && ( Koha.Preference( 'TagsEnabled' ) == 1 ) %]
128
        var MSG_TAGS_DISABLED = _("Sorry, tags are not enabled on this system.");
130
        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 1071-1077 Link Here
1071
                                [% END %]
1071
                                [% END %]
1072
                            </li>
1072
                            </li>
1073
                            [%# busc is already URI encoded %]
1073
                            [%# busc is already URI encoded %]
1074
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li>
1074
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1075
                            <li class="right_results">
1075
                            <li class="right_results">
1076
                                [% IF ( nextBiblionumber ) %]
1076
                                [% IF ( nextBiblionumber ) %]
1077
                                    <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>
1077
                                    <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 1094-1126 Link Here
1094
                    </div>
1094
                    </div>
1095
                [% END # / IF OpacBrowseResults && busc %]
1095
                [% END # / IF OpacBrowseResults && busc %]
1096
1096
1097
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1097
                <div id="sidebar">
1098
                    [% INCLUDE 'opac-detail-sidebar.inc' %]
1098
1099
1099
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1100
                    [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1100
                    <div id="NovelistSelect">
1101
                        <div id="NovelistSelect">
1101
                        <h4>Novelist Select</h4>
1102
                            <h4>Novelist Select</h4>
1102
                        <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1103
                            <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1103
                    </div>
1104
                        </div>
1104
                [% END %]
1105
                    [% END %]
1105
1106
1106
                [% IF ( Babeltheque ) %]
1107
                    [% IF ( Babeltheque ) %]
1107
                    <div class="babeltheque_adds">
1108
                        <div class="babeltheque_adds">
1108
                        <div id="BW_critiques_aj"></div>
1109
                            <div id="BW_critiques_aj"></div>
1109
                        <div id="BW_citations_aj"></div>
1110
                            <div id="BW_citations_aj"></div>
1110
                    </div>
1111
                        </div>
1111
                [% END %]
1112
                    [% END %]
1112
1113
1113
                [% IF ( SocialNetworks ) %]
1114
                    [% IF ( SocialNetworks ) %]
1114
                    <div id="social_networks" class="clearfix">
1115
                        <div id="social_networks" class="clearfix">
1115
                        <span>Share</span>
1116
                            <span>Share</span>
1116
                        <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% protocol %][% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1117
                            <div><a id="facebook" href="http://www.facebook.com/sharer.php?u=[% protocol %][% current_url |url %]&amp;t=[% title |url %]" title="Share on Facebook">Facebook</a></div>
1117
                        <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1118
                            <div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&amp;url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
1118
                        <div><a id="delicious" href="http://www.delicious.com/save?url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1119
                            <div><a id="delicious" href="http://www.delicious.com/save?url=[% protocol %][% current_url |url %]&amp;title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
1119
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% protocol %][% current_url |url %])" title="Share by email">Email</a></div>
1120
                            <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% protocol %][% current_url |url %])" title="Share by email">Email</a></div>
1120
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1121
                            <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1121
                        <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1122
                            <div><a id="twitter" href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-text="[% title %]" data-lang="[% lang %]">Tweet</a></div>
1122
                    </div>
1123
                        </div>
1123
                [% END %]
1124
                    [% END %]
1125
                </div>
1124
            </div> <!-- / .ulactioncontainer -->
1126
            </div> <!-- / .ulactioncontainer -->
1125
        </div> <!-- / .span4 -->
1127
        </div> <!-- / .span4 -->
1126
    </div> <!-- / .row-fluid -->
1128
    </div> <!-- / .row-fluid -->
Lines 1468-1473 Link Here
1468
            renderPagIndexList(pag_index_ini, $("#listResults"));
1470
            renderPagIndexList(pag_index_ini, $("#listResults"));
1469
        }
1471
        }
1470
        $("#a_listResults").click(function(e) {
1472
        $("#a_listResults").click(function(e) {
1473
            $("#sidebar").toggle();
1471
            if (arrPagination.length > 0) {
1474
            if (arrPagination.length > 0) {
1472
                e.preventDefault();
1475
                e.preventDefault();
1473
                var navigation = $(".results-pagination");
1476
                var navigation = $(".results-pagination");
Lines 1487-1492 Link Here
1487
            e.preventDefault();
1490
            e.preventDefault();
1488
            var navigation = $(".results-pagination");
1491
            var navigation = $(".results-pagination");
1489
            navigation.hide();
1492
            navigation.hide();
1493
            $("#sidebar").toggle();
1490
        });
1494
        });
1491
    [% END %]
1495
    [% END %]
1492
[% IF ( OPACShelfBrowser ) %]
1496
[% IF ( OPACShelfBrowser ) %]
Lines 1657-1664 Link Here
1657
        var timeoutRFW;
1661
        var timeoutRFW;
1658
        var totalPagItemList = 10;
1662
        var totalPagItemList = 10;
1659
1663
1660
        function rewindList()
1664
        function rewindList(e)
1661
        {
1665
        {
1666
            e.preventDefault();
1662
            var ul = $("#listResults");
1667
            var ul = $("#listResults");
1663
            var li_ini = ul.children(':first').next();
1668
            var li_ini = ul.children(':first').next();
1664
            var index_ini = pag_index_ini;
1669
            var index_ini = pag_index_ini;
Lines 1676-1683 Link Here
1676
            }
1681
            }
1677
        }//rewindList
1682
        }//rewindList
1678
1683
1679
        function forwardList()
1684
        function forwardList(e)
1680
        {
1685
        {
1686
            e.preventDefault();
1681
            var ul = $("#listResults");
1687
            var ul = $("#listResults");
1682
            var li_ini = ul.children(':first').next();
1688
            var li_ini = ul.children(':first').next();
1683
            var index_ini = pag_index_ini;
1689
            var index_ini = pag_index_ini;
Lines 1708-1714 Link Here
1708
            var ini = index - 1;
1714
            var ini = index - 1;
1709
            var end = ini + totalPagItemList - 1;
1715
            var end = ini + totalPagItemList - 1;
1710
            li = $("<li />");
1716
            li = $("<li />");
1711
            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;";
1717
            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;";
1712
            li.html(html);
1718
            li.html(html);
1713
            ul.append(li);
1719
            ul.append(li);
1714
            var title = "";
1720
            var title = "";
Lines 1730-1736 Link Here
1730
            li = $("<li />");
1736
            li = $("<li />");
1731
            ini = index + 1;
1737
            ini = index + 1;
1732
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1738
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1733
            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;";
1739
            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;";
1734
            li.html(html);
1740
            li.html(html);
1735
            ul.append(li);
1741
            ul.append(li);
1736
        }//renderPagIndexList
1742
        }//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 244-254 if ($session->param('busc')) { Link Here
244
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
245
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
245
        }
246
        }
246
    }
247
    }
248
247
    my $searchAgain = 0;
249
    my $searchAgain = 0;
250
    my ( $offset, $results_per_page );
251
252
    my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' );
253
    if ( scalar( @$bibnums ) ) {
254
        $arrParamsBusc{count} = scalar( @$bibnums );
255
        $arrParamsBusc{listBiblios} = join ',', @$bibnums;
256
        $results_per_page = $arrParamsBusc{count};
257
        $offset = 0;
258
    } else {
259
    $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
248
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
260
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
249
    my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
261
    $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
250
    $arrParamsBusc{'count'} = $results_per_page;
262
    $arrParamsBusc{'count'} = $results_per_page;
251
    my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
252
    # The value OPACnumSearchResults has changed and the search has to be rebuild
263
    # The value OPACnumSearchResults has changed and the search has to be rebuild
253
    if ($count != $results_per_page) {
264
    if ($count != $results_per_page) {
254
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
265
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
Lines 308-313 if ($session->param('busc')) { Link Here
308
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
319
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
309
        }
320
        }
310
    }
321
    }
322
323
    } # end if cookie bibs_selected exists
324
311
    my $buscParam = '';
325
    my $buscParam = '';
312
    my $j = 0;
326
    my $j = 0;
313
    # Rebuild the query for the button "back to results"
327
    # Rebuild the query for the button "back to results"
Lines 374-380 if ($session->param('busc')) { Link Here
374
        }
388
        }
375
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
389
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
376
    }
390
    }
377
    if ($searchAgain) {
391
    if ($searchAgain and not scalar( @$bibnums )) {
378
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
392
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
379
        my @newresults = @$newresultsRef;
393
        my @newresults = @$newresultsRef;
380
        # build the new listBiblios
394
        # build the new listBiblios
381
- 

Return to bug 10858