mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
Customer portal : Manage Brick : Added an optional tag <opening_mode> to define how the objects should be open (Value can be edit|view, Default is edit). Note that even if the tag is set to edit, objects that the user isn't allowed to edit will open in view mode.
SVN:trunk[4175]
This commit is contained in:
@@ -344,7 +344,7 @@ class ManageBrickController extends BrickController
|
||||
if ($sItemAttr === $sMainActionAttrCode)
|
||||
{
|
||||
// Checking if we can edit the object
|
||||
if (SecurityHelper::IsActionAllowed($oApp, UR_ACTION_MODIFY, $sCurrentClass, $oCurrentRow->GetKey()))
|
||||
if (SecurityHelper::IsActionAllowed($oApp, UR_ACTION_MODIFY, $sCurrentClass, $oCurrentRow->GetKey()) && ($oBrick->GetOpeningMode() === ManageBrick::ENUM_ACTION_EDIT))
|
||||
{
|
||||
$sActionType = ManageBrick::ENUM_ACTION_EDIT;
|
||||
}
|
||||
|
||||
@@ -38,12 +38,14 @@ class ManageBrick extends PortalBrick
|
||||
const ENUM_ACTION_EDIT = 'edit';
|
||||
const DEFAULT_PAGE_TEMPLATE_PATH = 'itop-portal-base/portal/src/views/bricks/manage/layout.html.twig';
|
||||
const DEFAULT_OQL = '';
|
||||
const DEFAULT_OPENING_MODE = self::ENUM_ACTION_EDIT;
|
||||
const DEFAULT_DATA_LOADING = self::ENUM_DATA_LOADING_LAZY;
|
||||
const DEFAULT_COUNT_PER_PAGE_LIST = 20;
|
||||
const DEFAULT_ZLIST_FIELDS = 'list';
|
||||
|
||||
static $sRouteName = 'p_manage_brick';
|
||||
protected $sOql;
|
||||
protected $sOpeningMode;
|
||||
protected $aGrouping;
|
||||
protected $aFields;
|
||||
|
||||
@@ -52,6 +54,7 @@ class ManageBrick extends PortalBrick
|
||||
parent::__construct();
|
||||
|
||||
$this->sOql = static::DEFAULT_OQL;
|
||||
$this->sOpeningMode = static::DEFAULT_OPENING_MODE;
|
||||
$this->aGrouping = array();
|
||||
$this->aFields = array();
|
||||
|
||||
@@ -69,6 +72,16 @@ class ManageBrick extends PortalBrick
|
||||
return $this->sOql;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the brick's objects opening mode (edit or view)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetOpeningMode()
|
||||
{
|
||||
return $this->sOpeningMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the brick grouping
|
||||
*
|
||||
@@ -93,6 +106,7 @@ class ManageBrick extends PortalBrick
|
||||
* Sets the oql of the brick
|
||||
*
|
||||
* @param string $sOql
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function SetOql($sOql)
|
||||
{
|
||||
@@ -100,6 +114,18 @@ class ManageBrick extends PortalBrick
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the brick's objects opening mode
|
||||
*
|
||||
* @param string $sOpeningMode
|
||||
* @return \Combodo\iTop\Portal\Brick\ManageBrick
|
||||
*/
|
||||
public function SetOpeningMode($sOpeningMode)
|
||||
{
|
||||
$this->sOpeningMode = $sOpeningMode;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the grouping of the brick
|
||||
*
|
||||
@@ -287,7 +313,7 @@ class ManageBrick extends PortalBrick
|
||||
$sClass = $oBrickSubNode->GetText();
|
||||
if ($sClass === '')
|
||||
{
|
||||
throw new DOMFormatException('BrowseBrick : class tag is empty. Must contain Classname', null, null, $oBrickSubNode);
|
||||
throw new DOMFormatException('ManageBrick : class tag is empty. Must contain Classname', null, null, $oBrickSubNode);
|
||||
}
|
||||
|
||||
$this->SetOql('SELECT ' . $sClass);
|
||||
@@ -297,12 +323,22 @@ class ManageBrick extends PortalBrick
|
||||
$sOql = $oBrickSubNode->GetText();
|
||||
if ($sOql === '')
|
||||
{
|
||||
throw new DOMFormatException('BrowseBrick : oql tag is empty. Must contain OQL statement', null, null, $oBrickSubNode);
|
||||
throw new DOMFormatException('ManageBrick : oql tag is empty. Must contain OQL statement', null, null, $oBrickSubNode);
|
||||
}
|
||||
|
||||
$this->SetOql($sOql);
|
||||
break;
|
||||
|
||||
case 'opening_mode':
|
||||
$sOpeningMode = $oBrickSubNode->GetText(static::DEFAULT_OPENING_MODE);
|
||||
if (!in_array($sOpeningMode, array(static::ENUM_ACTION_VIEW, static::ENUM_ACTION_EDIT)))
|
||||
{
|
||||
throw new DOMFormatException('ManageBrick : opening_mode tag value must be edit|view ("' . $sOpeningMode . '" given)', null, null, $oBrickSubNode);
|
||||
}
|
||||
|
||||
$this->SetOpeningMode($sOpeningMode);
|
||||
break;
|
||||
|
||||
case 'fields':
|
||||
foreach ($oBrickSubNode->GetNodes('./field') as $oFieldNode)
|
||||
{
|
||||
|
||||
@@ -1113,7 +1113,9 @@
|
||||
<default>fc fc-ongoing-request fc-2x</default>
|
||||
</decoration_class>
|
||||
<oql><![CDATA[SELECT Ticket]]></oql>
|
||||
<!-- Can be either a class tag with the class name or an oql tag with the query -->
|
||||
<!-- Optional tag to define the how the objects should be opened. Values can be edit|view. Note that even if this is set to edit, objects not allowed in edition mode for the user (cf. scopes and security layers) will open in view mode -->
|
||||
<!-- <opening_mode>edit</opening_mode> -->
|
||||
<!-- Can be either a class tag with the class name or an oql tag with the query -->
|
||||
<!-- <class>Ticket</class> -->
|
||||
<fields>
|
||||
<field id="title"/>
|
||||
|
||||
Reference in New Issue
Block a user