Retrofit from trunk: Customer portal : Added possibility to give a controller action for a brick tile. This allows to use some logic in order to make a specific render relying for example on DB dataobjects

Increased version number of the portal-base module to 1.0.1 to reflect this change.

SVN:2.3[4309]
This commit is contained in:
Denis Flaven
2016-07-26 08:18:42 +00:00
parent 33c5839273
commit eae396f250
3 changed files with 15 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-portal-base/1.0.0', array(
'itop-portal-base/1.0.1', array(
// Identification
'label' => 'Portal Development Library',
'category' => 'Portal',

View File

@@ -37,8 +37,17 @@ class DefaultController
// Doing it only for tile visible on home page to avoid unnecessary rendering
if (($oBrick->GetVisibleHome() === true) && ($oBrick->GetTileControllerAction() !== null))
{
$oController = new \Combodo\iTop\Portal\Controller\ManageBrickController($oRequest, $oApp);
$aData['aTilesRendering'][$oBrick->GetId()] = $oController->HomeAction($oRequest, $oApp);
$aControllerActionParts = explode('::', $oBrick->GetTileControllerAction());
if (count($aControllerActionParts) !== 2)
{
$oApp->abort(500, 'Tile controller action must be of form "\Namespace\ControllerClass::FunctionName" for brick "' . $oBrick->GetId() . '"');
}
$sControllerName = $aControllerActionParts[0];
$sControllerAction = $aControllerActionParts[1];
$oController = new $sControllerName($oRequest, $oApp, $oBrick->GetId());
$aData['aTilesRendering'][$oBrick->GetId()] = $oController->$sControllerAction($oRequest, $oApp, $oBrick->GetId());
}
}

View File

@@ -493,6 +493,9 @@ abstract class PortalBrick extends AbstractBrick
$this->SetDecorationClassNavigationMenu($optionalNodeValue);
}
break;
case 'tile_controller_action':
$this->SetTileControllerAction($oBrickSubNode->GetText(static::DEFAULT_TILE_CONTROLLER_ACTION));
break;
}
}