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 1063-1069 Link Here
1063
                                [% END %]
1063
                                [% END %]
1064
                            </li>
1064
                            </li>
1065
                            [%# busc is already URI encoded %]
1065
                            [%# busc is already URI encoded %]
1066
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li>
1066
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1067
                            <li class="right_results">
1067
                            <li class="right_results">
1068
                                [% IF ( nextBiblionumber ) %]
1068
                                [% IF ( nextBiblionumber ) %]
1069
                                    <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>
1069
                                    <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 1086-1118 Link Here
1086
                    </div>
1086
                    </div>
1087
                [% END # / IF OpacBrowseResults && busc %]
1087
                [% END # / IF OpacBrowseResults && busc %]
1088
1088
1089
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1089
                <div id="sidebar">
1090
                    [% INCLUDE 'opac-detail-sidebar.inc' %]
1090
1091
1091
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1092
                    [% IF ( NovelistSelectProfile && NovelistSelectView == 'right') %]
1092
                    <div id="NovelistSelect">
1093
                        <div id="NovelistSelect">
1093
                        <h4>Novelist Select</h4>
1094
                            <h4>Novelist Select</h4>
1094
                        <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1095
                            <div data-novelist-novelistselect=[% normalized_isbn %]></div>
1095
                    </div>
1096
                        </div>
1096
                [% END %]
1097
                    [% END %]
1097
1098
1098
                [% IF ( Babeltheque ) %]
1099
                    [% IF ( Babeltheque ) %]
1099
                    <div class="babeltheque_adds">
1100
                        <div class="babeltheque_adds">
1100
                        <div id="BW_critiques_aj"></div>
1101
                            <div id="BW_critiques_aj"></div>
1101
                        <div id="BW_citations_aj"></div>
1102
                            <div id="BW_citations_aj"></div>
1102
                    </div>
1103
                        </div>
1103
                [% END %]
1104
                    [% END %]
1104
1105
1105
                [% IF ( SocialNetworks ) %]
1106
                    [% IF ( SocialNetworks ) %]
1106
                    <div id="social_networks" class="clearfix">
1107
                        <div id="social_networks" class="clearfix">
1107
                        <span>Share</span>
1108
                            <span>Share</span>
1108
                        <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>
1109
                            <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>
1109
                        <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>
1110
                            <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>
1110
                        <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>
1111
                            <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>
1111
                        <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>
1112
                            <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>
1112
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1113
                            <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1113
                        <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>
1114
                            <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>
1114
                    </div>
1115
                        </div>
1115
                [% END %]
1116
                    [% END %]
1117
                </div>
1116
            </div> <!-- / .ulactioncontainer -->
1118
            </div> <!-- / .ulactioncontainer -->
1117
        </div> <!-- / .span4 -->
1119
        </div> <!-- / .span4 -->
1118
    </div> <!-- / .row-fluid -->
1120
    </div> <!-- / .row-fluid -->
Lines 1456-1461 Link Here
1456
            renderPagIndexList(pag_index_ini, $("#listResults"));
1458
            renderPagIndexList(pag_index_ini, $("#listResults"));
1457
        }
1459
        }
1458
        $("#a_listResults").click(function(e) {
1460
        $("#a_listResults").click(function(e) {
1461
            $("#sidebar").toggle();
1459
            if (arrPagination.length > 0) {
1462
            if (arrPagination.length > 0) {
1460
                e.preventDefault();
1463
                e.preventDefault();
1461
                var navigation = $(".results-pagination");
1464
                var navigation = $(".results-pagination");
Lines 1475-1480 Link Here
1475
            e.preventDefault();
1478
            e.preventDefault();
1476
            var navigation = $(".results-pagination");
1479
            var navigation = $(".results-pagination");
1477
            navigation.hide();
1480
            navigation.hide();
1481
            $("#sidebar").toggle();
1478
        });
1482
        });
1479
    [% END %]
1483
    [% END %]
1480
[% IF ( OPACShelfBrowser ) %]
1484
[% IF ( OPACShelfBrowser ) %]
Lines 1639-1646 Link Here
1639
        var timeoutRFW;
1643
        var timeoutRFW;
1640
        var totalPagItemList = 10;
1644
        var totalPagItemList = 10;
1641
1645
1642
        function rewindList()
1646
        function rewindList(e)
1643
        {
1647
        {
1648
            e.preventDefault();
1644
            var ul = $("#listResults");
1649
            var ul = $("#listResults");
1645
            var li_ini = ul.children(':first').next();
1650
            var li_ini = ul.children(':first').next();
1646
            var index_ini = pag_index_ini;
1651
            var index_ini = pag_index_ini;
Lines 1658-1665 Link Here
1658
            }
1663
            }
1659
        }//rewindList
1664
        }//rewindList
1660
1665
1661
        function forwardList()
1666
        function forwardList(e)
1662
        {
1667
        {
1668
            e.preventDefault();
1663
            var ul = $("#listResults");
1669
            var ul = $("#listResults");
1664
            var li_ini = ul.children(':first').next();
1670
            var li_ini = ul.children(':first').next();
1665
            var index_ini = pag_index_ini;
1671
            var index_ini = pag_index_ini;
Lines 1690-1696 Link Here
1690
            var ini = index - 1;
1696
            var ini = index - 1;
1691
            var end = ini + totalPagItemList - 1;
1697
            var end = ini + totalPagItemList - 1;
1692
            li = $("<li />");
1698
            li = $("<li />");
1693
            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;";
1699
            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;";
1694
            li.html(html);
1700
            li.html(html);
1695
            ul.append(li);
1701
            ul.append(li);
1696
            var title = "";
1702
            var title = "";
Lines 1712-1718 Link Here
1712
            li = $("<li />");
1718
            li = $("<li />");
1713
            ini = index + 1;
1719
            ini = index + 1;
1714
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1720
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1715
            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;";
1721
            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;";
1716
            li.html(html);
1722
            li.html(html);
1717
            ul.append(li);
1723
            ul.append(li);
1718
        }//renderPagIndexList
1724
        }//renderPagIndexList
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-4 / +51 lines)
Lines 162-167 Link Here
162
                                                    Tag status here.
162
                                                    Tag status here.
163
                                                </div>
163
                                                </div>
164
                                            [% END %]
164
                                            [% END %]
165
                                            [% IF Koha.Preference('OpacBrowseResults') %]
166
                                              <span class="details_link"></span>
167
                                            [% END %]
165
                                        </span> <!-- / .links -->
168
                                        </span> <!-- / .links -->
166
                                </div> <!-- / #selections-toolbar -->
169
                                </div> <!-- / #selections-toolbar -->
167
170
Lines 630-640 function tagAdded() { Link Here
630
633
631
function enableCheckboxActions(){
634
function enableCheckboxActions(){
632
    // Enable/disable controls if checkboxes are checked
635
    // Enable/disable controls if checkboxes are checked
633
    var checkedBoxes = $(".checkboxed input:checkbox:checked");
636
    var bibnums = getContextBiblioNumbers();
634
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
637
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
635
    if ($(checkedBoxes).size()) {
638
    if ( bibnums.length > 0 ) {
636
      $("#selections").html(_("With selected titles: "));
639
      $("#selections").html(_("With selected titles: "));
637
      $(controls).removeClass("disabled");
640
      $(controls).removeClass("disabled");
641
      // Hide or show details link
642
      // Update with first biblionumber in queue
643
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]);
638
    } else {
644
    } else {
639
      $("#selections").html(_("Select titles to: "));
645
      $("#selections").html(_("Select titles to: "));
640
      $(controls).addClass("disabled");
646
      $(controls).addClass("disabled");
Lines 663-668 function highlightOn() { Link Here
663
    $(".highlight_toggle").toggle();
669
    $(".highlight_toggle").toggle();
664
}
670
}
665
[% END %]
671
[% END %]
672
666
$(document).ready(function(){
673
$(document).ready(function(){
667
    [% IF ( OpacHighlightedWords ) %]
674
    [% IF ( OpacHighlightedWords ) %]
668
        $('a.title').each(function() {
675
        $('a.title').each(function() {
Lines 670-680 $(document).ready(function(){ Link Here
670
        });
677
        });
671
    [% END %]
678
    [% END %]
672
679
673
    $(".cb").click(function(){
680
    $(".cb").change(function(){
681
      [% IF Koha.Preference('OpacBrowseResults') %]
682
        if ( $(this).is(':checked') == true ) {
683
          addBibToContext( $(this).val() );
684
        } else {
685
          delBibToContext( $(this).val() );
686
        }
687
      [% END %]
674
      enableCheckboxActions();
688
      enableCheckboxActions();
675
    });
689
    });
690
691
    $("span.details_link").html("<a href=\"#\" class=\"disabled\">"+_("Browse selected records")+"<\/a>");
692
    $(".details_link a").click(function(e) {
693
      if ( $(this).hasClass("disabled") == true ) {
694
        e.preventDefault();
695
        var checkedBoxes = $(".searchresults :checkbox:checked");
696
        if ($(checkedBoxes).size() == 0) {
697
            alert(MSG_NO_RECORD_SELECTED);
698
        } else {
699
            alert(MSG_NEED_COOKIE_ENABLED);
700
        }
701
        return false;
702
      }
703
    });
676
    enableCheckboxActions();
704
    enableCheckboxActions();
677
705
706
707
    $("#bookbag_form").ready(function(){
708
      $("#bookbag_form").unCheckCheckboxes();
709
      var bibnums = getContextBiblioNumbers();
710
      if (bibnums) {
711
        for (var i=0; i < bibnums.length; i++) {
712
          var id = ('#bib' + bibnums[i]);
713
          if ($(id)) {
714
            $(id).attr('checked', true);
715
          }
716
        }
717
      }
718
    });
719
678
    [% IF ( IDreamBooksResults ) %]
720
    [% IF ( IDreamBooksResults ) %]
679
        $('.idbresult').each(function() {
721
        $('.idbresult').each(function() {
680
            var isbn = $(this).children('a').text().replace(/\s*/,'');
722
            var isbn = $(this).children('a').text().replace(/\s*/,'');
Lines 812-822 $(document).ready(function(){ Link Here
812
    $("#CheckAll").click(function(){
854
    $("#CheckAll").click(function(){
813
        $("#bookbag_form").checkCheckboxes();
855
        $("#bookbag_form").checkCheckboxes();
814
        enableCheckboxActions();
856
        enableCheckboxActions();
857
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
858
            $(this).change();
859
        } );
815
        return false;
860
        return false;
816
    });
861
    });
817
    $("#CheckNone").click(function(){
862
    $("#CheckNone").click(function(){
818
        $("#bookbag_form").unCheckCheckboxes();
863
        $("#bookbag_form").unCheckCheckboxes();
819
        enableCheckboxActions();
864
        enableCheckboxActions();
865
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
866
            $(this).change();
867
        } );
820
        return false;
868
        return false;
821
    });
869
    });
822
870
Lines 918-924 $(document).ready(function(){ Link Here
918
            });
966
            });
919
        });
967
        });
920
[% END %]
968
[% END %]
921
922
});
969
});
923
//]]>
970
//]]>
924
</script>
971
</script>
(-)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 433-452 function addSelToShelf() { Link Here
433
///  vShelfAdd()  builds url string for multiple-biblio adds.
441
///  vShelfAdd()  builds url string for multiple-biblio adds.
434
442
435
function vShelfAdd() {
443
function vShelfAdd() {
436
        bibs= new Array;
444
    var bibnums = getContextBiblioNumbers();
445
    bibs = new Array;
446
    if ( bibnums.length > 0 ) {
447
        for ( var i = 0 ; i < bibnums.length ; i++ ) {
448
            bibs.push("biblionumber=" + bibnums[i]);
449
        }
450
        return bibs.join("&");
451
    } else {
437
        if(document.bookbag_form.biblionumber.length > 0) {
452
        if(document.bookbag_form.biblionumber.length > 0) {
438
                for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
453
            for (var i=0; i < document.bookbag_form.biblionumber.length; i++) {
439
                        if (document.bookbag_form.biblionumber[i].checked) {
454
                if (document.bookbag_form.biblionumber[i].checked) {
440
                                bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
455
                    bibs.push("biblionumber=" +  document.bookbag_form.biblionumber[i].value);
441
                        }
442
                }
456
                }
443
        if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
457
            }
458
            if (bibs.length == 0) { showListsUpdate(MSG_NO_RECORD_SELECTED); }
444
            return bibs.join("&");
459
            return bibs.join("&");
445
        } else {
460
        } else {
446
            if (document.bookbag_form.biblionumber.checked) {
461
            if (document.bookbag_form.biblionumber.checked) {
447
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
462
                return "biblionumber=" + document.bookbag_form.biblionumber.value;
448
            }
463
            }
449
        }
464
        }
465
    }
450
}
466
}
451
467
452
function showCart(){
468
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/koha-tmpl/opac-tmpl/bootstrap/lib/jquery/plugins/jquery.cookie.min.js (+1 lines)
Line 0 Link Here
1
jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
(-)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