dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22838
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11112: Only display datasets which have data elements with formulas in aggregate query builder.
------------------------------------------------------------
revno: 11112
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-05-30 16:42:05 +0700
message:
Only display datasets which have data elements with formulas in aggregate query builder.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowUpdateCaseAggregationConditionFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java 2013-02-07 08:12:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/AddCaseAggregationConditionAction.java 2013-05-30 09:42:05 +0000
@@ -68,6 +68,8 @@
private Integer deSumId;
+ private Integer dataSetId;
+
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
@@ -77,6 +79,16 @@
this.aggregationConditionService = aggregationConditionService;
}
+ public Integer getDataSetId()
+ {
+ return dataSetId;
+ }
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
public void setDataElementService( DataElementService dataElementService )
{
this.dataElementService = dataElementService;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java 2013-05-30 02:42:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAllCaseAggregationConditionAction.java 2013-05-30 09:42:05 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
@@ -105,20 +106,24 @@
throws Exception
{
dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
+ aggregationConditions = aggregationConditionService.getAllCaseAggregationCondition();
+
+ for ( CaseAggregationCondition aggCondition : aggregationConditions )
+ {
+ DataElement dataElement = aggCondition.getAggregationDataElement();
+
+ dataSets.addAll( dataElement.getDataSets() );
+ }
Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
- if ( dataSetId == null )
+ if ( dataSetId != null )
{
- aggregationConditions = aggregationConditionService.getAllCaseAggregationCondition();
+ DataSet dataSet = dataSetService.getDataSet( dataSetId );
- return SUCCESS;
+ aggregationConditions = aggregationConditionService.getCaseAggregationCondition( dataSet.getDataElements() );
}
-
- DataSet dataSet = dataSetService.getDataSet( dataSetId );
-
- aggregationConditions = aggregationConditionService.getCaseAggregationCondition( dataSet.getDataElements() );
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowUpdateCaseAggregationConditionFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowUpdateCaseAggregationConditionFormAction.java 2012-03-16 07:50:14 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/ShowUpdateCaseAggregationConditionFormAction.java 2013-05-30 09:42:05 +0000
@@ -28,12 +28,15 @@
package org.hisp.dhis.patient.action.caseaggregation;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
import org.hisp.dhis.caseaggregation.CaseAggregationConditionService;
import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementService;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
import org.hisp.dhis.patient.PatientAttribute;
@@ -82,6 +85,8 @@
private List<DataSet> dataSets;
private List<Program> programs;
+
+ private DataSet dataSet;
// -------------------------------------------------------------------------
// Getters && Setters
@@ -151,6 +156,11 @@
// Action implementation
// -------------------------------------------------------------------------
+ public DataSet getDataSet()
+ {
+ return dataSet;
+ }
+
@Override
public String execute()
throws Exception
@@ -167,6 +177,16 @@
caseAggregation = aggregationConditionService.getCaseAggregationCondition( id );
description = aggregationConditionService.getConditionDescription( caseAggregation.getAggregationExpression() );
+ DataElement dataelement = caseAggregation.getAggregationDataElement();
+ for ( DataSet _dataSet : dataSets )
+ {
+ if ( _dataSet.getDataElements().contains( dataelement ) )
+ {
+ dataSet = _dataSet;
+ break;
+ }
+ }
+
return SUCCESS;
}
}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2013-02-07 08:12:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/UpdateCaseAggregationConditionAction.java 2013-05-30 09:42:05 +0000
@@ -69,16 +69,28 @@
private String aggregationDataElementId;
private Integer deSumId;
+
+ private Integer dataSetId;
// -------------------------------------------------------------------------
// Getters && Setters
// -------------------------------------------------------------------------
-
+
public void setAggregationConditionService( CaseAggregationConditionService aggregationConditionService )
{
this.aggregationConditionService = aggregationConditionService;
}
+ public Integer getDataSetId()
+ {
+ return dataSetId;
+ }
+
+ public void setDataSetId( Integer dataSetId )
+ {
+ this.dataSetId = dataSetId;
+ }
+
public void setId( Integer id )
{
this.id = id;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm 2013-03-10 15:03:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm 2013-05-30 09:42:05 +0000
@@ -9,8 +9,9 @@
<h3>$i18n.getString( "create_new_aggregation_query_builder" )</h3>
-<form id="addCaseAggregationForm" action="addCaseAggregation.action" method="post" >
+<form id="addCaseAggregationForm" action="addCaseAggregation.action" method="post" onsubmit='setFieldValue("dataSetId",getFieldValue("dataSets") );' >
+<input type='hidden' id='dataSetId' name='dataSetId'>
<table>
<thead>
<tr>
@@ -104,7 +105,7 @@
<p>
<input type="submit" value="$i18n.getString( 'add' )" />
<input type="button" value="$i18n.getString( 'test_condition' )" onclick='testCaseAggregationCondition();'/>
- <input type="button" value="$i18n.getString( 'cancel' )" onClick="window.location.href='caseAggregation.action?dataSetId=$!dataSetId'" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onClick="cancelOnClick();" />
</p>
</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-05-17 08:47:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-05-30 09:42:05 +0000
@@ -544,3 +544,8 @@
}
}
+function cancelOnClick()
+{
+ var dataSetId = getFieldValue("dataSets");
+ window.location.href='caseAggregation.action?dataSetId=' + dataSetId;
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2013-03-10 15:03:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm 2013-05-30 09:42:05 +0000
@@ -9,9 +9,10 @@
<h3>$i18n.getString( "edit_aggregation_query_builder" )</h3>
-<form id="updateCaseAggregationForm" action="updateCaseAggregation.action" method="post" >
+<form id="updateCaseAggregationForm" action="updateCaseAggregation.action" method="post" onsubmit='setFieldValue("dataSetId",getFieldValue("dataSets") );' >
<input type='hidden' id='id' name='id' value='$caseAggregation.id'>
+<input type='hidden' id='dataSetId' name='dataSetId' value='$dataSet.id'>
<table>
<thead>
<tr>
@@ -31,8 +32,8 @@
<td>
<select id="dataSets" name="dataSets" onchange="getDataElementsByDataset();">
<option value="">[$i18n.getString('please_select')]</option>
- #foreach( $dataSet in $dataSets)
- <option value="$dataSet.id" #if( $dataSetId=="$dataSet.id") selected #end >$dataSet.displayName</option>
+ #foreach( $ds in $dataSets)
+ <option value="$ds.id" #if( $dataSet.id=="$ds.id") selected #end >$ds.displayName</option>
#end
</select>
</td>
@@ -105,7 +106,7 @@
<p>
<input type="submit" value="$i18n.getString( 'update' )" >
<input type="button" value="$i18n.getString( 'test_condition' )" onclick='testCaseAggregationCondition();'/>
- <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='caseAggregation.action?dataSetId=$!dataSetId'" >
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="cancelOnClick();" >
</p>
</form>