← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9812: (PT) Relative periods working.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 9812 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-14 16:45:04 +0100
message:
  (PT) Relative periods working.
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-14 10:48:44 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-02-14 15:43:30 +0000
@@ -19,7 +19,7 @@
 
 	var pt = PT.core.getInstance();
 
-	PT.instance = pt;
+	PT.app.instances = [pt];
 
 	PT.app.getInits = function(r) {
 		var init = Ext.decode(r.responseText);
@@ -207,7 +207,7 @@
 
 		store.periodType = Ext.create('Ext.data.Store', {
 			fields: ['id', 'name'],
-			data: pt.conf.period.periodtypes
+			data: pt.conf.period.periodTypes
 		});
 
 		store.fixedPeriodAvailable = Ext.create('Ext.data.Store', {
@@ -2134,13 +2134,9 @@
 		};
 
 		pt.init = PT.app.getInits(r);
-
 		pt.util = PT.app.getUtils();
-
 		pt.store = PT.app.getStores();
-
 		pt.cmp = PT.app.getCmp();
-
 		pt.viewport = createViewport();
 
 		pt.viewport.settingsWindow = PT.app.SettingsWindow(pt);

=== 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-14 13:59:56 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-02-14 15:43:30 +0000
@@ -95,7 +95,7 @@
 	};
 
 	conf.period = {
-		relativeperiodunits: {
+		relativePeriods: {
 			LAST_MONTH: 1,
 			LAST_3_MONTHS: 3,
 			LAST_12_MONTHS: 12,
@@ -107,7 +107,7 @@
 			LAST_YEAR: 1,
 			LAST_5_YEARS: 5
 		},
-		periodtypes: [
+		periodTypes: [
 			{id: 'Daily', name: 'Daily'},
 			{id: 'Weekly', name: 'Weekly'},
 			{id: 'Monthly', name: 'Monthly'},
@@ -130,7 +130,7 @@
         west_fill_accordion_dataelement: 77,
         west_fill_accordion_dataset: 45,
         west_fill_accordion_period: 270,
-        //west_fill_accordion_fixedperiod: 77,        
+        //west_fill_accordion_fixedperiod: 77,
         west_fill_accordion_organisationunit: 103,
         west_maxheight_accordion_indicator: 478,
         west_maxheight_accordion_dataelement: 478,
@@ -212,31 +212,6 @@
 		}
 	};
 
-	util.viewport = {
-		getSize: function() {
-			return {x: PT.cmp.region.center.getWidth(), y: PT.cmp.region.center.getHeight()};
-		},
-		getXY: function() {
-			return {x: PT.cmp.region.center.x + 15, y: PT.cmp.region.center.y + 43};
-		},
-		getPageCenterX: function(cmp) {
-			return ((screen.width/2)-(cmp.width/2));
-		},
-		getPageCenterY: function(cmp) {
-			return ((screen.height/2)-((cmp.height/2)-100));
-		},
-		resizeDimensions: function() {
-			var a = [PT.cmp.dimension.indicator.panel, PT.cmp.dimension.dataelement.panel, PT.cmp.dimension.dataset.panel,
-					PT.cmp.dimension.relativePeriod.panel, PT.cmp.dimension.fixedperiod.panel, PT.cmp.dimension.organisationUnit.panel,
-					PT.cmp.dimension.organisationUnitGroup.panel, PT.cmp.options.panel];
-			for (var i = 0; i < a.length; i++) {
-				if (!a[i].collapsed) {
-					a[i].fireEvent('expand');
-				}
-			}
-		}
-	};
-
 	util.multiselect = {
 		select: function(a, s) {
 			var selected = a.getValue();
@@ -648,8 +623,14 @@
 								for (var j = 0, item; j < settingsItems.length; j++) {
 									item = settingsItems[j];
 
-									if (Ext.Array.contains(responseItems, item)) {
-										orderedResponseItems.push(item);
+									if (header.name === 'pe' && pt.conf.period.relativePeriods[item]) {
+										orderedResponseItems = responseItems;
+										orderedResponseItems.sort();
+									}
+									else {
+										if (Ext.Array.contains(responseItems, item)) {
+											orderedResponseItems.push(item);
+										}
 									}
 								}
 							}
@@ -961,8 +942,7 @@
 						valueItemRow = [];
 						htmlValueItemRow = [];
 
-						for (var j = 0, id, value; j < colSize; j++) {
-//console.log((xColAxis ? xColAxis.ids[j] : ''), (xRowAxis ? xRowAxis.ids[i] : ''));							
+						for (var j = 0, id, value; j < colSize; j++) {						
 							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
@@ -1129,6 +1109,7 @@
 					xRowAxis;
 
 				pt.util.mask.showMask(container);
+				
 
 				xSettings = extendSettings(settings);
 
@@ -1197,7 +1178,6 @@
 		var col,
 			row,
 			filter,
-			settings,
 
 			removeEmptyDimensions,
 			getValidatedAxis,
@@ -1280,7 +1260,7 @@
 			return true;
 		};
 		
-		settings = function() {
+		return function() {
 			var obj = {};
 			
 			if (!(config && Ext.isObject(config))) {
@@ -1308,8 +1288,6 @@
 
 			return obj;
 		}();
-
-		return settings;
 	};
 
 	return api;