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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+53 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 %]/js/search.js"></script>
88
<script type="text/javascript">
89
<script type="text/javascript">
89
    Modernizr.load([
90
    Modernizr.load([
90
        // Test need for polyfill
91
        // Test need for polyfill
Lines 99-104 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
99
100
100
    // Fix for datepicker in a modal
101
    // Fix for datepicker in a modal
101
    $.fn.modal.Constructor.prototype.enforceFocus = function () {};
102
    $.fn.modal.Constructor.prototype.enforceFocus = function () {};
103
104
    $(document).ready(function() {
105
        var query_xlate = {
106
            "kw": _("Keyword"),
107
            "su": _("Subject"),
108
            "su,phr": _("Subject phrase"),
109
            "su-br": _("Subject and broader terms"),
110
            "su-na": _("Subject and narrower terms"),
111
            "su-rl": _("Subject and related terms"),
112
            "ti": _("Title"),
113
            "ti,phr": _("Title phrase"),
114
            "se": _("Series"),
115
            "se,wrdl": _("Series title"),
116
            "callnum": _("Call Number"),
117
            "location": _("Shelving location"),
118
            "au": _("Author"),
119
            "au,phr": _("Author phrase"),
120
            "cpn": _("Corporate name"),
121
            "cfn": _("Conference name"),
122
            "cfn,phr": _("Conference name phrase"),
123
            "pn": _("Personal name"),
124
            "pn,phr": _("Personal name phrase"),
125
            "nt": _("Notes/Comments"),
126
            "curriculum": _("Curriculum"),
127
            "pb": _("Publisher"),
128
            "pl": _("Publisher location"),
129
            "sn": _("Standard number"),
130
            "nb": _("ISBN"),
131
            "ns": _("ISSN"),
132
            "bc": _("Barcode")
133
        };
134
        var limit_xlate = {
135
            "mc-itype": _("Type"),
136
            "ln": _("Language"),
137
            "branch": _("Branch"),
138
            "aud": _("Audience"),
139
            "l-format": _("Format"),
140
            "ctype": _("Content Type"),
141
            "yr": _("Year")
142
        };
143
        var limit_qualifier_xlate = {
144
            "wrdl": "",
145
            "phr": "",
146
            "rtrn": "",
147
            "st-numeric": "",
148
            "ge=": ">=",
149
            "le=": "<="
150
        };
151
        KOHA.Search.init(query_xlate, limit_xlate, limit_qualifier_xlate);
152
153
        KOHA.Search.search_set_select('select[name="idx"]');
154
    });
102
</script>
155
</script>
103
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
156
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
104
<script type="text/javascript">//<![CDATA[
157
<script type="text/javascript">//<![CDATA[
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results-grouped.tt (-1 / +11 lines)
Lines 20-26 href="/cgi-bin/koha/opac-rss.pl?[% query_cgi %][% limit_cgi |html %]" /> Link Here
20
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
20
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
21
            <li>
21
            <li>
22
                [% IF ( searchdesc ) %]
22
                [% IF ( searchdesc ) %]
23
                    <a href="#">Results of search [% IF ( query_desc ) %]for '[% query_desc | html %]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]</a>
23
                    <a href="#">Results of search [% IF ( query_desc ) %]for '<span class="query_desc_xlate">[% query_desc | html %]</span>'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'<span class="limit_desc_xlate">[% limit_desc | html %]</span>'[% END %]</a>
24
                [% ELSE %]
24
                [% ELSE %]
25
                    <a href="#">You did not specify any search criteria.</a>
25
                    <a href="#">You did not specify any search criteria.</a>
26
                [% END %]
26
                [% END %]
Lines 323-328 $(document).ready(function(){ Link Here
323
        return false;
323
        return false;
324
    });
324
    });
325
    [% IF ( query_desc ) %]
325
    [% IF ( query_desc ) %]
326
        [% IF ( searchdesc ) %]
327
            var query_desc_xlate = KOHA.Search.query_xlate("[% query_desc %]");
328
            $(".query_desc_xlate").text(query_desc_xlate);
329
        [% END %]
326
    var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
330
    var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
327
    q_array = query_desc.split(" ");
331
    q_array = query_desc.split(" ");
328
    // ensure that we don't have "" at the end of the array, which can
332
    // ensure that we don't have "" at the end of the array, which can
Lines 334-339 $(document).ready(function(){ Link Here
334
    $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
338
    $("#highlight_toggle_on" ).hide().click(function() {highlightOn() ;});
335
    $("#highlight_toggle_off").show().click(function() {highlightOff();});
339
    $("#highlight_toggle_off").show().click(function() {highlightOff();});
336
    [% END %]
340
    [% END %]
341
    [% IF ( limit_desc ) %]
342
        [% IF ( searchdesc ) %]
343
            var limit_desc_xlate = KOHA.Search.limit_xlate("[% limit_desc %]");
344
            $(".limit_desc_xlate").text(limit_desc_xlate);
345
        [% END %]
346
    [% END %]
337
});
347
});
338
348
339
function highlightOff() {
349
function highlightOff() {
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (-2 / +12 lines)
Lines 27-33 Link Here
27
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
27
            <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
28
            <li>
28
            <li>
29
                [% IF ( searchdesc ) %]
29
                [% IF ( searchdesc ) %]
30
                    <a href="#">Results of search [% IF ( query_desc ) %]for '[% query_desc | html%]'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'[% limit_desc | html %]'[% END %]</a>
30
                    <a href="#">Results of search [% IF ( query_desc ) %]for '<span class="query_desc_xlate">[% query_desc | html%]</span>'[% END %][% IF ( limit_desc ) %]&nbsp;with limit(s):&nbsp;'<span class="limit_desc_xlate">[% limit_desc | html %]</span>'[% END %]</a>
31
                [% ELSE %]
31
                [% ELSE %]
32
                    <a href="#">You did not specify any search criteria</a>
32
                    <a href="#">You did not specify any search criteria</a>
33
                [% END %]
33
                [% END %]
Lines 864-872 $(document).ready(function(){ Link Here
864
[% END %]
864
[% END %]
865
865
866
[% IF ( query_desc ) %]
866
[% IF ( query_desc ) %]
867
    var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
867
    [% IF ( searchdesc ) %]
868
        var query_desc_xlate = KOHA.Search.query_xlate("[% query_desc %]");
869
        $(".query_desc_xlate").text(query_desc_xlate);
870
    [% END %]
868
    var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
871
    var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
869
    [% IF ( OpacHighlightedWords ) %]
872
    [% IF ( OpacHighlightedWords ) %]
873
        var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
870
        q_array = query_desc.split(" ");
874
        q_array = query_desc.split(" ");
871
        // ensure that we don't have "" at the end of the array, which can
875
        // ensure that we don't have "" at the end of the array, which can
872
        // break the highlighter
876
        // break the highlighter
Lines 912-917 $(document).ready(function(){ Link Here
912
        } );
916
        } );
913
    [% END %]
917
    [% END %]
914
[% END %]
918
[% END %]
919
[% IF ( limit_desc ) %]
920
    [% IF ( searchdesc ) %]
921
        var limit_desc_xlate = KOHA.Search.limit_xlate("[% limit_desc %]");
922
        $(".limit_desc_xlate").text(limit_desc_xlate);
923
    [% END %]
924
[% END %]
915
925
916
[% IF ( TagsInputEnabled && loggedinusername ) %]
926
[% IF ( TagsInputEnabled && loggedinusername ) %]
917
    $("#tagsel_tag").click(function(){
927
    $("#tagsel_tag").click(function(){
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/search.js (-1 / +57 lines)
Line 0 Link Here
0
- 
1
if ( typeof KOHA == "undefined" || !KOHA ) {
2
    var KOHA = {};
3
}
4
5
KOHA.Search = new function() {
6
    this.query_xlate_table = {};
7
    this.limit_xlate_table = {};
8
    this.limit_qualifier_xlate_table = {};
9
10
    this.init = function(query_xlate_table, limit_xlate_table, limit_qualifier_xlate_table) {
11
        this.query_xlate_table = query_xlate_table;
12
        this.limit_xlate_table = limit_xlate_table;
13
        this.limit_qualifier_xlate_table = limit_qualifier_xlate_table;
14
    }
15
16
    this.search_set_select = function(select_el) {
17
        var query_xlate_table = this.query_xlate_table;
18
        $(select_el).children("option").each(function(index, el) {
19
            var val = $(el).attr("value");
20
            var label = query_xlate_table[val];
21
            if (label) {
22
                var html = $(el).html().replace(/[\w\s]*$/,label);
23
                $(el).html(html);
24
            }
25
        });
26
    };
27
28
    this.query_xlate = function(query_desc) {
29
        $.each(this.query_xlate_table, function (key, val) {
30
            var key_re = new RegExp('\\b' + key + ':', "g");
31
            query_desc = query_desc.replace(key_re, val + ':');
32
            if (!key.match(/,/)) {
33
                key_re = new RegExp('\\b' + key + ',wrdl:', "g");
34
                query_desc = query_desc.replace(key_re, val + ':');
35
            }
36
        });
37
        return query_desc;
38
    };
39
40
    this.limit_xlate = function(limit_desc) {
41
        $.each(this.limit_xlate_table, function (key, val) {
42
            var key_re = new RegExp('\\b' + key + ':', 'g');
43
            limit_desc = limit_desc.replace(key_re, val + ':');
44
            key_re = new RegExp('\\b' + key + ',', 'g');
45
            limit_desc = limit_desc.replace(key_re, val + ',');
46
        });
47
        $.each(this.limit_qualifier_xlate_table, function (key, val) {
48
            var repl = "";
49
            if (val) {
50
                repl = " " + val;
51
            }
52
            var key_re = new RegExp('\\b,' + key, 'g');
53
            limit_desc = limit_desc.replace(key_re, repl);
54
        });
55
        return limit_desc;
56
    };
57
}

Return to bug 15434