=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-01-06 09:03:29 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-01-10 06:17:21 +0000 @@ -914,7 +914,7 @@ { if(sortList==undefined) sortList = [[0,0]]; - jQuery("#" + tableId ).tablesorter(); + jQuery("#" + tableId ).tablesorter({dateFormat:dateFormat}); if($("#" + tableId ).find("tbody").children().size() > 0 ) { === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.ext.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.ext.js 2010-09-08 10:40:26 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.ext.js 2011-01-10 06:17:21 +0000 @@ -2,4 +2,25 @@ postJSON: function( url, data, callback ) { return jQuery.post(url, data, callback, "json"); } +}); + +$.tablesorter.addParser({ + id: "period", + is: function (s) { + return /\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s); + }, format: function (s, table, cell) { + var v = $(cell).attr('value'); + var c = table.config; + v = v.replace(/\-/g, "/"); + if (c.dateFormat == "us") { + // reformat the string in ISO format + v = v.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$1/$2"); + } else if (c.dateFormat == "uk") { + // reformat the string in ISO format + v = v.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3/$2/$1"); + } else if (c.dateFormat == "dd/mm/yy" || c.dateFormat == "dd-mm-yy") { + v = v.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$1/$2/$3"); + } + return $.tablesorter.formatFloat(new Date(v).getTime()); + }, type: "numeric" }); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2010-12-26 15:38:45 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2011-01-10 06:17:21 +0000 @@ -20,8 +20,7 @@ - - + @@ -31,6 +30,7 @@ + === modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm' --- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm 2011-01-07 03:46:17 +0000 +++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm 2011-01-10 06:17:21 +0000 @@ -16,7 +16,7 @@ $i18n.getString( "data_element" ) $i18n.getString( "organisation_unit" ) - $i18n.getString( "period" ) + $i18n.getString( "period" ) $i18n.getString( "min" ) $i18n.getString( "value" ) $i18n.getString( "max" ) @@ -32,7 +32,7 @@ $value.sourceName - $format.formatPeriod( $value.period ) + $format.formatPeriod( $value.period ) $value.min