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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (-3 / +10 lines)
Lines 12-17 Link Here
12
    </script>
12
    </script>
13
[% END %]
13
[% END %]
14
14
15
[%# Define prefs we will need all around %]
16
<script>
17
    [% IF Koha.Preference('BrowseResultSelection') %]
18
        var global_pref_BrowseResultSelection = 1;
19
    [% ELSE %]
20
        var global_pref_BrowseResultSelection = 0;
21
    [% END %]
22
</script>
23
15
[% Asset.js("lib/jquery/jquery-2.2.3.min.js") %]
24
[% Asset.js("lib/jquery/jquery-2.2.3.min.js") %]
16
[% Asset.js("lib/jquery/jquery-migrate-1.3.0.min.js") %]
25
[% Asset.js("lib/jquery/jquery-migrate-1.3.0.min.js") %]
17
[% Asset.js("lib/jquery/jquery-ui-1.11.4.min.js") %]
26
[% Asset.js("lib/jquery/jquery-ui-1.11.4.min.js") %]
Lines 22-30 Link Here
22
[% Asset.js("lib/jquery/plugins/jquery.validate.min.js") %]
31
[% Asset.js("lib/jquery/plugins/jquery.validate.min.js") %]
23
<!-- koha core js -->
32
<!-- koha core js -->
24
[% Asset.js("js/staff-global.js") %]
33
[% Asset.js("js/staff-global.js") %]
25
[% IF Koha.Preference('BrowseResultSelection') %]
34
[% Asset.js("js/commons.js") %]
26
    [% Asset.js("js/commons.js") %]
27
[% END %]
28
35
29
[% INCLUDE 'validator-strings.inc' %]
36
[% INCLUDE 'validator-strings.inc' %]
30
[% IF ( IntranetUserJS ) %]
37
[% IF ( IntranetUserJS ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-8 / +9 lines)
Lines 773-788 Link Here
773
                delSingleRecord(biblionumber);
773
                delSingleRecord(biblionumber);
774
            });
774
            });
775
775
776
            [% UNLESS Koha.Preference('BrowseResultSelection') %]
776
            [% IF Koha.Preference('BrowseResultSelection') %]
777
                $(".selection").change(function(){
778
                    if ( $(this).is(':checked') == true ) {
779
                      addBibToContext( $(this).val() );
780
                    } else {
781
                      delBibToContext( $(this).val() );
782
                    }
783
                });
784
            [% ELSE %]
777
                resetSearchContext();
785
                resetSearchContext();
778
            [% END %]
786
            [% END %]
779
            $(".selection").change(function(){
780
                if ( $(this).is(':checked') == true ) {
781
                  addBibToContext( $(this).val() );
782
                } else {
783
                  delBibToContext( $(this).val() );
784
                }
785
            });
786
            $("#bookbag_form").ready(function(){
787
            $("#bookbag_form").ready(function(){
787
                $("#bookbag_form").unCheckCheckboxes();
788
                $("#bookbag_form").unCheckCheckboxes();
788
                var bibnums = getContextBiblioNumbers();
789
                var bibnums = getContextBiblioNumbers();
(-)a/koha-tmpl/intranet-tmpl/prog/js/commons.js (-14 / +24 lines)
Lines 27-32 function paramOfUrl( url, param ) { Link Here
27
}
27
}
28
28
29
function addBibToContext( bibnum ) {
29
function addBibToContext( bibnum ) {
30
    if ( ! global_pref_BrowseResultSelection ) return;
30
    bibnum = parseInt(bibnum, 10);
31
    bibnum = parseInt(bibnum, 10);
31
    var bibnums = getContextBiblioNumbers();
32
    var bibnums = getContextBiblioNumbers();
32
    bibnums.push(bibnum);
33
    bibnums.push(bibnum);
Lines 35-46 function addBibToContext( bibnum ) { Link Here
35
}
36
}
36
37
37
function delBibToContext( bibnum ) {
38
function delBibToContext( bibnum ) {
39
    if ( ! global_pref_BrowseResultSelection ) return;
38
    var bibnums = getContextBiblioNumbers();
40
    var bibnums = getContextBiblioNumbers();
39
    removeByValue( bibnums, bibnum );
41
    removeByValue( bibnums, bibnum );
40
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
42
    setContextBiblioNumbers( $.uniqueArray( bibnums ) );
41
}
43
}
42
44
43
function setContextBiblioNumbers( bibnums ) {
45
function setContextBiblioNumbers( bibnums ) {
46
    if ( ! global_pref_BrowseResultSelection ) return;
47
44
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
48
    $.cookie('bibs_selected', JSON.stringify( bibnums ));
45
}
49
}
46
50
Lines 54-73 function getContextBiblioNumbers() { Link Here
54
}
58
}
55
59
56
function resetSearchContext() {
60
function resetSearchContext() {
57
    setContextBiblioNumbers( new Array() );
61
    if ( global_pref_BrowseResultSelection ) {
62
        setContextBiblioNumbers( new Array() );
63
    } else {
64
        $.cookie('bibs_selected', '', { 'path': '/', 'expires': -1 });
65
    }
58
}
66
}
59
67
60
$(document).ready(function(){
68
$(document).ready(function(){
61
    // forms with action leading to search
69
62
    $("form[action*='search.pl']").submit(function(){
70
    if ( ! global_pref_BrowseResultSelection ) {
63
        resetSearchContext();
71
        // forms with action leading to search
64
    });
72
        $("form[action*='search.pl']").submit(function(){
65
    // any link to launch a search except navigation links
73
            resetSearchContext();
66
    $("[href*='search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
74
        });
67
        resetSearchContext();
75
        // any link to launch a search except navigation links
68
    });
76
        $("[href*='search.pl?']").not(".nav").not('.searchwithcontext').click(function(){
69
    // any link to a detail page from the results page.
77
            resetSearchContext();
70
    $("#bookbag_form a[href*='detail.pl?']").click(function(){
78
        });
71
        resetSearchContext();
79
        // any link to a detail page from the results page.
72
    });
80
        $("#bookbag_form a[href*='detail.pl?']").click(function(){
81
            resetSearchContext();
82
        });
83
    }
73
});
84
});
74
- 

Return to bug 21024