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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/strings.inc (+1 lines)
Lines 17-22 Link Here
17
    var PREVIOUS_CHECKOUTS = _("Previous checkouts");
17
    var PREVIOUS_CHECKOUTS = _("Previous checkouts");
18
    var BY = _("by _AUTHOR_");
18
    var BY = _("by _AUTHOR_");
19
    var ON_HOLD = _("On hold");
19
    var ON_HOLD = _("On hold");
20
    var PLACE_HOLD = _("Place hold");
20
    var NOT_RENEWABLE = _("Not renewable");
21
    var NOT_RENEWABLE = _("Not renewable");
21
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
22
    var NOT_RENEWABLE_TOO_SOON = _("No renewal before %s");
22
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
23
    var NOT_RENEWABLE_AUTO_TOO_SOON = _("Scheduled for automatic renewal");
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-315 / +35 lines)
Lines 673-996 Link Here
673
    <script>
673
    <script>
674
        var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
674
        var MSG_NO_ITEM_SELECTED = _("Nothing is selected.");
675
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold.");
675
        var MSG_NON_RESERVES_SELECTED = _("One or more selected items cannot be placed on hold.");
676
        var PREF_AmazonCoverImages = parseInt( [% Koha.Preference('AmazonCoverImages') | html %], 10);
676
        var q_array = new Array();  // will hold search terms, if present
677
        var q_array = new Array();  // will hold search terms, if present
677
        [% IF ( AmazonCoverImages ) %]
678
        var PREF_LocalCoverImages = parseInt( [% Koha.Preference('LocalCoverImages') | html %], 10);
678
            // http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
679
        var PREF_IntranetCoce = parseInt( [% Koha.Preference('IntranetCoce') | html %], 10);
679
            function verify_images() {
680
        var PREF_CoceProviders = "[% Koha.Preference('CoceProviders') | html %]";
680
                $("img").each(function(i){
681
        var CoceHost = "[% CoceHost | html %]";
681
                    if ((this.src.indexOf('images-amazon.com') >= 0) || (this.src.indexOf('images.amazon.com') >=0)) {
682
        var CoceProviders = "[% CoceProviders | html %]";
682
                        w = this.width;
683
        var PREF_BrowseResultSelection = parseInt( [% Koha.Preference('BrowseResultSelection') | html %], 10);
683
                        h = this.height;
684
        var PREF_NotHighlightedWords = "[% Koha.Preference('NotHighlightedWords') | html %]";
684
                        if ((w == 1) || (h == 1)) {
685
        var biblionumber = "[% biblionumber | html %]";
685
                            $(this).parent().html('<span class="no-image">No cover image available</span>');
686
        var holdfor_cardnumber = "[% holdfor_cardnumber | html %]";
686
                        } else if ((this.complete != null) && (!this.complete)) {
687
        var holdforclub = "[% holdforclub | html %]";
687
                            $(this).parent().html('<span class="no-image">No cover image available</span>');
688
        var SEARCH_RESULTS = [% IF (SEARCH_RESULTS) %]1[% ELSE %]0[% END %];
688
                        }
689
        var new_results_browser = [
689
                    }
690
            [%- FOREACH result IN SEARCH_RESULTS -%]
690
                });
691
                [%- result.biblionumber | html -%],
691
            }
692
            [%- END -%]
692
693
        ];
693
            $(window).load(function() {
694
        var strQuery="&frameworkcode=";
694
                verify_images();
695
        [%- FOREACH z3950_search_param IN z3950_search_params -%]
695
            });
696
            strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]";
696
        [% END %]
697
        [%- END -%]
697
        var Sticky;
698
698
        $(document).ready(function() {
699
        var search_result = {
699
700
            query_desc: "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]",
700
            $(".moretoggle").click(function(e) {
701
            query_cgi: "[% query_cgi | html %]",
701
                e.preventDefault();
702
            limit_cgi: "[% limit_cgi | html %]",
702
                $(this).siblings(".collapsible-facet").toggle();
703
            sort_cgi: "[% sort_cgi | html %]",
703
                $(this).siblings(".moretoggle").toggle();
704
            gotoPage: "[% gotoPage | html %]",
704
                $(this).toggle();
705
            gotoNumber: "[% gotoNumber | html %]",
705
            });
706
            searchid: "[% searchid | html %]",
706
707
            total: "[% total | html %]",
707
            Sticky = $("#searchheader");
708
            first_result_number: "[% SEARCH_RESULTS.first.result_number | html %]",
708
            Sticky.hcSticky({
709
            first_biblionumber: "[% SEARCH_RESULTS.first.biblionumber | html %]",
709
                stickTo: "main",
710
            last_biblionumber: "[% SEARCH_RESULTS.last.biblionumber | html %]",
710
                stickyClass: "floating"
711
            });
712
713
            $("#cartsubmit").click(function(e){
714
                e.preventDefault();
715
                addMultiple();
716
            });
717
718
            $(".addtolist").on("click",function(e){
719
                e.preventDefault();
720
                var shelfnumber = $(this).data("shelfnumber");
721
                var vshelf = vShelfAdd();
722
                if( vshelf ){
723
                    if( $(this).hasClass("morelists") ){
724
                        openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf);
725
                    } else if( $(this).hasClass("newlist") ){
726
                        openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf);
727
                    } else {
728
                        openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf);
729
                    }
730
                }
731
            });
732
733
            $("#z3950submit").click(function(){
734
                PopupZ3950();
735
                return false;
736
            });
737
738
            $("#searchheader").on("click", ".browse_selection", function(){
739
                browse_selection();
740
                return false;
741
            });
742
743
            $("#searchheader").on("click",".placehold", function(){
744
                $("#holdFor").val("");
745
                $("#holdForClub").val("");
746
                placeHold();
747
                $(".btn-group").removeClass("open");
748
                return false;
749
            });
750
751
            $(".placeholdfor").click(function(){
752
                holdForPatron();
753
                $(".btn-group").removeClass("open");
754
                return false;
755
            });
756
757
            $(".placeholdforclub").click(function(){
758
                holdForClub();
759
                $(".btn-group").removeClass("open");
760
                return false;
761
            });
762
763
            $("#forgetholdfor, #forgetholdforclub").click(function(){
764
                forgetPatronAndClub();
765
                $(".btn-group").removeClass("open");
766
                return false;
767
            });
768
769
            $("#tagsel_span").html("<input id=\"tagsel_tag\" class=\"submit\" type=\"submit\" value=\"Tag\"/>");
770
771
            $(".selection").show();
772
773
            [% IF ( query_desc ) %]
774
                toHighlight = $("p,span.results_summary,a.title");
775
                var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
776
                q_array = query_desc.split(" ");
777
                // ensure that we don't have "" at the end of the array, which can
778
                // break the highlighter
779
                while (q_array.length > 0 && q_array[q_array.length-1] == "") {
780
                    q_array = q_array.splice(0,-1);
781
                }
782
                highlightOn();
783
                $("#highlight_toggle_on" ).hide().click(function(e) {
784
                    e.preventDefault();
785
                     highlightOn();
786
                });
787
                $("#highlight_toggle_off").show().click(function(e) {
788
                    e.preventDefault();
789
                    highlightOff();
790
                });
791
            [% END %]
792
793
            [% IF (SEARCH_RESULTS) %]
794
                var newresults = [
795
                    [%- FOREACH result IN SEARCH_RESULTS -%]
796
                        [%- result.biblionumber | html %],
797
                    [%- END -%]
798
                ];
799
                var browser = KOHA.browser('[% searchid | html %]', parseInt('[% biblionumber | html %]', 10));
800
                browser.create([% SEARCH_RESULTS.first.result_number | html %], '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]',
801
                       newresults, '[% total | html %]');
802
            [% END %]
803
804
            [% IF (gotoPage && gotoNumber) %]
805
                [% IF (gotoNumber == 'first') %]
806
                    window.location = '/cgi-bin/koha/catalogue/[% gotoPage | html %]?biblionumber=' + [% SEARCH_RESULTS.first.biblionumber | html %] + '&searchid=[% searchid | html %]';
807
                [% ELSIF (gotoNumber == 'last') %]
808
                    window.location = '/cgi-bin/koha/catalogue/[% gotoPage | html %]?biblionumber=' + [% SEARCH_RESULTS.last.biblionumber | html %] + '&searchid=[% searchid | html %]';
809
                [% END %]
810
            [% END %]
811
812
            [% IF LocalCoverImages %]
813
                KOHA.LocalCover.LoadResultsCovers();
814
            [% END %]
815
816
            [% IF ( IntranetCoce && CoceProviders ) %]
817
                KOHA.coce.getURL('[% CoceHost | html %]', '[% CoceProviders | html %]');
818
            [% END %]
819
820
            $("#select_all").on("click",function(e){
821
                e.preventDefault();
822
                selectAll();
823
            });
824
825
            $("#clear_all").on("click",function(e){
826
                e.preventDefault();
827
                clearAll();
828
            });
829
830
            $("#searchresults").on("click",".addtocart",function(e){
831
                e.preventDefault();
832
                var selection_id = this.id;
833
                var biblionumber = selection_id.replace("cart","");
834
                addRecord(biblionumber);
835
            });
836
837
            $("#searchresults").on("click",".cartRemove",function(e){
838
                e.preventDefault();
839
                var selection_id = this.id;
840
                var biblionumber = selection_id.replace("cartR","");
841
                delSingleRecord(biblionumber);
842
            });
843
844
            [% UNLESS Koha.Preference('BrowseResultSelection') %]
845
                resetSearchContext();
846
            [% END %]
847
            $(".selection").change(function(){
848
                if ( $(this).is(':checked') == true ) {
849
                  addBibToContext( $(this).val() );
850
                } else {
851
                  delBibToContext( $(this).val() );
852
                }
853
            });
854
            $("#bookbag_form").ready(function(){
855
                $("#bookbag_form").unCheckCheckboxes();
856
                var bibnums = getContextBiblioNumbers();
857
                if (bibnums) {
858
                    for (var i=0; i < bibnums.length; i++) {
859
                        var id = ('#bib' + bibnums[i]);
860
                        if ($(id)) {
861
                            $(id).attr('checked', true);
862
                        }
863
                    }
864
                }
865
            });
866
867
        });
868
869
870
        [% IF ( query_desc ) %]
871
            function highlightOff() {
872
                toHighlight.removeHighlight();
873
                $(".highlight_toggle").toggle();
874
            }
875
            function highlightOn() {
876
                var x;
877
                for (x in q_array) {
878
                    q_array[x] = q_array[x].toLowerCase();
879
                    var myStopwords = "[% Koha.Preference('NotHighlightedWords') | html %]".toLowerCase().split('|');
880
                    if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) {
881
                        toHighlight.highlight(q_array[x]);
882
                    }
883
                }
884
                $(".highlight_toggle").toggle();
885
            }
886
        [% END %]
887
888
        function selectAll () {
889
            $("#bookbag_form").checkCheckboxes();
890
            $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
891
                $(this).change();
892
            } );
893
            return false;
894
        }
895
        function clearAll () {
896
            $("#bookbag_form").unCheckCheckboxes();
897
            $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
898
                $(this).change();
899
            } );
900
            return false;
901
        }
902
        function placeHold () {
903
            var checkedItems = $(".selection:checked");
904
            if ($(checkedItems).size() == 0) {
905
                alert(MSG_NO_ITEM_SELECTED);
906
                return false;
907
            }
908
            var bibs = "";
909
            var badBibs = false;
910
            $(checkedItems).each(function() {
911
                var bib = $(this).val();
912
                if ($("#reserve_" + bib).size() == 0) {
913
                    alert(MSG_NON_RESERVES_SELECTED);
914
                    badBibs = true;
915
                    return false;
916
                }
917
                bibs += bib + "/";
918
            });
919
            if (badBibs) {
920
                return false;
921
            }
922
            $("#hold_form_biblios").val(bibs);
923
            $("#hold_form").submit();
924
            return false;
925
        }
926
927
        function forgetPatronAndClub(){
928
            $.removeCookie("holdfor", { path: '/' });
929
            $.removeCookie("holdforclub", { path: '/' });
930
            $(".holdforlink").remove();
931
            $("#placeholdc").html("<a class=\"btn btn-default btn-xs placehold\" href=\"#\"><i class=\"fa fa-sticky-note-o\"></i> "+_("Place hold")+"</a>");
932
        }
933
934
        function browse_selection () {
935
            var bibnums = getContextBiblioNumbers();
936
            if ( bibnums && bibnums.length > 0 ) {
937
                var browser = KOHA.browser('', parseInt('[% biblionumber | html %]', 10));
938
                browser.create(1, '[% query_cgi | html %]', '[% limit_cgi | html %]','[% sort_cgi | html %]', bibnums, bibnums.length);
939
                window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid;
940
            } else {
941
                alert(MSG_NO_ITEM_SELECTED);
942
            }
943
            return false;
944
        }
945
946
        function addToList () {
947
            var checkedItems = $(".selection:checked");
948
            if ($(checkedItems).size() == 0) {
949
                alert(MSG_NO_ITEM_SELECTED);
950
                return false;
951
            }
952
            var bibs = "";
953
            $(checkedItems).each(function() {
954
                bibs += $(this).val() + "/";
955
            });
956
957
            var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
958
            window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
959
            return false;
960
        }
961
962
        /* this function open a popup to search on z3950 server.  */
963
        function PopupZ3950() {
964
            var strQuery = GetZ3950Terms();
965
            if(strQuery){
966
                window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
967
            }
968
        }
969
        /* provide Z3950 search points */
970
        function GetZ3950Terms(){
971
            var strQuery="&frameworkcode=";
972
            [% FOREACH z3950_search_param IN z3950_search_params %]
973
                strQuery += "&" + "[% z3950_search_param.name |uri %]" + "=" + "[% z3950_search_param.value |uri %]";
974
            [% END %]
975
            return strQuery;
976
        }
977
978
        function holdfor(){
979
            $("#holdFor").val("");
980
            $("#holdForClub").val("");
981
            placeHold();
982
        }
983
984
        function holdForPatron() {
985
            $("#holdFor").val("[% holdfor_cardnumber | html %]");
986
            placeHold();
987
        }
988
989
        function holdForClub() {
990
            $("#holdForClub").val("[% holdforclub | html %]");
991
            placeHold();
992
        }
711
        }
993
    </script>
712
    </script>
713
    [% Asset.js("js/pages/results.js") | $raw %]
994
[% END %]
714
[% END %]
995
715
996
[% INCLUDE 'intranet-bottom.inc' %]
716
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/pages/results.js (-1 / +308 lines)
Line 0 Link Here
0
- 
1
/* global KOHA biblionumber new_results_browser addMultiple vShelfAdd openWindow search_result SEARCH_RESULTS PREF_AmazonCoverImages PREF_LocalCoverImages PREF_IntranetCoce PREF_CoceProviders CoceHost CoceProviders addRecord delSingleRecord PREF_BrowseResultSelection resetSearchContext addBibToContext delBibToContext getContextBiblioNumbers MSG_NO_ITEM_SELECTED MSG_NO_ITEM_SELECTED holdfor_cardnumber holdforclub strQuery MSG_NON_RESERVES_SELECTED PREF_NotHighlightedWords PLACE_HOLD */
2
3
if( PREF_AmazonCoverImages ){
4
    $(window).load(function() {
5
        verify_images();
6
    });
7
}
8
9
var Sticky;
10
var toHighlight = {};
11
var q_array;
12
13
$(document).ready(function() {
14
15
    $(".moretoggle").click(function(e) {
16
        e.preventDefault();
17
        $(this).siblings(".collapsible-facet").toggle();
18
        $(this).siblings(".moretoggle").toggle();
19
        $(this).toggle();
20
    });
21
22
    Sticky = $("#searchheader");
23
    Sticky.hcSticky({
24
        stickTo: "main",
25
        stickyClass: "floating"
26
    });
27
28
    $("#cartsubmit").click(function(e){
29
        e.preventDefault();
30
        addMultiple();
31
    });
32
33
    $(".addtolist").on("click",function(e){
34
        e.preventDefault();
35
        var shelfnumber = $(this).data("shelfnumber");
36
        var vshelf = vShelfAdd();
37
        if( vshelf ){
38
            if( $(this).hasClass("morelists") ){
39
                openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?' + vshelf);
40
            } else if( $(this).hasClass("newlist") ){
41
                openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?newshelf=1&' + vshelf);
42
            } else {
43
                openWindow('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&' + vshelf);
44
            }
45
        }
46
    });
47
48
    $("#z3950submit").click(function(){
49
        PopupZ3950();
50
        return false;
51
    });
52
53
    $("#searchheader").on("click", ".browse_selection", function(){
54
        browse_selection();
55
        return false;
56
    });
57
58
    $("#searchheader").on("click",".placehold", function(){
59
        $("#holdFor").val("");
60
        $("#holdForClub").val("");
61
        placeHold();
62
        $(".btn-group").removeClass("open");
63
        return false;
64
    });
65
66
    $(".placeholdfor").click(function(){
67
        holdForPatron();
68
        $(".btn-group").removeClass("open");
69
        return false;
70
    });
71
72
    $(".placeholdforclub").click(function(){
73
        holdForClub();
74
        $(".btn-group").removeClass("open");
75
        return false;
76
    });
77
78
    $("#forgetholdfor, #forgetholdforclub").click(function(){
79
        forgetPatronAndClub();
80
        $(".btn-group").removeClass("open");
81
        return false;
82
    });
83
84
    $(".selection").show();
85
86
    if( search_result.query_desc ){
87
        toHighlight = $("p,span.results_summary,a.title");
88
        q_array = search_result.query_desc.split(" ");
89
        // ensure that we don't have "" at the end of the array, which can
90
        // break the highlighter
91
        while ( q_array.length > 0 && q_array[q_array.length-1] == "") {
92
            q_array = q_array.splice(0,-1);
93
        }
94
        highlightOn();
95
        $("#highlight_toggle_on" ).hide().click(function(e) {
96
            e.preventDefault();
97
            highlightOn();
98
        });
99
        $("#highlight_toggle_off").show().click(function(e) {
100
            e.preventDefault();
101
            highlightOff();
102
        });
103
    }
104
105
    if( SEARCH_RESULTS ){
106
        var browser = KOHA.browser( search_result.searchid, parseInt( biblionumber, 10));
107
        browser.create( search_result.first_result_number, search_result.query_cgi, search_result.limit_cgi, search_result.sort_cgi, new_results_browser, search_result.total );
108
    }
109
110
    if( search_result.gotoPage && search_result.gotoNumber){
111
        if( search_result.gotoNumber == 'first' ){
112
            window.location = "/cgi-bin/koha/catalogue/" + search_result.gotoPage + "?biblionumber=" + search_result.first_biblionumber + "&searchid=" + search_result.searchid;
113
        } else if( search_result.gotoNumber == "last" ){
114
            window.location = "/cgi-bin/koha/catalogue/" + search_result.gotoPage + "?biblionumber=" + search_result.last_biblionumber + "&searchid=" + search_result.searchid;
115
        }
116
    }
117
118
    if( PREF_LocalCoverImages ){
119
        KOHA.LocalCover.LoadResultsCovers();
120
    }
121
122
    if( PREF_IntranetCoce && PREF_CoceProviders ){
123
        KOHA.coce.getURL( CoceHost, CoceProviders );
124
    }
125
126
    $("#select_all").on("click",function(e){
127
        e.preventDefault();
128
        selectAll();
129
    });
130
131
    $("#clear_all").on("click",function(e){
132
        e.preventDefault();
133
        clearAll();
134
    });
135
136
    $("#searchresults").on("click",".addtocart",function(e){
137
        e.preventDefault();
138
        var selection_id = this.id;
139
        var biblionumber = selection_id.replace("cart","");
140
        addRecord(biblionumber);
141
    });
142
143
    $("#searchresults").on("click",".cartRemove",function(e){
144
        e.preventDefault();
145
        var selection_id = this.id;
146
        var biblionumber = selection_id.replace("cartR","");
147
        delSingleRecord(biblionumber);
148
    });
149
150
    if( !PREF_BrowseResultSelection ){
151
        resetSearchContext();
152
    }
153
154
    $(".selection").change(function(){
155
        if ( $(this).is(':checked') == true ) {
156
            addBibToContext( $(this).val() );
157
        } else {
158
            delBibToContext( $(this).val() );
159
        }
160
    });
161
    $("#bookbag_form").ready(function(){
162
        $("#bookbag_form").unCheckCheckboxes();
163
        var bibnums = getContextBiblioNumbers();
164
        if (bibnums) {
165
            for (var i=0; i < bibnums.length; i++) {
166
                var id = ('#bib' + bibnums[i]);
167
                if ($(id)) {
168
                    $(id).attr('checked', true);
169
                }
170
            }
171
        }
172
    });
173
});
174
175
176
function highlightOff() {
177
    if( toHighlight.length > 0 ){
178
        toHighlight.removeHighlight();
179
        $(".highlight_toggle").toggle();
180
    }
181
}
182
183
function highlightOn() {
184
    if( toHighlight.length > 0 ){
185
        var x;
186
        for (x in q_array) {
187
            q_array[x] = q_array[x].toLowerCase();
188
            var myStopwords = PREF_NotHighlightedWords.toLowerCase().split('|');
189
            if ( (q_array[x].length > 0) && ($.inArray(q_array[x], myStopwords) == -1) ) {
190
                toHighlight.highlight(q_array[x]);
191
            }
192
        }
193
        $(".highlight_toggle").toggle();
194
    }
195
}
196
197
198
function selectAll () {
199
    $("#bookbag_form").checkCheckboxes();
200
    $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
201
        $(this).change();
202
    } );
203
    return false;
204
}
205
function clearAll () {
206
    $("#bookbag_form").unCheckCheckboxes();
207
    $("#bookbag_form").find("input[type='checkbox'][name='biblionumber']").each(function(){
208
        $(this).change();
209
    } );
210
    return false;
211
}
212
function placeHold () {
213
    var checkedItems = $(".selection:checked");
214
    if ($(checkedItems).size() == 0) {
215
        alert(MSG_NO_ITEM_SELECTED);
216
        return false;
217
    }
218
    var bibs = "";
219
    var badBibs = false;
220
    $(checkedItems).each(function() {
221
        var bib = $(this).val();
222
        if ($("#reserve_" + bib).size() == 0) {
223
            alert(MSG_NON_RESERVES_SELECTED);
224
            badBibs = true;
225
            return false;
226
        }
227
        bibs += bib + "/";
228
    });
229
    if (badBibs) {
230
        return false;
231
    }
232
    $("#hold_form_biblios").val(bibs);
233
    $("#hold_form").submit();
234
    return false;
235
}
236
237
function forgetPatronAndClub(){
238
    $.removeCookie("holdfor", { path: '/' });
239
    $.removeCookie("holdforclub", { path: '/' });
240
    $(".holdforlink").remove();
241
    $("#placeholdc").html("<a class=\"btn btn-default btn-xs placehold\" href=\"#\"><i class=\"fa fa-sticky-note-o\"></i> " + PLACE_HOLD + "</a>");
242
}
243
244
function browse_selection () {
245
    var bibnums = getContextBiblioNumbers();
246
    if ( bibnums && bibnums.length > 0 ) {
247
        var browser = KOHA.browser('', parseInt( biblionumber, 10));
248
        browser.create(1, search_result.query_cgi, search_result.limit_cgi, search_result.sort_cgi, bibnums, bibnums.length);
249
        window.location = '/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + bibnums[0] + '&searchid='+browser.searchid;
250
    } else {
251
        alert(MSG_NO_ITEM_SELECTED);
252
    }
253
    return false;
254
}
255
256
function addToList () {
257
    var checkedItems = $(".selection:checked");
258
    if ($(checkedItems).size() == 0) {
259
        alert(MSG_NO_ITEM_SELECTED);
260
        return false;
261
    }
262
    var bibs = "";
263
    $(checkedItems).each(function() {
264
        bibs += $(this).val() + "/";
265
    });
266
267
    var url = "/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?biblionumbers=" + bibs;
268
    window.open(url, 'Add_to_virtualshelf', 'width=500, height=400, toolbar=false, scrollbars=yes');
269
    return false;
270
}
271
272
/* this function open a popup to search on z3950 server.  */
273
function PopupZ3950() {
274
    if( strQuery ){
275
        window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=" + biblionumber + strQuery,"z3950search",'width=740,height=450,location=yes,toolbar=no,scrollbars=yes,resize=yes');
276
    }
277
}
278
279
function holdfor(){
280
    $("#holdFor").val("");
281
    $("#holdForClub").val("");
282
    placeHold();
283
}
284
285
function holdForPatron() {
286
    $("#holdFor").val( holdfor_cardnumber );
287
    placeHold();
288
}
289
290
function holdForClub() {
291
    $("#holdForClub").val( holdforclub );
292
    placeHold();
293
}
294
295
// http://www.oreillynet.com/pub/a/javascript/2003/10/21/amazonhacks.html
296
function verify_images() {
297
    $("img").each(function(){
298
        if ((this.src.indexOf('images-amazon.com') >= 0) || (this.src.indexOf('images.amazon.com') >=0)) {
299
            var w = this.width;
300
            var h = this.height;
301
            if ((w == 1) || (h == 1)) {
302
                $(this).parent().html('<span class="no-image">No cover image available</span>');
303
            } else if ((this.complete != null) && (!this.complete)) {
304
                $(this).parent().html('<span class="no-image">No cover image available</span>');
305
            }
306
        }
307
    });
308
}

Return to bug 23885