← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15809: ER EV integration.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15809 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-06-23 13:48:55 +0200
message:
  ER EV integration.
modified:
  dhis-2/dhis-web/dhis-web-event-reports/src/main/resources/org/hisp/dhis/eventreport/i18n_module.properties
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/i18n.json
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/resources/org/hisp/dhis/eventvisualizer/i18n_module.properties
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/i18n.json
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/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-event-reports/src/main/resources/org/hisp/dhis/eventreport/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/resources/org/hisp/dhis/eventreport/i18n_module.properties	2014-05-12 23:03:35 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/resources/org/hisp/dhis/eventreport/i18n_module.properties	2014-06-23 11:47:18 +0000
@@ -158,4 +158,7 @@
 limit=Limit
 events=Events
 tracked_entity_instances=Tracked entity instances
-count_type=Count type
\ No newline at end of file
+count_type=Count type
+go_to_event_charts=Go to event charts
+open_this_table_as_chart=Open this table as chart
+open_last_chart=Open last chart
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/i18n.json'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/i18n.json	2014-05-12 23:03:35 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/i18n.json	2014-06-23 11:47:18 +0000
@@ -158,5 +158,8 @@
 "limit",
 "events",
 "tracked_entity_instances",
-"count_type"
+"count_type",
+"go_to_event_charts",
+"open_this_table_as_chart",
+"open_last_chart"
 ]

=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-06-20 11:31:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/app.js	2014-06-23 11:47:18 +0000
@@ -2198,8 +2198,6 @@
 
 								ns.app.stores.eventReport.loadStore();
 
-								ns.app.shareButton.enable();
-
 								window.destroy();
 							}
 						});
@@ -2215,7 +2213,7 @@
 
 					if (id && name) {
 						Ext.Ajax.request({
-							url: ns.core.init.contextPath + '/api/eventReports/' + id + '.json?viewClass=dimensional&links=false',
+                            url: init.contextPath + '/api/eventReports/' + id + '.json?fields=' + conf.url.analysisFields.join(','),
 							method: 'GET',
 							failure: function(r) {
 								ns.core.web.mask.show();
@@ -2336,7 +2334,7 @@
 			text: NS.i18n.prev,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? ns.core.init.contextPath + '/api/eventReports.json?fields=id,name,access&filter=name:like:' + value : null;
+					url = value ? ns.core.init.contextPath + '/api/eventReports?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null,
 					store = ns.app.stores.eventReport;
 
 				store.page = store.page <= 1 ? 1 : store.page - 1;
@@ -2348,7 +2346,7 @@
 			text: NS.i18n.next,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? ns.core.init.contextPath + '/api/eventReports/query/' + value + '.json?viewClass=sharing&links=false' : null,
+					url = value ? ns.core.init.contextPath + '/api/eventReports.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null,
 					store = ns.app.stores.eventReport;
 
 				store.page = store.page + 1;
@@ -2441,8 +2439,6 @@
 													ns.app.xLayout.name = true;
 
 													ns.app.stores.eventReport.loadStore();
-
-													ns.app.shareButton.enable();
 												}
 											});
 										}
@@ -5178,6 +5174,7 @@
 
 			accordionBody: accordionBody,
 			accordionPanels: accordionPanels,
+            treePanel: treePanel,
 
 			reset: reset,
 			setGui: setGui,
@@ -5704,7 +5701,7 @@
 				}
 
 				Ext.Ajax.request({
-					url: init.contextPath + '/api/eventReports/' + id + '.json?viewClass=dimensional&links=false',
+					url: init.contextPath + '/api/eventReports/' + id + '.json?fields=' + conf.url.analysisFields.join(','),
 					failure: function(r) {
 						web.mask.hide(ns.app.centerRegion);
 						alert(r.responseText);
@@ -5922,6 +5919,7 @@
             pluginItem,
             shareButton,
             statusBar,
+            defaultButton,
             centerRegion,
             getLayoutWindow,
             viewport;
@@ -6365,7 +6363,7 @@
 			disabled: true,
 			xableItems: function() {
 				interpretationItem.xable();
-				pluginItem.xable();
+				//pluginItem.xable();
 			},
 			//menu: {
 				//cls: 'ns-menu',
@@ -6412,6 +6410,18 @@
             }
         });
 
+		defaultButton = Ext.create('Ext.button.Button', {
+			text: NS.i18n.table,
+			iconCls: 'ns-button-icon-table',
+			toggleGroup: 'module',
+			pressed: true,
+			handler: function() {
+				if (!this.pressed) {
+					this.toggle();
+				}
+			}
+		});
+
 		centerRegion = Ext.create('Ext.panel.Panel', {
 			region: 'center',
 			bodyStyle: 'padding:1px',
@@ -6448,6 +6458,68 @@
 					downloadButton,
 					shareButton,
 					'->',
+					defaultButton,
+					{
+						text: NS.i18n.chart,
+						iconCls: 'ns-button-icon-chart',
+						toggleGroup: 'module',
+						menu: {},
+						handler: function(b) {
+							b.menu = Ext.create('Ext.menu.Menu', {
+								closeAction: 'destroy',
+								shadow: false,
+								showSeparator: false,
+								items: [
+									{
+										text: NS.i18n.go_to_event_charts + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										handler: function() {
+											window.location.href = ns.core.init.contextPath + '/dhis-web-event-visualizer/app/index.html';
+										}
+									},
+									'-',
+									{
+										text: NS.i18n.open_this_table_as_chart + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										disabled: !(NS.isSessionStorage && ns.app.layout),
+										handler: function() {
+											if (NS.isSessionStorage) {
+												ns.app.layout.parentGraphMap = ns.app.widget.treePanel.getParentGraphMap();
+												ns.core.web.storage.session.set(ns.app.layout, 'eventanalytical', ns.core.init.contextPath + '/dhis-web-event-visualizer/app/index.html?s=eventanalytical');
+											}
+										}
+									},
+									{
+										text: NS.i18n.open_last_chart + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										disabled: !(NS.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['eventchart']),
+										handler: function() {
+											window.location.href = ns.core.init.contextPath + '/dhis-web-event-visualizer/app/index.html?s=eventchart';
+										}
+									}
+								],
+								listeners: {
+									show: function() {
+										ns.core.web.window.setAnchorPosition(b.menu, b);
+									},
+									hide: function() {
+										b.menu.destroy();
+										defaultButton.toggle();
+									},
+									destroy: function(m) {
+										b.menu = null;
+									}
+								}
+							});
+
+							b.menu.show();
+						}
+					},
+					{
+						xtype: 'tbseparator',
+						height: 18,
+						style: 'border-color:transparent; border-right-color:#d1d1d1; margin-right:4px',
+					},
 					{
 						xtype: 'button',
 						text: NS.i18n.home,
@@ -6640,7 +6712,7 @@
 
 								// root nodes
 								requests.push({
-									url: init.contextPath + '/api/organisationUnits.json?userDataViewFallback=true&paging=false&fields=id,name,children[id,name]',
+									url: init.contextPath + '/api/organisationUnits.json?userDataViewFallback=true&fields=id,name,children[id,name]&paging=false',
 									success: function(r) {
 										init.rootNodes = Ext.decode(r.responseText).organisationUnits || [];
 										fn();
@@ -6693,15 +6765,6 @@
 									}
 								});
 
-								// legend sets
-								//requests.push({
-									//url: init.contextPath + '/api/mapLegendSets.json?viewClass=detailed&links=false&paging=false',
-									//success: function(r) {
-										//init.legendSets = Ext.decode(r.responseText).mapLegendSets || [];
-										//fn();
-									//}
-								//});
-
 								// dimensions
 								requests.push({
 									url: init.contextPath + '/api/dimensions.json?links=false&paging=false',

=== modified file 'dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-17 14:36:09 +0000
+++ dhis-2/dhis-web/dhis-web-event-reports/src/main/webapp/dhis-web-event-reports/app/scripts/core.js	2014-06-23 09:11:59 +0000
@@ -182,6 +182,43 @@
 					'large': '13px'
 				}
 			};
+
+            conf.url = {
+                analysisFields: [
+                    '*',
+                    'program[id,name]',
+                    'programStage[id,name]',
+                    'columns[dimension,filter,items[id,name]]',
+                    'rows[dimension,filter,items[id,name]]',
+                    'filters[dimension,filter,items[id,name]]',
+                    '!lastUpdated',
+                    '!href',
+                    '!created',
+                    '!publicAccess',
+                    '!rewindRelativePeriods',
+                    '!userOrganisationUnit',
+                    '!userOrganisationUnitChildren',
+                    '!userOrganisationUnitGrandChildren',
+                    '!externalAccess',
+                    '!access',
+                    '!relativePeriods',
+                    '!columnDimensions',
+                    '!rowDimensions',
+                    '!filterDimensions',
+                    '!user',
+                    '!organisationUnitGroups',
+                    '!itemOrganisationUnitGroups',
+                    '!userGroupAccesses',
+                    '!indicators',
+                    '!dataElements',
+                    '!dataElementOperands',
+                    '!dataElementGroups',
+                    '!dataSets',
+                    '!periods',
+                    '!organisationUnitLevels',
+                    '!organisationUnits'
+                ]
+            };
 		}());
 
 		// api
@@ -432,6 +469,10 @@
 					layout.rows = config.rows;
 					layout.filters = config.filters;
 
+                    layout.dataType = Ext.isString(config.dataType) ? config.dataType : 'aggregated_values';
+                    layout.program = config.program;
+                    layout.programStage = config.programStage;
+
                     // dates
                     if (config.startDate && config.endDate) {
                         layout.startDate = config.startDate;

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/resources/org/hisp/dhis/eventvisualizer/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/resources/org/hisp/dhis/eventvisualizer/i18n_module.properties	2014-06-06 10:11:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/resources/org/hisp/dhis/eventvisualizer/i18n_module.properties	2014-06-23 11:47:18 +0000
@@ -186,4 +186,7 @@
 trend=Trend
 base=Base
 axes=Axes
-general=General
\ No newline at end of file
+general=General
+go_to_event_reports=Go to event reports
+open_this_chart_as_table=Open this chart as table
+open_last_table=Open last table
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/i18n.json'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/i18n.json	2014-06-06 10:11:04 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/i18n.json	2014-06-23 11:47:18 +0000
@@ -185,5 +185,8 @@
 "trend",
 "base",
 "axes",
-"general"
+"general",
+"go_to_event_reports",
+"open_this_chart_as_table",
+"open_last_table"
 ]

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js	2014-06-20 11:31:08 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/app.js	2014-06-23 11:47:18 +0000
@@ -1859,7 +1859,7 @@
 
 								ns.app.stores.eventChart.loadStore();
 
-								//ns.app.shareButton.enable();
+								ns.app.shareButton.enable();
 
 								window.destroy();
 							}
@@ -2103,7 +2103,7 @@
 
 													ns.app.stores.eventChart.loadStore();
 
-													//ns.app.shareButton.enable();
+													ns.app.shareButton.enable();
 												}
 											});
 										}
@@ -4624,7 +4624,7 @@
 			ns.app.downloadButton.enable();
 
 			if (layout.id) {
-				//ns.app.shareButton.enable();
+				ns.app.shareButton.enable();
 			}
 
             //ns.app.statusBar.setStatus(layout, response);
@@ -4827,6 +4827,7 @@
 
 			accordionBody: accordionBody,
 			accordionPanels: accordionPanels,
+            treePanel: treePanel,
 
 			reset: reset,
 			setGui: setGui,
@@ -6069,7 +6070,7 @@
 			disabled: true,
 			xableItems: function() {
 				interpretationItem.xable();
-				pluginItem.xable();
+				//pluginItem.xable();
 			},
 			//menu: {
 				//cls: 'ns-menu',
@@ -6116,6 +6117,18 @@
             //}
         //});
 
+		defaultButton = Ext.create('Ext.button.Button', {
+			text: NS.i18n.chart,
+			iconCls: 'ns-button-icon-chart',
+			toggleGroup: 'module',
+			pressed: true,
+			handler: function() {
+				if (!this.pressed) {
+					this.toggle();
+				}
+			}
+		});
+
 		centerRegion = Ext.create('Ext.panel.Panel', {
 			region: 'center',
 			bodyStyle: 'padding:1px',
@@ -6153,6 +6166,68 @@
 					shareButton,
 					'->',
 					{
+						text: NS.i18n.table,
+						iconCls: 'ns-button-icon-table',
+						toggleGroup: 'module',
+						menu: {},
+						handler: function(b) {
+							b.menu = Ext.create('Ext.menu.Menu', {
+								closeAction: 'destroy',
+								shadow: false,
+								showSeparator: false,
+								items: [
+									{
+										text: NS.i18n.go_to_event_reports + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										handler: function() {
+											window.location.href = ns.core.init.contextPath + '/dhis-web-event-reports/app/index.html';
+										}
+									},
+									'-',
+									{
+										text: NS.i18n.open_this_chart_as_table + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										disabled: !(NS.isSessionStorage && ns.app.layout),
+										handler: function() {
+											if (NS.isSessionStorage) {
+												ns.app.layout.parentGraphMap = ns.app.widget.treePanel.getParentGraphMap();
+												ns.core.web.storage.session.set(ns.app.layout, 'eventanalytical', ns.core.init.contextPath + '/dhis-web-event-reports/app/index.html?s=eventanalytical');
+											}
+										}
+									},
+									{
+										text: NS.i18n.open_last_table + '&nbsp;&nbsp;', //i18n
+										cls: 'ns-menu-item-noicon',
+										disabled: !(NS.isSessionStorage && JSON.parse(sessionStorage.getItem('dhis2')) && JSON.parse(sessionStorage.getItem('dhis2'))['eventtable']),
+										handler: function() {
+											window.location.href = ns.core.init.contextPath + '/dhis-web-event-reports/app/index.html?s=eventtable';
+										}
+									}
+								],
+								listeners: {
+									show: function() {
+										ns.core.web.window.setAnchorPosition(b.menu, b);
+									},
+									hide: function() {
+										b.menu.destroy();
+										defaultButton.toggle();
+									},
+									destroy: function(m) {
+										b.menu = null;
+									}
+								}
+							});
+
+							b.menu.show();
+						}
+					},
+					defaultButton,
+					{
+						xtype: 'tbseparator',
+						height: 18,
+						style: 'border-color:transparent; border-right-color:#d1d1d1; margin-right:4px',
+					},
+					{
 						xtype: 'button',
 						text: NS.i18n.home,
 						handler: function() {

=== modified file 'dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-17 14:58:39 +0000
+++ dhis-2/dhis-web/dhis-web-event-visualizer/src/main/webapp/dhis-web-event-visualizer/app/scripts/core.js	2014-06-23 11:47:18 +0000
@@ -491,17 +491,30 @@
 					config.rows = getValidatedDimensionArray(config.rows);
 					config.filters = getValidatedDimensionArray(config.filters);
 
-					// at least one dimension specified as column or row
+					// column
 					if (!config.columns) {
 						alert('No series items selected');
 						return;
 					}
 
+                    if (config.columns.length > 1) {
+                        config.filters = config.filters || [];
+
+                        config.filters = config.filters.concat(config.columns.splice(1));
+                    }
+
+                    // row
 					if (!config.rows && !config.startDate && !config.endDate) {
 						alert('No category items selected');
 						return;
 					}
 
+                    if (config.rows.length > 1) {
+                        config.filters = config.filters || [];
+
+                        config.filters = config.filters.concat(config.rows.splice(1));
+                    }
+
 					// get object names
 					for (var i = 0, dims = Ext.Array.clean([].concat(config.columns || [], config.rows || [], config.filters || [])); i < dims.length; i++) {
 
@@ -531,7 +544,7 @@
 					layout.rows = config.rows;
 					layout.filters = config.filters;
                     
-                    layout.type = config.type;
+                    layout.type = Ext.isString(config.type) ? config.type : 'column';
                     layout.program = config.program;
                     layout.programStage = config.programStage;
 

=== 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	2014-06-20 10:41:50 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js	2014-06-23 08:00:48 +0000
@@ -1063,7 +1063,7 @@
 			text: NS.i18n.prev,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? ns.core.init.contextPath + '/api/reportTables.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
+					url = value ? ns.core.init.contextPath + '/api/reportTables.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null,
 					store = ns.app.stores.reportTable;
 
 				store.page = store.page <= 1 ? 1 : store.page - 1;
@@ -1075,7 +1075,7 @@
 			text: NS.i18n.next,
 			handler: function() {
 				var value = searchTextfield.getValue(),
-					url = value ? ns.core.init.contextPath + '/api/reportTables.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null;
+					url = value ? ns.core.init.contextPath + '/api/reportTables.json?fields=id,name,access' + (value ? '&filter=name:like:' + value : '') : null,
 					store = ns.app.stores.reportTable;
 
 				store.page = store.page + 1;