← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21051: PT noext.

 

------------------------------------------------------------
revno: 21051
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-11-13 21:09:54 +0100
message:
  PT noext.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.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-pivot/scripts/core2.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-13 20:00:40 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js	2015-11-13 20:09:54 +0000
@@ -401,6 +401,7 @@
             // constants
             t.defaultUiLocale = 'en';
             t.defaultDisplayProperty = 'displayName';
+            t.rootNodeId = 'root';
 
             t.valueTypes = {
                 'numeric': ['NUMBER','UNIT_INTERVAL','PERCENTAGE','INTEGER','INTEGER_POSITIVE','INTEGER_NEGATIVE','INTEGER_ZERO_OR_POSITIVE'],
@@ -454,6 +455,12 @@
             t.periodGenerator;
             t.viewUnapprovedData;
 
+            t.rootNodes = [];
+            t.organisationUnitLevels = [];
+            t.dimensions = [];
+            t.legendSets = [];
+            t.dataApprovalLevels = [];
+
             // transient
             t.path;
             t.dateFormat;
@@ -493,6 +500,20 @@
             return this.valueTypes[type];
         };
 
+        AppManager.prototype.getRootNodes = function() {
+            return this.rootNodes;
+        };
+
+        AppManager.prototype.addRootNodes = function(param) {
+            var t = this,
+                nodes = N.arrayFrom(param);
+
+            nodes.forEach(function(node) {
+                node.expanded = true;
+                node.path = '/' + t.rootId + '/' + node.id;
+            });
+        };
+
         // dep 1
 
         AppManager.prototype.isUiLocaleDefault = function() {
@@ -503,6 +524,10 @@
             return this.analysisFields ? this.analysisFields : (this.analysisFields = (this.defaultAnalysisFields.join(',').replaceAll('$', this.getDisplayProperty())));
         };
 
+        AppManager.prototype.getRootNode = function() {
+            return this.getRootNodes()[0];
+        };
+
         N.AppManager = new AppManager();
     })();
 
@@ -739,39 +764,6 @@
         N.DimConf = new DimensionConfig();
     })();
 
-    // RootNodeManager
-    (function() {
-        var RootNodeManager = function() {
-            var t = this;
-
-            // constants
-            t.rootId = 'root';
-
-            // uninitialized
-            t.nodes;
-        };
-
-        RootNodeManager.prototype.add = function(param) {
-            var t = this,
-                nodes = N.arrayFrom(param);
-
-            nodes.forEach(function(node) {
-                node.expanded = true;
-                node.path = '/' + t.rootId + '/' + node.id;
-            });
-        };
-
-        RootNodeManager.prototype.getRootNode = function() {
-            return this.nodes[0];
-        };
-
-        RootNodeManager.prototype.getRootNodes = function() {
-            return this.nodes;
-        };
-
-        N.RootNodeManager = new RootNodeManager();
-    })();
-
     // PeriodConfig
     (function() {
         var PeriodConfig = function() {
@@ -1700,7 +1692,14 @@
             };
 
             RequestManager.prototype.add = function(param) {
-                this.requests = [].concat(this.requests, N.arrayFrom(param));
+                var t = this,
+                    requests = N.arrayFrom(param);
+
+                requests.forEach(function(request) {
+                    request.setManager(t);
+                });
+
+                this.requests = [].concat(this.requests, requests);
             };
 
             RequestManager.prototype.set = function(fn) {