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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc (+52 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 96-101 $.widget.bridge('uitooltip', $.ui.tooltip); Link Here
96
        "[% interface %]/[% theme %]/lib/enquire.min.js",
97
        "[% interface %]/[% theme %]/lib/enquire.min.js",
97
        "[% interface %]/[% theme %]/js/script.js"
98
        "[% interface %]/[% theme %]/js/script.js"
98
    ]);
99
    ]);
100
    $(document).ready(function() {
101
        var query_xlate = {
102
            "kw": _("Keyword"),
103
            "su": _("Subject"),
104
            "su,phr": _("Subject phrase"),
105
            "su-br": _("Subject and broader terms"),
106
            "su-na": _("Subject and narrower terms"),
107
            "su-rl": _("Subject and related terms"),
108
            "ti": _("Title"),
109
            "ti,phr": _("Title phrase"),
110
            "se": _("Series"),
111
            "se,wrdl": _("Series title"),
112
            "callnum": _("Call Number"),
113
            "location": _("Shelving location"),
114
            "au": _("Author"),
115
            "au,phr": _("Author phrase"),
116
            "cpn": _("Corporate name"),
117
            "cfn": _("Conference name"),
118
            "cfn,phr": _("Conference name phrase"),
119
            "pn": _("Personal name"),
120
            "pn,phr": _("Personal name phrase"),
121
            "nt": _("Notes/Comments"),
122
            "curriculum": _("Curriculum"),
123
            "pb": _("Publisher"),
124
            "pl": _("Publisher location"),
125
            "sn": _("Standard number"),
126
            "nb": _("ISBN"),
127
            "ns": _("ISSN"),
128
            "bc": _("Barcode")
129
        };
130
        var limit_xlate = {
131
            "mc-itype": _("Type"),
132
            "ln": _("Language"),
133
            "branch": _("Branch"),
134
            "aud": _("Audience"),
135
            "l-format": _("Format"),
136
            "ctype": _("Content Type"),
137
            "yr": _("Year")
138
        };
139
        var limit_qualifier_xlate = {
140
            "wrdl": "",
141
            "phr": "",
142
            "rtrn": "",
143
            "st-numeric": "",
144
            "ge=": ">=",
145
            "le=": "<="
146
        };
147
        KOHA.Search.init(query_xlate, limit_xlate, limit_qualifier_xlate);
148
149
        KOHA.Search.search_set_select('select[name="idx"]');
150
    });
99
</script>
151
</script>
100
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
152
[% IF ( OPACAmazonCoverImages || SyndeticsCoverImages ) %]
101
<script type="text/javascript">//<![CDATA[
153
<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 865-873 $(document).ready(function(){ Link Here
865
[% END %]
865
[% END %]
866
866
867
[% IF ( query_desc ) %]
867
[% IF ( query_desc ) %]
868
    var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
868
    [% IF ( searchdesc ) %]
869
        var query_desc_xlate = KOHA.Search.query_xlate("[% query_desc %]");
870
        $(".query_desc_xlate").text(query_desc_xlate);
871
    [% END %]
869
    var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
872
    var querystring = "[% querystring |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
870
    [% IF ( OpacHighlightedWords ) %]
873
    [% IF ( OpacHighlightedWords ) %]
874
        var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
871
        q_array = query_desc.split(" ");
875
        q_array = query_desc.split(" ");
872
        // ensure that we don't have "" at the end of the array, which can
876
        // ensure that we don't have "" at the end of the array, which can
873
        // break the highlighter
877
        // break the highlighter
Lines 896-901 $(document).ready(function(){ Link Here
896
        } );
900
        } );
897
    [% END %]
901
    [% END %]
898
[% END %]
902
[% END %]
903
[% IF ( limit_desc ) %]
904
    [% IF ( searchdesc ) %]
905
        var limit_desc_xlate = KOHA.Search.limit_xlate("[% limit_desc %]");
906
        $(".limit_desc_xlate").text(limit_desc_xlate);
907
    [% END %]
908
[% END %]
899
909
900
[% IF ( TagsInputEnabled && loggedinusername ) %]
910
[% IF ( TagsInputEnabled && loggedinusername ) %]
901
    $("#tagsel_tag").click(function(){
911
    $("#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