From a40e902808306de6e96a7177a7f32c7aa4f07d23 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Fri, 25 May 2012 15:58:59 +0000 Subject: [PATCH] User editable dashboards... implementation in progress SVN:trunk[2039] --- pages/ajax.render.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/pages/ajax.render.php b/pages/ajax.render.php index e26cbf5b3..19985216f 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -722,7 +722,7 @@ try $oDashboard->FromParams($aParams); $oDashboard->Save(); // trigger a reload of the current page since the dashboard just changed - $oPage->add_ready_script("window.location.href=window.location.href;"); // reloads the page, doing a GET even if we arrived via a POST + $oPage->add_ready_script("sLocation = new String(window.location.href); window.location.href=sLocation.replace('&edit=1', '');"); // reloads the page, doing a GET even if we arrived via a POST break; case 'revert_dashboard': @@ -745,6 +745,34 @@ try $oDashboard->Render($oPage, true /* bEditMode */); break; + case 'dashlet_creation_dlg': + $sOQL = utils::ReadParam('oql', '', false, 'raw_data'); + RuntimeDashboard::GetDashletCreationDlgFromOQL($oPage, $sOQL); + break; + + case 'add_dashlet': + $oForm = RuntimeDashboard::GetDashletCreationForm(''); + $aValues = $oForm->ReadParams(); + + $sDashletClass = $aValues['dashlet_class']; + $sMenuId = $aValues['menu_id']; + + if (is_subclass_of($sDashletClass, 'Dashlet')) + { + $oDashlet = new $sDashletClass(0); + $oDashlet->FromParams($aValues); + + $index = ApplicationMenu::GetMenuIndexById($sMenuId); + $oMenu = ApplicationMenu::GetMenuNode($index); + $oMenu->AddDashlet($oDashlet); + // navigate to the dashboard page + if ($aValues['open_editor']) + { + $oPage->add_ready_script("window.location.href='".addslashes(utils::GetAbsoluteUrlAppRoot().'pages/UI.php?c[menu]='.$index)."&edit=1';"); // reloads the page, doing a GET even if we arrived via a POST + } + } + break; + default: $oPage->p("Invalid query."); }