mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-20 00:58:48 +02:00
Portal: Change ManageBrick XML definition for tile & page display modes.
SVN:trunk[5877]
This commit is contained in:
@@ -107,6 +107,17 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array(
|
||||
'Brick:Portal:Manage:Name' => 'Spravovat položky',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Žádná položka',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
@@ -103,6 +103,17 @@ Dict::Add('DE DE', 'German', 'Deutsch', array(
|
||||
'Brick:Portal:Manage:Name' => 'Einträge managen',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Kein Eintrag.',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
@@ -108,9 +108,9 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Brick:Portal:Manage:Name' => 'Manage items',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'No item.',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:DisplayMode:default' => 'List',
|
||||
'Brick:Portal:Manage:Others' => 'Others',
|
||||
'Brick:Portal:Manage:All' => 'All',
|
||||
'Brick:Portal:Manage:Group' => 'Group',
|
||||
|
||||
@@ -103,6 +103,17 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
'Brick:Portal:Manage:Name' => 'Administrar elementos',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Sin objeto.',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Acciones',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
@@ -108,9 +108,9 @@ Dict::Add('FR FR', 'French', 'Français', array(
|
||||
'Brick:Portal:Manage:Name' => 'Gestion d\'éléments',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Aucun élément',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'Liste',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Secteur',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Histogramme',
|
||||
'Brick:Portal:Manage:DisplayMode:default' => 'Liste',
|
||||
'Brick:Portal:Manage:Others' => 'Autres',
|
||||
'Brick:Portal:Manage:All' => 'Total',
|
||||
'Brick:Portal:Manage:Group' => 'Groupe',
|
||||
|
||||
@@ -97,6 +97,17 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
'Brick:Portal:Manage:Name' => 'Beheer items',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Geen gegevens',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
@@ -72,10 +72,10 @@ class ManageBrickController extends BrickController
|
||||
|
||||
if (is_null($sDisplayMode))
|
||||
{
|
||||
$sDisplayMode = $oBrick->GetDisplayMode();
|
||||
$sDisplayMode = $oBrick->GetDefaultDisplayMode();
|
||||
}
|
||||
$aDisplayParams = $oBrick->GetPresentationDataForDisplayMode($sDisplayMode);
|
||||
$aData = $this->GetData($oRequest, $oApp, $sBrickId, $sGroupingTab, $aDisplayParams['need_details']);
|
||||
$aDisplayParams = $oBrick->GetPresentationDataForTileMode($sDisplayMode);
|
||||
$aData = $this->GetData($oRequest, $oApp, $sBrickId, $sGroupingTab, $oBrick::AreDetailsNeededForDisplayMode($sDisplayMode));
|
||||
|
||||
$aExportFields = $oBrick->GetExportFields();
|
||||
$aData = $aData + array(
|
||||
@@ -89,7 +89,7 @@ class ManageBrickController extends BrickController
|
||||
}
|
||||
else
|
||||
{
|
||||
$sLayoutTemplate = $aDisplayParams['layoutTemplate'];
|
||||
$sLayoutTemplate = $oBrick::GetPageTemplateFromDisplayMode($sDisplayMode);
|
||||
$oResponse = $oApp['twig']->render($sLayoutTemplate, $aData);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,13 @@ class ManageBrick extends PortalBrick
|
||||
const ENUM_ACTION_VIEW = 'view';
|
||||
const ENUM_ACTION_EDIT = 'edit';
|
||||
|
||||
const ENUM_DISPLAY_MODE_TABLE = 'default';
|
||||
const ENUM_TILE_MODE_TEXT = 'text';
|
||||
const ENUM_TILE_MODE_BADGE = 'badge';
|
||||
const ENUM_TILE_MODE_PIE = 'pie-chart';
|
||||
const ENUM_TILE_MODE_BAR = 'bar-chart';
|
||||
const ENUM_TILE_MODE_TOP = 'top-list';
|
||||
|
||||
const ENUM_DISPLAY_MODE_LIST = 'list';
|
||||
const ENUM_DISPLAY_MODE_PIE = 'pie-chart';
|
||||
const ENUM_DISPLAY_MODE_BAR = 'bar-chart';
|
||||
|
||||
@@ -46,50 +52,60 @@ class ManageBrick extends PortalBrick
|
||||
const DEFAULT_LIST_LENGTH = 20;
|
||||
const DEFAULT_ZLIST_FIELDS = 'list';
|
||||
const DEFAULT_SHOW_TAB_COUNTS = false;
|
||||
const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_TABLE;
|
||||
const DEFAULT_DISPLAY_MODE = self::ENUM_DISPLAY_MODE_LIST;
|
||||
const DEFAULT_TILE_MODE = self::ENUM_TILE_MODE_TEXT;
|
||||
const DEFAULT_GROUP_LIMIT = 0;
|
||||
const DEFAULT_GROUP_SHOW_OTHERS = true;
|
||||
|
||||
const DEFAULT_TILE_TEMPLATE_PATH = 'itop-portal-base/portal/src/views/bricks/manage/tile-default.html.twig';
|
||||
const DEFAULT_TILE_CONTROLLER_ACTION = 'Combodo\\iTop\\Portal\\Controller\\ManageBrickController::TileAction';
|
||||
|
||||
static $aDisplayModes = array(
|
||||
self::ENUM_DISPLAY_MODE_TABLE,
|
||||
self::ENUM_DISPLAY_MODE_LIST,
|
||||
self::ENUM_DISPLAY_MODE_PIE,
|
||||
self::ENUM_DISPLAY_MODE_BAR,
|
||||
);
|
||||
static $aTileModes = array(
|
||||
self::ENUM_TILE_MODE_TEXT,
|
||||
self::ENUM_TILE_MODE_BADGE,
|
||||
self::ENUM_TILE_MODE_PIE,
|
||||
self::ENUM_TILE_MODE_BAR,
|
||||
self::ENUM_TILE_MODE_TOP,
|
||||
);
|
||||
static $aPresentationData = array(
|
||||
'badge' => array(
|
||||
self::ENUM_TILE_MODE_BADGE => array(
|
||||
'decorationCssClass' => 'fa fa-id-card-o fa-2x',
|
||||
'tileTemplate' => 'itop-portal-base/portal/src/views/bricks/manage/tile-badge.html.twig',
|
||||
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
|
||||
'need_details' => true,
|
||||
),
|
||||
'top-list' => array(
|
||||
self::ENUM_TILE_MODE_TOP => array(
|
||||
'decorationCssClass' => 'fa fa-signal fa-rotate-270 fa-2x',
|
||||
'tileTemplate' => 'itop-portal-base/portal/src/views/bricks/manage/tile-top-list.html.twig',
|
||||
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
|
||||
'need_details' => true,
|
||||
),
|
||||
'pie-chart' => array(
|
||||
self::ENUM_TILE_MODE_PIE => array(
|
||||
'decorationCssClass' => 'fa fa-pie-chart fa-2x',
|
||||
'tileTemplate' => 'itop-portal-base/portal/src/views/bricks/manage/tile-chart.html.twig',
|
||||
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_PIE,
|
||||
'need_details' => false,
|
||||
),
|
||||
'bar-chart' => array(
|
||||
self::ENUM_TILE_MODE_BAR => array(
|
||||
'decorationCssClass' => 'fa fa-bar-chart fa-2x',
|
||||
'tileTemplate' => 'itop-portal-base/portal/src/views/bricks/manage/tile-chart.html.twig',
|
||||
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_CHART,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_BAR,
|
||||
'need_details' => false,
|
||||
),
|
||||
'default' => array(
|
||||
self::ENUM_TILE_MODE_TEXT => array(
|
||||
'decorationCssClass' => 'fa fa-pencil-square fa-2x',
|
||||
'tileTemplate' => self::DEFAULT_TILE_TEMPLATE_PATH,
|
||||
'layoutTemplate' => self::ENUM_PAGE_TEMPLATE_PATH_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_TABLE,
|
||||
'layoutDisplayMode' => self::ENUM_DISPLAY_MODE_LIST,
|
||||
'need_details' => true,
|
||||
),
|
||||
);
|
||||
@@ -102,15 +118,58 @@ class ManageBrick extends PortalBrick
|
||||
protected $aFields;
|
||||
protected $aExportFields;
|
||||
protected $bShowTabCounts;
|
||||
/**
|
||||
* @var string default display mode for the brick's tile
|
||||
*/
|
||||
protected $sDisplayMode;
|
||||
protected $aAvailableDisplayModes = array();
|
||||
protected $sDefaultDisplayMode;
|
||||
|
||||
protected $sTileMode;
|
||||
protected $iGroupLimit;
|
||||
protected $bGroupShowOthers;
|
||||
protected $aAvailableDisplayModes = array();
|
||||
|
||||
public function __construct()
|
||||
/**
|
||||
* Returns true if the $sDisplayMode need objects details for rendering.
|
||||
*
|
||||
* @param string $sDisplayMode
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
static public function AreDetailsNeededForDisplayMode($sDisplayMode)
|
||||
{
|
||||
$bNeedDetails = false;
|
||||
foreach(static::$aPresentationData as $aData)
|
||||
{
|
||||
if($aData['layoutDisplayMode'] === $sDisplayMode)
|
||||
{
|
||||
$bNeedDetails = $aData['need_details'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $bNeedDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the page template path for the $sDisplayMode
|
||||
*
|
||||
* @param string $sDisplayMode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
static public function GetPageTemplateFromDisplayMode($sDisplayMode)
|
||||
{
|
||||
$sTemplate = static::DEFAULT_PAGE_TEMPLATE_PATH;
|
||||
foreach(static::$aPresentationData as $aData)
|
||||
{
|
||||
if($aData['layoutDisplayMode'] === $sDisplayMode)
|
||||
{
|
||||
$sTemplate = $aData['layoutTemplate'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $sTemplate;
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
@@ -120,6 +179,11 @@ class ManageBrick extends PortalBrick
|
||||
$this->aFields = array();
|
||||
$this->aExportFields = array();
|
||||
$this->bShowTabCounts = static::DEFAULT_SHOW_TAB_COUNTS;
|
||||
$this->sDefaultDisplayMode = static::DEFAULT_DISPLAY_MODE;
|
||||
|
||||
$this->sTileMode = static::DEFAULT_TILE_MODE;
|
||||
$this->iGroupLimit = static::DEFAULT_GROUP_LIMIT;
|
||||
$this->bGroupShowOthers = static::DEFAULT_GROUP_SHOW_OTHERS;
|
||||
|
||||
// This is hardcoded for now, we might allow area grouping on another attribute in the future
|
||||
$this->AddGrouping('areas', array('attribute' => 'finalclass'));
|
||||
@@ -185,35 +249,66 @@ class ManageBrick extends PortalBrick
|
||||
return $this->bShowTabCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the brick default display mode
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetDefaultDisplayMode()
|
||||
{
|
||||
return $this->sDefaultDisplayMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default display mode of the brick
|
||||
*
|
||||
* @param string $sDefaultDisplayMode
|
||||
*
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function SetDefaultDisplayMode($sDefaultDisplayMode)
|
||||
{
|
||||
$this->sDefaultDisplayMode = $sDefaultDisplayMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the tile mode (display)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetDisplayMode()
|
||||
public function GetTileMode()
|
||||
{
|
||||
return $this->sDisplayMode;
|
||||
return $this->sTileMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDisplayMode
|
||||
* Sets the tile mode (display)
|
||||
*
|
||||
* @param string $sTileMode
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function SetDisplayMode($sDisplayMode)
|
||||
public function SetTileMode($sTileMode)
|
||||
{
|
||||
$this->sDisplayMode = $sDisplayMode;
|
||||
$this->sTileMode = $sTileMode;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sDisplayMode
|
||||
* @param string $sTileMode
|
||||
*
|
||||
* @return string[] parameters for specified type, default parameters if type is invalid
|
||||
*/
|
||||
public function GetPresentationDataForDisplayMode($sDisplayMode)
|
||||
public function GetPresentationDataForTileMode($sTileMode)
|
||||
{
|
||||
if (isset(static::$aPresentationData[$sDisplayMode]))
|
||||
if (isset(static::$aPresentationData[$sTileMode]))
|
||||
{
|
||||
return static::$aPresentationData[$sDisplayMode];
|
||||
return static::$aPresentationData[$sTileMode];
|
||||
}
|
||||
|
||||
return static::$aPresentationData[static::DEFAULT_DISPLAY_MODE];
|
||||
return static::$aPresentationData[static::DEFAULT_TILE_MODE];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -394,7 +489,6 @@ class ManageBrick extends PortalBrick
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns if the brick has grouping tabs or not.
|
||||
*
|
||||
@@ -435,12 +529,41 @@ class ManageBrick extends PortalBrick
|
||||
return (isset($this->aGrouping['areas'])) ? $this->aGrouping['areas'] : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sModeId
|
||||
*
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function AddAvailableDisplayMode($sModeId)
|
||||
{
|
||||
if(!in_array($sModeId, static::$aDisplayModes))
|
||||
{
|
||||
throw new Exception('ManageBrick: Display mode "' . $sModeId. '" must be one of the allowed display modes (' . implode(', ', static::$aDisplayModes) . ')');
|
||||
}
|
||||
|
||||
$this->aAvailableDisplayModes[] = $sModeId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes $sModeId from the list of availables display modes
|
||||
*
|
||||
* @param string $sModeId
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function RemoveAvailableDisplayMode($sModeId)
|
||||
{
|
||||
if (isset($this->aAvailableDisplayModes[$sModeId]))
|
||||
{
|
||||
unset($this->aAvailableDisplayModes[$sModeId]);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the available display modes for the brick (page, not tile)
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function GetAvailablesDisplayModes()
|
||||
@@ -498,9 +621,6 @@ class ManageBrick extends PortalBrick
|
||||
public function LoadFromXml(DesignElement $oMDElement)
|
||||
{
|
||||
parent::LoadFromXml($oMDElement);
|
||||
$this->sDisplayMode = 'default';
|
||||
$this->iGroupLimit = 0;
|
||||
$this->bGroupShowOthers = true;
|
||||
$bUseListFieldsForExport = false;
|
||||
|
||||
// Checking specific elements
|
||||
@@ -566,11 +686,16 @@ class ManageBrick extends PortalBrick
|
||||
}
|
||||
break;
|
||||
|
||||
case 'default';
|
||||
$this->sDisplayMode = $oDisplayNode->nodeValue;
|
||||
$aDisplayParameterForType = $this->GetPresentationDataForDisplayMode($this->sDisplayMode);
|
||||
$this->SetTileTemplatePath($aDisplayParameterForType['tileTemplate']);
|
||||
$this->SetPageTemplatePath($aDisplayParameterForType['layoutTemplate']);
|
||||
case 'default':
|
||||
$this->SetDefaultDisplayMode($oDisplayNode->GetText(static::DEFAULT_DISPLAY_MODE));
|
||||
break;
|
||||
|
||||
case 'tile';
|
||||
$this->SetTileMode($oDisplayNode->GetText(static::DEFAULT_TILE_MODE));
|
||||
|
||||
$aTileParametersForType = $this->GetPresentationDataForTileMode($this->sTileMode);
|
||||
$this->SetTileTemplatePath($aTileParametersForType['tileTemplate']);
|
||||
$this->SetPageTemplatePath($aTileParametersForType['layoutTemplate']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -692,21 +817,24 @@ class ManageBrick extends PortalBrick
|
||||
// Checking if has an oql
|
||||
if ($this->GetOql() === '')
|
||||
{
|
||||
throw new DOMFormatException('BrowseBrick : must have a valid <class|oql> tag', null, null, $oMDElement);
|
||||
throw new DOMFormatException('ManageBrick: must have a valid <class|oql> tag', null, null, $oMDElement);
|
||||
}
|
||||
|
||||
// Display modes : at least one selected
|
||||
$sDefaultDetailDisplayMode = (isset($this->sDisplayMode))
|
||||
? static::$aPresentationData[$this->sDisplayMode]['layoutDisplayMode']
|
||||
: 'default';
|
||||
$bHasAvailableDisplayModes = (count($this->GetAvailablesDisplayModes()) > 0);
|
||||
$bIsDefaultDisplayModeInAvailableModes = in_array($sDefaultDetailDisplayMode,
|
||||
$this->GetAvailablesDisplayModes());
|
||||
if (!$bHasAvailableDisplayModes || (!$bIsDefaultDisplayModeInAvailableModes))
|
||||
{
|
||||
// legacy : setting to default
|
||||
$this->AddAvailableDisplayMode($sDefaultDetailDisplayMode);
|
||||
}
|
||||
// Checking that the brick has at least a display mode
|
||||
if (count($this->GetAvailablesDisplayModes()) === 0)
|
||||
{
|
||||
$this->AddAvailableDisplayMode(static::DEFAULT_DISPLAY_MODE);
|
||||
}
|
||||
// Checking that default display mode in among the availables
|
||||
if (!in_array($this->sDefaultDisplayMode, $this->aAvailableDisplayModes))
|
||||
{
|
||||
throw new DOMFormatException('ManageBrick: Default display mode "' . $this->sDefaultDisplayMode . '" must be one of the available display modes (' . implode(', ', $this->aAvailableDisplayModes) . ')', null, null, $oMDElement);
|
||||
}
|
||||
// Checking that tile mode in among the availables
|
||||
if (!in_array($this->sTileMode, static::$aTileModes))
|
||||
{
|
||||
throw new DOMFormatException('ManageBrick: Tile mode "' . $this->sTileMode. '" must be one of the allowed tile modes (' . implode(', ', static::$aTileModes) . ')', null, null, $oMDElement);
|
||||
}
|
||||
|
||||
// Checking if specified fields, if not we put those from the details zlist
|
||||
if (empty($this->aFields))
|
||||
@@ -728,9 +856,9 @@ class ManageBrick extends PortalBrick
|
||||
|
||||
// Checking the navigation icon
|
||||
$sDecorationClassNavigationMenu = $this->GetDecorationClassNavigationMenu();
|
||||
if (empty($sDecorationClassNavigationMenu) && isset(static::$aPresentationData[$this->sDisplayMode]))
|
||||
if (empty($sDecorationClassNavigationMenu) && isset(static::$aPresentationData[$this->sTileMode]))
|
||||
{
|
||||
$sDecorationClassNavigationMenu = static::$aPresentationData[$this->sDisplayMode]['decorationCssClass'];
|
||||
$sDecorationClassNavigationMenu = static::$aPresentationData[$this->sTileMode]['decorationCssClass'];
|
||||
if (!empty($sDecorationClassNavigationMenu))
|
||||
{
|
||||
$this->SetDecorationClassNavigationMenu($sDecorationClassNavigationMenu);
|
||||
@@ -741,8 +869,8 @@ class ManageBrick extends PortalBrick
|
||||
if (empty($sTitle))
|
||||
{
|
||||
$sOql = $this->GetOql();
|
||||
$oSeach = DBSearch::FromOQL($sOql);
|
||||
$sClassName = MetaModel::GetName($oSeach->GetClass());
|
||||
$oSearch = DBSearch::FromOQL($sOql);
|
||||
$sClassName = MetaModel::GetName($oSearch->GetClass());
|
||||
$this->SetTitleHome($sClassName);
|
||||
$this->SetTitleNavigationMenu($sClassName);
|
||||
$this->SetTitle($sClassName);
|
||||
|
||||
@@ -28,7 +28,6 @@ class ManageBrickRouter extends AbstractRouter
|
||||
'bind' => 'p_manage_brick',
|
||||
'asserts' => array(),
|
||||
'values' => array(
|
||||
'sDisplayMode' => 'default',
|
||||
'sGroupingTab' => null,
|
||||
)
|
||||
),
|
||||
@@ -37,7 +36,7 @@ class ManageBrickRouter extends AbstractRouter
|
||||
'callback' => 'Combodo\\iTop\\Portal\\Controller\\ManageBrickController::DisplayAction',
|
||||
'bind' => 'p_manage_brick_display_as',
|
||||
'asserts' => array(
|
||||
'sDisplayMode' => 'badge|pie-chart|bar-chart|top-list|default'
|
||||
'sDisplayMode' => 'list|pie-chart|bar-chart'
|
||||
),
|
||||
'values' => array(
|
||||
'sGroupingTab' => null,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
{% for sDisplay in oBrick.GetAvailablesDisplayModes %}
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': sDisplay}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
id="btn_tab_for_{{ sDisplay }}"
|
||||
class="btn btn-default {% if sDisplay == oBrick.GetPresentationDataForDisplayMode(sDisplayMode).layoutDisplayMode %}active{% endif %}">
|
||||
class="btn btn-default {% if sDisplay == oBrick.GetPresentationDataForTileMode(sDisplayMode).layoutDisplayMode %}active{% endif %}">
|
||||
{{ ('Brick:Portal:Manage:DisplayMode:' ~ sDisplay)|dict_s }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="col-xs-12 col-sm-{{ oBrick.GetWidth }}">
|
||||
{% block pTileWrapper %}
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDefaultDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] is defined %}{% for key, value in app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] %} {{ key }}="{{ value }}"{% endfor %}{% endif %}
|
||||
{% if oBrick.GetModal %}data-toggle="modal" data-target="#modal-for-all"{% endif %}
|
||||
class="tile tile_badge{# vertical-center#}"
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
|
||||
<div class="col-xs-12 col-sm-{{ oBrick.GetWidth }}">
|
||||
{% block pTileWrapper %}
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDefaultDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] is defined %}{% for key, value in app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] %} {{ key }}="{{ value }}"{% endfor %}{% endif %}
|
||||
{% if oBrick.GetModal %}data-toggle="modal" data-target="#modal-for-all"{% endif %}
|
||||
class="tile tile_chart{# vertical-center#}"
|
||||
id="brick-{{ oBrick.GetId }}"
|
||||
data-brick-id="{{ oBrick.GetId }}">
|
||||
<div>
|
||||
<div class="tile_title"><span class="icon fa fa-{{ oBrick.GetDisplayMode }}"></span> {{ oBrick.GetTitle()|dict_s }}
|
||||
<div class="tile_title"><span class="icon fa fa-{{ oBrick.GetTileMode }}"></span> {{ oBrick.GetTitle()|dict_s }}
|
||||
({{ iCount }})</span> </div>
|
||||
{% include 'itop-portal-base/portal/src/views/bricks/manage/mode-' ~ oBrick.GetDisplayMode ~ '.html.twig' with {'oBrick': oBrick, 'aColumns': aColumns, 'aNames': aNames, 'aUrls': aUrls, 'aDisplayValues': aDisplayValues} %}
|
||||
{% include 'itop-portal-base/portal/src/views/bricks/manage/mode-' ~ oBrick.GetTileMode ~ '.html.twig' with {'oBrick': oBrick, 'aColumns': aColumns, 'aNames': aNames, 'aUrls': aUrls, 'aDisplayValues': aDisplayValues} %}
|
||||
</div>
|
||||
</a>
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<div class="col-xs-12 col-sm-{{ oBrick.GetWidth }}">
|
||||
{% block pTileWrapper %}
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
<a href="{{ app.url_generator.generate('p_manage_brick_display_as', {'sBrickId': sBrickId, 'sDisplayMode': oBrick.GetDefaultDisplayMode}) }}{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] is defined %}#{{ app['combodo.portal.instance.routes'][oBrick.GetRouteName]['hash'] }}{% endif %}"
|
||||
{% if app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] is defined %}{% for key, value in app['combodo.portal.instance.routes'][oBrick.GetRouteName]['navigation_menu_attr'] %} {{ key }}="{{ value }}"{% endfor %}{% endif %}
|
||||
{% if oBrick.GetModal %}data-toggle="modal" data-target="#modal-for-all"{% endif %}
|
||||
class="tile{# vertical-center#}"
|
||||
|
||||
@@ -103,6 +103,17 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:Manage:Name' => 'Gerenciar itens',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Sem dados.',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Ações',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
@@ -85,6 +85,17 @@ Dict::Add('RU RU', 'Russian', 'Русский', array(
|
||||
'Brick:Portal:Manage:Name' => 'Управление элементами',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Нет элементов',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Actions~~',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List~~',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Pie Chart~~',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:Others' => 'Others~~',
|
||||
'Brick:Portal:Manage:All' => 'All~~',
|
||||
'Brick:Portal:Manage:Group' => 'Group~~',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total~~',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Sum~~',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Average~~',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min~~',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max~~',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
|
||||
Reference in New Issue
Block a user