← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11026: (PT) Download options: table layout and plain data source.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11026 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-05-27 21:07:11 +0200
message:
  (PT) Download options: table layout and plain data source.
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/webapp/dhis-web-visualizer/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/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-05-27 14:09:32 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2013-05-27 19:02:40 +0000
@@ -1908,6 +1908,7 @@
 				layoutButton,
 				optionsButton,
 				favoriteButton,
+				openTableLayoutTab,
 				downloadButton,
 
 				accordionBody,
@@ -2805,7 +2806,7 @@
 				height: 180,
 				valueField: 'id',
 				displayField: 'name',
-				ddReorder: true,
+				ddReorder: false,
 				store: pt.store.fixedPeriodSelected,
 				tbar: [
 					' ',
@@ -3555,21 +3556,61 @@
 				}
 			});
 
+			openTableLayoutTab = function(type) {
+				if (pt.baseUrl && pt.paramString) {
+					var url = pt.baseUrl + '/api/analytics.' + type + pt.paramString;
+					url += '&tableLayout=true&columns=' + pt.xLayout.columnDimensionNames.join(';') + '&rows=' + pt.xLayout.rowDimensionNames.join(';');
+
+					window.open(url, '_blank');
+				}
+			};
+
 			downloadButton = Ext.create('Ext.button.Button', {
 				text: 'Download',
 				disabled: true,
 				menu: {
 					cls: 'pt-menu',
-					width: 105,
+					width: 140,
 					shadow: false,
 					showSeparator: false,
 					items: [
 						{
-							text: 'Excel (XLS)',
-							iconCls: 'pt-menu-item-xls',
+							xtype: 'label',
+							text: 'Table layout',
+							style: 'padding:7px 5px 5px 7px; font-weight:bold'
+						},
+						{
+							text: 'Microsoft Excel (.xls)',
+							iconCls: 'pt-menu-item-xls',
+							handler: function() {
+								openTableLayoutTab('xls');
+							}
+						},
+						{
+							text: 'CSV (.csv)',
+							iconCls: 'pt-menu-item-xls',
+							handler: function() {
+								openTableLayoutTab('csv');
+							}
+						},
+						{
+							text: 'HTML (.html)',
+							iconCls: 'pt-menu-item-xls',
+							handler: function() {
+								openTableLayoutTab('html');
+							}
+						},
+						{
+							xtype: 'label',
+							text: 'Plain data source',
+							style: 'padding:7px 5px 5px 7px; font-weight:bold'
+						},
+						{
+							text: 'JSON',
+							iconCls: 'pt-menu-item-csv',
 							handler: function() {
 								if (pt.baseUrl && pt.paramString) {
-									window.location.href = pt.baseUrl + '/api/analytics.xls' + pt.paramString;
+									window.open(pt.baseUrl + '/api/analytics.json' + pt.paramString);
 								}
 							}
 						},
@@ -3583,15 +3624,6 @@
 							}
 						},
 						{
-							text: 'JSON',
-							iconCls: 'pt-menu-item-csv',
-							handler: function() {
-								if (pt.baseUrl && pt.paramString) {
-									window.open(pt.baseUrl + '/api/analytics.json' + pt.paramString);
-								}
-							}
-						},
-						{
 							text: 'XML',
 							iconCls: 'pt-menu-item-csv',
 							handler: function() {
@@ -3599,6 +3631,15 @@
 									window.open(pt.baseUrl + '/api/analytics.xml' + pt.paramString);
 								}
 							}
+						},
+						{
+							text: 'Microsoft Excel',
+							iconCls: 'pt-menu-item-xls',
+							handler: function() {
+								if (pt.baseUrl && pt.paramString) {
+									window.location.href = pt.baseUrl + '/api/analytics.xls' + pt.paramString;
+								}
+							}
 						}
 					],
 					listeners: {

=== 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 14:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js	2013-05-27 19:02:40 +0000
@@ -841,7 +841,9 @@
 						items = Ext.Array.unique(items);
 					}
 
-					paramString += ':' + items.join(';');
+					if (dimName !== dimConf.category.dimensionName) {
+						paramString += ':' + items.join(';');
+					}
 
 					if (i < (sortedAxisDimensionNames.length - 1)) {
 						paramString += '&';

=== 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-05-15 09:45:38 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css	2013-05-27 19:06:21 +0000
@@ -483,7 +483,6 @@
     padding-left: 18px;
 }
 
-
 /*----------------------------------------------------------------------------
  * Button
  *--------------------------------------------------------------------------*/

=== 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-05-27 14:14:21 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js	2013-05-27 19:02:40 +0000
@@ -3164,7 +3164,7 @@
 				height: 180,
 				valueField: 'id',
 				displayField: 'name',
-				ddReorder: true,
+				ddReorder: false,
 				store: dv.store.fixedPeriodSelected,
 				tbar: [
 					' ',

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2013-05-27 14:51:20 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js	2013-05-27 19:02:40 +0000
@@ -672,7 +672,9 @@
 						items = Ext.Array.unique(items);
 					}
 
-					paramString += ':' + items.join(';');
+					if (dimName !== dimConf.category.dimensionName) {
+						paramString += ':' + items.join(';');
+					}
 
 					if (i < (sortedAxisDimensionNames.length - 1)) {
 						paramString += '&';