mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
Taxons: Add support in the portal (UI still to be done).
This commit is contained in:
@@ -6714,47 +6714,6 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
return array_merge(parent::ListExpectedParams(), array('is_null_allowed', 'tag_max_nb', 'tag_code_max_len'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ormTagSet $oValue
|
||||
*
|
||||
* @return string JSON to be used in the itop.set_widget JQuery widget
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetJsonForWidget($oValue)
|
||||
{
|
||||
$aJson = array();
|
||||
|
||||
// possible_values
|
||||
$aTagSetObjectData = $this->GetAllowedValues();
|
||||
$aTagSetKeyValData = array();
|
||||
foreach($aTagSetObjectData as $sTagCode => $sTagLabel)
|
||||
{
|
||||
$aTagSetKeyValData[] = [
|
||||
'code' => $sTagCode,
|
||||
'label' => $sTagLabel,
|
||||
];
|
||||
}
|
||||
$aJson['possible_values'] = $aTagSetKeyValData;
|
||||
|
||||
if (is_null($oValue))
|
||||
{
|
||||
$aJson['partial_values'] = array();
|
||||
$aJson['orig_value'] = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$aJson['partial_values'] = $oValue->GetModifiedTags();
|
||||
$aJson['orig_value'] = array_merge($oValue->GetValue(), $oValue->GetModifiedTags());
|
||||
}
|
||||
$aJson['added'] = array();
|
||||
$aJson['removed'] = array();
|
||||
|
||||
$iMaxTags = $this->GetTagMaxNb();
|
||||
$aJson['max_items_allowed'] = $iMaxTags;
|
||||
|
||||
return json_encode($aJson);
|
||||
}
|
||||
|
||||
public function GetDefaultValue(DBObject $oHostObject = null)
|
||||
{
|
||||
return null;
|
||||
@@ -7411,6 +7370,47 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
return $oSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \ormTagSet $oValue
|
||||
*
|
||||
* @return string JSON to be used in the itop.tagset_widget JQuery widget
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetJsonForWidget($oValue)
|
||||
{
|
||||
$aJson = array();
|
||||
|
||||
// possible_values
|
||||
$aTagSetObjectData = $this->GetAllowedValues();
|
||||
$aTagSetKeyValData = array();
|
||||
foreach($aTagSetObjectData as $sTagCode => $sTagLabel)
|
||||
{
|
||||
$aTagSetKeyValData[] = [
|
||||
'code' => $sTagCode,
|
||||
'label' => $sTagLabel,
|
||||
];
|
||||
}
|
||||
$aJson['possible_values'] = $aTagSetKeyValData;
|
||||
|
||||
if (is_null($oValue))
|
||||
{
|
||||
$aJson['partial_values'] = array();
|
||||
$aJson['orig_value'] = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
$aJson['partial_values'] = $oValue->GetModifiedTags();
|
||||
$aJson['orig_value'] = array_merge($oValue->GetValue(), $oValue->GetModifiedTags());
|
||||
}
|
||||
$aJson['added'] = array();
|
||||
$aJson['removed'] = array();
|
||||
|
||||
$iMaxTags = $this->GetTagMaxNb();
|
||||
$aJson['max_tags_allowed'] = $iMaxTags;
|
||||
|
||||
return json_encode($aJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* The part of the current attribute in the object's signature, for the supplied value
|
||||
*
|
||||
@@ -7430,6 +7430,10 @@ class AttributeTagSet extends AttributeDBFieldVoid
|
||||
return parent::Fingerprint($value);
|
||||
}
|
||||
|
||||
static public function GetFormFieldClass()
|
||||
{
|
||||
return '\\Combodo\\iTop\\Form\\Field\\TagSetField';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user