dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15356
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5534: Only show number-dataelements for program-stage validation.
------------------------------------------------------------
revno: 5534
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-22 09:47:09 +0700
message:
Only show number-dataelements for program-stage validation.
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
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/programValidation.js
--
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
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/caseaggregation/GetAggPSDataElementsAction.java 2011-12-22 02:47:09 +0000
@@ -0,0 +1,155 @@
+/*
+ * 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.patient.action.caseaggregation;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.hisp.dhis.caseaggregation.CaseAggregationCondition;
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.program.ProgramStageDataElementService;
+import org.hisp.dhis.program.ProgramStageService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $Id: GetAggPSDataElementsAction.java Dec 22, 2011 9:24:49 AM $
+ */
+public class GetAggPSDataElementsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ProgramStageService programStageService;
+
+ public void setProgramStageService( ProgramStageService programStageService )
+ {
+ this.programStageService = programStageService;
+ }
+
+ private ProgramStageDataElementService programStageDataElementService;
+
+ public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
+ {
+ this.programStageDataElementService = programStageDataElementService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<String> optionComboNames;
+
+ public List<String> getOptionComboNames()
+ {
+ return optionComboNames;
+ }
+
+ private List<String> optionComboIds;
+
+ public List<String> getOptionComboIds()
+ {
+ return optionComboIds;
+ }
+
+ private List<String> optionComboType;
+
+ public List<String> getOptionComboType()
+ {
+ return optionComboType;
+ }
+
+ private Integer psId;
+
+ public void setPsId( Integer psId )
+ {
+ this.psId = psId;
+ }
+
+ private List<DataElement> dataElementList;
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ optionComboNames = new ArrayList<String>();
+
+ optionComboIds = new ArrayList<String>();
+
+ optionComboType = new ArrayList<String>();
+
+ dataElementList = new ArrayList<DataElement>( programStageDataElementService
+ .getListDataElement( programStageService.getProgramStage( psId ) ) );
+
+ if ( dataElementList != null && !dataElementList.isEmpty() )
+ {
+ Iterator<DataElement> deIterator = dataElementList.iterator();
+
+ while ( deIterator.hasNext() )
+ {
+ DataElement de = deIterator.next();
+
+ if ( de.getType().equals( DataElement.VALUE_TYPE_INT ) )
+ {
+ DataElementCategoryCombo dataElementCategoryCombo = de.getCategoryCombo();
+
+ List<DataElementCategoryOptionCombo> optionCombos = new ArrayList<DataElementCategoryOptionCombo>(
+ dataElementCategoryCombo.getOptionCombos() );
+
+ Iterator<DataElementCategoryOptionCombo> optionComboIterator = optionCombos.iterator();
+
+ while ( optionComboIterator.hasNext() )
+ {
+ DataElementCategoryOptionCombo decoc = optionComboIterator.next();
+
+ optionComboIds.add( "[" + CaseAggregationCondition.OBJECT_PROGRAM_STAGE_DATAELEMENT + ":"
+ + psId + "." + de.getId() + "." + decoc.getId() + "]" );
+
+ optionComboNames.add( de.getName() + " " + decoc.getName() );
+
+ if ( de.isMultiDimensional() )
+ optionComboType.add( "1:" + de.getType() );
+ else
+ optionComboType.add( "0:" + de.getType() );
+ }
+ }
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-12-20 11:55:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2011-12-22 02:47:09 +0000
@@ -624,6 +624,18 @@
ref="org.hisp.dhis.program.ProgramStageDataElementService" />
</bean>
+
+ <bean
+ id="org.hisp.dhis.patient.action.caseaggregation.GetAggPSDataElementsAction"
+ class="org.hisp.dhis.patient.action.caseaggregation.GetAggPSDataElementsAction"
+ scope="prototype">
+ <property name="programStageService">
+ <ref bean="org.hisp.dhis.program.ProgramStageService" />
+ </property>
+ <property name="programStageDataElementService"
+ ref="org.hisp.dhis.program.ProgramStageDataElementService" />
+ </bean>
+
<bean
id="org.hisp.dhis.patient.action.caseaggregation.RemoveCaseAggregationConditionAction"
class="org.hisp.dhis.patient.action.caseaggregation.RemoveCaseAggregationConditionAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-11-03 02:20:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2011-12-22 02:47:09 +0000
@@ -721,6 +721,13 @@
/dhis-web-maintenance-patient/responseAggDataElement.vm
</result>
</action>
+
+ <action name="getAggPSDataElements"
+ class="org.hisp.dhis.patient.action.caseaggregation.GetAggPSDataElementsAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-maintenance-patient/responseAggDataElement.vm
+ </result>
+ </action>
<action name="getCaseAggregation"
class="org.hisp.dhis.patient.action.caseaggregation.GetCaseAggregationConditionAction">
=== 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 2011-10-05 09:19:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2011-12-22 02:47:09 +0000
@@ -91,7 +91,7 @@
var programStage = document.getElementById( 'programStage' );
var psId = programStage.options[ programStage.selectedIndex ].value;
- $.post( 'getPSDataElements.action', { psId:psId }, getPrgramStageDataElementsCompleted );
+ $.post( 'getAggDataElements.action', { psId:psId }, getPrgramStageDataElementsCompleted );
}
function getPrgramStageDataElementsCompleted( dataelementElement )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2011-10-04 08:53:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2011-12-22 02:47:09 +0000
@@ -96,7 +96,7 @@
if( psId == '') return;
$.ajax({
- url: 'getPSDataElements.action?psId=' + psId,
+ url: 'getAggPSDataElements.action?psId=' + psId,
dataType: "xml",
success: getLeftPrgramStageDataElementsCompleted
});
@@ -135,7 +135,7 @@
if( psId == '') return;
$.ajax({
- url: 'getPSDataElements.action?psId=' + psId,
+ url: 'getAggPSDataElements.action?psId=' + psId,
dataType: "xml",
success: getRightPrgramStageDataElementsCompleted
});