← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9720: (PT) Static callback param + No values validation + Group set removed from names + Settings windo...

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 9720 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-05 09:13:55 +0100
message:
  (PT) Static callback param + No values validation + Group set removed from names + Settings window update button.
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-04 14:00:34 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-02-05 08:06:23 +0000
@@ -280,7 +280,7 @@
 
 				groupSets.push({
 					id: gs.id,
-					name: 'Group set: ' + gs.name //i18n
+					name: gs.name
 				});
 			}
 
@@ -445,10 +445,6 @@
 			}
 		});
 
-		value = Ext.create('Ext.form.Label', {
-			text: 'Value = DHIS 2 data value'
-		});
-
 		selectPanel = Ext.create('Ext.panel.Panel', {
 			bodyStyle: 'border:0 none',
 			items: [
@@ -464,8 +460,7 @@
 					layout: 'column',
 					bodyStyle: 'border:0 none',
 					items: [
-						row,
-						value
+						row
 					]
 				}
 			]
@@ -502,6 +497,13 @@
 					handler: function() {
 						window.hide();
 					}
+				},
+				{
+					text: '<b>Update</b>',
+					handler: function() {
+						pt.viewport.update();
+						window.hide();
+					}
 				}
 			],
 			listeners: {
@@ -521,6 +523,7 @@
 			var viewport,
 				westRegion,
 				centerRegion,
+				accordion,
 
 				indicatorAvailable,
 				indicatorSelected,
@@ -538,7 +541,7 @@
 				fixedPeriod,
 				organisationUnit,
 				getOrganisationUnitGroupSetPanels,
-				accordion,
+				update,
 
 				addListeners;
 
@@ -1871,7 +1874,7 @@
 					});
 
 					panel = Ext.create('Ext.panel.Panel', {
-						title: '<div class="pt-panel-title-organisationunit">Group set: ' + groupSet.name + '</div>', //i18n
+						title: '<div class="pt-panel-title-organisationunit">' + groupSet.name + '</div>', //i18n
 						hideCollapseTool: true,
 						getData: function() {
 							var data = {
@@ -1938,6 +1941,14 @@
 				return getPanels();
 			};
 
+			update = function() {
+				var settings = pt.api.Settings(pt.util.pivot.getSettingsConfig());
+
+				if (settings && Ext.isObject(settings)) {
+					pt.util.pivot.getTable(settings, pt, centerRegion);
+				}
+			};				
+
 			accordion = Ext.create('Ext.panel.Panel', {
 				bodyStyle: 'border-style:none; padding:3px;',
 				layout: 'fit',
@@ -2013,11 +2024,7 @@
 						{
 							text: '<b>Update</b>',
 							handler: function() {
-								var settings = pt.api.Settings(pt.util.pivot.getSettingsConfig());
-
-								if (settings && Ext.isObject(settings)) {
-									pt.util.pivot.getTable(settings, pt, centerRegion);
-								}
+								update();
 							}
 						}
 					]
@@ -2039,6 +2046,7 @@
 
 			viewport.westRegion = westRegion;
 			viewport.centerRegion = centerRegion;
+			viewport.update = update;
 
 			addListeners = function() {
 				pt.store.indicatorAvailable.on('load', function() {

=== 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-04 14:00:34 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-02-05 07:59:23 +0000
@@ -389,6 +389,7 @@
 			var getDimensionItemsFromSettings,
 				getParamStringFromDimensionItems,
 
+				validateResponse,
 				extendResponse,
 				extendDims,
 				getDims,
@@ -438,6 +439,15 @@
 				return paramString;
 			};
 
+			validateResponse = function(response) {
+				if (response.width < 1 || response.height < 1 || response.rows.length < 1) {
+					alert('No values');
+					return false;
+				}
+
+				return true;
+			};
+		
 			extendResponse = function(dimensionItems) {
 				var response = pt.response,
 					headers = response.headers,
@@ -920,15 +930,17 @@
 				Ext.data.JsonP.request({
 					method: 'GET',
 					url: pt.init.contextPath + '/api/analytics.jsonp' + paramString,
-					//params: {
-						//filter: getFilterParamStringFromSettings()
-					//},
+					callbackName: 'analytics',
 					headers: {
 						'Content-Type': 'application/json',
 						'Accept': 'application/json'
 					},
 					disableCaching: false,
 					success: function(r) {
+						if (!validateResponse(r)) {
+							return;
+						}
+						
 						pt.response = r;
 
 						pt.response.metaData['PT59n8BQbqM'] = 'Female < 10';