← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 18828: Reverted R 18827..18826

 

------------------------------------------------------------
revno: 18828
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-04-08 12:59:12 +0200
message:
  Reverted R 18827..18826
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2015-04-08 09:55:13 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js	2015-04-08 10:59:12 +0000
@@ -745,7 +745,7 @@
     };
 
     var expandTreeAtOrgUnit = function( ou, select ) {
-      select = select || false;
+        select = select || false;
 
       if( organisationUnits[ou] == null ) {
           subtree.ajaxGetLeaf(ou).done(function( data ) {
@@ -851,7 +851,6 @@
             var def = $.Deferred();
 
             subtree.ajaxGetChildren( parentId ).done(function( data ) {
-                $('#orgUnitTree').trigger('dhis2.ouwt.childrenLoaded', parentId);
                 def.resolveWith( window, [ data ] );
             });
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2015-04-08 10:10:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2015-04-08 10:59:12 +0000
@@ -74,9 +74,6 @@
 // Indicates whether current form is multi org unit
 dhis2.de.multiOrganisationUnit = false;
 
-// List of parent for which we have fetched dataSet associations, used to optimize dhis2.de.fetchDataSets
-dhis2.de.fetchedChildren = [];
-
 // "organisationUnits" object inherited from ouwt.js
 
 // Constants
@@ -225,18 +222,6 @@
         $.when( dhis2.de.getMultiOrgUnitSetting(), dhis2.de.loadMetaData(), dhis2.de.loadDataSetAssociations() ).done( function() {
         	dhis2.de.setMetaDataLoaded();
         	organisationUnitSelected( ids, names );
-
-          if( ids && ids[0] ) {
-              dhis2.de.fetchDataSets(ids[0]).done(function() {
-                selection.responseReceived();
-            })
-          }
-
-          $('#orgUnitTree').on('dhis2.ouwt.childrenLoaded', function(e, ou) {
-            dhis2.de.fetchDataSets(ou).done(function() {
-                selection.responseReceived();
-            })
-          });
         } );
     } );
 } );
@@ -995,26 +980,21 @@
 {
     var def = $.Deferred();
 
-    if( dhis2.de.fetchedChildren.indexOf(ou) != -1 ) {
-        def.resolve();
-    } else {
-        $.ajax({
-            type: 'GET',
-            url: '../api/organisationUnits/' + ou,
-            data: {
-                fields: 'id,dataSets[id],children[id,dataSets[id]]'
-            }
-        }).done(function(data) {
-            dhis2.de._updateDataSets(data);
-
-            data.children.forEach(function( item ) {
-                dhis2.de._updateDataSets(item);
-            });
-
-            dhis2.de.fetchedChildren.push(ou);
-            def.resolve(data);
+    $.ajax({
+        type: 'GET',
+        url: '../api/organisationUnits/' + ou,
+        data: {
+            fields: 'id,dataSets[id],children[id,dataSets[id]]'
+        }
+    }).done(function(data) {
+        dhis2.de._updateDataSets(data);
+
+        data.children.forEach(function( item ) {
+            dhis2.de._updateDataSets(item);
         });
-    }
+
+        def.resolve(data);
+    });
 
     return def.promise();
 };