← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20862: tracker-capture: bug fix in ou tree reload

 

------------------------------------------------------------
revno: 20862
committer: Abyot Asalefew Gizaw <abyota@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-23 10:08:54 +0200
message:
  tracker-capture: bug fix in ou tree reload
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.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/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js	2015-10-22 11:47:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-capture/scripts/directives.js	2015-10-23 08:08:54 +0000
@@ -4,23 +4,19 @@
 
 var eventCaptureDirectives = angular.module('eventCaptureDirectives', [])
 
-.directive('selectedOrgUnit', function ($timeout, OrgUnitService, SessionStorageService) {
+.directive('selectedOrgUnit', function ($timeout) {
     return {
         restrict: 'A',
         link: function (scope, element, attrs) {
-            //once ou tree is loaded, start meta-data download            
-            $( '#orgUnitTree' ).one( 'ouwtLoaded', function( event, ids, names ){
-                console.log('Finished loading orgunit tree');
-                //Disable ou selection until meta-data has downloaded
-                $("#orgUnitTree").addClass("disable-clicks");
-
+            $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {                                   
+                console.log('Finished loading orgunit tree');                        
+                $("#orgUnitTree").addClass("disable-clicks"); //Disable ou selection until meta-data has downloaded
                 $timeout(function () {
                     scope.treeLoaded = true;
                     scope.$apply();
                 });
-
-                downloadMetaData();
-            });
+                downloadMetaData();                
+            });            
 
             //listen to user selection, and inform angular         
             selection.setListenerFunction(setSelectedOu, true);
@@ -33,5 +29,4 @@
             }
         }
     };
-})
-;
\ No newline at end of file
+});
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-10-22 10:28:56 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/components/dashboard/dashboard-controller.js	2015-10-23 08:08:54 +0000
@@ -362,8 +362,7 @@
     };
     
     $scope.back = function(){
-        $location.path('/').search({program: $scope.selectedProgramId});
-        //$route.reload();
+        $location.path('/').search({program: $scope.selectedProgramId});        
     };
     
     $scope.displayEnrollment = false;

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2015-10-22 11:47:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/index.html	2015-10-23 08:08:54 +0000
@@ -72,8 +72,8 @@
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.storage.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/dhis2/dhis2.contextmenu.js"></script>
         
-        <!--<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
-        <script src="scripts/tracker-capture.js"></script>-->
+        <script src="../dhis-web-commons/ouwt/ouwt.js"></script>
+        <script src="scripts/tracker-capture.js"></script>
 
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/select.js"></script>
         <script type="text/javascript" src="../dhis-web-commons/javascripts/angular/plugins/select2.js"></script>

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2015-10-22 11:47:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/scripts/directives.js	2015-10-23 08:08:54 +0000
@@ -4,47 +4,30 @@
 
 var trackerCaptureDirectives = angular.module('trackerCaptureDirectives', [])
 
-.directive('selectedOrgUnit', function ($timeout, OrgUnitService, SessionStorageService) {
+.directive('selectedOrgUnit', function ($timeout) {
     return {
         restrict: 'A',
         link: function (scope, element, attrs) {
-            //once ou tree is loaded, start meta-data download            
-            
-            if( dhis2.tc && dhis2.tc.metaDataCached ){
-                $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {
-                    console.log('Finished loading orgunit tree');
-
-                    //Disable ou selection until meta-data has downloaded
-                    $("#orgUnitTree").addClass("disable-clicks");
-
-                    var ouId = SessionStorageService.get('ouSelected');
-                    OrgUnitService.get(ouId).then(function(ou){
-                        if(ou && ou.id && ou.name){                                    
-                            $timeout(function () {
-                                scope.selectedOrgUnit = ou;
-                                scope.treeLoaded = true;
-                                scope.$apply();
-                            });
-                        }                                                       
-                    });
-                });
-            }
-            else{
-                $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {
-                    console.log('Finished loading orgunit tree');
-
-                    //Disable ou selection until meta-data has downloaded
-                    $("#orgUnitTree").addClass("disable-clicks");
-
-                    $timeout(function () {
-                        scope.treeLoaded = true;
-                        scope.$apply();
-                    });
-
+                
+            selection.load();
+            $("#orgUnitTree").one("ouwtLoaded", function (event, ids, names) {
+                if( dhis2.tc && dhis2.tc.metaDataCached ){
+                    $timeout(function () {
+                        scope.treeLoaded = true;
+                        scope.$apply();
+                    });
+                    selection.responseReceived(); 
+                }
+                else{                    
+                    console.log('Finished loading orgunit tree');                        
+                    $("#orgUnitTree").addClass("disable-clicks"); //Disable ou selection until meta-data has downloaded
+                    $timeout(function () {
+                        scope.treeLoaded = true;
+                        scope.$apply();
+                    });
                     downloadMetaData();
-                });
-            }                
-            
+                }
+            });            
 
             //listen to user selection, and inform angular         
             selection.setListenerFunction(setSelectedOu, true);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2015-10-22 11:47:52 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-tracker-capture/views/home.html	2015-10-23 08:08:54 +0000
@@ -24,13 +24,9 @@
     $(window).resize(function () {
         $("#selectDropDown").width($("#selectDropDownParent").width());
         $("#searchDropDown").width($("#searchDropDownParent").width());
-    });    
-    
+    });
 </script>
 
-<script src="../dhis-web-commons/ouwt/ouwt.js"></script>
-<script src="scripts/tracker-capture.js"></script>
-
 <span id="showLeftBar">
     <a href="javascript:dhis2.leftBar.showAnimated()" title="$i18n.getString('show_menu' )"><i class="fa fa-arrow-right leftBarIcon"></i></a>
 </span>

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-10-22 10:28:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.angular.directives.js	2015-10-23 08:08:54 +0000
@@ -455,6 +455,7 @@
         }
     };
 })
+
 .directive('d2CustomForm', function ($compile) {
     return{
         restrict: 'E',