=== modified file 'dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java' --- dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2010-09-08 05:46:03 +0000 +++ dhis-2/dhis-services/dhis-service-administration/src/test/java/org/hisp/dhis/databrowser/DataBrowserServiceTest.java 2010-09-08 11:00:18 +0000 @@ -31,8 +31,10 @@ import static junit.framework.Assert.assertNotNull; import static junit.framework.Assert.assertNotSame; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.period.MonthlyPeriodType; import org.hisp.dhis.period.PeriodService; -import org.junit.Ignore; +import org.hisp.dhis.period.PeriodType; import org.junit.Test; /** @@ -513,20 +515,22 @@ * format ); */ @Test - @Ignore public void testConvertDate() { - // To do - } - - /** - * String getFromToDateFormat( PeriodType periodType, String fromDate, - * String toDate, I18nFormat format ); - */ - @Test - @Ignore - public void getFromToDateFormat() - { - // To do + I18nFormat format = new I18nFormat(); + PeriodType monthlyPeriodType = periodService.getPeriodTypeByName( MonthlyPeriodType.NAME ); + + // Get all children of unit B from 2005-03-01 to 2005-04-30 registered + // on monthly basis (this should be period A and B data values) + DataBrowserTable table = dataBrowserService.getOrgUnitsInPeriod( unitB.getId(), "2005-03-01", "2005-04-30", + periodA.getPeriodType(), 4 ); + + assertNotNull( "DataBrowserTable not supposed to be null", table ); + assertEquals( "No. of queries", 3, table.getQueryCount() ); + assertNotSame( "Querytime more than 0", 0, table.getQueryTime() ); + + assertEquals( "Metacolumns", 3, table.getColumns().size() ); + assertEquals( "drilldown_organisation_unit", dataBrowserService.convertDate( monthlyPeriodType, table + .getColumns().get( 0 ).getName(), format ) ); } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java 2010-09-07 05:24:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/DataElementListFilteredByGroupForSection.java 2010-09-08 11:00:18 +0000 @@ -147,7 +147,6 @@ public String execute() throws Exception { - // dataSetId if ( dataSetId != null ) { @@ -180,21 +179,6 @@ } } - // if ( dataElementGroupId == null || dataElementGroupId.equals( ALL ) ) - // { - // dataElements = new ArrayList( - // dataElementService.getAllActiveDataElements() ); - // } - // else - // { - // DataElementGroup dataElementGroup = - // dataElementService.getDataElementGroup( Integer - // .parseInt( dataElementGroupId ) ); - // - // dataElements = new ArrayList( - // dataElementGroup.getMembers() ); - // } - // dataElementGroupId if ( dataElementGroupId == null || dataElementGroupId.equals( ALL ) ) { === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-09-07 05:24:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/struts.xml 2010-09-08 11:00:18 +0000 @@ -76,7 +76,7 @@ /main.vm /dhis-web-maintenance-dataset/editSection.vm /dhis-web-maintenance-dataset/menu.vm - javascript/dataSet.js + javascript/section.js + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-09-07 05:24:21 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-09-08 11:00:18 +0000 @@ -158,22 +158,25 @@ function filterByDataElementGroupForSection( groupId ) { - var request = new Request(); - - var requestString = 'filterDataElementsByDataElementGroupForSection.action'; - - var params = getParamString( 'selectedList' ); - params += 'dataElementGroupId=' + groupId; - params += '&dataSetId=' + getFieldValue( 'dataSetId' ); - params += '&categoryComboId=' + getFieldValue( 'categoryComboId' ); - - // Clear the list - clearListById( 'availableList' ); - - request.setResponseTypeXML( 'dataElementGroup' ); - request.setCallbackSuccess( filterByDataElementGroupForSectionCompleted ); - request.sendAsPost( params ); - request.send( requestString ); + var aSelectedList = new Array(); + var selectedList = byId( 'selectedList' ); + + for ( var i = 0; i < selectedList.options.length; ++i) + { + aSelectedList.push( selectedList.options[i].value ); + } + + $.post("filterDataElementsByDataElementGroupForSection.action", + { + selectedList: aSelectedList, + dataElementGroupId: groupId, + dataSetId: getFieldValue( 'dataSetId' ), + categoryComboId: getFieldValue( 'categoryComboId' ) + }, + function (data) + { + filterByDataElementGroupForSectionCompleted( data ); + }, 'xml'); } function filterByDataElementGroupForSectionCompleted( dataElementGroup ) @@ -182,6 +185,7 @@ var dataElementList = dataElements.getElementsByTagName( 'dataElement' ); var availableList = byId( 'availableList' ); + availableList.options.length = 0; for ( var i = 0; i < dataElementList.length; i++ ) {