← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19251: Program UI, fixed bug, attributes and constant filters did not work

 

------------------------------------------------------------
revno: 19251
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-06-02 14:03:24 +0200
message:
  Program UI, fixed bug, attributes and constant filters did not work
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/commons.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.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-program/src/main/webapp/dhis-web-maintenance-program/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/commons.js	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/commons.js	2015-06-02 12:03:24 +0000
@@ -3,27 +3,21 @@
 // Filter data-element
 //------------------------------------------------------------------------------
 
-function filterDE( event, value, fieldName )
+function filterIndicatorSelect( event, value, fieldName )
 {
 	var field = byId(fieldName);
+	
 	for ( var index = 0; index < field.options.length; index++ )
     {
 		var option = field.options[index];
 		
-		if(value.length == 0 )
+		if ( value.length == 0 || option.text.toLowerCase().indexOf( value.toLowerCase() ) != -1 )
 		{
 			option.style.display = "block";
 		}
 		else
 		{
-			if (option.text.toLowerCase().indexOf( value.toLowerCase() ) != -1 )
-			{
-				option.style.display = "block";
-			}
-			else
-			{
-				option.style.display = "none";
-			}
+			option.style.display = "none";
 		}
     }	    
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2015-06-02 11:55:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicatorForm.vm	2015-06-02 12:03:24 +0000
@@ -12,7 +12,7 @@
 	  <table style="width:100%">
         <tr>
 			<td>
-				<input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDE(event, this.value, 'dataElements');" placeholder="$i18n.getString('filter')" />
+				<input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterIndicatorSelect(event, this.value, 'dataElements');" placeholder="$i18n.getString('filter')" />
 				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchValue', '');" />			
 			</td>
         </tr>
@@ -27,17 +27,23 @@
 #if($program.type!='3')
 	<div id="tab-2">
 		<table style="width:100%">
-			<tr>
-				<td>
-					<select multiple id="programProperty" name="programProperty" size="10" style="width:100%" ondblclick="insertInfo(this, false);" >
-						<option value="V{incident_date}">$i18n.getString( "incident_date" )</option>
-						<option value="V{enrollment_date}">$i18n.getString( "date_of_enrollment" )</option>
-						<option value="V{current_date}">$i18n.getString( "current_date" )</option>
-						<option value="V{value_count}">$i18n.getString( "value_count" )</option>
-						<option value="V{zero_pos_value_count}">$i18n.getString( "zero_pos_value_count" )</option>
-					</select>
-				</td>
-			</tr>
+		  <tr>
+		    <td>
+			  <input type='text' id='txtSearchPropertyValue' name='txtSearchValue' onKeyUp="filterIndicatorSelect(event, this.value, 'programProperty');" placeholder="$i18n.getString('filter')" />
+			  <input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchPropertyValue', '');" />			
+			</td>
+        </tr>
+		<tr>
+			<td>
+				<select multiple id="programProperty" name="programProperty" size="10" style="width:100%" ondblclick="insertInfo(this, false);" >
+					<option value="V{incident_date}">$i18n.getString( "incident_date" )</option>
+					<option value="V{enrollment_date}">$i18n.getString( "date_of_enrollment" )</option>
+					<option value="V{current_date}">$i18n.getString( "current_date" )</option>
+					<option value="V{value_count}">$i18n.getString( "value_count" )</option>
+					<option value="V{zero_pos_value_count}">$i18n.getString( "zero_pos_value_count" )</option>
+				</select>
+			</td>
+		</tr>
 		</table>
 	</div>
 
@@ -45,7 +51,7 @@
 		<table style="width:100%">
         <tr>
 			<td>
-				<input type='text' id='txtSearchAttrValue' name='txtSearchAttrValue' onKeyUp="filterAttr(event, this.value, 'attributes');" placeholder="$i18n.getString('filter')" />
+				<input type='text' id='txtSearchAttrValue' name='txtSearchAttrValue' onKeyUp="filterIndicatorSelect(event, this.value, 'attributes');" placeholder="$i18n.getString('filter')" />
 				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchAttrValue', '');" />			
 			</td>
         </tr>
@@ -69,8 +75,8 @@
 		<table style="width:100%">
         <tr>
 			<td>
-				<input type='text' id='txtSearchContsValue' name='txtSearchAttrValue' onKeyUp="filterAttr(event, this.value, 'attributes');" placeholder="$i18n.getString('filter')" />
-				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchAttrValue', '');" />			
+				<input type='text' id='txtSearchContsValue' name='txtSearchAttrValue' onKeyUp="filterIndicatorSelect(event, this.value, 'constants');" placeholder="$i18n.getString('filter')" />
+				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchContsValue', '');" />			
 			</td>
         </tr>
         <tr>