diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index 1f6836314..bc6ef3d80 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -205,9 +205,14 @@ EOF $oReflection = new ReflectionClass($sDashletClass); if (!$oReflection->isAbstract()) { - $aCallSpec = array($sDashletClass, 'GetInfo'); - $aInfo = call_user_func($aCallSpec); - $oPage->add(''); + $aCallSpec = array($sDashletClass, 'IsVisible'); + $bVisible = call_user_func($aCallSpec); + if ($bVisible) + { + $aCallSpec = array($sDashletClass, 'GetInfo'); + $aInfo = call_user_func($aCallSpec); + $oPage->add(''); + } } } } @@ -228,12 +233,14 @@ EOF { $sId = $oDashlet->GetID(); $sClass = get_class($oDashlet); - - $oPage->add('
'); + if ($oDashlet->IsVisible()) + { + $oPage->add(''); + } } $oPage->add(''); @@ -343,11 +350,17 @@ $('#dashboard_editor').dialog({ $('#dashboard_editor .ui-layout-center').dashboard({ dashboard_id: '$sId', layout_class: '$sLayoutClass', title: '$sTitle', submit_to: '$sUrl', submit_parameters: {operation: 'save_dashboard'}, - render_to: '$sUrl', render_parameters: {operation: 'render_dashboard'} + render_to: '$sUrl', render_parameters: {operation: 'render_dashboard'}, + new_dashlet_parameters: {operation: 'new_dashlet'} }); -$('#dashboard_editor table').sortable({ - items: '.dashlet' +$('#select_dashlet').droppable({ + accept: '.dashlet', + drop: function(event, ui) { + $( this ).find( ".placeholder" ).remove(); + var oDashlet = ui.draggable; + oDashlet.remove(); + }, }); $('#event_bus').bind('dashlet-selected', function(event, data){ diff --git a/application/dashboardlayout.class.inc.php b/application/dashboardlayout.class.inc.php index daac6e13d..31541555d 100644 --- a/application/dashboardlayout.class.inc.php +++ b/application/dashboardlayout.class.inc.php @@ -29,6 +29,24 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout public function Render($oPage, $aDashlets, $bEditMode = false, $aExtraParams = array()) { + // Trim the list of dashlets to remove the invisible ones at the end of the array + $aKeys = array_reverse(array_keys($aDashlets)); + $idx = 0; + $bNoVisibleFound = true; + while($idx < count($aKeys) && $bNoVisibleFound) + { + $oDashlet = $aDashlets[$aKeys[$idx]]; + if ($oDashlet->IsVisible()) + { + $bNoVisibleFound = false; + } + else + { + unset($aDashlets[$aKeys[$idx]]); + } + $idx++; + } + $oPage->add('