← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17986: Dashboard plugin fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 17986 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-01-14 14:17:58 +0100
message:
  Dashboard plugin fixes.
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.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-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2015-01-14 12:56:04 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js	2015-01-14 13:17:15 +0000
@@ -42,9 +42,9 @@
 $( document ).ready( function()
 {
 	$( "#interpretationArea" ).autogrow();
-	
+
 	$( document ).click( dhis2.db.hideSearch );
-	
+
 	$( window ).resize( dhis2.db.drawWideItems );
 
 	$( "#searchField" ).focus( function() {
@@ -415,18 +415,18 @@
 }
 
 /**
- * Toggles size of item. The order is 1) normal 2) double 3) full. 
+ * Toggles size of item. The order is 1) normal 2) double 3) full.
  */
 dhis2.db.resizeItem = function( id )
 {
 	$.getJSON( "../api/dashboardItems/" + id, function( item ) {
 
 		var newShape = dhis2.db.shapeNormal;
-		
+
 		if ( dhis2.db.shapeDoubleWidth == item.shape ) {
 			newShape = dhis2.db.shapeFullWidth;
 			dhis2.db.setFullItemWidth( id );
-		}	
+		}
 	    else if ( dhis2.db.shapeFullWidth == item.shape ) {
 			newShape = dhis2.db.shapeNormal;
 			dhis2.db.setNormalItemWidth( id );
@@ -435,7 +435,7 @@
 	    	newShape = dhis2.db.shapeDoubleWidth;
 	    	dhis2.db.setDoubleItemWidth( id );
 	    }
-		
+
 		if ( newShape ) {
 			$.ajax( {
 				url: "../api/dashboardItems/" + id + "/shape/" + newShape,
@@ -447,18 +447,18 @@
 
 dhis2.db.setNormalItemWidth = function( id ) {
 	$( "#" + id ).css( "width", dhis2.db.widthNormal + "px" );
-	Ext.get( "plugin-" + id ).viewport.setWidth( dhis2.db.widthNormal );
+	Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthNormal );
 }
 
 dhis2.db.setDoubleItemWidth = function( id ) {
 	$( "#" + id ).css( "width", dhis2.db.widthDouble + "px" );
-	Ext.get( "plugin-" + id ).viewport.setWidth( dhis2.db.widthDouble );
+	Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthDouble );
 }
 
 dhis2.db.setFullItemWidth = function( id ) {
 	var	fullWidth = dhis2.db.getFullWidth();
 	$( "#" + id ).css( "width", fullWidth + "px" );
-	Ext.get( "plugin-" + id ).viewport.setWidth( fullWidth );
+	Ext.get( "plugin-" + id ).setViewportWidth( fullWidth );
 }
 
 dhis2.db.drawWideItems = function()
@@ -466,7 +466,7 @@
 	if ( undefined !== dhis2.db.current() ) {
 		var url = "../api/dashboards/" + dhis2.db.current() + "?fields=dashboardItems[id,shape]",
 			viewPortWidth = $( window ).width();
-		
+
 		$.getJSON( url, function( dashboard ) {
 			$.each( dashboard.dashboardItems, function( i, item ) {
 				if ( dhis2.db.shapeFullWidth == item.shape ) {
@@ -476,7 +476,7 @@
 					dhis2.db.setNormalItemWidth( item.id );
 				}
 				else if ( viewPortWidth > dhis2.db.widthDouble && dhis2.db.shapeDoubleWidth == item.shape ) {
-					dhis2.db.setDoubleItemWidth( item.id );			
+					dhis2.db.setDoubleItemWidth( item.id );
 				}
 			} );
 		} );
@@ -518,16 +518,16 @@
 				}
 
 				var width = dhis2.db.widthNormal;
-				
+
 				if ( dhis2.db.shapeFullWidth == dashboardItem.shape ) {
 					width = fullWidth;
 				}
 				else if ( dhis2.db.shapeDoubleWidth == dashboardItem.shape ) {
 					width = dhis2.db.widthDouble;
 				}
-				
+
 				var style = "width:" + width + "px";
-				
+
 				if ( "chart" == dashboardItem.type )
 				{
 				    $d.append( $.tmpl( dhis2.db.tmpl.chartItem, { "itemId": dashboardItem.id, "id": dashboardItem.chart.id, "name": dashboardItem.chart.name, "style": style,

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-01-14 11:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/chart.js	2015-01-14 12:56:58 +0000
@@ -3013,7 +3013,7 @@
                         chart.setTitlePosition();
                     };
 
-                    chart.on('afterrender', function() {
+                    chart.on('resize', function() {
                         chart.setTitlePosition();
                     });
 
@@ -3954,7 +3954,10 @@
 
 			ns.app.viewport = createViewport();
 			ns.app.centerRegion = ns.app.viewport.centerRegion;
-            Ext.get(config.el).viewport = ns.app.centerRegion;
+
+            Ext.get(config.el).setViewportWidth = function(width) {
+                ns.app.centerRegion.setWidth(width);
+            };
 
 			if (config && config.id) {
 				ns.core.web.chart.loadChart(config);

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js	2015-01-14 11:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventchart.js	2015-01-14 12:56:58 +0000
@@ -3380,7 +3380,7 @@
                         chart.setTitlePosition();
                     };
 
-                    chart.on('afterrender', function() {
+                    chart.on('resize', function() {
                         chart.setTitlePosition();
                     });
 
@@ -4505,7 +4505,10 @@
 
 			ns.app.viewport = createViewport();
 			ns.app.centerRegion = ns.app.viewport.centerRegion;
-            Ext.get(config.el).viewport = ns.app.centerRegion;
+
+            Ext.get(config.el).setViewportWidth = function(width) {
+                ns.app.centerRegion.setWidth(width);
+            };
 
 			if (config && config.id) {
 				ns.core.web.report.loadReport(config);

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js	2015-01-14 11:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/eventreport.js	2015-01-14 12:56:58 +0000
@@ -3816,7 +3816,10 @@
 
 			ns.app.viewport = createViewport();
 			ns.app.centerRegion = ns.app.viewport.centerRegion;
-            Ext.get(config.el).viewport = ns.app.centerRegion;
+
+            Ext.get(config.el).setViewportWidth = function(width) {
+                ns.app.centerRegion.setWidth(width);
+            };
 
 			if (config.id) {
 				ns.core.web.report.loadReport(config.id);

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-14 11:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/map.js	2015-01-14 13:00:40 +0000
@@ -6958,7 +6958,7 @@
                                 centerRegion = this;
                             }
                         }
-			    },
+                    },
                     {
                         xtype: 'panel',
                         layout: 'anchor',
@@ -6981,7 +6981,7 @@
                                         gis.layer.thematic1.legendPanel = this;
                                     }
                                 }
-			    },
+                            },
                             {
                                 title: GIS.i18n.thematic_layer_2_legend,
                                 cls: 'gis-panel-legend',
@@ -6991,7 +6991,7 @@
                                         gis.layer.thematic2.legendPanel = this;
                                     }
                                 }
-			    },
+                            },
                             {
                                 title: GIS.i18n.thematic_layer_3_legend,
                                 cls: 'gis-panel-legend',
@@ -7001,7 +7001,7 @@
                                         gis.layer.thematic3.legendPanel = this;
                                     }
                                 }
-			    },
+                            },
                             {
                                 title: GIS.i18n.thematic_layer_4_legend,
                                 cls: 'gis-panel-legend',
@@ -7011,7 +7011,7 @@
                                         gis.layer.thematic4.legendPanel = this;
                                     }
                                 }
-			    },
+                            },
                             {
                                 title: GIS.i18n.facility_layer_legend,
                                 cls: 'gis-panel-legend',
@@ -7021,15 +7021,15 @@
                                         gis.layer.facility.legendPanel = this;
                                     }
                                 }
-			    }
-			],
+                            }
+                        ],
                         listeners: {
                             added: function () {
                                 eastRegion = this;
                             }
                         }
-		    }
-		],
+                    }
+                ],
                 listeners: {
                     afterrender: function () {
                         afterRender();
@@ -7115,7 +7115,11 @@
             gis.map = config;
 
             gis.viewport = createViewport();
-            Ext.get(config.el).viewport = gis.viewport.centerRegion;
+
+            Ext.get(config.el).setViewportWidth = function(width) {
+                gis.viewport.setWidth(width);
+                gis.viewport.centerRegion.setWidth(width);
+            };
 
             gis.olmap.mask = Ext.create('Ext.LoadMask', gis.viewport.centerRegion.getEl(), {
                 msg: 'Loading'

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js	2015-01-14 11:40:43 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/plugin/table.js	2015-01-14 12:56:58 +0000
@@ -3407,7 +3407,10 @@
 
 			ns.app.viewport = createViewport();
 			ns.app.centerRegion = ns.app.viewport.centerRegion;
-            Ext.get(config.el).viewport = ns.app.centerRegion;
+
+            Ext.get(config.el).setViewportWidth = function(width) {
+                ns.app.centerRegion.setWidth(width);
+            };
 
 			if (config && config.id) {
 				ns.core.web.pivot.loadTable(config);