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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/datatables-strings.inc (+1 lines)
Lines 13-17 Link Here
13
    var MSG_DT_PROCESSING = _("Processing...");
13
    var MSG_DT_PROCESSING = _("Processing...");
14
    var MSG_DT_SEARCH = _("Search:");
14
    var MSG_DT_SEARCH = _("Search:");
15
    var MSG_DT_ZERO_RECORDS = _("No matching records found");
15
    var MSG_DT_ZERO_RECORDS = _("No matching records found");
16
    var CONFIG_EXCLUDE_ARTICLES_FROM_SORT = _("a an the");
16
//]]>
17
//]]>
17
</script>
18
</script>
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js (-1 / +45 lines)
Lines 493-496 jQuery.extend( jQuery.fn.dataTableExt.oSort, { Link Here
493
    "title-string-desc": function ( a, b ) {
493
    "title-string-desc": function ( a, b ) {
494
        return ((a < b) ? 1 : ((a > b) ? -1 : 0));
494
        return ((a < b) ? 1 : ((a > b) ? -1 : 0));
495
    }
495
    }
496
} );
496
} );
497
498
(function() {
499
500
    /* Plugin to allow text sorting to ignore articles
501
     *
502
     * In DataTables config:
503
     *     "aoColumns": [
504
     *        { "sType": "anti-the" },
505
     *      ]
506
     * Based on the plugin found here:
507
     * http://datatables.net/plug-ins/sorting#anti_the
508
     * Modified to exclude HTML tags from sorting
509
     * Extended to accept a string of space-separated articles
510
     * from a configuration file (in English, "a," "an," and "the")
511
     */
512
513
    if(CONFIG_EXCLUDE_ARTICLES_FROM_SORT){
514
        var articles = CONFIG_EXCLUDE_ARTICLES_FROM_SORT.split(" ");
515
        var rpattern = "";
516
        for(i=0;i<articles.length;i++){
517
            rpattern += "^" + articles[i] + " ";
518
            if(i < articles.length - 1){ rpattern += "|"; }
519
        }
520
        var re = new RegExp(rpattern, "i");
521
    }
522
523
    jQuery.extend( jQuery.fn.dataTableExt.oSort, {
524
        "anti-the-pre": function ( a ) {
525
            var x = String(a).replace( /<[\s\S]*?>/g, "" );
526
            var y = x.trim();
527
            var z = y.replace(re, "").toLowerCase();
528
            return z;
529
        },
530
531
        "anti-the-asc": function ( a, b ) {
532
            return ((a < b) ? -1 : ((a > b) ? 1 : 0));
533
        },
534
535
        "anti-the-desc": function ( a, b ) {
536
            return ((a < b) ? 1 : ((a > b) ? -1 : 0));
537
        }
538
    });
539
540
}());
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/readingrec.tt (-2 / +14 lines)
Lines 8-20 Link Here
8
<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
8
<script type="text/javascript" src="[% interface %]/[% theme %]/en/js/datatables.js"></script>
9
<script type="text/javascript" id="js">
9
<script type="text/javascript" id="js">
10
//<![CDATA[
10
//<![CDATA[
11
11
 $(document).ready(function() {
12
 $(document).ready(function() {
12
    [% IF (dateformat == 'metric') %]
13
    [% IF (dateformat == 'metric') %]
13
        dt_add_type_uk_date();
14
        dt_add_type_uk_date();
14
    [% END %]
15
    [% END %]
15
    $("#table_readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
16
    $("#table_readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
16
        "sPaginationType": "four_button",
17
        "sPaginationType": "four_button",
17
        "aaSorting": []
18
        "aaSorting": [],
19
        "aoColumns": [
20
            null,
21
            { "sType": "anti-the" },
22
            null,
23
            null,
24
            null,
25
            null,
26
            null,
27
            null,
28
            null,
29
            null
30
        ]
18
    }));
31
    }));
19
 });
32
 });
20
//]]>
33
//]]>
21
- 

Return to bug 5766