← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19746: tracker and event capture now display only those indicators configured for displayInForm

 

------------------------------------------------------------
revno: 19746
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-08-07 18:01:27 +0200
message:
  tracker and event capture now display only those indicators configured for displayInForm
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.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-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-07-17 07:28:57 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/event-capture.js	2015-08-07 16:01:27 +0000
@@ -446,7 +446,7 @@
 
 function getProgramIndicators( programIndicators )
 {
-    return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
+    return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,displayInForm,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
 }
 
 function getMetaProgramRules( programs )

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-07-02 07:19:49 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/services.js	2015-08-07 16:01:27 +0000
@@ -328,65 +328,68 @@
                 MetaDataFactory.getByProgram('programIndicators',programUid).then(function(pis){                    
                     var variables = [];
                     var programRules = [];
-                    angular.forEach(pis, function(pi){                    
-                        var newAction = {
-                                id:pi.id,
-                                content:pi.displayDescription ? pi.displayDescription : pi.name,
-                                data:pi.expression,
-                                programRuleActionType:'DISPLAYKEYVALUEPAIR',
-                                location:'indicators'
-                            };
-                        var newRule = {
-                                name:pi.name,
-                                id: pi.id,
-                                shortname:pi.shortname,
-                                code:pi.code,
-                                program:pi.program,
-                                description:pi.description,
-                                condition:pi.filter ? pi.filter : 'true',
-                                programRuleActions: [newAction]
-                            };
-
-                        programRules.push(newRule);
-
-                        var variablesInCondition = newRule.condition.match(/#{\w+.?\w*}/g);
-                        var variablesInData = newAction.data.match(/#{\w+.?\w*}/g);
-
-                        var pushDirectAddressedVariable = function(variableWithCurls) {
-                            var variableName = variableWithCurls.replace("#{","").replace("}","");
-                            var variableNameParts = variableName.split('.');
-
-
-                            if(variableNameParts.length === 2) {
-                                //this is a programstage and dataelement specification. translate to program variable:
-                                variables.push({
-                                    name:variableName,
-                                    programRuleVariableSourceType:'DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE',
-                                    dataElement:variableNameParts[1],
-                                    programStage:variableNameParts[0],
-                                    program:programUid
-                                });
-                            }
-                            else if(variableNameParts.length === 1)
-                            {
-                                //This is an attribute - let us translate to program variable:
-                                variables.push({
-                                    name:variableName,
-                                    programRuleVariableSourceType:'TEI_ATTRIBUTE',
-                                    trackedEntityAttribute:variableNameParts[0],
-                                    program:programUid
-                                });
-                            }
-
-                        };
-
-                        angular.forEach(variablesInCondition, function(variableInCondition) {
-                            pushDirectAddressedVariable(variableInCondition);
-                        });
-
-                        angular.forEach(variablesInData, function(variableInData) {
-                            pushDirectAddressedVariable(variableInData);
-                        });
+                    angular.forEach(pis, function(pi){
+                        if(pi.displayInForm){
+                            var newAction = {
+                                    id:pi.id,
+                                    content:pi.displayDescription ? pi.displayDescription : pi.name,
+                                    data:pi.expression,
+                                    programRuleActionType:'DISPLAYKEYVALUEPAIR',
+                                    location:'indicators'
+                                };
+                            var newRule = {
+                                    name:pi.name,
+                                    id: pi.id,
+                                    shortname:pi.shortname,
+                                    code:pi.code,
+                                    program:pi.program,
+                                    description:pi.description,
+                                    condition:pi.filter ? pi.filter : 'true',
+                                    programRuleActions: [newAction]
+                                };
+
+                            programRules.push(newRule);
+
+                            var variablesInCondition = newRule.condition.match(/#{\w+.?\w*}/g);
+                            var variablesInData = newAction.data.match(/#{\w+.?\w*}/g);
+
+                            var pushDirectAddressedVariable = function(variableWithCurls) {
+                                var variableName = variableWithCurls.replace("#{","").replace("}","");
+                                var variableNameParts = variableName.split('.');
+
+
+                                if(variableNameParts.length === 2) {
+                                    //this is a programstage and dataelement specification. translate to program variable:
+                                    variables.push({
+                                        name:variableName,
+                                        programRuleVariableSourceType:'DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE',
+                                        dataElement:variableNameParts[1],
+                                        programStage:variableNameParts[0],
+                                        program:programUid
+                                    });
+                                }
+                                else if(variableNameParts.length === 1)
+                                {
+                                    //This is an attribute - let us translate to program variable:
+                                    variables.push({
+                                        name:variableName,
+                                        programRuleVariableSourceType:'TEI_ATTRIBUTE',
+                                        trackedEntityAttribute:variableNameParts[0],
+                                        program:programUid
+                                    });
+                                }
+
+                            };
+
+                            angular.forEach(variablesInCondition, function(variableInCondition) {
+                                pushDirectAddressedVariable(variableInCondition);
+                            });
+
+                            angular.forEach(variablesInData, function(variableInData) {
+                                pushDirectAddressedVariable(variableInData);
+                            });
+                        }
+                        
                     });
 
                     var programIndicators = {rules:programRules, variables:variables};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-07-31 21:45:44 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-08-07 16:01:27 +0000
@@ -1121,65 +1121,68 @@
                 MetaDataFactory.getByProgram('programIndicators',programUid).then(function(pis){                    
                     var variables = [];
                     var programRules = [];
-                    angular.forEach(pis, function(pi){                    
-                        var newAction = {
-                                id:pi.id,
-                                content:pi.displayDescription ? pi.displayDescription : pi.name,
-                                data:pi.expression,
-                                programRuleActionType:'DISPLAYKEYVALUEPAIR',
-                                location:'indicators'
-                            };
-                        var newRule = {
-                                name:pi.name,
-                                id: pi.id,
-                                shortname:pi.shortname,
-                                code:pi.code,
-                                program:pi.program,
-                                description:pi.description,
-                                condition:pi.filter ? pi.filter : 'true',
-                                programRuleActions: [newAction]
-                            };
-
-                        programRules.push(newRule);
-
-                        var variablesInCondition = newRule.condition.match(/#{\w+.?\w*}/g);
-                        var variablesInData = newAction.data.match(/#{\w+.?\w*}/g);
-
-                        var pushDirectAddressedVariable = function(variableWithCurls) {
-                            var variableName = variableWithCurls.replace("#{","").replace("}","");
-                            var variableNameParts = variableName.split('.');
-
-
-                            if(variableNameParts.length === 2) {
-                                //this is a programstage and dataelement specification. translate to program variable:
-                                variables.push({
-                                    name:variableName,
-                                    programRuleVariableSourceType:'DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE',
-                                    dataElement:variableNameParts[1],
-                                    programStage:variableNameParts[0],
-                                    program:programUid
-                                });
-                            }
-                            else if(variableNameParts.length === 1)
-                            {
-                                //This is an attribute - let us translate to program variable:
-                                variables.push({
-                                    name:variableName,
-                                    programRuleVariableSourceType:'TEI_ATTRIBUTE',
-                                    trackedEntityAttribute:variableNameParts[0],
-                                    program:programUid
-                                });
-                            }
-
-                        };
-
-                        angular.forEach(variablesInCondition, function(variableInCondition) {
-                            pushDirectAddressedVariable(variableInCondition);
-                        });
-
-                        angular.forEach(variablesInData, function(variableInData) {
-                            pushDirectAddressedVariable(variableInData);
-                        });
+                    angular.forEach(pis, function(pi){
+                        if(pi.displayInForm){
+                            var newAction = {
+                                    id:pi.id,
+                                    content:pi.displayDescription ? pi.displayDescription : pi.name,
+                                    data:pi.expression,
+                                    programRuleActionType:'DISPLAYKEYVALUEPAIR',
+                                    location:'indicators'
+                                };
+                            var newRule = {
+                                    name:pi.name,
+                                    id: pi.id,
+                                    shortname:pi.shortname,
+                                    code:pi.code,
+                                    program:pi.program,
+                                    description:pi.description,
+                                    condition:pi.filter ? pi.filter : 'true',
+                                    programRuleActions: [newAction]
+                                };
+
+                            programRules.push(newRule);
+
+                            var variablesInCondition = newRule.condition.match(/#{\w+.?\w*}/g);
+                            var variablesInData = newAction.data.match(/#{\w+.?\w*}/g);
+
+                            var pushDirectAddressedVariable = function(variableWithCurls) {
+                                var variableName = variableWithCurls.replace("#{","").replace("}","");
+                                var variableNameParts = variableName.split('.');
+
+
+                                if(variableNameParts.length === 2) {
+                                    //this is a programstage and dataelement specification. translate to program variable:
+                                    variables.push({
+                                        name:variableName,
+                                        programRuleVariableSourceType:'DATAELEMENT_NEWEST_EVENT_PROGRAM_STAGE',
+                                        dataElement:variableNameParts[1],
+                                        programStage:variableNameParts[0],
+                                        program:programUid
+                                    });
+                                }
+                                else if(variableNameParts.length === 1)
+                                {
+                                    //This is an attribute - let us translate to program variable:
+                                    variables.push({
+                                        name:variableName,
+                                        programRuleVariableSourceType:'TEI_ATTRIBUTE',
+                                        trackedEntityAttribute:variableNameParts[0],
+                                        program:programUid
+                                    });
+                                }
+
+                            };
+
+                            angular.forEach(variablesInCondition, function(variableInCondition) {
+                                pushDirectAddressedVariable(variableInCondition);
+                            });
+
+                            angular.forEach(variablesInData, function(variableInData) {
+                                pushDirectAddressedVariable(variableInData);
+                            });
+                        }
+                        
                     });
 
                     var programIndicators = {rules:programRules, variables:variables};

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-08-06 10:10:48 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/tracker-capture.js	2015-08-07 16:01:27 +0000
@@ -558,7 +558,7 @@
 
 function getProgramIndicators( programIndicators )
 {
-    return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
+    return checkAndGetD2Objects( programIndicators, 'programIndicators', '../api/programIndicators', 'fields=id,name,code,shortName,displayInForm,expression,displayDescription,rootDate,description,valueType,DisplayName,filter,program[id]');
 }
 
 function getMetaProgramRules( programs )