Completely rewritten table sorting script.
authorLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 21:47:00 +0000 (21:47 +0000)
committerLeo Koppelkamm <diebuche@users.mediawiki.org>
Thu, 14 Apr 2011 21:47:00 +0000 (21:47 +0000)
commit7d6ddfe836310c89469b339e18fef21114d80e70
tree4b1c59c80ca28630b076ba2270f0c9ca76f1ad38
parent32e0b5915081aaad3788c778790e9dd7eb4f53f9
Completely rewritten table sorting script.
Fixes Bug 8028, Bug 8115, Bug 15406, Bug 17141, Bug 8732

1. Sites can specify custom collations.
The script accepts an object "tableSorterCollation" which contains a lookup
table, how specific characters should be treated.
For example, after setting "tableSorterCollation={'ä':'ae', 'ß':'ss'};" in the
site's common.js any string containing an ä or Ä will be sorted as if it were a
'ae'.

2. Table rows can be forced to use a specific data type.
By setting class="sort-{Parsername}", the row will be parsed with the specified
algorithm. class="sort-date" would force date sorting etc.
The following parsers are available: text, IPAddress, number, url, currency,
date, isoDate, usLongDate, time

3. Execution time is reduced by half or more.

Sorting a 935 row * 8 columns table:

Browser     Before      After
--------    ------      -----
Chrome 10   90ms        42ms
Safari 5    115ms       48ms
Firefox 4   412ms       87ms
IE8         720ms       115ms

4. Based on the content language and the mdy vs dmy preference, the parser can
understand dates such as "17. März '11". wgMonthNames=[] and
wgMonthNamesShort=[]
in the content language and the mdy vs dmy preference are exported to js; A
table containing the following dates would be sorted correctly:
17. Jan. 01
23 Feb 1992
9.02.05
13 November 2001
14 Oktober '76

Was tested in ie6-8, chrome, safari 5, ff3 & ff4
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/Resources.php
resources/jquery/jquery.tablesorter.js [new file with mode: 0644]
resources/mediawiki.util/mediawiki.util.js
skins/common/images/sort_both.gif [new file with mode: 0644]
skins/common/images/sort_down.gif
skins/common/images/sort_up.gif
skins/common/shared.css
skins/common/wikibits.js