mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-21 01:28:47 +02:00
N°3203 - Datamodel: Add semantic for image & state attributes Part. II
This commit is contained in:
@@ -95,7 +95,7 @@ class iTopDesignFormat
|
||||
'go_to_previous' => 'From18To17',
|
||||
'next' => null,
|
||||
'go_to_next' => null,
|
||||
)
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -768,9 +768,35 @@ class iTopDesignFormat
|
||||
*/
|
||||
protected function From17To18($oFactory)
|
||||
{
|
||||
$oXPath = new DOMXPath($this->oDocument);
|
||||
|
||||
// N°3233 - Remove "display template" feature from MetaModel
|
||||
$sPath = "/itop_design//class/properties/display_template";
|
||||
$this->RemoveNodeFromXPath($sPath);
|
||||
|
||||
// N°3203 - Datamodel: Add semantic for image & state attributes
|
||||
// - Move lifecycle attribute declaration to the semantic node
|
||||
$oNodeList = $oXPath->query("/itop_design//class/lifecycle/attribute");
|
||||
/** @var \DOMElement $oNode */
|
||||
foreach ($oNodeList as $oNode) {
|
||||
// Find semantic node or create it
|
||||
$oPropertiesNode = $oXPath->query("../../properties", $oNode)->item(0);
|
||||
$oFieldsSemanticNodeList = $oXPath->query("fields_semantic", $oPropertiesNode);
|
||||
if ($oFieldsSemanticNodeList->length > 0) {
|
||||
$oSemanticNode = $oFieldsSemanticNodeList->item(0);
|
||||
}
|
||||
else {
|
||||
$oSemanticNode = $oPropertiesNode->ownerDocument->createElement("fields_semantic");
|
||||
$oPropertiesNode->appendChild($oSemanticNode);
|
||||
}
|
||||
|
||||
// Create state_attribute node
|
||||
$oStateNode = $oSemanticNode->ownerDocument->createElement("state_attribute", $oNode->nodeValue);
|
||||
$oSemanticNode->appendChild($oStateNode);
|
||||
|
||||
// Remove current node from lifecycle
|
||||
$this->DeleteNode($oNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -780,6 +806,8 @@ class iTopDesignFormat
|
||||
*/
|
||||
protected function From18To17($oFactory)
|
||||
{
|
||||
$oXPath = new DOMXPath($this->oDocument);
|
||||
|
||||
// N°3182 - Remove style node from MenuGroup
|
||||
$sPath = "/itop_design/menus/menu[@xsi:type='MenuGroup']/style";
|
||||
$this->RemoveNodeFromXPath($sPath);
|
||||
@@ -791,6 +819,27 @@ class iTopDesignFormat
|
||||
// N°2982 - Speed up SCSS themes compilation during setup
|
||||
$sPath = "/itop_design/branding/themes/theme/precompiled_stylesheet";
|
||||
$this->RemoveNodeFromXPath($sPath);
|
||||
|
||||
// N°3203 - Datamodel: Add semantic for image & state attributes
|
||||
// - Move state_attribute back to the lifecycle node if it has one
|
||||
$oNodeList = $oXPath->query("/itop_design//class/properties/fields_semantic/state_attribute");
|
||||
/** @var \DOMElement $oNode */
|
||||
foreach ($oNodeList as $oNode) {
|
||||
// Move node under lifecycle only if there is such a node
|
||||
$oLifecycleNode = $oXPath->query("../../../lifecycle", $oNode)->item(0);
|
||||
if($oLifecycleNode !== null)
|
||||
{
|
||||
// Create attribute node
|
||||
$oAttributeNode = $oLifecycleNode->ownerDocument->createElement("attribute", $oNode->nodeValue);
|
||||
$oLifecycleNode->appendChild($oAttributeNode);
|
||||
}
|
||||
|
||||
// Remove current node from semantic in all cases
|
||||
$this->DeleteNode($oNode);
|
||||
}
|
||||
// - Remove semantic node
|
||||
$sPath = "/itop_design//class/properties/fields_semantic";
|
||||
$this->RemoveNodeFromXPath($sPath);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user