mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
User editable dashboards... implementation in progress
SVN:trunk[2002]
This commit is contained in:
@@ -631,6 +631,48 @@ try
|
|||||||
$oMenu = ApplicationMenu::GetMenuNode($idx);
|
$oMenu = ApplicationMenu::GetMenuNode($idx);
|
||||||
$oMenu->RenderEditor($oPage);
|
$oMenu->RenderEditor($oPage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'update_dashlet_property':
|
||||||
|
require_once(APPROOT.'application/forms.class.inc.php');
|
||||||
|
require_once(APPROOT.'application/dashlet.class.inc.php');
|
||||||
|
$aParams = utils::ReadParam('params', '', false, 'raw_data');
|
||||||
|
$sDashletClass = $aParams['attr_dashlet_class'];
|
||||||
|
$sDashletId = $aParams['attr_dashlet_id'];
|
||||||
|
$aUpdatedProperties = $aParams['updated'];
|
||||||
|
$aPreviousValues = $aParams['previous_values'];
|
||||||
|
if (is_subclass_of($sDashletClass, 'Dashlet'))
|
||||||
|
{
|
||||||
|
$oDashlet = new $sDashletClass($sDashletId);
|
||||||
|
$oForm = $oDashlet->GetForm();
|
||||||
|
$aValues = $oForm->ReadParams();
|
||||||
|
|
||||||
|
$aCurrentValues = $aValues;
|
||||||
|
foreach($aUpdatedProperties as $sProp)
|
||||||
|
{
|
||||||
|
$aCurrentValues[$sProp] = $aPreviousValues[$sProp];
|
||||||
|
}
|
||||||
|
|
||||||
|
$oDashlet->FromParams($aCurrentValues);
|
||||||
|
$oDashlet->Update($aValues, $aUpdatedProperties);
|
||||||
|
if ($oDashlet->IsRedrawNeeded())
|
||||||
|
{
|
||||||
|
$offset = $oPage->start_capture();
|
||||||
|
$oDashlet->Render($oPage, true);
|
||||||
|
$sHtml = addslashes($oPage->end_capture($offset));
|
||||||
|
|
||||||
|
$oPage->add_script("$('#dashlet_$sDashletId').html('$sHtml')"); // in ajax web page add_script has the same effect as add_ready_script
|
||||||
|
// but is executed BEFORE all 'ready_scripts'
|
||||||
|
}
|
||||||
|
if ($oDashlet->IsFormRedrawNeeded())
|
||||||
|
{
|
||||||
|
$oForm = $oDashlet->GetForm($oPage, $oDashlet);
|
||||||
|
$oForm->SetSubmitParams(utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php', array('operation' => 'update_dashlet_property'));
|
||||||
|
$sHtml = addslashes($oForm->RenderAsPropertySheet($oPage, true /* bReturnHtml */));
|
||||||
|
$oPage->add_script("$('#dashlet_properties_$sDashletId').html('$sHtml')"); // in ajax web page add_script has the same effect as add_ready_script // but is executed BEFORE all 'ready_scripts'
|
||||||
|
// but is executed BEFORE all 'ready_scripts'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$oPage->p("Invalid query.");
|
$oPage->p("Invalid query.");
|
||||||
|
|||||||
Reference in New Issue
Block a user