=== 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 18:17:17 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dashboard.js 2015-01-15 14:28:32 +0000
@@ -33,6 +33,9 @@
dhis2.db.widthNormal = 408;
dhis2.db.widthDouble = 849;
+dhis2.db.itemContentHeight = 304;
+dhis2.db.itemScrollbarWidth = /\bchrome\b/.test(navigator.userAgent.toLowerCase()) ? 8 : 17;
+
// TODO support table as link and embedded
// TODO double horizontal size
@@ -118,7 +121,7 @@
"
",
@@ -420,7 +423,7 @@
/**
* Toggles size of item. The order is 1) normal 2) double 3) full.
*/
-dhis2.db.resizeItem = function( id )
+dhis2.db.resizeItem = function( id, isScrollbar )
{
$.getJSON( "../api/dashboardItems/" + id, function( item ) {
@@ -428,15 +431,15 @@
if ( dhis2.db.shapeDoubleWidth == item.shape ) {
newShape = dhis2.db.shapeFullWidth;
- dhis2.db.setFullItemWidth( id );
+ dhis2.db.setFullItemWidth( id, isScrollbar );
}
else if ( dhis2.db.shapeFullWidth == item.shape ) {
newShape = dhis2.db.shapeNormal;
- dhis2.db.setNormalItemWidth( id );
+ dhis2.db.setNormalItemWidth( id, isScrollbar );
}
else {
newShape = dhis2.db.shapeDoubleWidth;
- dhis2.db.setDoubleItemWidth( id );
+ dhis2.db.setDoubleItemWidth( id, isScrollbar );
}
if ( newShape ) {
@@ -448,20 +451,20 @@
} );
}
-dhis2.db.setNormalItemWidth = function( id ) {
+dhis2.db.setNormalItemWidth = function( id, isScrollbar ) {
$( "#" + id ).css( "width", dhis2.db.widthNormal + "px" );
- Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthNormal );
+ Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthNormal - (isScrollbar ? dhis2.db.itemScrollbarWidth : 0));
}
-dhis2.db.setDoubleItemWidth = function( id ) {
+dhis2.db.setDoubleItemWidth = function( id, isScrollbar ) {
$( "#" + id ).css( "width", dhis2.db.widthDouble + "px" );
- Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthDouble );
+ Ext.get( "plugin-" + id ).setViewportWidth( dhis2.db.widthDouble - (isScrollbar ? dhis2.db.itemScrollbarWidth : 0));
}
-dhis2.db.setFullItemWidth = function( id ) {
+dhis2.db.setFullItemWidth = function( id, isScrollbar ) {
var fullWidth = dhis2.db.getFullWidth();
$( "#" + id ).css( "width", fullWidth + "px" );
- Ext.get( "plugin-" + id ).setViewportWidth( fullWidth );
+ Ext.get( "plugin-" + id ).setViewportWidth( fullWidth - (isScrollbar ? dhis2.db.itemScrollbarWidth : 0));
}
dhis2.db.drawWideItems = function()
@@ -488,10 +491,6 @@
dhis2.db.renderDashboard = function( id )
{
- var contentHeight = 304,
- isChrome = /\bchrome\b/.test(navigator.userAgent.toLowerCase()),
- scrollbarWidth = isChrome ? 8 : 17;
-
if ( !id )
{
return;
@@ -541,7 +540,7 @@
el: 'plugin-' + dashboardItem.id,
id: dashboardItem.chart.id,
width: width,
- height: contentHeight,
+ height: dhis2.db.itemContentHeight,
dashboard: true,
crossDomain: false,
skipMask: true,
@@ -577,7 +576,7 @@
el: 'plugin-' + dashboardItem.id,
id: dashboardItem.eventChart.id,
width: width,
- height: contentHeight,
+ height: dhis2.db.itemContentHeight,
dashboard: true,
crossDomain: false,
skipMask: true,