← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20767: Program indicator UI. Filtering out non-aggregatble data elements form expression

 

------------------------------------------------------------
revno: 20767
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-10-19 15:43:13 +0200
message:
  Program indicator UI. Filtering out non-aggregatble data elements form expression
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicator.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/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java	2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programindicator/GetProgramIndicatorAction.java	2015-10-19 13:43:13 +0000
@@ -128,7 +128,7 @@
     {
         return attributes;
     }
-
+    
     private List<Constant> constants = new ArrayList<>();
 
     public List<Constant> getConstants()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js	2015-10-19 12:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programIndicator.js	2015-10-19 13:43:13 +0000
@@ -1,3 +1,9 @@
+dhis2.util.namespace( 'dhis2.pi' );
+
+dhis2.pi.aggregatableValueTypes = [
+  'BOOLEAN', 'TRUE_ONLY', 'NUMBER', 'UNIT_INTERVAL', 'PERCENTAGE',
+  'INTEGER', 'INTEGER_POSITIVE', 'INTEGER_NEGATIVE', 'INTEGER_ZERO_OR_POSITIVE' ];  
+
 $(function() {
   dhis2.contextmenu.makeContextMenu({
     menuId: 'contextMenu',
@@ -72,7 +78,12 @@
     }, function( json ) {
       var dataElements = jQuery('#' + fieldId);
       for( i in json.dataElements ) {
-        dataElements.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
+		var de = json.dataElements[i];
+		
+		if ( !('expression' == type && de.valueType && !dhis2.pi.aggregatableValueTypes.indexOf(de.valueType))) {
+          dataElements.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + 
+            "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
+        }
       }
     });
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicator.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicator.vm	2015-07-10 16:14:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programIndicator.vm	2015-10-19 13:43:13 +0000
@@ -39,7 +39,7 @@
 					#set( $mark = false )
 					#foreach( $programIndicator in $programIndicators )
 						<tr id="tr${programIndicator.id}" data-id="$!programIndicator.id" data-uid="$!programIndicator.uid" data-type="ProgramIndicator"
-								data-name="$encoder.htmlEncode( $!programIndicator.displayName )"
+							data-name="$encoder.htmlEncode( $!programIndicator.displayName )"
 						    data-can-manage="$security.canManage( $programIndicator )"
 						    data-can-update="$security.canUpdate( $programIndicator )"
 						    data-can-delete="$security.canDelete( $programIndicator )">
@@ -54,16 +54,16 @@
 		<td id="detailsData">
       <div id="detailsArea">
         <div id="hideDetailsArea">
-					<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
-				</div>				
-				<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
-				<p><label class="bold">$i18n.getString( "code" ):</label><br><span id="codeField"></span></p>				
-				<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
-				<p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
-				<p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
-				<p><label class="bold">$i18n.getString( "filter" ):</label><br><span id="filterField"></span></p>
-				<p><label class="bold">$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
-			</div>
+				<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+		</div>				
+			<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+			<p><label class="bold">$i18n.getString( "code" ):</label><br><span id="codeField"></span></p>				
+			<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+			<p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
+			<p><label class="bold">$i18n.getString( "expression" ):</label><br><span id="expressionField"></span></p>
+			<p><label class="bold">$i18n.getString( "filter" ):</label><br><span id="filterField"></span></p>
+			<p><label class="bold">$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
+		</div>
 		</td>
 	</tr>
 </table>