← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21520: tracker-capture: TEI searcing is now by default across all children and starting from the root of...

 

------------------------------------------------------------
revno: 21520
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-12-23 10:29:34 +0100
message:
  tracker-capture: TEI searcing is now by default across all children and starting from the root of data view orgunit
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.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/controllers.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-12-11 09:36:25 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/controllers.js	2015-12-23 09:29:34 +0000
@@ -33,11 +33,11 @@
     
     //Selection
     $scope.ouModes = [{name: 'SELECTED'}, {name: 'CHILDREN'}, {name: 'DESCENDANTS'}, {name: 'ACCESSIBLE'}];         
-    $scope.selectedOuMode = $scope.ouModes[0];    
+    $scope.selectedOuMode = $scope.ouModes[2];    
     $scope.dashboardProgramId = ($location.search()).program;
     $scope.selectedOrgUnitId = ($location.search()).ou;
     $scope.treeLoaded = false;
-    $scope.searchOuTree = false;
+    $scope.searchOuTree = {open: true};
     $scope.teiListMode = {onlyActive: false};
     $scope.enrollmentStatus = 'ALL';    
        
@@ -241,7 +241,7 @@
             }            
             
             $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
-            $scope.searchingOrgUnit = $scope.selectedOrgUnit;
+            $scope.searchingOrgUnit = $scope.selectedSearchingOrgUnit && $scope.selectedSearchingOrgUnit.id ? $scope.selectedSearchingOrgUnit : $scope.selectedOrgUnit;
         }
         
         if( $scope.selectedSearchMode === $scope.searchMode.attributeBased ){
@@ -262,7 +262,7 @@
         if( $scope.selectedSearchMode === $scope.searchMode.listAll ){
             $scope.searchText = null;            
             $scope.attributes = EntityQueryFactory.resetAttributesQuery($scope.attributes, $scope.enrollment);
-            $scope.searchingOrgUnit = $scope.selectedOrgUnit;
+            $scope.searchingOrgUnit = $scope.selectedSearchingOrgUnit && $scope.selectedSearchingOrgUnit.id ? $scope.selectedSearchingOrgUnit : $scope.selectedOrgUnit;
         }
         
         $scope.doSearch = false;
@@ -409,6 +409,8 @@
                 o.hasChildren = o.children && o.children.length > 0 ? true : false;
             });            
         });
+        
+        $scope.selectedSearchingOrgUnit = $scope.orgUnits[0] ? $scope.orgUnits[0] : null; 
     });
     
     //expand/collapse of search orgunit tree

=== 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-12-17 15:00:48 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/services.js	2015-12-23 09:29:34 +0000
@@ -498,10 +498,10 @@
             return orgUnitWithParent;
         },
         getSearchTreeRoot: function(){
-            var roles = SessionStorageService.get('USER_ROLES');
+            //var roles = SessionStorageService.get('USER_ROLES');
             if(!rootOrgUnitPromise){
                 var url = '../api/me.json?fields=organisationUnits[id,name,children[id,name,children[id,name]]]&paging=false';
-                if( roles && roles.userCredentials && roles.userCredentials.userRoles){
+                /*if( roles && roles.userCredentials && roles.userCredentials.userRoles){
                     var userRoles = roles.userCredentials.userRoles;
                     for(var i=0; i<userRoles.length; i++){
                         if(userRoles[i].authorities.indexOf('ALL') !== -1 || 
@@ -510,7 +510,7 @@
                           i=userRoles.length;
                         }
                     }  
-                }             
+                }*/
                 rootOrgUnitPromise = $http.get( url ).then(function(response){
                     return response.data;
                 });