dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41117
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20935: PT noext.
------------------------------------------------------------
revno: 20935
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-03 20:39:15 +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-03 15:28:30 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js 2015-11-03 19:39:15 +0000
@@ -569,7 +569,7 @@
t.items = items;
};
- Record.prototype.log = function(text, noError) {
+ Dimension.prototype.log = function(text, noError) {
if (!noError) {
console.log(text, this);
}
@@ -616,7 +616,7 @@
})();
// prototype
- t.prototype.log = function(text, noError) {
+ t.log = function(text, noError) {
if (!noError) {
console.log(text, this);
}
@@ -687,7 +687,7 @@
t.fontSize = NS.isString(config.fontSize) && !NS.isEmpty(config.fontSize) ? config.fontSize : NS.conf.finals.style.normal;
t.digitGroupSeparator = NS.isString(config.digitGroupSeparator) && !NS.isEmpty(config.digitGroupSeparator) ? config.digitGroupSeparator : NS.conf.finals.style.space;
- t.legendSet = (new NS.Api.Record(config.legendSet)).val();
+ t.legendSet = (new NS.Api.Record(config.legendSet)).val(true);
t.parentGraphMap = NS.isObject(config.parentGraphMap) ? config.parentGraphMap : null;
@@ -756,12 +756,16 @@
};
Layout.prototype.getAxes = function(includeFilter) {
- return NS.arrayClean(this.columns, this.rows, (includeFilter ? this.filters : null));
- };
-
- Layout.prototype.getDimensions = function(includeFilter, isSorted) {
- var dimensions = NS.arrayClean([].concat(this.columns, this.rows, (includeFilter ? this.filters : null)));
- return isSorted ? dimensions.sort(function(a, b) {return a.dimension - b.dimension;}) : dimensions;
+ var axes = NS.arrayClean([this.columns, this.rows, (includeFilter ? this.filters : null)]);
+
+ axes.each = function(fn) {
+ for (var i = 0, axis; i < axes.length; i++) {
+ axis = axes[i];
+ fn.call(this, axis);
+ }
+ };
+
+ return axes;
};
Layout.prototype.getUserOrgUnitUrl = function() {
@@ -773,13 +777,29 @@
// dep 1
Layout.prototype.hasDimension = function(dimensionName, includeFilter) {
- for (var i = 0, axes = this.getAxes(includeFilter); i < axes.length; i++) {
- if (axes[i].has(dimensionName)) {
- return true;
+ var axisCollection = this.getAxes(includeFilter),
+ hasDimension = false;
+
+ axisCollection.each(function(axis) {
+ if (axis.has(dimensionName)) {
+ hasDimension = true;
}
- }
-
- return false;
+ });
+
+ return hasDimension;
+ };
+
+ Layout.prototype.getDimensions = function(includeFilter, isSorted) {
+ var axisCollection = this.getAxes(includeFilter),
+ dimensions = [];
+
+ axisCollection.each(function(axis) {
+ axis.each(function(dimension) {
+ dimensions.push(dimension);
+ });
+ });
+
+ return isSorted ? dimensions.sort(function(a, b) {return a.dimension - b.dimension;}) : dimensions;
};
Layout.prototype.getDimensionNames = function(includeFilter, isSorted) {
@@ -792,6 +812,12 @@
return this.dimensionNames;
};
+ //Layout.prototype.forEachDimension = function(fn, includeFilter) {
+ //var dimensions = this.getDimensions(includeFilter);
+
+ //for (var i = 0; i < dimensions.length; i++) {
+
+
Layout.prototype.getDimensionNameIdsMap = function() {
if (this.dimensionNameIdsMap) {
return this.dimensionNameIdsMap;