dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20969
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9811: (PT) Dimension calculation bug fixed.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 9811 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-14 16:44:34 +0100
message:
(PT) Dimension calculation bug fixed.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.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-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-02-12 12:15:42 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-02-14 10:48:44 +0000
@@ -510,7 +510,7 @@
window = Ext.create('Ext.window.Window', {
title: 'Pivot settings', //i18n
layout: 'fit',
- bodyStyle: 'background-color:#fff; padding:8px 8px 3px',
+ bodyStyle: 'background-color:#fff; padding:5px 5px 0px',
closeAction: 'hide',
autoShow: true,
modal: true,
@@ -541,8 +541,9 @@
}
],
listeners: {
- afterrender: function(w) {
- w.setPosition(w.getPosition()[0], 100);
+ show: function(w) {
+ var x = (pt.viewport.getWidth() / 2) - (w.getWidth() / 2);
+ w.setPosition(x, 60);
}
}
});
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-02-12 13:09:58 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-02-14 13:59:56 +0000
@@ -493,7 +493,7 @@
return xSettings;
};
- getSyncedXSettings = function(xSettings, response) {
+ getSyncronizedXSettings = function(xSettings, response) {
var getHeaderNames,
headerNames,
@@ -624,7 +624,6 @@
response.idValueMap = {};
var extendHeaders = function() {
- //var dimensions = xSettings.dimensions;
// Extend headers: index, items (ordered), size
for (var i = 0, header, settingsItems, responseItems, orderedResponseItems; i < headers.length; i++) {
@@ -712,10 +711,9 @@
aGuiItems = [],
aAllItems = [],
aColIds = [],
- aUniqueIds,
- getUniqueIds;
+ aUniqueIds;
- getUniqueIds = function() {
+ aUniqueIds = function() {
var a = [];
for (var i = 0, dim; i < axis.length; i++) {
@@ -725,15 +723,13 @@
}
return a;
- };
-
- aUniqueIds = getUniqueIds();
-
- console.log("aUniqueIds", aUniqueIds);
-
- //aUniqueIds = [ [de1, de2, de3],
- // [p1],
- // [ou1, ou2, ou3, ou4] ]
+ }();
+
+console.log("aUniqueIds", aUniqueIds);
+
+//aUniqueIds = [ [de1, de2, de3],
+// [p1],
+// [ou1, ou2, ou3, ou4] ]
for (var i = 0, dim; i < aUniqueIds.length; i++) {
nNumCols = aUniqueIds[i].length;
@@ -743,22 +739,22 @@
aAccNumCols.push(nCols);
}
- console.log("");
- console.log("aNumCols", aNumCols);
- console.log("nCols", nCols);
- console.log("aAccNumCols", aAccNumCols);
+console.log("");
+console.log("aNumCols", aNumCols);
+console.log("nCols", nCols);
+console.log("aAccNumCols", aAccNumCols);
- //aNumCols = [3, 1, 4]
- //nCols = 12 (3 * 1 * 4)
- //aAccNumCols = [3, 3, 12]
+ //aNumCols = [3, 1, 4]
+ //nCols = 12 (3 * 1 * 4)
+ //aAccNumCols = [3, 3, 12]
for (var i = 0; i < aUniqueIds.length; i++) {
aSpan.push(aNumCols[i] === 1 ? nCols : nCols / aAccNumCols[i]); //if one, span all
}
- console.log("aSpan", aSpan);
+console.log("aSpan", aSpan);
- //aSpan = [10, 2, 1]
+ //aSpan = [10, 2, 1]
aGuiItems.push(aUniqueIds[0]);
@@ -775,40 +771,34 @@
}
}
- console.log("aGuiItems", aGuiItems);
- //aGuiItems = [ [d1, d2, d3], (3)
- // [p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5], (15)
- // [o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2...] (30)
- // ]
-
-
- for (var i = 0, dimItems, span; i < aUniqueIds.length; i++) {
- dimItems = [];
+console.log("aGuiItems", aGuiItems);
+ //aGuiItems = [ [d1, d2, d3], (3)
+ // [p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5], (15)
+ // [o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2...] (30)
+ // ]
+
+ for (var i = 0, aAllRow, aUniqueRow, span, factor; i < aUniqueIds.length; i++) {
+ aAllRow = [];
+ aUniqueRow = aUniqueIds[i];
span = aSpan[i];
+ factor = nCols / (span * aUniqueRow.length);
- if (i === 0) {
- for (var j = 0; j < aUniqueIds[i].length; j++) {
- for (var k = 0; k < span; k++) {
- dimItems.push(aUniqueIds[i][j]);
+ for (var j = 0; j < factor; j++) {
+ for (var k = 0; k < aUniqueRow.length; k++) {
+ for (var l = 0; l < span; l++) {
+ aAllRow.push(aUniqueRow[k]);
}
}
}
- else {
- var factor = nCols / aUniqueIds[i].length;
-
- for (var k = 0; k < factor; k++) {
- dimItems = dimItems.concat(aUniqueIds[i]);
- }
- }
-
- aAllItems.push(dimItems);
+
+ aAllItems.push(aAllRow);
}
- console.log("aAllItems", aAllItems);
- //aAllItems = [ [d1, d1, d1, d1, d1, d1, d1, d1, d1, d1, d2, d2, d2, d2, d2, d2, d2, d2, d2, d2, d3, d3, d3, d3, d3, d3, d3, d3, d3, d3], (30)
- // [p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5], (30)
- // [o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2] (30)
- // ]
+console.log("aAllItems", aAllItems);
+ //aAllItems = [ [d1, d1, d1, d1, d1, d1, d1, d1, d1, d1, d2, d2, d2, d2, d2, d2, d2, d2, d2, d2, d3, d3, d3, d3, d3, d3, d3, d3, d3, d3], (30)
+ // [p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5, p1, p2, p3, p4, p5], (30)
+ // [o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2, o1, o2] (30)
+ // ]
for (var i = 0, id; i < nCols; i++) {
id = '';
@@ -820,8 +810,8 @@
aColIds.push(id);
}
- console.log("aColIds", aColIds);
- //aColIds = [ aaaaaaaaBBBBBBBBccccccc, aaaaaaaaaccccccccccbbbbbbbbbb, ... ]
+console.log("aColIds", aColIds);
+ //aColIds = [ aaaaaaaaBBBBBBBBccccccc, aaaaaaaaaccccccccccbbbbbbbbbb, ... ]
console.log("");
@@ -972,6 +962,7 @@
htmlValueItemRow = [];
for (var j = 0, id, value; j < colSize; j++) {
+//console.log((xColAxis ? xColAxis.ids[j] : ''), (xRowAxis ? xRowAxis.ids[i] : ''));
id = (xColAxis ? xColAxis.ids[j] : '') + (xRowAxis ? xRowAxis.ids[i] : '');
value = xResponse.idValueMap[id] ? parseFloat(xResponse.idValueMap[id]) : 0; //todo
htmlValue = xResponse.idValueMap[id] ? parseFloat(xResponse.idValueMap[id]) : '-'; //todo
@@ -1167,7 +1158,7 @@
response.metaData['PT59n8BQbqM'] = '(Outreach)';
response.metaData['pq2XI5kz2BY'] = '(Fixed)';
- xSettings = getSyncedXSettings(xSettings, response);
+ xSettings = getSyncronizedXSettings(xSettings, response);
if (!xSettings) {
pt.util.mask.hideMask();