← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17461: GIS ER EV start date fix + PT button menu fix.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17461 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-11-13 11:45:23 +0100
message:
  GIS ER EV start date fix + PT button menu fix.
modified:
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js
  dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/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-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2014-11-10 16:03:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/app.js	2014-11-13 10:43:12 +0000
@@ -4048,12 +4048,7 @@
 			labelSeparator: '',
             columnWidth: 0.5,
             height: 44,
-            value: function() {
-                var greg = $.calendars.instance('gregorian'),
-                    date = greg.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
-
-                return ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, date);
-            }(),
+            value: ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, ns.core.init.calendar.today().add(-3, 'm')),
             listeners: {
                 render: function(c) {
                     onDateFieldRender(c);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2014-11-10 16:03:39 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/app.js	2014-11-13 10:43:12 +0000
@@ -3684,12 +3684,7 @@
 			labelSeparator: '',
             columnWidth: 0.5,
             height: 44,
-            value: function() {
-                var greg = $.calendars.instance('gregorian'),
-                    date = greg.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
-
-                return ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, date);
-            }(),
+            value: ns.core.init.calendar.formatDate(ns.core.init.systemInfo.dateFormat, ns.core.init.calendar.today().add(-3, 'm')),
             listeners: {
                 render: function(c) {
                     onDateFieldRender(c);

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2014-11-13 07:17:37 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/scripts/app.js	2014-11-13 10:43:12 +0000
@@ -4619,13 +4619,7 @@
 			labelSeparator: '',
             columnWidth: 0.5,
             height: 41,
-            //value: function() {
-                ////var greg = $.calendars.instance('gregorian'),
-                //var date = gis.init.calendar.parseDate('yyyy-mm-dd', (new Date( (new Date()).setMonth( (new Date()).getMonth() - 3))).toJSON().slice(0,10));
-
-                //return gis.init.calendar.formatDate(gis.init.systemInfo.dateFormat, date);
-            //}(),
-            value: gis.init.calendar.formatDate(gis.init.systemInfo.dateFormat, gis.init.calendar.today()),
+            value: gis.init.calendar.formatDate(gis.init.systemInfo.dateFormat, gis.init.calendar.today().add(-3, 'm')),
             listeners: {
                 render: function(c) {
                     onDateFieldRender(c);
@@ -4970,7 +4964,6 @@
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_levels,
 			editable: false,
-			hidden: true,
 			store: {
 				fields: ['id', 'name', 'level'],
 				data: gis.init.organisationUnitLevels
@@ -4986,7 +4979,6 @@
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_groups,
 			editable: false,
-			hidden: true,
 			store: gis.store.organisationUnitGroup
 		});
 
@@ -5006,11 +4998,9 @@
 		toolMenu = Ext.create('Ext.menu.Menu', {
 			shadow: false,
 			showSeparator: false,
-			menuValue: 'orgunit',
+			menuValue: 'level',
 			clickHandler: function(param) {
-				if (!param) {
-					return;
-				}
+				param = param || this.menuValue;
 
 				var items = this.items.items;
 				this.menuValue = param;
@@ -5064,18 +5054,15 @@
 				},
 				{
 					text: GIS.i18n.select_organisation_units + '&nbsp;&nbsp;',
-					param: 'orgunit',
-					iconCls: 'gis-menu-item-selected'
+					param: 'orgunit'
 				},
 				{
 					text: 'Select levels' + '&nbsp;&nbsp;',
-					param: 'level',
-					iconCls: 'gis-menu-item-unselected'
+					param: 'level'
 				},
 				{
 					text: 'Select groups' + '&nbsp;&nbsp;',
-					param: 'group',
-					iconCls: 'gis-menu-item-unselected'
+					param: 'group'
 				}
 			],
 			listeners: {
@@ -5120,7 +5107,12 @@
                     ]
                 },
                 treePanel
-            ]
+            ],
+			listeners: {
+				render: function() {
+                    toolMenu.clickHandler();
+                }
+            }
         });
 
             // accordion

=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2014-11-06 15:44:09 +0000
+++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/scripts/app.js	2014-11-13 08:38:49 +0000
@@ -5401,6 +5401,138 @@
 			}
 		});
 
+		downloadButton = Ext.create('Ext.button.Button', {
+			text: 'Download',
+			disabled: true,
+			menu: function() {
+                var b = this;
+
+                b.menu = Ext.create('Ext.menu.Menu', {
+                    closeAction: 'destroy',
+                    //cls: 'ns-menu',
+                    shadow: false,
+                    showSeparator: false,
+                    items: function() {
+                        var items = [
+                            {
+                                xtype: 'label',
+                                text: NS.i18n.table_layout,
+                                style: 'padding:7px 5px 5px 7px; font-weight:bold; border:0 none'
+                            },
+                            {
+                                text: 'Microsoft Excel (.xls)',
+                                iconCls: 'ns-menu-item-tablelayout',
+                                handler: function() {
+                                    openTableLayoutTab('xls');
+                                }
+                            },
+                            {
+                                text: 'CSV (.csv)',
+                                iconCls: 'ns-menu-item-tablelayout',
+                                handler: function() {
+                                    openTableLayoutTab('csv');
+                                }
+                            },
+                            {
+                                text: 'HTML (.html)',
+                                iconCls: 'ns-menu-item-tablelayout',
+                                handler: function() {
+                                    openTableLayoutTab('html+css', true);
+                                }
+                            },
+                            {
+                                xtype: 'label',
+                                text: NS.i18n.plain_data_sources,
+                                style: 'padding:7px 5px 5px 7px; font-weight:bold'
+                            },
+                            {
+                                text: 'JSON',
+                                iconCls: 'ns-menu-item-datasource',
+                                handler: function() {
+                                    if (ns.core.init.contextPath && ns.app.paramString) {
+                                        window.open(ns.core.init.contextPath + '/api/analytics.json' + getParamString(), '_blank');
+                                    }
+                                }
+                            },
+                            {
+                                text: 'XML',
+                                iconCls: 'ns-menu-item-datasource',
+                                handler: function() {
+                                    if (ns.core.init.contextPath && ns.app.paramString) {
+                                        window.open(ns.core.init.contextPath + '/api/analytics.xml' + getParamString(), '_blank');
+                                    }
+                                }
+                            },
+                            {
+                                text: 'Microsoft Excel',
+                                iconCls: 'ns-menu-item-datasource',
+                                handler: function() {
+                                    if (ns.core.init.contextPath && ns.app.paramString) {
+                                        window.location.href = ns.core.init.contextPath + '/api/analytics.xls' + getParamString();
+                                    }
+                                }
+                            },
+                            {
+                                text: 'CSV',
+                                iconCls: 'ns-menu-item-datasource',
+                                handler: function() {
+                                    if (ns.core.init.contextPath && ns.app.paramString) {
+                                        window.location.href = ns.core.init.contextPath + '/api/analytics.csv' + getParamString();
+                                    }
+                                }
+                            },
+                            {
+                                text: 'JRXML',
+                                iconCls: 'ns-menu-item-datasource',
+                                handler: function() {
+                                    if (ns.core.init.contextPath && ns.app.paramString) {
+                                        window.open(ns.core.init.contextPath + '/api/analytics.jrxml' + getParamString(), '_blank');
+                                    }
+                                }
+                            }
+                        ];
+
+                        if (ns.app.layout && !!ns.app.layout.showHierarchy && ns.app.xResponse.nameHeaderMap.hasOwnProperty('ou')) {
+                            items.push({
+                                xtype: 'label',
+                                text: NS.i18n.plain_data_sources + ' w/ hierarchy',
+                                style: 'padding:7px 8px 5px 7px; font-weight:bold'
+                            });
+
+                            items.push({
+                                text: 'CSV',
+                                iconCls: 'ns-menu-item-datasource',
+                                hidden: !(ns.app.layout && !!ns.app.layout.showHierarchy && ns.app.xResponse.nameHeaderMap.hasOwnProperty('ou')),
+                                handler: function() {
+                                    var response = ns.core.service.response.addOuHierarchyDimensions(Ext.clone(ns.app.response));
+
+                                    ns.core.web.document.printResponseCSV(response);
+                                }
+                            });
+                        }
+
+                        return items;
+                    }(),
+                    listeners: {
+                        added: function() {
+                            ns.app.downloadButton = this;
+                        },
+                        show: function() {
+                            ns.core.web.window.setAnchorPosition(b.menu, b);
+                        },
+                        hide: function() {
+                            b.menu.destroy();
+                        },
+                        destroy: function(m) {
+                            b.menu = null;
+                        }
+                    }
+                });
+
+                return b.menu;
+			}()
+		});
+
 		interpretationItem = Ext.create('Ext.menu.Item', {
 			text: 'Write interpretation' + '&nbsp;&nbsp;',
 			iconCls: 'ns-menu-item-tablelayout',
@@ -6176,7 +6308,7 @@
 				ns.app.viewport = createViewport();
 			}
 		};
-        
+
 		// requests
 		Ext.Ajax.request({
 			url: 'manifest.webapp',