summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Marquette <billm@pfsense.org>2007-10-05 21:11:53 +0000
committerBill Marquette <billm@pfsense.org>2007-10-05 21:11:53 +0000
commit66eff923a353c2bc8d855083a3dd9e2562f7ea7b (patch)
tree0b3e3f27809ebf7e63ee05dbf87bc03b5b8c797f
parent7fa5fd2c810d58de98a9c58445e661cad099cac6 (diff)
downloadpfsense-66eff923a353c2bc8d855083a3dd9e2562f7ea7b.zip
pfsense-66eff923a353c2bc8d855083a3dd9e2562f7ea7b.tar.gz
Ticket #1448: IP Address sorting was MFC'd from HEAD (this whole file
should probably be MFC'd) MFC: to RELENG_1_2
-rw-r--r--usr/local/www/javascript/sorttable.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/usr/local/www/javascript/sorttable.js b/usr/local/www/javascript/sorttable.js
index 9995de0..bbcca46 100644
--- a/usr/local/www/javascript/sorttable.js
+++ b/usr/local/www/javascript/sorttable.js
@@ -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();
OpenPOWER on IntegriCloud