mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
N°985 - AttributeEnumSet (portal support)
This commit is contained in:
@@ -9683,11 +9683,21 @@ abstract class AttributeSet extends AttributeDBFieldVoid
|
||||
{
|
||||
const SEARCH_WIDGET_TYPE = self::SEARCH_WIDGET_TYPE_RAW;
|
||||
const EDITABLE_INPUT_ID_SUFFIX = '-setwidget-values'; // used client side, see js/jquery.itop-set-widget.js
|
||||
protected $bDisplayLink; // Display search link in readonly mode
|
||||
|
||||
public function __construct($sCode, array $aParams)
|
||||
{
|
||||
parent::__construct($sCode, $aParams);
|
||||
$this->aCSSClasses[] = 'attribute-set';
|
||||
$this->bDisplayLink = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $bDisplayLink
|
||||
*/
|
||||
public function setDisplayLink($bDisplayLink)
|
||||
{
|
||||
$this->bDisplayLink = $bDisplayLink;
|
||||
}
|
||||
|
||||
public static function ListExpectedParams()
|
||||
@@ -10062,7 +10072,7 @@ abstract class AttributeSet extends AttributeDBFieldVoid
|
||||
$sUIPage = cmdbAbstractObject::ComputeStandardUIPage($oFilter->GetClass());
|
||||
$sFilter = rawurlencode($oFilter->serialize());
|
||||
$sLink = '';
|
||||
if ($bWithLink)
|
||||
if ($bWithLink && $this->bDisplayLink)
|
||||
{
|
||||
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
|
||||
$sLink = ' href="'.$sUrl.'"';
|
||||
@@ -11198,7 +11208,7 @@ class AttributeTagSet extends AttributeSet
|
||||
$sFilter = rawurlencode($oFilter->serialize());
|
||||
|
||||
$sLink = '';
|
||||
if ($bWithLink)
|
||||
if ($bWithLink && $this->bDisplayLink)
|
||||
{
|
||||
$sUrl = utils::GetAbsoluteUrlAppRoot()."pages/$sUIPage?operation=search&filter=".$sFilter."&{$sContext}";
|
||||
$sLink = ' href="'.$sUrl.'"';
|
||||
|
||||
@@ -25,6 +25,7 @@ use AttributeDateTime;
|
||||
use AttributeDefinition;
|
||||
use AttributeExternalKey;
|
||||
use AttributeImage;
|
||||
use AttributeSet;
|
||||
use AttributeTagSet;
|
||||
use BinaryExpression;
|
||||
use CMDBSource;
|
||||
@@ -686,6 +687,12 @@ class ManageBrickController extends BrickController
|
||||
$sValue = $oAttDef->GenerateViewHtmlForValues($aCodes, '', false);
|
||||
$sSortValue = implode(' ', $aCodes);
|
||||
}
|
||||
elseif ($oAttDef instanceof AttributeSet)
|
||||
{
|
||||
$oAttDef->SetDisplayLink(false);
|
||||
$sValue = $oAttDef->GetAsHTML($oCurrentRow->Get($sItemAttr));
|
||||
$sSortValue = "".$oCurrentRow->Get($sItemAttr);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sValue = $oAttDef->GetAsHTML($oCurrentRow->Get($sItemAttr));
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace Combodo\iTop\Portal\Helper;
|
||||
|
||||
|
||||
use AttributeImage;
|
||||
use AttributeSet;
|
||||
use AttributeTagSet;
|
||||
use Combodo\iTop\Portal\Brick\BrowseBrick;
|
||||
use DBSearch;
|
||||
@@ -399,6 +400,11 @@ class BrowseBrickHelper
|
||||
$sHtmlForFieldValue = $oAttDef->GenerateViewHtmlForValues($aCodes, '', false);
|
||||
break;
|
||||
|
||||
case $oAttDef instanceof AttributeSet:
|
||||
$oAttDef->SetDisplayLink(false);
|
||||
$sHtmlForFieldValue = $value->Get($aField['code']);
|
||||
break;
|
||||
|
||||
case $oAttDef instanceof AttributeImage:
|
||||
// Todo: This should be refactored, it has been seen multiple times in the portal
|
||||
$oOrmDoc = $value->Get($aField['code']);
|
||||
@@ -553,4 +559,4 @@ class BrowseBrickHelper
|
||||
$this->AddToTreeItems($aItems[$sCurrentIndex]['subitems'], $aCurrentRowSliced, $aLevelsProperties, $aCurrentRowObjects);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user