diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php index dd3c42c4a..d473c2234 100644 --- a/application/dashboard.class.inc.php +++ b/application/dashboard.class.inc.php @@ -789,6 +789,7 @@ class RuntimeDashboard extends Dashboard /** * @inheritDoc + * @return bool $bIsNew * @throws \Exception */ public function Save() @@ -798,6 +799,7 @@ class RuntimeDashboard extends Dashboard $oUDSearch->AddCondition('user_id', UserRights::GetUserId(), '='); $oUDSearch->AddCondition('menu_code', $this->sId, '='); $oUDSet = new DBObjectSet($oUDSearch); + $bIsNew = false; if ($oUDSet->Count() > 0) { // Assuming there is at most one couple {user, menu}! @@ -811,10 +813,12 @@ class RuntimeDashboard extends Dashboard $oUserDashboard->Set('user_id', UserRights::GetUserId()); $oUserDashboard->Set('menu_code', $this->sId); $oUserDashboard->Set('contents', $sXml); + $bIsNew = true; } utils::PushArchiveMode(false); $oUserDashboard->DBWrite(); utils::PopArchiveMode(); + return $bIsNew; } /** diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 3be8c79ed..7c3ac2c3b 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -943,8 +943,6 @@ try } $oDashboard->Render($oPage, false, $aExtraParams); } - //$oPage->add_ready_script("$('.ibo-dashboard table.listResults').tableHover(); $('.ibo-dashboard table.listResults') - //.tablesorter( { widgets: ['myZebra', 'truncatedList']} );"); break; case 'reload_dashboard': @@ -963,12 +961,11 @@ try } $oDashboard->Render($oPage, false, $aExtraParams); } - //$oPage->add_ready_script("$('.ibo-dashboard table.listResults').tableHover(); $('.ibo-dashboard table.listResults') - //.tablesorter( { widgets: ['myZebra', 'truncatedList']} );"); break; case 'save_dashboard': $sDashboardId = utils::ReadParam('dashboard_id', '', false, 'context_param'); + $aExtraParams = utils::ReadParam('extra_params', array(), false, 'raw_data'); $sReloadURL = utils::ReadParam('reload_url', '', false, 'raw_data'); appUserPreferences::SetPref('display_original_dashboard_'.$sDashboardId, false); @@ -982,14 +979,23 @@ try $oDashboard = new RuntimeDashboard($sDashboardId); $oDashboard->FromParams($aParams); - $oDashboard->Save(); + $bIsNew = $oDashboard->Save(); $sDashboardFile = addslashes(utils::ReadParam('file', '', false, 'string')); $sDashboardDivId = preg_replace('/[^a-zA-Z0-9_]/', '', $sDashboardId); - - // trigger a reload of the current page since the dashboard just changed - $oPage->add_script( - <<add_script( + <<add_script( + <<