← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6090: (patient) Allow select multi dataelements and attributes into suggestion-values fields for aggreg...

 

------------------------------------------------------------
revno: 6090
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-02-23 11:05:16 +0700
message:
  (patient) Allow select multi dataelements and attributes into suggestion-values fields for aggregate formulas.
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/resources/org/hisp/dhis/patient/i18n_module.properties
  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-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	2012-02-20 09:12:19 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/caseaggregation/DefaultCaseAggregationConditionService.java	2012-02-23 04:05:16 +0000
@@ -88,6 +88,10 @@
     private final String INVALID_CONDITION = "Invalid condition";
 
     private final String NUMBER_PATIENTS_REGISTERED = "Registered Beneficiaries No";
+    
+    private final String IN_CONDITION_START_SIGN = "@";
+    
+    private final String IN_CONDITION_END_SIGN = "#";
 
     // -------------------------------------------------------------------------
     // Dependencies
@@ -529,7 +533,8 @@
             subSQL.add( sql );
         }
 
-        return getSQL( aggregationCondition.getOperator(), subSQL, operators );
+         sql = getSQL( aggregationCondition.getOperator(), subSQL, operators ).replace( IN_CONDITION_START_SIGN, "(" ).replaceAll( IN_CONDITION_END_SIGN , ")" );
+         return sql;
     }
 
     private String createSQL( String aggregationExpression, String operator, int orgunitId, String startDate, String endDate )

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-02-23 02:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-02-23 04:05:16 +0000
@@ -246,4 +246,6 @@
 no_date_data_element_in_selected_program_stage=No data elements with date-type in the selected program stage
 shown_on_reports=Shown on reports 
 hide_provided_other_facility=Hide provided other facility
-suggested_values=Suggested values
\ No newline at end of file
+suggested_values=Suggested values
+back_to_main_menu = Back to main menu
+add_all_values = Add all values
\ No newline at end of file

=== 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	2012-02-16 01:26:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addCaseAggregation.vm	2012-02-23 04:05:16 +0000
@@ -124,9 +124,12 @@
 			<td>
 				<fieldset style="border: 1px solid #3f5d8e; ">
 				<legend>$i18n.getString( "suggested_values" )</legend>
-				<select multiple size="10" id='suggestedDEValues' style="width:20em; height: 17em" ondblclick="insertInfo(this);" >
+				<select multiple size="10" id='suggestedDEValues' style="width:20em; height: 17em" ondblclick="insertSingleValue('suggestedDEValues');" >
 				</select>
 			</td>
+			<td>
+				<img src="../images/move_down.png" alt="$i18n.getString( 'add_all_values' )" title="$i18n.getString( 'add_all_values' )" style='cursor:pointer;' onclick="insertMultiValues('suggestedDEValues');">
+			</td>
 		</tr>
 		</table>
 	</div>
@@ -141,7 +144,7 @@
 					<table>
 						<tr>
 							<td>
-								<select id="caseProperty" name="caseProperty" size="8" ondblclick="insertInfo(this);" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
+								<select id="caseProperty" name="caseProperty" size="8" ondblclick="insertSingleValue('caseProperty');" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
 									<option value="[PT:count]" suggestedValues=''>$i18n.getString( "patients_registered" )</option>
 									<option value="[CP:gender]" suggestedValues='F, M' title='$i18n.getString( "gender" )'>$i18n.getString( "gender" )</option>
 									<option value="[CP:dobType]" suggestedValues='V, D, A' title='$i18n.getString( "dob_type" )'>$i18n.getString( "dob_type" )</option>
@@ -164,7 +167,9 @@
 						</select>
 					</fieldset>
 				</td>
-				
+				<td>
+					<img src="../images/move_down.png" alt="$i18n.getString( 'add_all_values' )" title="$i18n.getString( 'add_all_values' )" style='cursor:pointer;' onclick="insertMultiValues('caSuggestedValues');">
+				</td>
 			</tr>
 		</table>
 	</div>
@@ -248,7 +253,6 @@
 			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 			<img src="../images/and.png" alt="$i18n.getString( 'and' )" onclick='insertOperator( "AND" );' style="cursor:pointer;"/>
 			<img src="../images/or.png" alt="$i18n.getString( 'or' )" onclick='insertOperator( "OR" );' style="cursor:pointer;"/>
-			<img src="../images/in.png" alt="$i18n.getString( 'in' )" onclick='insertOperator( "IN" );' style="cursor:pointer;"/>
 			
 			<img src="../images/clear.png" align="right" alt="$i18n.getString( 'clear' )" onclick="byId('aggregationCondition').value='';" style="cursor:pointer;"/>
 		</td>

=== 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	2012-02-23 03:01:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2012-02-23 04:05:16 +0000
@@ -243,7 +243,7 @@
 	{
 		var option = document.createElement("option");
 		var value = jQuery.trim( arrValues[i] );
-		option.value = "'=" + value + "'";
+		option.value = "'" + value + "'";
 		option.text = value;
 		option.title = value;
 
@@ -251,4 +251,30 @@
 	}
 }
 
+function insertSingleValue( elementId )
+{
+	var element = byId( elementId );
+	insertTextCommon('aggregationCondition', "=" + element.options[element.selectedIndex].value );
+	getConditionDescription();
+}
+
+function insertMultiValues( elementId )
+{
+	var list = jQuery('select[id=' + elementId + '] option:selected')
+	if( list.length > 1 )
+	{
+		var selectedValues = "";
+		list.each(function(){
+			selectedValues += jQuery(this).val() + ", ";
+		});
+		selectedValues = " IN @ " + selectedValues.substring( 0, selectedValues.length - 2) + " #";
+		
+		insertTextCommon('aggregationCondition', selectedValues );
+		getConditionDescription();
+	}
+	else
+	{
+		insertSingleValue( elementId );
+	}
+}
 

=== 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	2012-02-16 01:26:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateCaseAggregation.vm	2012-02-23 04:05:16 +0000
@@ -127,9 +127,12 @@
 			<td>
 				<fieldset style="border: 1px solid #3f5d8e; ">
 				<legend>$i18n.getString( "suggested_values" )</legend>
-				<select multiple size="10" id='suggestedDEValues' style="width:20em; height: 17em" ondblclick="insertInfo(this);" >
+				<select multiple size="10" id='suggestedDEValues' style="width:20em; height: 17em" ondblclick="insertSingleValue('suggestedDEValues');" >
 				</select>
 			</td>
+			<td>
+				<img src="../images/move_down.png" alt="$i18n.getString( 'add_all_values' )" title="$i18n.getString( 'add_all_values' )" style='cursor:pointer;' onclick="insertMultiValues('suggestedDEValues');">
+			</td>
 		</tr>
 		</table>
 	</div>
@@ -144,7 +147,7 @@
 					<table>
 						<tr>
 							<td>
-								<select id="caseProperty" name="caseProperty" size="8" ondblclick="insertInfo(this);" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
+								<select id="caseProperty" name="caseProperty" size="8" ondblclick="insertSingleValue('caseProperty');" style="width:18em; height:16.5em" onclick="getSuggestedValues(this.id, 'caSuggestedValues' )">
 									<option value="[PT:count]" suggestedValues=''>$i18n.getString( "patients_registered" )</option>
 									<option value="[CP:gender]" suggestedValues='F, M' title='$i18n.getString( "gender" )'>$i18n.getString( "gender" )</option>
 									<option value="[CP:dobType]" suggestedValues='V, D, A' title='$i18n.getString( "dob_type" )'>$i18n.getString( "dob_type" )</option>
@@ -167,7 +170,9 @@
 						</select>
 					</fieldset>
 				</td>
-				
+				<td>
+					<img src="../images/move_down.png" alt="$i18n.getString( 'add_all_values' )" title="$i18n.getString( 'add_all_values' )" style='cursor:pointer;' onclick="insertMultiValues('caSuggestedValues');">
+				</td>
 			</tr>
 		</table>
 	</div>
@@ -251,7 +256,6 @@
 			&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 			<img src="../images/and.png" alt="$i18n.getString( 'and' )" onclick='insertOperator( "AND" );' style="cursor:pointer;">
 			<img src="../images/or.png" alt="$i18n.getString( 'or' )" onclick='insertOperator( "OR" );' style="cursor:pointer;">
-			<img src="../images/in.png" alt="$i18n.getString( 'in' )" onclick='insertOperator( "IN" );' style="cursor:pointer;">
 			
 			<img src="../images/clear.png" align="right" alt="$i18n.getString( 'clear' )" onclick="byId('aggregationCondition').value='';" style="cursor:pointer;">
 		</td>