← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9854: Add operator buttons for calculated patient attribute and fix bug for description of expression.

 

------------------------------------------------------------
revno: 9854
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-02-20 20:46:42 +0700
message:
  Add operator buttons for calculated patient attribute and fix bug for description of expression.
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2013-02-18 03:04:47 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2013-02-20 13:46:42 +0000
@@ -202,13 +202,13 @@
     @Override
     public Collection<CaseAggregationCondition> getAllCaseAggregationCondition()
     {
-        return i18n( i18nService, aggregationConditionStore.getAll());
+        return i18n( i18nService, aggregationConditionStore.getAll() );
     }
 
     @Override
     public CaseAggregationCondition getCaseAggregationCondition( int id )
     {
-        return i18n( i18nService, aggregationConditionStore.get( id ));
+        return i18n( i18nService, aggregationConditionStore.get( id ) );
 
     }
 
@@ -221,14 +221,14 @@
     @Override
     public Collection<CaseAggregationCondition> getCaseAggregationCondition( DataElement dataElement )
     {
-        return i18n( i18nService, aggregationConditionStore.get( dataElement ));
+        return i18n( i18nService, aggregationConditionStore.get( dataElement ) );
     }
 
     @Override
     public CaseAggregationCondition getCaseAggregationCondition( DataElement dataElement,
         DataElementCategoryOptionCombo optionCombo )
     {
-        return i18n( i18nService, aggregationConditionStore.get( dataElement, optionCombo ));
+        return i18n( i18nService, aggregationConditionStore.get( dataElement, optionCombo ) );
     }
 
     @Override
@@ -438,8 +438,12 @@
                         return INVALID_CONDITION;
                     }
 
-                    matcher.appendReplacement( description,
-                        "[" + OBJECT_PROGRAM + SEPARATOR_OBJECT + program.getDisplayName() + "]" );
+                    String programDes = OBJECT_PROGRAM + SEPARATOR_ID + program.getDisplayName();
+                    if ( ids.length == 2 )
+                    {
+                        programDes += SEPARATOR_OBJECT + ids[1];
+                    }
+                    matcher.appendReplacement( description, "[" + programDes + "]" );
                 }
                 else if ( info[0].equalsIgnoreCase( OBJECT_PROGRAM_STAGE ) )
                 {
@@ -454,7 +458,6 @@
                     String count = (ids.length == 2) ? SEPARATOR_ID + ids[1] : "";
                     matcher.appendReplacement( description, "[" + OBJECT_PROGRAM_STAGE + SEPARATOR_OBJECT
                         + programStage.getDisplayName() + count + "]" );
-
                 }
             }
 
@@ -561,7 +564,7 @@
 
     public Collection<CaseAggregationCondition> getCaseAggregationCondition( Collection<DataElement> dataElements )
     {
-        return i18n( i18nService, aggregationConditionStore.get( dataElements ));
+        return i18n( i18nService, aggregationConditionStore.get( dataElements ) );
     }
 
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2012-12-21 09:23:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientAttributeForm.vm	2013-02-20 13:46:42 +0000
@@ -59,11 +59,22 @@
 	</tr>
 
 	<tr id="calculatedAttrTR" class="hidden">
-		<td>$i18n.getString( "params" )</td>
+		<td>$i18n.getString( "properties" )</td>
 		<td>
 			<select multiple id="availableAttribute" name="availableAttribute" ondblclick="insertTextCommon( 'expression', this.value);getConditionDescription();"></select>
 		</td>
 	</tr>
+	
+	<tr id="operatorTR" class="hidden">
+		<td></td>
+		<td>
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "+" );' value="+" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "-" );' value="-" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "*" );' value="*" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "/" );' value="/" />
+		</td>
+	</tr>
+	
 	<tr id="expressionTR" class="hidden">
 		<td>$i18n.getString( "expression" )</td>
 		<td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js	2013-02-01 08:40:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/patientAttribute.js	2013-02-20 13:46:42 +0000
@@ -36,6 +36,7 @@
 		{
 			hideById("calculatedAttrTR");
 			hideById("expressionTR");
+			hideById("operatorTR");
 			showById("attributeComboRow");
 			if( jQuery("#attrOptionContainer").find("input").length ==0 ) 
 			{
@@ -67,6 +68,7 @@
 			}
 			hideById("attributeComboRow");
 			showById("calculatedAttrTR");
+			showById("operatorTR");
 			showById("expressionTR");
 			showById("descriptionTR");
 		}
@@ -74,6 +76,7 @@
 		{
 			hideById("attributeComboRow");
 			hideById("calculatedAttrTR");
+			hideById("operatorTR");
 			hideById("expressionTR");
 			hideById("descriptionTR");
 		}
@@ -140,4 +143,10 @@
 		{
 			setInnerHTML('expDescription', html);
 		});
-}
\ No newline at end of file
+}
+
+function insertOperator( value )
+{
+	insertTextCommon('expression', ' ' + value + ' ' );
+	getConditionDescription();
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2012-12-21 09:23:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updatePatientAttibuteForm.vm	2013-02-20 13:46:42 +0000
@@ -69,17 +69,29 @@
 	</tr>
 	
 	<tr id="calculatedAttrTR">
-		<td>$i18n.getString( "params" )</td>
+		<td>$i18n.getString( "properties" )</td>
 		<td>
 			<select multiple id="availableAttribute" name="availableAttribute" ondblclick="insertTextCommon( 'expression', this.value);getConditionDescription();" ></select>
 		</td>
 	</tr>
+	
+	<tr id="operatorTR" class="hidden">
+		<td></td>
+		<td>
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "+" );' value="+" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "-" );' value="-" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "*" );' value="*" />
+			<input type='button' class="small-button" alt="$i18n.getString( 'plus' )" onclick='insertOperator( "/" );' value="/" />
+		</td>
+	</tr>
+	
 	<tr id="expressionTR" >
 		<td>$i18n.getString( "expression" )</td>
 		<td>
 			<textarea id="expression" name="expression" onkeyup='getConditionDescription();' style="width:320px;" >$!patientAttribute.expression</textarea>
 		</td>
 	</tr>
+	
 	<tr id="descriptionTR">
 		<td></td>
 		<td>