diff --git a/application/dashboard.class.inc.php b/application/dashboard.class.inc.php
index 2932cf79c..3a0428054 100644
--- a/application/dashboard.class.inc.php
+++ b/application/dashboard.class.inc.php
@@ -17,6 +17,9 @@
* You should have received a copy of the GNU Affero General Public License
*/
+use Combodo\iTop\Application\UI\Component\Button\ButtonFactory;
+use Combodo\iTop\Application\UI\Component\Toolbar\Toolbar;
+
require_once(APPROOT.'application/dashboardlayout.class.inc.php');
require_once(APPROOT.'application/dashlet.class.inc.php');
require_once(APPROOT.'core/modelreflection.class.inc.php');
@@ -529,34 +532,37 @@ EOF
*/
public function Render($oPage, $bEditMode = false, $aExtraParams = array(), $bCanEdit = true)
{
- if (!array_key_exists('dashboard_div_id', $aExtraParams))
- {
+ if (!array_key_exists('dashboard_div_id', $aExtraParams)) {
$aExtraParams['dashboard_div_id'] = utils::Sanitize($this->GetId(), '', 'element_identifier');
}
$sTitleForHTML = utils::HtmlEntities(Dict::S($this->sTitle));
- $oPage->add(<<
-
{$sTitleForHTML}
-
-HTML
- );
+
+ $sHtml = "{$sTitleForHTML}
";
+ if ($oPage instanceof iTopWebPage) {
+ $oTopBar = $oPage->GetTopBarLayout();
+ $oToolbar = new Toolbar();
+ $oTopBar->SetToolbar($oToolbar);
+ $oToolbar->AddHtml($sHtml);
+ } else {
+ $oPage->add_script(<<sLayoutClass();
- foreach($this->aCells as $iCellIdx => $aDashlets)
- {
- foreach($aDashlets as $oDashlet)
- {
+ foreach ($this->aCells as $iCellIdx => $aDashlets) {
+ foreach ($aDashlets as $oDashlet) {
$aDashletCoordinates = $oLayout->GetDashletCoordinates($iCellIdx);
$this->PrepareDashletForRendering($oDashlet, $aDashletCoordinates, $aExtraParams);
}
}
$oLayout->Render($oPage, $this->aCells, $bEditMode, $aExtraParams);
- if (!$bEditMode)
- {
+ if (!$bEditMode) {
$oPage->add_linked_script('../js/dashlet.js');
$oPage->add_linked_script('../js/dashboard.js');
}
@@ -987,39 +993,38 @@ EOF
}
/**
- * @param \iTopWebPage $oPage
+ * @param WebPage $oPage
* @param array $aAjaxParams
+ *
+ * @throws \CoreException
+ * @throws \CoreUnexpectedValue
+ * @throws \MySQLException
*/
- protected function RenderSelector($oPage, $aAjaxParams = array())
+ protected function RenderSelector(WebPage $oPage, $aAjaxParams = array())
{
$sId = $this->GetId();
$sDivId = utils::Sanitize($sId, '', 'element_identifier');
$sExtraParams = json_encode($aAjaxParams);
- $sSelectorHtml = '';
- if ($this->HasCustomDashboard())
- {
+ $sSelectorHtml = '
';
- $sSelectorHtml = addslashes($sSelectorHtml);
$sFile = addslashes($this->GetDefinitionFile());
$sReloadURL = $this->GetReloadURL();
- $oPage->add_ready_script(
-<<
GetTopBarLayout()->GetToolbar();
+ $oToolbar->AddHtml($sSelectorHtml);
- $oPage->add_script(
-<<add_script(
+ <<add_script(<<add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.iframe-transport.js');
$oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.fileupload.js');
- $sEditMenu = "