Bugzilla – Attachment 18657 Details for
Bug 9747
sort issue for the z3950 results
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9747 - sort issue for the z3950 results
0001-Bug-9747-Fix-sorting-issues-on-z3950-search-results.patch (text/plain), 3.58 KB, created by
Fridolin Somers
on 2013-06-05 07:37:48 UTC
(
hide
)
Description:
Bug 9747 - sort issue for the z3950 results
Filename:
MIME Type:
Creator:
Fridolin Somers
Created:
2013-06-05 07:37:48 UTC
Size:
3.58 KB
patch
obsolete
>From cad6ea7cfc66a4f3caddeb2e81cb247be36ed583 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 5 Mar 2013 13:52:20 +0100 >Subject: [PATCH] Bug 9747: Fix sorting issues on z3950 search results >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >At least the BNF server returns results containing non-sorting >characters (NSB SNE). >In order to sort results according these characters, this patch adds a >new Datatable function. > >Test plan: >- search 'tintin' on the z3950 search (cataloguing/z3950_search.pl) >- sort on title (default sort) and check that results are not well > sorted. >- apply this patch >- do the same search and check that the first result is "Hergé. Les > Aventures de Tintin..." > The value of the cell is: > <td>ÂHergé. Les ÂAventures de Tintin...</td> > >Signed-off-by: Fridolyn SOMERS <fridolyn.somers@biblibre.com> >--- > koha-tmpl/intranet-tmpl/prog/en/js/datatables.js | 25 +++++++++++++++++++- > .../prog/en/modules/acqui/z3950_search.tt | 2 ++ > .../prog/en/modules/cataloguing/z3950_search.tt | 1 + > 3 files changed, 27 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >index 703944e..021b27c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/datatables.js >@@ -493,4 +493,27 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, { > "title-string-desc": function ( a, b ) { > return ((a < b) ? 1 : ((a > b) ? -1 : 0)); > } >-} ); >\ No newline at end of file >+} ); >+/* Plugin to allow sorting by removing prefix between NSB and NSE characters >+* >+* Ex: "\x88The \x89Lord of the rings" sorted with "L" >+* Mainly used in BNF catalogue >+* >+* In DataTables config: >+* "aoColumns": [ >+* { "sType": "nsb-nse" }, >+* ] >+*/ >+jQuery.extend( jQuery.fn.dataTableExt.oSort, { >+ "nsb-nse-pre": function ( a ) { >+ var pattern = new RegExp("\x88.*\x89"); >+ return a.replace(pattern, "").toLowerCase(); >+ }, >+ "nsb-nse-asc": function ( a, b ) { >+ return jQuery.fn.dataTableExt.oSort['string-asc'](a, b); >+ }, >+ "nsb-nse-desc": function ( a, b ) { >+ return jQuery.fn.dataTableExt.oSort['string-desc'](a, b); >+ } >+} ); >+ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >index 7ce0222..698f4b0 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/z3950_search.tt >@@ -15,7 +15,9 @@ > var resultst = $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, { > "aoColumnDefs": [ > { "aTargets": [ -1, -2 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 1 ], "sType": "nsb-nse" }, > ], >+ "aaSorting": [[ 1, "asc" ]], > "bPaginate": false > } ) ); > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >index 7e5b0af..d8d370e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_search.tt >@@ -33,6 +33,7 @@ $(document).ready(function(){ > "sDom": 't', > "aoColumnDefs": [ > { "aTargets": [ -1,-2,-3 ], "bSortable": false, "bSearchable": false }, >+ { "aTargets": [ 1 ], "sType": "nsb-nse" }, > ], > "aaSorting": [[ 1, "asc" ]], > "bPaginate": false >-- >1.7.10.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9747
:
15889
|
16361
|
16461
|
18655
|
18656
|
18657
|
18669