dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #41260
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 21009: PT noext.
------------------------------------------------------------
revno: 21009
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2015-11-10 14:18:36 +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-09 16:28:26 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/core2.js 2015-11-10 13:18:36 +0000
@@ -492,16 +492,26 @@
t.getDimensionNameMap = function() {
var map = {};
- for (var dimension in dimensions) {
- if (dimensions.hasOwnProperty(dimension)) {
- map[dimension.dimensionName] = dimension;
- }
- }
-
- return map;
- };
-
- t.getObjectNameMap = t.getDimensionNameMap;
+ for (var name in dimensions) {
+ if (dimensions.hasOwnProperty(name)) {
+ map[dimensions[name].dimensionName] = dimensions[name];
+ }
+ }
+
+ return map;
+ };
+
+ t.getObjectNameMap = function() {
+ var map = {};
+
+ for (var name in dimensions) {
+ if (dimensions.hasOwnProperty(name)) {
+ map[dimensions[name].objectName] = dimensions[name];
+ }
+ }
+
+ return map;
+ };
};
NS.DimConf = new DimensionConfig();
@@ -1317,8 +1327,17 @@
};
Request.prototype.add = function(param) {
+ var t = this;
+
if (NS.isString(param)) {
- this.params.push(param);
+ t.params.push(param);
+ }
+ else if (NS.isObject(param)) {
+ for (var key in param) {
+ if (param.hasOwnProperty(key)) {
+ t.params.push(key + '=' + param[key]);
+ }
+ }
}
return this;
@@ -1441,7 +1460,7 @@
};
Response.prototype.getNameById = function(id) {
- return this.metaData.names[id];
+ return this.metaData.names[id] || '';
};
Response.prototype.getHierarchyNameById = function(id, isHierarchy, isHtml) {
@@ -2064,7 +2083,7 @@
var oc = NS.OptionConf,
spaceId = oc.getDigitGroupSeparator('space').id,
noneId = oc.getDigitGroupSeparator('none').id;
-console.log(separator);
+
separator = separator || spaceId;
if (separator === noneId) {
@@ -2126,7 +2145,7 @@
a.push(getEmptyNameTdConfig({
cls: 'pivot-dim-label',
- htmlValue: objectNameMap[columnDimensionNames[i]].name
+ htmlValue: response.getNameById(columnDimensionNames[i]) // objectNameMap[columnDimensionNames[i]].name
}));
}
else {
@@ -2134,14 +2153,14 @@
for (var j = 0; j < rowAxis.dims - 1; j++) {
a.push(getEmptyNameTdConfig({
cls: 'pivot-dim-label',
- htmlValue: (objectNameMap[rowDimensionNames[j]] || {}).name
+ htmlValue: response.getNameById(rowDimensionNames[j]) //(objectNameMap[rowDimensionNames[j]] || {}).name
}));
}
}
a.push(getEmptyNameTdConfig({
cls: 'pivot-dim-label',
- htmlValue: (rowAxis ? (objectNameMap[rowDimensionNames[j]] || {}).name : '') + (colAxis && rowAxis ? ' / ' : '') + (colAxis ? (objectNameMap[columnDimensionNames[i]] || {}).name : '')
+ htmlValue: response.getNameById(rowDimensionNames[j]) + (colAxis && rowAxis ? ' / ' : '') + response.getNameById(columnDimensionNames[i])
}));
}
@@ -2158,7 +2177,7 @@
for (var i = 0; i < rowDimensionNames.length; i++) {
dimLabelHtml.push(getEmptyNameTdConfig({
cls: 'pivot-dim-label',
- htmlValue: objectNameMap[rowDimensionNames[i]].name
+ htmlValue: response.getNameById(rowDimensionNames[i])
}));
}