=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/CaseAggregationResultAction.java 2010-12-03 06:08:58 +0000 @@ -30,8 +30,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Date; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,13 +45,14 @@ import org.hisp.dhis.dataset.DataSetService; import org.hisp.dhis.datavalue.DataValue; import org.hisp.dhis.datavalue.DataValueService; +import org.hisp.dhis.i18n.I18n; +import org.hisp.dhis.i18n.I18nFormat; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitShortNameComparator; import org.hisp.dhis.oust.manager.SelectionTreeManager; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.period.PeriodType; import org.hisp.dhis.user.CurrentUserService; import com.opensymphony.xwork2.Action; @@ -105,6 +108,20 @@ this.currentUserService = currentUserService; } + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + private I18n i18n; + + public void setI18n( I18n i18n ) + { + this.i18n = i18n; + } + // --------------------------------------------------------------- // Input & Output Parameters // --------------------------------------------------------------- @@ -130,78 +147,95 @@ this.facilityLB = facilityLB; } - private String selectedDataSets; - - public void setSelectedDataSets( String selectedDataSets ) - { - this.selectedDataSets = selectedDataSets; - } - - private String resultMessage; - - public String getResultMessage() - { - return resultMessage; - } - - private DataSet selDataSet; - - private OrganisationUnit selOrgUnit; - - private List orgUnitList; - - private List dataElementList; - - private List periodList; - - private String storedBy; - - // --------------------------------------------------------------- + private List periods; + + public List getPeriods() + { + return periods; + } + + public void setPeriods( List periods ) + { + this.periods = periods; + } + + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + + private Map mapDataValues; + + public Map getMapDataValues() + { + return mapDataValues; + } + + // ------------------------------------------------------------------------- // Action Implementation - // --------------------------------------------------------------- + // ------------------------------------------------------------------------- + public String execute() throws Exception { - storedBy = currentUserService.getCurrentUsername() + "_CAE"; - - resultMessage = ""; - - // DataSet and DataElement - selDataSet = dataSetService.getDataSet( Integer.parseInt( selectedDataSets ) ); - dataElementList = new ArrayList( selDataSet.getDataElements() ); - - selOrgUnit = selectionTreeManager.getReloadedSelectedOrganisationUnit(); - - orgUnitList = new ArrayList(); + mapDataValues = new HashMap(); + + String storedBy = currentUserService.getCurrentUsername() + "_CAE"; + // --------------------------------------------------------------------- + // Get selected orgunits + // --------------------------------------------------------------------- + + OrganisationUnit selectedOrgunit = selectionTreeManager.getReloadedSelectedOrganisationUnit(); + + if ( selectedOrgunit == null ) + { + return SUCCESS; + } + + List orgUnitList = new ArrayList(); if ( facilityLB.equals( "children" ) ) { - orgUnitList = getChildOrgUnitTree( selOrgUnit ); + orgUnitList = getChildOrgUnitTree( selectedOrgunit ); } else if ( facilityLB.equals( "immChildren" ) ) { - orgUnitList.add( selOrgUnit ); - List organisationUnits = new ArrayList( selOrgUnit.getChildren() ); + orgUnitList.add( selectedOrgunit ); + List organisationUnits = new ArrayList( selectedOrgunit.getChildren() ); Collections.sort( organisationUnits, new OrganisationUnitShortNameComparator() ); orgUnitList.addAll( organisationUnits ); } else { - orgUnitList.add( selOrgUnit ); - } - - // Period Related Info - Period startPeriod = periodService.getPeriod( sDateLB ); - Period endPeriod = periodService.getPeriod( eDateLB ); - - PeriodType dataSetPeriodType = selDataSet.getPeriodType(); - periodList = new ArrayList( periodService.getIntersectingPeriodsByPeriodType( dataSetPeriodType, - startPeriod.getStartDate(), endPeriod.getEndDate() ) ); - - // Orgunit Iteration for Aggregation + orgUnitList.add( selectedOrgunit ); + } + + // --------------------------------------------------------------------- + // Get DataElement list of selected dataset + // --------------------------------------------------------------------- + + DataSet selectedDataSet = dataSetService.getDataSet( dataSetId ); + + List dataElementList = new ArrayList( selectedDataSet.getDataElements() ); + + // --------------------------------------------------------------------- + // Get selected periods list + // --------------------------------------------------------------------- + + List periodList = new ArrayList(); + + if ( sDateLB != -1 && eDateLB != -1 ) + { + periodList = periods.subList( sDateLB, eDateLB + 1 ); + } + + // --------------------------------------------------------------------- + // Aggregation + // --------------------------------------------------------------------- for ( OrganisationUnit orgUnit : orgUnitList ) { - for ( DataElement dElement : dataElementList ) { List deCOCList = new ArrayList( @@ -217,21 +251,22 @@ for ( Period period : periodList ) { + String message = i18n.getString( "in" ) + " " + format.formatPeriod( period ); + double resultValue = aggregationConditionService.parseConditition( condition, orgUnit, period ); - + if ( resultValue != 0 ) { - String tempStr = "" + orgUnit.getName() + "_" + dElement.getName() + "_" - + period.getStartDate() + "_"; DataValue dataValue = dataValueService .getDataValue( orgUnit, dElement, period, optionCombo ); + if ( dataValue == null ) { dataValue = new DataValue( dElement, period, orgUnit, "" + resultValue, storedBy, new Date(), null, optionCombo ); dataValueService.addDataValue( dataValue ); - tempStr += resultValue + "Added."; + mapDataValues.put( dataValue, i18n.getString( "added" ) + " " + message ); } else { @@ -240,11 +275,10 @@ dataValue.setStoredBy( storedBy ); dataValueService.updateDataValue( dataValue ); - tempStr += resultValue + "Updated."; + + mapDataValues.put( dataValue, i18n.getString( "updated" ) + " " + message ); } - System.out.println( tempStr ); - resultMessage += "
" + tempStr; } }// PeriodList end === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetDataSetPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetDataSetPeriodsAction.java 2010-11-29 02:04:22 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetDataSetPeriodsAction.java 1970-01-01 00:00:00 +0000 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2004-2010, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.caseentry.action.caseaggregation; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Date; -import java.util.Iterator; -import java.util.List; - -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.period.Period; -import org.hisp.dhis.period.PeriodService; -import org.hisp.dhis.period.PeriodType; -import org.hisp.dhis.period.comparator.PeriodComparator; - -import com.opensymphony.xwork2.Action; - -public class GetDataSetPeriodsAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private PeriodService periodService; - - public void setPeriodService( PeriodService periodService ) - { - this.periodService = periodService; - } - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - // ------------------------------------------------------------------------- - // Input & output - // ------------------------------------------------------------------------- - - private Integer selectedDataSets; - - public void setSelectedDataSets( Integer selectedDataSets ) - { - this.selectedDataSets = selectedDataSets; - } - - private List periods; - - public List getPeriods() - { - return periods; - } - - private List periodNameList; - - public List getPeriodNameList() - { - return periodNameList; - } - - private SimpleDateFormat simpleDateFormat1; - - private SimpleDateFormat simpleDateFormat2; - - private PeriodType periodType; - - public PeriodType getPeriodType() - { - return periodType; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - periodNameList = new ArrayList(); - - DataSet dSet = dataSetService.getDataSet( selectedDataSets ); - periodType = dSet.getPeriodType(); - - periods = new ArrayList( periodService.getPeriodsByPeriodType( periodType ) ); - - Iterator periodIterator = periods.iterator(); - while ( periodIterator.hasNext() ) - { - Period p1 = periodIterator.next(); - - if ( p1.getStartDate().compareTo( new Date() ) > 0 ) - { - periodIterator.remove(); - } - - } - - Collections.sort( periods, new PeriodComparator() ); - - if ( periodType.getName().equalsIgnoreCase( "monthly" ) ) - { - simpleDateFormat1 = new SimpleDateFormat( "MMM-yyyy" ); - for ( Period p1 : periods ) - { - // if ( p1.getStartDate().compareTo( new Date() ) <= 0 ) - periodNameList.add( simpleDateFormat1.format( p1.getStartDate() ) ); - - } - - } - else if ( periodType.getName().equalsIgnoreCase( "quarterly" ) ) - { - simpleDateFormat1 = new SimpleDateFormat( "MMM" ); - simpleDateFormat2 = new SimpleDateFormat( "MMM-yyyy" ); - - for ( Period p1 : periods ) - { - // if ( p1.getStartDate().compareTo( new Date() ) <= 0 ) - { - String tempPeriodName = simpleDateFormat1.format( p1.getStartDate() ) + " - " - + simpleDateFormat2.format( p1.getEndDate() ); - periodNameList.add( tempPeriodName ); - } - } - } - /* - * else if(periodType.getName().equalsIgnoreCase("yearly")) { - * simpleDateFormat1 = new SimpleDateFormat( "yyyy" ); for(Period p1 : - * periods) { periodNameList.add( - * simpleDateFormat1.format(p1.getStartDate() ) ); } } - */ - - else if ( periodType.getName().equalsIgnoreCase( "yearly" ) ) - { - simpleDateFormat1 = new SimpleDateFormat( "yyyy" ); - int year; - for ( Period p1 : periods ) - { - // if ( p1.getStartDate().compareTo( new Date() ) <= 0 ) - { - year = Integer.parseInt( simpleDateFormat1.format( p1.getStartDate() ) ) + 1; - periodNameList.add( simpleDateFormat1.format( p1.getStartDate() ) + "-" + year ); - } - } - } - else - { - simpleDateFormat1 = new SimpleDateFormat( "yyyy-mm-dd" ); - for ( Period p1 : periods ) - { - // if ( p1.getStartDate().compareTo( new Date() ) <= 0 ) - { - String tempPeriodName = simpleDateFormat1.format( p1.getStartDate() ) + " - " - + simpleDateFormat1.format( p1.getEndDate() ); - periodNameList.add( tempPeriodName ); - } - } - } - - return SUCCESS; - } - -} === removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetOrgUnitsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetOrgUnitsAction.java 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/GetOrgUnitsAction.java 1970-01-01 00:00:00 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2004-2010, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package org.hisp.dhis.caseentry.action.caseaggregation; - -import org.hisp.dhis.organisationunit.OrganisationUnit; -import org.hisp.dhis.organisationunit.OrganisationUnitService; - -import com.opensymphony.xwork2.ActionSupport; - -public class GetOrgUnitsAction - extends ActionSupport -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private OrganisationUnitService organisationUnitService; - - public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) - { - this.organisationUnitService = organisationUnitService; - } - - // ------------------------------------------------------------------------- - // Getters & Setters - // ------------------------------------------------------------------------- - - private Integer orgUnitId; - - public void setOrgUnitId( Integer orgUnitId ) - { - this.orgUnitId = orgUnitId; - } - - private OrganisationUnit orgUnit; - - public OrganisationUnit getOrgUnit() - { - return orgUnit; - } - - private Integer orgUnitLevel; - - public Integer getOrgUnitLevel() - { - return orgUnitLevel; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() throws Exception - { - /* OrganisationUnit */ - if ( orgUnitId != null ) - { - orgUnit = organisationUnitService.getOrganisationUnit( orgUnitId ); - } - - orgUnitLevel = organisationUnitService.getLevelOfOrganisationUnit( orgUnit ); - - return SUCCESS; - } - -} === added file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/LoadPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/LoadPeriodsAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseaggregation/LoadPeriodsAction.java 2010-12-03 06:08:58 +0000 @@ -0,0 +1,109 @@ +package org.hisp.dhis.caseentry.action.caseaggregation; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Date; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.period.CalendarPeriodType; +import org.hisp.dhis.period.Period; + +import com.opensymphony.xwork2.Action; + +public class LoadPeriodsAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List periods = new ArrayList(); + + public Collection getPeriods() + { + return periods; + } + + private boolean periodValid; + + public boolean isPeriodValid() + { + return periodValid; + } + + private Collection significantZeros = new HashSet(); + + public Collection getSignificantZeros() + { + return significantZeros; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + DataSet selectedDataSet = dataSetService.getDataSet( dataSetId ); + + if ( selectedDataSet != null ) + { + periods = getPeriodList( (CalendarPeriodType) selectedDataSet.getPeriodType() ); + } + + return SUCCESS; + } + + // ------------------------------------------------------------------------- + // Support method + // ------------------------------------------------------------------------- + + private List getPeriodList( CalendarPeriodType periodType ) + { + Period basePeriod = periodType.createPeriod(); + + List periods = periodType.generatePeriods( basePeriod ); + + Date now = new Date(); + + Iterator iterator = periods.iterator(); + + while ( iterator.hasNext() ) + { + if ( iterator.next().getStartDate().after( now ) ) + { + iterator.remove(); + } + } + + return periods; + } + +} === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2010-12-03 06:08:58 +0000 @@ -1,399 +1,367 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2010-11-29 07:29:38 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2010-12-03 06:08:58 +0000 @@ -475,3 +475,10 @@ immediate_children = Immediate Children child_tree = Child Tree aggregate = Aggregate +added = Added +updated = Updated +in = in +value = Value +status = Status +no_value_added_or_update = No values added or updated. +greater_then_from_date = This field is greater then from date. === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2010-12-02 03:44:08 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml 2010-12-03 06:08:58 +0000 @@ -223,18 +223,16 @@ /dhis-web-caseentry/caseAggregationMenu.vm javascript/caseagg.js,javascript/date.js - - - /dhis-web-caseentry/responseOrgUnit.vm - plainTextError - - - - /dhis-web-caseentry/dSetResponsePeriod.vm - plainTextError - - - + + + /dhis-web-caseentry/responsePeriods.vm + + + + caseAggregationResultChain + + + /main.vm /dhis-web-caseentry/caseAggregationResult.vm /dhis-web-caseentry/menu.vm === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm 2010-11-25 22:22:10 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationForm.vm 2010-12-03 06:08:58 +0000 @@ -1,11 +1,26 @@

$i18n.getString( "case_aggregation_form" )

-
+
@@ -14,8 +29,8 @@ $i18n.getString( "dataset_list" ) @@ -37,8 +52,10 @@ $i18n.getString( "to" ) +
- + #foreach ( $dataSet in $datasets ) #end @@ -28,7 +43,7 @@ $i18n.getString( "from" ) - +
- + +
@@ -72,5 +89,5 @@ \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm 2010-04-12 08:28:26 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/caseAggregationResult.vm 2010-12-03 06:08:58 +0000 @@ -1,2 +1,31 @@ - -
$resultMessage
\ No newline at end of file +
+ +
+

+
+#if( $mapDataValues.keySet().size() > 0 ) + + + + + + + + #set ( $keys = $mapDataValues.keySet() ) + #set ($index = 1) + #foreach( $key in $keys) + + + + + + + #set ($index = $index + 1) + #end +
#$i18n.getString('name')$i18n.getString('value')$i18n.getString('status')
$index$key.dataElement.getName()$key.getValue()$mapDataValues.get($key)
+ +#else + $i18n.getString('no_value_added_or_update') +#end + +
\ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2010-11-29 02:04:22 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/caseagg.js 2010-12-03 06:08:58 +0000 @@ -1,132 +1,29 @@ - -// Removes slected orgunits from the Organisation List -function remOUFunction() -{ - var ouList = document.getElementById("orgUnitListCB"); - var index = ouList.options.length; - var i=0; - for(i=index-1;i>=0;i--) - { - if(ouList.options[i].selected) - ouList.options[i] = null; - } -}// remOUFunction end - - -//Getting corresponding Period List for Datasets. -function getdSetPeriods() -{ - var dataSetList = document.getElementById("selectedDataSets"); - var dataSetId = dataSetList.options[ dataSetList.selectedIndex].value; - - if(dataSetId == '0') - { - return; - } - - var url = "getDataSetPeriods.action?selectedDataSets=" + dataSetId; - - var request = new Request(); - request.setResponseTypeXML( 'period' ); - request.setCallbackSuccess( getdSetPeriodsReceived ); - request.send( url ); -} - - -function getdSetPeriodsReceived( xmlObject ) -{ - var sDateLB = document.getElementById( "sDateLB" ); - var eDateLB = document.getElementById( "eDateLB" ); - - - var periods = xmlObject.getElementsByTagName( "period" ); - - for ( var i = 0; i < periods.length; i++) +function dataSetSelected() +{ + var dataSetId = $( '#dataSetId' ).val(); + var periodFrom = $( '#sDateLB' ).val(); + var periodTo = $( '#eDateLB' ).val(); + + if ( dataSetId && dataSetId != 0 ) { - var periodType = periods[ i ].getElementsByTagName( "periodtype" )[0].firstChild.nodeValue; - - if(i ==0 ) - { - if( periodType == curPeriodType ) - { - break; - } - else - { - curPeriodType = periodType; - clearList( sDateLB ); - clearList( eDateLB ); - } - } - - - var id = periods[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue; - var periodName = periods[ i ].getElementsByTagName( "periodname" )[0].firstChild.nodeValue; - - var option1 = document.createElement( "option" ); - option1.value = id; - option1.text = periodName; - sDateLB.add( option1, null ); + var url = 'loadPeriods.action?dataSetId=' + dataSetId; + + var listStartPeriod = document.getElementById( 'sDateLB' ); + var listEndPeriod = document.getElementById( 'eDateLB' ); + + clearList( listStartPeriod ); + clearList( listEndPeriod ); + + addOptionToList( listStartPeriod, '', '[' + i18n_please_select + ']' ); + addOptionToList( listEndPeriod, '', '[' + i18n_please_select + ']' ); + + $.getJSON( url, function( json ) { - var option2 = document.createElement( "option" ); - option2.value = id; - option2.text = periodName; - eDateLB.add( option2, null); - } -} - - -function getOrgUDetails(orgUnitIds) -{ - var url = "getOrgUnitDetails.action?orgUnitId=" + orgUnitIds; - - var request = new Request(); - request.setResponseTypeXML( 'orgunit' ); - request.setCallbackSuccess( getOrgUDetailsRecevied ); - request.send( url ); -} - -function getOrgUDetailsRecevied(xmlObject) -{ - var ouList = document.getElementById("orgUnitListCB"); - var orgUnits = xmlObject.getElementsByTagName("orgunit"); - - clearList(ouList); - - for ( var i = 0; i < orgUnits.length; i++ ) - { - var id = orgUnits[ i ].getElementsByTagName("id")[0].firstChild.nodeValue; - var orgUnitName = orgUnits[ i ].getElementsByTagName("name")[0].firstChild.nodeValue; - - ouList.options[0] = new Option(orgUnitName,id,false,false); - } -} - -//CaseAgg Form Validations -function formValidationsForCaseAggMapping() -{ - var selOUListIndex = document.caseAggregationForm.orgUnitListCB.options.length; - var selDSListSize = document.caseAggregationForm.selectedDataSets.options.length; - - sDateIndex = document.caseAggregationForm.sDateLB.selectedIndex; - eDateIndex = document.caseAggregationForm.eDateLB.selectedIndex; - sDateTxt = document.caseAggregationForm.sDateLB.options[sDateIndex].text; - sDate = formatDate(new Date(getDateFromFormat(sDateTxt,"MMM - y")),"yyyy-MM-dd"); - eDateTxt = document.caseAggregationForm.eDateLB.options[eDateIndex].text; - eDate = formatDate(new Date(getDateFromFormat(eDateTxt,"MMM - y")),"yyyy-MM-dd"); - if(selOUListIndex <= 0) {alert("Please Select OrganisationUnit"); return false;} - else if(selDSListSize <= 0) {alert("Please Select DataSet"); return false;} - else if(sDateIndex < 0) {alert("Please Select Starting Period"); return false;} - else if(eDateIndex < 0) {alert("Please Select Ending Period"); return false;} - else if(sDate > eDate) {alert("Starting Date is Greater"); return false;} - - var k=0; - - for(k=0;k