diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index fd96f8ee0..c563141ee 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -495,7 +495,10 @@ EOF $bCanEdit = UserRights::IsAdministrator() || $oAttDef->IsUserEditable(); $sDivId = $oDashboard->GetId(); $oPage->add('
'); - $aExtraParams = array('query_params' => $this->ToArgsForQuery()); + $aExtraParams = array( + 'query_params' => $this->ToArgsForQuery(), + 'dashboard_div_id' => $sDivId, + ); $oDashboard->Render($oPage, false, $aExtraParams, $bCanEdit); $oPage->add('
'); } diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index 737720e86..eb32d7095 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -825,6 +825,8 @@ class RuntimeDashboard extends Dashboard $aRenderParams = $aExtraParams; } + $aRenderParams['bCustomized'] = $this->bCustomized; + parent::Render($oPage, $bEditMode, $aRenderParams); if (isset($aExtraParams['query_params']['this->object()'])) @@ -1092,9 +1094,11 @@ EOF { $aRenderParams = $aExtraParams; } + $aRenderParams['dashboard_div_id'] = $aExtraParams['dashboard_div_id']; $sJSExtraParams = json_encode($aExtraParams); $oPage->add('
'); $oPage->add('
'); + $this->SetCustomFlag(true); $this->Render($oPage, true, $aRenderParams); $oPage->add('
'); $oPage->add('
'); diff --git a/application/dashboardlayout.class.inc.php b/application/dashboardlayout.class.inc.php index 8ed7be5ec..4a17ed070 100644 --- a/application/dashboardlayout.class.inc.php +++ b/application/dashboardlayout.class.inc.php @@ -129,10 +129,20 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout { if ($oDashlet->IsVisible()) { - $sDashboardId = $oDashlet->GetID(); - // N°2634 : we must have a unique id per dashlet ! - // To avoid collision with other dashlets with the same ID we prefix it. Collisions typically happen with extensions. - $oDashlet->SetID("row$iRows-col$iCols-$sDashboardId"); + $sDashletId = $oDashlet->GetID(); + if(strpos($sDashletId, 'IDrow') === false) + { + $sDashboardDivId = $aExtraParams['dashboard_div_id']; + // N°2634 : we must have a unique id per dashlet ! + // To avoid collision with other dashlets with the same ID we prefix it with row/cell id + // Collisions typically happen with extensions. + $sDashletId = $sDashboardDivId."_IDrow$iRows-col$iCols-$sDashletId"; + if (array_key_exists('bCustomized', $aExtraParams) && ((bool)$aExtraParams['bCustomized']) === true) + { + $sDashletId = 'CUSTOM_'.$sDashletId; + } + $oDashlet->SetID($sDashletId); + } $oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams); } } diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php index 071af7a04..d4f66201c 100644 --- a/application/menunode.class.inc.php +++ b/application/menunode.class.inc.php @@ -1205,6 +1205,7 @@ class DashboardMenuNode extends MenuNode { $sDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $this->sMenuId); $oPage->add('
'); + $aExtraParams['dashboard_div_id'] = $sDivId; $oDashboard->SetReloadURL($this->GetHyperlink($aExtraParams)); $oDashboard->Render($oPage, false, $aExtraParams); $oPage->add('
'); diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 78b66d968..e20cf1f0d 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1199,6 +1199,7 @@ EOF case 'dashboard_editor': $sId = utils::ReadParam('id', '', false, 'raw_data'); $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); + $aExtraParams['dashboard_div_id'] = preg_replace('/[^a-zA-Z0-9_]/', '', $sId); $sDashboardFile = utils::ReadParam('file', '', false, 'raw_data'); $sReloadURL = utils::ReadParam('reload_url', '', false, 'raw_data'); $oKPI = new ExecutionKPI();