← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10867: Add data element value-types filter in Add/Update Aggregate Query Builder form

 

------------------------------------------------------------
revno: 10867
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-17 15:47:52 +0700
message:
  Add data element value-types filter in Add/Update Aggregate Query Builder form
modified:
  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/caseAggregationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.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
=== 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	2013-05-17 08:24:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2013-05-17 08:47:52 +0000
@@ -400,4 +400,5 @@
 minus_with_enrollmentDate = MINUS TO ENROLLMENT DATE
 and_operator = AND
 or_operator = OR
-combine_operator = COMBINE
\ No newline at end of file
+combine_operator = COMBINE
+filter_by_type = Filter by type
\ 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/caseAggregationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm	2013-05-17 08:24:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm	2013-05-17 08:47:52 +0000
@@ -9,7 +9,8 @@
 	  <table>
         <tr>
 			<td colspan='2'>
-				<input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDataElement(event, this.value, 'dataElements','dataElementBackups');" style='width:265px;'/>
+				$i18n.getString("filter_by_name"): 
+				<input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDataElement(event, this.value, 'dataElements','dataElementBackups');" style='width:185px;'/>
 				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchValue', '');" style='width:50px'>			
 			</td>
 			<td>
@@ -17,12 +18,25 @@
 				<input type='button' title="$i18n.getString( 'insert_selected_values' )" value="&raquo;" class="small-button" onClick="insertMultiValues('suggestedDEValues');" >
 			</td>
         </tr>
+		 <tr>
+			<td colspan='2'>
+				$i18n.getString("filter_by_type"): <select type='text' id='deValueType' name='deValueType' onchange="filterDataElement(event, this.value, 'dataElements','dataElementBackups');" style='width:245px;'>
+					<option value=''>[$i18n.getString('view_all')]</option>
+					<option value="int">$i18n.getString( "number" )</option>
+					<option value="string">$i18n.getString( "text" )</option>
+					<option value="bool">$i18n.getString( "yes_no" )</option>
+					<option value="trueOnly">$i18n.getString( "yes_only" )</option>
+					<option value="date">$i18n.getString( "date" )</option>
+					<option value="username">$i18n.getString( "user_name" )</option>
+				</select>
+			</td>
+		</tr>
         <tr>
 			<td colspan='2'>
 				<select id="dataElements" name="dataElements" size="8" ondblclick="insertDataElement(this);" onclick="getSuggestedValues(this.id, 'suggestedDEValues' )"></select>
 				<select id="dataElementBackups" name="dataElementBackups" style='display:none;'></select>
 			</td>
-			<td rowspan='3'>
+			<td rowspan='4'>
 				<select name="suggestedDEValues" size="12" multiple id='suggestedDEValues' ondblclick="insertSingleValue('suggestedDEValues');" ></select>			
 			</td>
 		</tr>

=== 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-15 04:01:06 +0000
+++ 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
@@ -236,11 +236,11 @@
 			deSumId.append( "<option value='' >" + i18n_please_select + "</option>" );
 			for ( i in json.dataElements )
 			{ 
-				dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
-				dataElementBackups.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+				dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
+				dataElementBackups.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
 				if( json.dataElements[i].type=='int')
 				{
-					deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
+					deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
 				}
 			}
 			
@@ -447,16 +447,20 @@
 {
 	// Remove all options in data element fields
 	var field = jQuery('#' + fieldName + " option " ).remove();
-	
+	var valueType = getFieldValue('deValueType');
+			
 	jQuery('#' + backupFieldsName + " option ").each( function(){
 		var option = jQuery(this);
-		if(value.length == 0 )
-		{
-			jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "'>" + option.text() + "</option>" );				
-		}
-		else if (option.text().toLowerCase().indexOf( value.toLowerCase() ) != -1 )
-		{
-			jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "'>" + option.text() + "</option>" );				
+		if (valueType=='' || valueType.indexOf( option.attr('valueType').toLowerCase() ) != -1 )
+		{
+			if(value.length == 0 )
+			{
+				jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>" );				
+			}
+			else if (option.text().toLowerCase().indexOf( value.toLowerCase() ) != -1 )
+			{
+				jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>" );				
+			}
 		}
 	});