← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11043: (PT) Download fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11043 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-05-28 12:14:40 +0200
message:
  (PT) Download fixes.
modified:
  dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties
  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/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties	2013-05-09 08:48:24 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties	2013-05-28 10:10:21 +0000
@@ -13,7 +13,7 @@
 select_period_type=S\u00E9lectionner type de p\u00E9riode
 last_4_quarters=4 derniers trimestres
 data_sets=Ensembles de donn\u00E9es
-next_year=Ann\u00E9e suiv
+next_year=Suiv
 create=Cr\u00E9er
 last_2_sixmonths=2 derniers semestres
 hide_empty_rows=Masquer les lignes vides
@@ -89,7 +89,7 @@
 last_3_months=3 derniers mois
 bimonths=Bimestre
 months=Mois
-prev_year=Ann\u00E9e pr\u00E9c
+prev_year=Pr\u00E9c
 last_month=Mois pass\u00E9
 all_indicator_groups=Tous les groupes d'indicateurs
 this_year=Cette ann\u00E9e

=== 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-05-27 19:53:38 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-05-28 09:57:43 +0000
@@ -3558,7 +3558,7 @@
 
 			openTableLayoutTab = function(type, isNewTab) {
 				if (pt.baseUrl && pt.paramString) {
-					var url = pt.baseUrl + '/api/analytics.' + type + pt.paramString;
+					var url = pt.baseUrl + '/api/analytics.' + type + pt.util.pivot.getParamString(pt.xLayout);
 					url += '&tableLayout=true&columns=' + pt.xLayout.columnDimensionNames.join(';') + '&rows=' + pt.xLayout.rowDimensionNames.join(';');
 
 					window.open(url, isNewTab ? '_blank' : '_top');
@@ -3610,7 +3610,7 @@
 							iconCls: 'pt-menu-item-csv',
 							handler: function() {
 								if (pt.baseUrl && pt.paramString) {
-									window.open(pt.baseUrl + '/api/analytics.json' + pt.paramString, '_blank');
+									window.open(pt.baseUrl + '/api/analytics.json' + pt.util.pivot.getParamString(pt.xLayout), '_blank');
 								}
 							}
 						},
@@ -3619,7 +3619,7 @@
 							iconCls: 'pt-menu-item-csv',
 							handler: function() {
 								if (pt.baseUrl && pt.paramString) {
-									window.open(pt.baseUrl + '/api/analytics.xml' + pt.paramString, '_blank');
+									window.open(pt.baseUrl + '/api/analytics.xml' + pt.util.pivot.getParamString(pt.xLayout), '_blank');
 								}
 							}
 						},
@@ -3628,7 +3628,7 @@
 							iconCls: 'pt-menu-item-xls',
 							handler: function() {
 								if (pt.baseUrl && pt.paramString) {
-									window.location.href = pt.baseUrl + '/api/analytics.xls' + pt.paramString;
+									window.location.href = pt.baseUrl + '/api/analytics.xls' + pt.util.pivot.getParamString(pt.xLayout);
 								}
 							}
 						},
@@ -3637,7 +3637,7 @@
 							iconCls: 'pt-menu-item-csv',
 							handler: function() {
 								if (pt.baseUrl && pt.paramString) {
-									window.location.href = pt.baseUrl + '/api/analytics.csv' + pt.paramString;
+									window.location.href = pt.baseUrl + '/api/analytics.csv' + pt.util.pivot.getParamString(pt.xLayout);
 								}
 							}
 						}

=== 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-05-27 19:02:40 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-05-28 09:57:43 +0000
@@ -701,10 +701,64 @@
 			return xLayout;
 		},
 
+		getParamString: function(xLayout, isSorted) {
+			var axisDimensionNames = isSorted ? xLayout.sortedAxisDimensionNames : xLayout.axisDimensionNames,
+				filterDimensions = isSorted ? xLayout.sortedFilterDimensions : xLayout.filterDimensions,
+				dimensionNameIdsMap = isSorted ? xLayout.dimensionNameSortedIdsMap : xLayout.dimensionNameIdsMap,
+				paramString = '?',
+				dimConf = pt.conf.finals.dimension,
+				addCategoryDimension = false,
+				map = xLayout.dimensionNameItemsMap,
+				dx = dimConf.indicator.dimensionName;
+
+			for (var i = 0, dimName, items; i < axisDimensionNames.length; i++) {
+				dimName = axisDimensionNames[i];
+
+				paramString += 'dimension=' + dimName;
+
+				items = Ext.clone(dimensionNameIdsMap[dimName]);
+
+				if (dimName === dx) {
+					for (var j = 0, index; j < items.length; j++) {
+						index = items[j].indexOf('-');
+
+						if (index > 0) {
+							addCategoryDimension = true;
+							items[j] = items[j].substr(0, index);
+						}
+					}
+
+					items = Ext.Array.unique(items);
+				}
+
+				if (dimName !== dimConf.category.dimensionName) {
+					paramString += ':' + items.join(';');
+				}
+
+				if (i < (axisDimensionNames.length - 1)) {
+					paramString += '&';
+				}
+			}
+
+			if (addCategoryDimension) {
+				paramString += '&dimension=' + pt.conf.finals.dimension.category.dimensionName;
+			}
+
+			if (Ext.isArray(filterDimensions) && filterDimensions.length) {
+				for (var i = 0, dim; i < filterDimensions.length; i++) {
+					dim = filterDimensions[i];
+
+					paramString += '&filter=' + dim.dimensionName + ':' + dim.ids.join(';');
+				}
+			}
+
+			return paramString;
+		},
+
 		createTable: function(layout, pt) {
 			var dimConf = pt.conf.finals.dimension,
 				getSyncronizedXLayout,
-				getParamString,
+				//getParamString,
 				getExtendedResponse,
 				getExtendedAxis,
 				validateUrl,
@@ -811,60 +865,6 @@
 				}();
 			};
 
-			getParamString = function(xLayout) {
-				var sortedAxisDimensionNames = xLayout.sortedAxisDimensionNames,
-					sortedFilterDimensions = xLayout.sortedFilterDimensions,
-					dimensionNameSortedIdsMap = xLayout.dimensionNameSortedIdsMap,
-					paramString = '?',
-					dimConf = pt.conf.finals.dimension,
-					addCategoryDimension = false,
-					map = xLayout.dimensionNameItemsMap,
-					dx = dimConf.indicator.dimensionName;
-
-				for (var i = 0, dimName, items; i < sortedAxisDimensionNames.length; i++) {
-					dimName = sortedAxisDimensionNames[i];
-
-					paramString += 'dimension=' + dimName;
-
-					items = Ext.clone(dimensionNameSortedIdsMap[dimName]);
-
-					if (dimName === dx) {
-						for (var j = 0, index; j < items.length; j++) {
-							index = items[j].indexOf('-');
-
-							if (index > 0) {
-								addCategoryDimension = true;
-								items[j] = items[j].substr(0, index);
-							}
-						}
-
-						items = Ext.Array.unique(items);
-					}
-
-					if (dimName !== dimConf.category.dimensionName) {
-						paramString += ':' + items.join(';');
-					}
-
-					if (i < (sortedAxisDimensionNames.length - 1)) {
-						paramString += '&';
-					}
-				}
-
-				if (addCategoryDimension) {
-					paramString += '&dimension=' + pt.conf.finals.dimension.category.dimensionName;
-				}
-
-				if (Ext.isArray(sortedFilterDimensions) && sortedFilterDimensions.length) {
-					for (var i = 0, dim; i < sortedFilterDimensions.length; i++) {
-						dim = sortedFilterDimensions[i];
-
-						paramString += '&filter=' + dim.dimensionName + ':' + dim.ids.join(';');
-					}
-				}
-
-				return paramString;
-			};
-
 			getExtendedResponse = function(response, xLayout) {
 				response.nameHeaderMap = {};
 				response.idValueMap = {};
@@ -1747,7 +1747,7 @@
 				xLayout = util.pivot.getExtendedLayout(layout);
 
 				// Param string
-				pt.paramString = getParamString(xLayout);
+				pt.paramString = util.pivot.getParamString(xLayout, true);
 				url = pt.init.contextPath + '/api/analytics.json' + pt.paramString;
 
 				// Validate request size