← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21607: Hiding of confidential attributes in TC listings

 

------------------------------------------------------------
revno: 21607
committer: Markus Bekken <markus.bekken@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2016-01-05 20:15:38 +0100
message:
  Hiding of confidential attributes in TC listings
modified:
  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/views/advanced-search.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.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-tracker-capture/scripts/services.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2016-01-01 21:05:36 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2016-01-05 19:15:38 +0000
@@ -1670,12 +1670,15 @@
             }
             var filterTypes = {}, filterText = {};
             var columns = [];
+            
+            //Filter out attributes that is confidential, so they will not be part of any grid:
+            var nonConfidentialAttributes = angular.copy($filter('nonConfidential')(attributes));
        
             //also add extra columns which are not part of attributes (orgunit for example)
             columns.push({id: 'orgUnitName', name: $translate.instant('registering_unit'), valueType: 'TEXT', displayInListNoProgram: false, attribute: false});
             columns.push({id: 'created', name: $translate.instant('registration_date'), valueType: 'DATE', displayInListNoProgram: false, attribute: false});
             columns.push({id: 'inactive', name: $translate.instant('inactive'), valueType: 'BOOLEAN', displayInListNoProgram: false, attribute: false});
-            columns = columns.concat(attributes ? angular.copy(attributes) : []);
+            columns = columns.concat(nonConfidentialAttributes ? nonConfidentialAttributes : []);
             
             //generate grid column for the selected program/attributes
             angular.forEach(columns, function(column){

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html	2015-12-11 09:08:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/advanced-search.html	2016-01-05 19:15:38 +0000
@@ -35,7 +35,7 @@
                     </div>                
                 </td>
             </tr>
-            <tr ng-repeat="attribute in attributes">
+            <tr ng-repeat="attribute in attributes | nonConfidential">
                 <td>
                     {{attribute.name}}
                 </td>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js	2015-09-14 14:10:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.filters.js	2016-01-05 19:15:38 +0000
@@ -115,6 +115,19 @@
     };
 })
 
+/* filter out confidential attributes from a list */
+.filter('nonConfidential', function() {
+  return function( items ) {
+    var filtered = [];
+    angular.forEach(items, function(item) {
+      if(!item.confidential) {
+        filtered.push(item);
+      }
+    });
+    return filtered;
+  };
+})
+
 /* trim away the qualifiers before and after a variable name */
 .filter('trimvariablequalifiers', function() {
     return function(input) {