Ticket #1448: IP Address sorting was MFC'd from HEAD (this whole file

should probably be MFC'd)

MFC: to RELENG_1_2
This commit is contained in:
Bill Marquette 2007-10-05 21:11:53 +00:00
parent 7fa5fd2c81
commit 66eff923a3

View File

@ -69,6 +69,7 @@ function ts_resortTable(lnk) {
if (itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)) sortfn = ts_sort_date;
if (itm.match(/^[£$]/)) sortfn = ts_sort_currency;
if (itm.match(/^[\d\.]+$/)) sortfn = ts_sort_numeric;
if (itm.match(/^\s*[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/)) sortfn = ts_sortIpAddress;
SORT_COLUMN_INDEX = column;
var firstRow = new Array();
var newRows = new Array();
@ -149,6 +150,18 @@ function ts_sort_numeric(a,b) {
return aa-bb;
}
function ts_sortIpAddress(a, b) {
var oa = a.split(".");
var ob = b.split(".");
for(var i = 0; i < 4; i++) {
if(parseInt(oa[i]) < parseInt(ob[i])) return -1;
if(parseInt(oa[i]) > parseInt(ob[i])) return 1;
}
return 0;
}
function ts_sort_caseinsensitive(a,b) {
aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();