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 (-28 / +34 lines)
Lines 1102-1108 Link Here
1102
                                [% END %]
1102
                                [% END %]
1103
                            </li>
1103
                            </li>
1104
                            [%# busc is already URI encoded %]
1104
                            [%# busc is already URI encoded %]
1105
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list">Back to results</a></li>
1105
                            <li class="back_results"><a href="opac-search.pl?[% busc %]" title="Back to the results search list" class="searchwithcontext">Back to results</a></li>
1106
                            <li class="right_results">
1106
                            <li class="right_results">
1107
                                [% IF ( nextBiblionumber ) %]
1107
                                [% IF ( nextBiblionumber ) %]
1108
                                    <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>
1108
                                    <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 1125-1156 Link Here
1125
                    </div>
1125
                    </div>
1126
                [% END # / IF OpacBrowseResults && busc %]
1126
                [% END # / IF OpacBrowseResults && busc %]
1127
1127
1128
                [% INCLUDE 'opac-detail-sidebar.inc' %]
1128
                <div id="sidebar">
1129
                    [% INCLUDE 'opac-detail-sidebar.inc' %]
1129
1130
1130
                [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %]
1131
                    [% IF ( NovelistSelectProfile && NovelistSelectView == 'right' && ( normalized_isbn || normalized_upc ) ) %]
1131
                    <div id="NovelistSelect">
1132
                        <div id="NovelistSelect">
1132
                        <h4>Novelist Select</h4>
1133
                            <h4>Novelist Select</h4>
1133
                        <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div>
1134
                            <div data-novelist-novelistselect=[% IF normalized_isbn %][% normalized_isbn %][% ELSE %][% normalized_upc %][% END %]></div>
1134
                    </div>
1135
                        </div>
1135
                [% END %]
1136
                    [% END %]
1136
1137
1137
                [% IF ( Babeltheque ) %]
1138
                    [% IF ( Babeltheque ) %]
1138
                    <div class="babeltheque_adds">
1139
                        <div class="babeltheque_adds">
1139
                        <div id="BW_critiques_aj"></div>
1140
                            <div id="BW_critiques_aj"></div>
1140
                        <div id="BW_citations_aj"></div>
1141
                            <div id="BW_citations_aj"></div>
1141
                    </div>
1142
                        </div>
1142
                [% END %]
1143
                    [% END %]
1143
1144
1144
                [% IF ( SocialNetworks ) %]
1145
                    [% IF ( SocialNetworks ) %]
1145
                    <div id="social_networks" class="clearfix">
1146
                        <div id="social_networks" class="clearfix">
1146
                        <span>Share</span>
1147
                            <span>Share</span>
1147
                        <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>
1148
                            <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>
1148
                        <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>
1149
                            <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>
1149
                        <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1150
                            <div><a id="email" href="mailto:?subject=[% title |url %]&amp;body=[% title |url %]%20([% current_url |url %])" title="Share by email">Email</a></div>
1150
                        <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1151
                            <div><div class="g-plusone" data-size="small" data-count="false"></div></div>
1151
                        <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>
1152
                            <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>
1152
                    </div>
1153
                        </div>
1153
                [% END %]
1154
                    [% END %]
1155
                </div>
1154
            </div> <!-- / .ulactioncontainer -->
1156
            </div> <!-- / .ulactioncontainer -->
1155
        </div> <!-- / .span4 -->
1157
        </div> <!-- / .span4 -->
1156
    </div> <!-- / .row-fluid -->
1158
    </div> <!-- / .row-fluid -->
Lines 1562-1567 Link Here
1562
            renderPagIndexList(pag_index_ini, $("#listResults"));
1564
            renderPagIndexList(pag_index_ini, $("#listResults"));
1563
        }
1565
        }
1564
        $("#a_listResults").click(function(e) {
1566
        $("#a_listResults").click(function(e) {
1567
            $("#sidebar").toggle();
1565
            if (arrPagination.length > 0) {
1568
            if (arrPagination.length > 0) {
1566
                e.preventDefault();
1569
                e.preventDefault();
1567
                var navigation = $(".results-pagination");
1570
                var navigation = $(".results-pagination");
Lines 1581-1586 Link Here
1581
            e.preventDefault();
1584
            e.preventDefault();
1582
            var navigation = $(".results-pagination");
1585
            var navigation = $(".results-pagination");
1583
            navigation.hide();
1586
            navigation.hide();
1587
            $("#sidebar").toggle();
1584
        });
1588
        });
1585
    [% END %]
1589
    [% END %]
1586
[% IF ( OPACShelfBrowser ) %]
1590
[% IF ( OPACShelfBrowser ) %]
Lines 1751-1758 Link Here
1751
        var timeoutRFW;
1755
        var timeoutRFW;
1752
        var totalPagItemList = 10;
1756
        var totalPagItemList = 10;
1753
1757
1754
        function rewindList()
1758
        function rewindList(e)
1755
        {
1759
        {
1760
            e.preventDefault();
1756
            var ul = $("#listResults");
1761
            var ul = $("#listResults");
1757
            var li_ini = ul.children(':first').next();
1762
            var li_ini = ul.children(':first').next();
1758
            var index_ini = pag_index_ini;
1763
            var index_ini = pag_index_ini;
Lines 1770-1777 Link Here
1770
            }
1775
            }
1771
        }//rewindList
1776
        }//rewindList
1772
1777
1773
        function forwardList()
1778
        function forwardList(e)
1774
        {
1779
        {
1780
            e.preventDefault();
1775
            var ul = $("#listResults");
1781
            var ul = $("#listResults");
1776
            var li_ini = ul.children(':first').next();
1782
            var li_ini = ul.children(':first').next();
1777
            var index_ini = pag_index_ini;
1783
            var index_ini = pag_index_ini;
Lines 1802-1808 Link Here
1802
            var ini = index - 1;
1808
            var ini = index - 1;
1803
            var end = ini + totalPagItemList - 1;
1809
            var end = ini + totalPagItemList - 1;
1804
            li = $("<li />");
1810
            li = $("<li />");
1805
            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;";
1811
            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;";
1806
            li.html(html);
1812
            li.html(html);
1807
            ul.append(li);
1813
            ul.append(li);
1808
            var title = "";
1814
            var title = "";
Lines 1824-1830 Link Here
1824
            li = $("<li />");
1830
            li = $("<li />");
1825
            ini = index + 1;
1831
            ini = index + 1;
1826
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1832
            end = (arrPagination.length > index + totalPagItemList)?index + totalPagItemList:arrPagination.length - 1;
1827
            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;";
1833
            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;";
1828
            li.html(html);
1834
            li.html(html);
1829
            ul.append(li);
1835
            ul.append(li);
1830
        }//renderPagIndexList
1836
        }//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 672-682 function tagAdded() { Link Here
672
675
673
function enableCheckboxActions(){
676
function enableCheckboxActions(){
674
    // Enable/disable controls if checkboxes are checked
677
    // Enable/disable controls if checkboxes are checked
675
    var checkedBoxes = $(".checkboxed input:checkbox:checked");
678
    var bibnums = getContextBiblioNumbers();
676
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
679
    var controls = $("#selections-toolbar .links a, #selections-toolbar .links input, #selections-toolbar .links select, , #selections-toolbar .links label")
677
    if ($(checkedBoxes).size()) {
680
    if ( bibnums.length > 0 ) {
678
      $("#selections").html(_("With selected titles: "));
681
      $("#selections").html(_("With selected titles: "));
679
      $(controls).removeClass("disabled");
682
      $(controls).removeClass("disabled");
683
      // Hide or show details link
684
      // Update with first biblionumber in queue
685
      $(".details_link a").attr("href", "/cgi-bin/koha/opac-detail.pl?biblionumber=" + bibnums[0]);
680
    } else {
686
    } else {
681
      $("#selections").html(_("Select titles to: "));
687
      $("#selections").html(_("Select titles to: "));
682
      $(controls).addClass("disabled");
688
      $(controls).addClass("disabled");
Lines 705-710 function highlightOn() { Link Here
705
    $(".highlight_toggle").toggle();
711
    $(".highlight_toggle").toggle();
706
}
712
}
707
[% END %]
713
[% END %]
714
708
$(document).ready(function(){
715
$(document).ready(function(){
709
    [% IF ( OpacHighlightedWords ) %]
716
    [% IF ( OpacHighlightedWords ) %]
710
        $('a.title').each(function() {
717
        $('a.title').each(function() {
Lines 712-722 $(document).ready(function(){ Link Here
712
        });
719
        });
713
    [% END %]
720
    [% END %]
714
721
715
    $(".cb").click(function(){
722
    $(".cb").change(function(){
723
      [% IF Koha.Preference('OpacBrowseResults') %]
724
        if ( $(this).is(':checked') == true ) {
725
          addBibToContext( $(this).val() );
726
        } else {
727
          delBibToContext( $(this).val() );
728
        }
729
      [% END %]
716
      enableCheckboxActions();
730
      enableCheckboxActions();
717
    });
731
    });
732
733
    $("span.details_link").html("<a href=\"#\" class=\"disabled\">"+_("Browse selected records")+"<\/a>");
734
    $(".details_link a").click(function(e) {
735
      if ( $(this).hasClass("disabled") == true ) {
736
        e.preventDefault();
737
        var checkedBoxes = $(".searchresults :checkbox:checked");
738
        if ($(checkedBoxes).size() == 0) {
739
            alert(MSG_NO_RECORD_SELECTED);
740
        } else {
741
            alert(MSG_NEED_COOKIE_ENABLED);
742
        }
743
        return false;
744
      }
745
    });
718
    enableCheckboxActions();
746
    enableCheckboxActions();
719
747
748
749
    $("#bookbag_form").ready(function(){
750
      $("#bookbag_form").unCheckCheckboxes();
751
      var bibnums = getContextBiblioNumbers();
752
      if (bibnums) {
753
        for (var i=0; i < bibnums.length; i++) {
754
          var id = ('#bib' + bibnums[i]);
755
          if ($(id)) {
756
            $(id).attr('checked', true);
757
          }
758
        }
759
      }
760
    });
761
720
    [% IF ( IDreamBooksResults ) %]
762
    [% IF ( IDreamBooksResults ) %]
721
        $('.idbresult').each(function() {
763
        $('.idbresult').each(function() {
722
            var isbn = $(this).children('a').text().replace(/\s*/,'');
764
            var isbn = $(this).children('a').text().replace(/\s*/,'');
Lines 860-870 $(document).ready(function(){ Link Here
860
    $("#CheckAll").click(function(){
902
    $("#CheckAll").click(function(){
861
        $("#bookbag_form").checkCheckboxes();
903
        $("#bookbag_form").checkCheckboxes();
862
        enableCheckboxActions();
904
        enableCheckboxActions();
905
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
906
            $(this).change();
907
        } );
863
        return false;
908
        return false;
864
    });
909
    });
865
    $("#CheckNone").click(function(){
910
    $("#CheckNone").click(function(){
866
        $("#bookbag_form").unCheckCheckboxes();
911
        $("#bookbag_form").unCheckCheckboxes();
867
        enableCheckboxActions();
912
        enableCheckboxActions();
913
        $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
914
            $(this).change();
915
        } );
868
        return false;
916
        return false;
869
    });
917
    });
870
918
(-)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 268-278 if ($session->param('busc')) { Link Here
268
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
269
            push @{$arrParamsBusc{$key}}, uri_unescape($value);
269
        }
270
        }
270
    }
271
    }
272
271
    my $searchAgain = 0;
273
    my $searchAgain = 0;
274
    my ( $offset, $results_per_page );
275
276
    my $bibnums = JSON::from_json( $query->cookie('bibs_selected') || '[]' );
277
    if ( scalar( @$bibnums ) ) {
278
        $arrParamsBusc{count} = scalar( @$bibnums );
279
        $arrParamsBusc{listBiblios} = join ',', @$bibnums;
280
        $results_per_page = $arrParamsBusc{count};
281
        $offset = 0;
282
    } else {
283
    $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
272
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
284
    my $count = C4::Context->preference('OPACnumSearchResults') || 20;
273
    my $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
285
    $results_per_page = ($arrParamsBusc{'count'} && $arrParamsBusc{'count'} =~ /^[0-9]+?/)?$arrParamsBusc{'count'}:$count;
274
    $arrParamsBusc{'count'} = $results_per_page;
286
    $arrParamsBusc{'count'} = $results_per_page;
275
    my $offset = ($arrParamsBusc{'offset'} && $arrParamsBusc{'offset'} =~ /^[0-9]+?/)?$arrParamsBusc{'offset'}:0;
276
    # The value OPACnumSearchResults has changed and the search has to be rebuild
287
    # The value OPACnumSearchResults has changed and the search has to be rebuild
277
    if ($count != $results_per_page) {
288
    if ($count != $results_per_page) {
278
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
289
        if (exists($arrParamsBusc{'listBiblios'}) && $arrParamsBusc{'listBiblios'} =~ /^[0-9]+(?:,[0-9]+)*$/) {
Lines 332-337 if ($session->param('busc')) { Link Here
332
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
343
            @arrBusc = split(/\&(?:amp;)?/, $newbusc);
333
        }
344
        }
334
    }
345
    }
346
347
    } # end if cookie bibs_selected exists
348
335
    my $buscParam = '';
349
    my $buscParam = '';
336
    my $j = 0;
350
    my $j = 0;
337
    # Rebuild the query for the button "back to results"
351
    # Rebuild the query for the button "back to results"
Lines 398-404 if ($session->param('busc')) { Link Here
398
        }
412
        }
399
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
413
        $offsetSearch = 0 if (defined($offsetSearch) && $offsetSearch < 0);
400
    }
414
    }
401
    if ($searchAgain) {
415
    if ($searchAgain and not scalar( @$bibnums )) {
402
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
416
        my $newresultsRef = searchAgain(\%arrParamsBusc, $offsetSearch, $results_per_page);
403
        my @newresults = @$newresultsRef;
417
        my @newresults = @$newresultsRef;
404
        # build the new listBiblios
418
        # build the new listBiblios
405
- 

Return to bug 10858