← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9728: (PT) Default settings + (DV) Relative period bug fixed.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 9728 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-05 12:05:27 +0100
message:
  (PT) Default settings + (DV) Relative period 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
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css
  dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.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-05 08:06:23 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-02-05 10:15:15 +0000
@@ -254,6 +254,7 @@
 
 			getData,
 			getStore,
+			getStoreKeys,
 			getCmpHeight,
 			getSetup,
 
@@ -269,10 +270,7 @@
 		getData = function() {
 			var groupSets = [],
 				data = [
-					{ id: 'dx', name: 'Data' },
-					{ id: 'coc', name: 'Categories' },
-					{ id: 'pe', name: 'Periods' },
-					{ id: 'ou', name: 'Organisation units' }
+					{id: 'coc', name: 'Categories'}
 				];
 
 			for (var i = 0; i < pt.init.ougs.length; i++) {
@@ -288,16 +286,40 @@
 		};
 
 		getStore = function(data) {
-			return Ext.create('Ext.data.Store', {
-				fields: ['id', 'name'],
-				data: data || []
-			});
+			var config = {};
+				
+			config.fields = ['id', 'name'];
+
+			if (data) {
+				config.data = data;
+			}
+
+			return Ext.create('Ext.data.Store', config);
 		};
 
+		getStoreKeys = function(store) {
+			var keys = [],
+				items = store.data.items;
+
+			if (items) {
+				for (var i = 0; i < items.length; i++) {
+					keys.push(items[i].data.id);
+				}
+			}
+			
+			return keys;
+		};				
+
 		dimensionStore = getStore(getData());
+
 		rowStore = getStore();
+		rowStore.add({id: 'pe', name: 'Periods'}); //i18n
+		
 		colStore = getStore();
+		colStore.add({id: 'dx', name: 'Data'}); //i18n
+		
 		filterStore = getStore();
+		filterStore.add({id: 'ou', name: 'Organisation units'}); //i18n
 
 		getCmpHeight = function() {
 			var size = dimensionStore.totalCount,
@@ -468,9 +490,9 @@
 
 		getSetup = function() {
 			return {
-				col: colStore.data.keys,
-				row: rowStore.data.keys,
-				filter: filterStore.data.keys
+				col: getStoreKeys(colStore),
+				row: getStoreKeys(rowStore),
+				filter: getStoreKeys(filterStore)
 			};
 		};
 
@@ -479,6 +501,7 @@
 			layout: 'fit',
 			bodyStyle: 'background-color:#fff; padding:8px 8px 3px',
 			closeAction: 'hide',
+			autoShow: true,
 			modal: true,
 			resizable: false,
 			getSetup: getSetup,
@@ -508,7 +531,7 @@
 			],
 			listeners: {
 				afterrender: function(w) {
-					w.setPosition(w.getPosition()[0], 100);
+					w.setPosition(w.getPosition()[0], 100);					
 				}
 			}
 		});
@@ -2075,6 +2098,9 @@
 		pt.cmp = PT.app.getCmp();
 
 		pt.viewport = createViewport();
+
+		pt.viewport.settingsWindow = PT.app.SettingsWindow(pt);
+		pt.viewport.settingsWindow.hide();
 	};
 
 	Ext.Ajax.request({

=== 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-05 09:27:19 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-02-05 10:13:20 +0000
@@ -785,8 +785,6 @@
 					for (var j = 0, id, value, row; j < pt.config.cols.size; j++) {
 						id = cols.ids[j] + rows.ids[i];
 						value = response.idValueMap[id] ? parseFloat(response.idValueMap[id]) : 0;
-//console.log(value);
-						//value = Ext.isNumber(value) ? value : 0;
 						row.push(value);
 					}
 
@@ -972,13 +970,12 @@
 						
 						pt.response = r;
 
-						pt.response.metaData['PT59n8BQbqM'] = '(Outreach)';
-						pt.response.metaData['pq2XI5kz2BY'] = '(Fixed)';
+pt.response.metaData['PT59n8BQbqM'] = '(Outreach)';
+pt.response.metaData['pq2XI5kz2BY'] = '(Fixed)';
 
 						extendResponse(dimensionItems);
 
 						pt.config = getDims();
-						console.log(pt);
 
 						extendRowDims(pt.config.rows);
 

=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css	2013-02-05 09:27:19 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css	2013-02-05 09:32:11 +0000
@@ -93,8 +93,7 @@
 
 .pivot-empty-body,
 td .pivot-empty-body {
-	background-color: #fff;
-	border: 0 none;
+	background-color: #e6efff;
 }
 
 .pivot-dim-body,

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2013-01-16 13:25:48 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java	2013-02-05 11:03:26 +0000
@@ -441,11 +441,12 @@
                 chart.getDataSets().add( dataSetService.getDataSet( id ) );
             }
         }
+        
+        RelativePeriods rp = new RelativePeriods();
 
         if ( reportingMonth || last12Months || last3Months || reportingQuarter || last4Quarters || lastSixMonth || last2SixMonths || thisYear
             || lastYear || last5Years )
         {
-            RelativePeriods rp = new RelativePeriods();
             rp.setReportingMonth( reportingMonth );
             rp.setLast12Months( last12Months );
             rp.setLast3Months( last3Months );
@@ -456,10 +457,10 @@
             rp.setThisYear( thisYear );
             rp.setLastYear( lastYear );
             rp.setLast5Years( last5Years );
-
-            chart.setRelatives( rp );
         }
 
+        chart.setRelatives( rp );
+
         chart.setRewindRelativePeriods( rewind );
 
         chart.getPeriods().clear();

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-02-04 17:49:15 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-02-05 11:03:26 +0000
@@ -1635,11 +1635,11 @@
 							f.relativePeriods.reportingQuarter = f.relativePeriods.lastQuarter;
 							delete f.relativePeriods.lastMonth;
 							delete f.relativePeriods.lastQuarter;
-	
+
 							DV.c.relativeperiod.rp = f.relativePeriods;
 							DV.c.relativeperiod.rewind = f.rewindRelativePeriods;
 						}
-						
+
 						if (f.periods) {
 							for (var i = 0; i < f.periods.length; i++) {
 								DV.c.fixedperiod.records.push({id: f.periods[i].id, name: DV.conf.util.jsonEncodeString(f.periods[i].name)});