N°4569 - Fix deletion of light-grey theme for iTop 2.7 and older

This commit is contained in:
Eric Espie
2022-01-26 10:00:48 +01:00
parent aa20289dfe
commit 468de06fe1
12 changed files with 620 additions and 9 deletions

View File

@@ -17,6 +17,8 @@
* You should have received a copy of the GNU Affero General Public License
*/
use Combodo\iTop\DesignDocument;
/**
* Utility to upgrade the format of a given XML datamodel to the latest version
@@ -109,7 +111,9 @@ class iTopDesignFormat
*/
protected $aLog;
protected $bStatus;
protected $bKeepObsoleteNodes;
protected $sKeepVersion;
/**
* Creation from a loaded DOMDocument
* @param DOMDocument $oDocument The document to transform
@@ -210,6 +214,20 @@ class iTopDesignFormat
return self::GetItopNodePath($oNode->parentNode).'/'.$sNodeDesc;
}
/**
* Compute a real xpath from iTop one
*
* @param \Combodo\iTop\DesignElement $oNode
*
* @return string
*/
public static function GetNodeXPath($oNode)
{
$sITopXPath = DesignDocument::GetItopNodePath($oNode);
return preg_replace(["@\[@", "@]@"], ["[@id=\"", "\"]"], $sITopXPath);
}
/**
* Test the conversion without altering the DOM
*
@@ -227,19 +245,21 @@ class iTopDesignFormat
}
/**
* Make adjustements to the DOM to migrate it to the specified version (default is latest)
* Make adjustments to the DOM to migrate it to the specified version (default is latest)
* For now only the conversion from version 1.0 to 1.1 is supported.
*
* @param string $sTargetVersion The desired version (or the latest possible version if not specified)
* @param object $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the
* @param \ModelFactory|null $oFactory Full data model (not yet used, aimed at allowing conversion that could not be performed without knowing the
* whole data model)
* @param bool $bKeepObsoleteNodes
*
* @return bool True on success, False if errors have been encountered (still the DOM may be altered!)
*/
public function Convert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null)
public function Convert($sTargetVersion = ITOP_DESIGN_LATEST_VERSION, $oFactory = null, $bKeepObsoleteNodes = true)
{
$this->aLog = array();
$this->bStatus = true;
$this->bKeepObsoleteNodes = $bKeepObsoleteNodes;
$oXPath = new DOMXPath($this->oDocument);
// Retrieve the version number
@@ -304,6 +324,7 @@ class iTopDesignFormat
$sIntermediate = self::$aVersions[$sFrom]['next'];
$sTransform = self::$aVersions[$sFrom]['go_to_next'];
$this->LogInfo("Upgrading from $sFrom to $sIntermediate ($sTransform)");
$this->sKeepVersion = $sFrom;
}
else
{
@@ -311,12 +332,16 @@ class iTopDesignFormat
$sIntermediate = self::$aVersions[$sFrom]['previous'];
$sTransform = self::$aVersions[$sFrom]['go_to_previous'];
$this->LogInfo("Downgrading from $sFrom to $sIntermediate ($sTransform)");
$this->sKeepVersion = null;
}
// Transform to the intermediate format
$aCallSpec = array($this, $sTransform);
try
{
call_user_func($aCallSpec, $oFactory);
if ($iFrom > $iTo && $this->bKeepObsoleteNodes) {
$this->RestorePreviousNodes($sIntermediate);
}
// Recurse
$this->DoConvert($sIntermediate, $sTo, $oFactory);
@@ -325,7 +350,6 @@ class iTopDesignFormat
{
$this->LogError($e->getMessage());
}
return;
}
/**
@@ -947,13 +971,78 @@ class iTopDesignFormat
}
}
}
/**
* @param string $sPath
* @param string $sNodeMetaVersion
*
* @return void
*/
private function RemoveNodeFromXPath($sPath)
private function RestorePreviousNodes($sNodeMetaVersion)
{
$oXPath = new DOMXPath($this->oDocument);
$oTrashedNodes = $oXPath->query("/itop_design/meta/previous_versions/previous_version[@id='$sNodeMetaVersion']/trashed_nodes/trashed_node");
foreach ($oTrashedNodes as $oTrashedNode) {
if ($oTrashedNode->nodeType == XML_ELEMENT_NODE) {
$oXPathNode = $oXPath->query('parent_xpath', $oTrashedNode)->item(0);
$oNodeTreeNode = $oXPath->query('node_tree', $oTrashedNode)->item(0);
if (!is_null($oXPathNode) && !is_null($oNodeTreeNode)) {
$sXPath = $this->GetText($oXPathNode, '');
$oParentNode = $oXPath->query($sXPath)->item(0);
if ($oParentNode) {
$oNode = $oNodeTreeNode->firstChild;
while ($oNode) {
$oNextNode = $oNode->nextSibling;
if ($oNode->nodeType == XML_ELEMENT_NODE) {
// Restore the modification flags
$oModifiedNodeList = $oXPath->query('descendant-or-self::*[@_disabled_delta or @_disabled_rename_from]', $oNode);
foreach ($oModifiedNodeList as $oModifiedNode) {
foreach (['_delta', '_rename_from'] as $sModificationFlag) {
$sCurrentFlag = $oNode->getAttribute('_disabled'.$sModificationFlag);
if (!empty($sCurrentFlag)) {
$oModifiedNode->setAttribute($sModificationFlag, $sCurrentFlag);
$oModifiedNode->removeAttribute('_disabled'.$sModificationFlag);
}
}
}
// Move the node back in place
$oParentNode->appendChild($oNode);
}
$oNode = $oNextNode;
}
}
}
}
}
// Clean up the mess
$this->RemoveNodeFromXPath("/itop_design/meta/previous_versions/previous_version[@id='$sNodeMetaVersion']", false);
$this->RemoveEmptyNodeFromXPath("/itop_design/meta/previous_versions");
$this->RemoveEmptyNodeFromXPath("/itop_design/meta");
}
private function RemoveEmptyNodeFromXPath($sXPath, $bStoreThisNodeInMetaVersion = false)
{
$oXPath = new DOMXPath($this->oDocument);
$oNodeToRemove = $oXPath->query($sXPath)->item(0);
if (is_null($oNodeToRemove)) {
return;
}
$oNode = $oNodeToRemove->firstChild;
while ($oNode) {
if ($oNode->nodeType == XML_ELEMENT_NODE) {
return;
}
$oNode = $oNode->nextSibling;
}
$this->RemoveNodeFromXPath($sXPath, $bStoreThisNodeInMetaVersion);
}
/**
* @param string $sPath
* @param bool $bStoreThisNodeInMetaVersion
*
* @return void
*/
private function RemoveNodeFromXPath($sPath, $bStoreThisNodeInMetaVersion = true)
{
$oXPath = new DOMXPath($this->oDocument);
@@ -961,10 +1050,68 @@ class iTopDesignFormat
foreach ($oNodeList as $oNode)
{
$this->LogWarning('Node '.self::GetItopNodePath($oNode).' is irrelevant in this version, it will be removed.');
$this->DeleteNode($oNode);
if ($bStoreThisNodeInMetaVersion && $this->bKeepObsoleteNodes && $this->sKeepVersion) {
// Move the node to <Meta> to keep it safe for backward migration
$oItopDesignNode = $this->GetOrCreateNode('/itop_design', 'itop_design', null);
$oMetaNode = $this->GetOrCreateNode('meta', 'meta', $oItopDesignNode);
$oPreviousVersionsNode = $this->GetOrCreateNode('previous_versions', 'previous_versions', $oMetaNode);
$oPreviousVersionNode = $this->GetOrCreateNode("previous_version[@id='$this->sKeepVersion']", 'previous_version', $oPreviousVersionsNode);
$oPreviousVersionNode->setAttribute('id', $this->sKeepVersion);
$oPreviousVersionNode->setAttribute('_delta', 'define');
$oTrashedNodeList = $this->GetOrCreateNode('trashed_nodes', 'trashed_nodes', $oPreviousVersionNode);
$iMaxIndex = 0;
$oTrashedNodes = $oXPath->query('trashed_node', $oTrashedNodeList);
foreach ($oTrashedNodes as $oTrashedNode) {
if ($oTrashedNode->nodeType == XML_ELEMENT_NODE) {
$iId = $oTrashedNode->getAttribute('id');
if ($iId > $iMaxIndex) {
$iMaxIndex = $iId;
}
}
}
$iNextId = $iMaxIndex + 1;
$oTrashedNode = $this->GetOrCreateNode("trashed_node[@id='$iNextId']", 'trashed_node', $oTrashedNodeList);
$oTrashedNode->setAttribute('id', $iNextId);
$oXPathNode = $this->GetOrCreateNode('parent_xpath', 'parent_xpath', $oTrashedNode);
$oParentNode = $oNode->parentNode;
if ($oParentNode instanceof DOMElement) {
$sParentXPath = static::GetNodeXPath($oParentNode);
$oXPathNode->appendChild(new DOMText($sParentXPath));
}
$oNodeTreeNode = $this->GetOrCreateNode('node_tree', 'node_tree', $oTrashedNode);
// Store the modification flags
$oModifiedNodeList = $oXPath->query('descendant-or-self::*[@_delta or @_rename_from]', $oNode);
foreach ($oModifiedNodeList as $oModifiedNode) {
foreach (['_delta', '_rename_from'] as $sModificationFlag) {
$sCurrentFlag = $oNode->getAttribute($sModificationFlag);
if (!empty($sCurrentFlag)) {
$oModifiedNode->setAttribute('_disabled'.$sModificationFlag, $sCurrentFlag);
$oModifiedNode->removeAttribute($sModificationFlag);
}
}
}
$oNodeTreeNode->appendChild($oNode);
} else {
$this->DeleteNode($oNode);
}
}
}
private function GetOrCreateNode($sXPath, $sName, $oRootNode)
{
$oXPath = new DOMXPath($this->oDocument);
$oNode = $oXPath->query($sXPath, $oRootNode)->item(0);
if (is_null($oNode)) {
$oNode = $oRootNode->ownerDocument->createElement($sName);
$oRootNode->appendChild($oNode);
}
return $oNode;
}
/**
* Clean a collection node by removing the _delta="define" on it and moving it to the item nodes.
*
@@ -1151,4 +1298,31 @@ class iTopDesignFormat
return null;
}
/**
* Returns the TEXT of the current node (possibly from several child nodes)
* @param null $sDefault
* @return null|string
*/
protected function GetText($oNode, $sDefault = null)
{
$sText = null;
foreach($oNode->childNodes as $oChildNode)
{
if ($oChildNode instanceof \DOMText)
{
if (is_null($sText)) $sText = '';
$sText .= $oChildNode->wholeText;
}
}
if (is_null($sText))
{
return $sDefault;
}
else
{
return $sText;
}
}
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<branding _revision_id="180">
<main_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</main_logo>
<login_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</login_logo>
<portal_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</portal_logo>
</branding>
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
</constants>
<meta>
<previous_versions>
<previous_version id="1.6" _delta="define">
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version>
</previous_versions>
</meta>
</itop_design>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
<branding _revision_id="180" _delta="define">
<main_logo _revision_id="53">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</main_logo>
<login_logo _revision_id="53">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</login_logo>
<portal_logo _revision_id="53">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</portal_logo>
</branding>
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</constants>
</itop_design>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.6">
<branding _revision_id="180">
<main_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</main_logo>
<login_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</login_logo>
<portal_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</portal_logo>
</branding>
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</constants>
</itop_design>

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<branding _revision_id="180">
<main_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</main_logo>
<login_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</login_logo>
<portal_logo _revision_id="53" _delta="define">
<fileref ref="smile_portal_logo_7417a491754f12f744ac6311525e4db3" _revision_id="116"/>
</portal_logo>
</branding>
<constants>
<constant id="RESPONSE_TICKET_SLT_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _delta="redefine"><![CDATA[SELECT slt FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id=root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN SLA AS sla ON l1.sla_id=sla.id JOIN lnkSLAToSLT AS l2 ON l2.sla_id=sla.id JOIN SLT AS slt ON l2.slt_id=slt.id WHERE slt.metric = :metric AND l1.service_id = :this->service_id AND child.id= :this->org_id AND slt.request_type = :request_type AND slt.priority = :this->priority]]></constant>
</constants>
<meta>
<previous_versions>
<previous_version id="1.6" _delta="define">
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/constants</parent_xpath>
<node_tree>
<constant id="PORTAL_VALIDATE_SERVICECATEGORY_QUERY" xsi:type="string" _created_in="itop-tickets" _revision_id="19" _disabled_delta="redefine"><![CDATA[SELECT s FROM Organization AS child JOIN Organization AS root ON child.parent_id BELOW root.id JOIN CustomerContract AS cc ON cc.org_id = root.id JOIN lnkCustomerContractToService AS l1 ON l1.customercontract_id=cc.id JOIN Service AS s ON l1.service_id=s.id WHERE child.id = :org_id AND s.id = :id AND s.status != 'obsolete' UNION SELECT Service AS s JOIN lnkCustomerContractToService AS l1 ON l1.service_id=s.id JOIN CustomerContract AS cc ON l1.customercontract_id=cc.id WHERE cc.org_id = :org_id AND s.id = :id AND s.status != 'obsolete']]></constant>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version>
</previous_versions>
</meta>
</itop_design>

View File

@@ -106,4 +106,45 @@
</fields>
</class>
</classes>
<meta>
<previous_versions>
<previous_version id="1.7" _delta="define">
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="3">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="4">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version>
</previous_versions>
</meta>
</itop_design>

View File

@@ -17,6 +17,16 @@
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
<classes>

View File

@@ -9,9 +9,22 @@
</variables>
<imports>
<import id="scss-variables">../css/scss-variables.scss</import>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/main.scss</stylesheet>
</stylesheets>
</theme>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</themes>

View File

@@ -133,4 +133,45 @@
<main_logo _delta="define">images/itop-logo.png</main_logo>
<main_logo_compact _delta="define">images/itop-logo-square.png</main_logo_compact>
</branding>
<meta>
<previous_versions>
<previous_version id="1.7" _delta="define">
<trashed_nodes>
<trashed_node id="1">
<parent_xpath>/itop_design/branding/themes</parent_xpath>
<node_tree>
<theme id="light-grey">
<variables/>
<imports>
<import id="css-variables">../css/css-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
<stylesheet id="main">../css/light-grey.scss</stylesheet>
</stylesheets>
</theme>
</node_tree>
</trashed_node>
<trashed_node id="2">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/imports</parent_xpath>
<node_tree>
<import id="css-variables">../css/css-variables.scss</import>
</node_tree>
</trashed_node>
<trashed_node id="3">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="jqueryui">../css/ui-lightness/jqueryui.scss</stylesheet>
</node_tree>
</trashed_node>
<trashed_node id="4">
<parent_xpath>/itop_design/branding/themes/theme[@id="test-red"]/stylesheets</parent_xpath>
<node_tree>
<stylesheet id="main">../css/main.scss</stylesheet>
</node_tree>
</trashed_node>
</trashed_nodes>
</previous_version>
</previous_versions>
</meta>
</itop_design>

View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="backoffice-environment-banner-background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
<lifecycle>
<attribute>foo</attribute>
</lifecycle>
</class>
<class id="ClassWithStateAndImage">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<icon>images/class-with-lifecycle.png</icon>
</properties>
</class>
<class id="OtherClass">
<properties>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">new</value>
<value id="waiting_for_approval">waiting_for_approval</value>
</values>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">ongoing</value>
<value id="resolved">resolved</value>
</values>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
</branding>
</itop_design>

View File

@@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="3.0">
<branding>
<themes>
<theme id="test-red" _delta="define">
<variables>
<variable id="ibo-page-banner--background-color">#C53030</variable>
<variable id="var1">#C53030</variable>
</variables>
<imports>
<import id="scss-variables" xsi:type="utilities">../css/scss-variables.scss</import>
</imports>
<stylesheets>
<stylesheet id="custom">../css/custom.scss</stylesheet>
</stylesheets>
</theme>
</themes>
</branding>
<classes>
<class id="ClassWithStateButNoLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithStateAndLifecycle">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
</fields_semantic>
</properties>
<lifecycle/>
</class>
<class id="ClassWithStateAndImage">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<state_attribute>foo</state_attribute>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="ClassWithImageOnly">
<properties>
<style>
<icon>images/class-with-lifecycle.png</icon>
</style>
<fields_semantic>
<image_attribute>bar</image_attribute>
</fields_semantic>
</properties>
</class>
<class id="OtherClass">
<properties>
<style>
<icon revisionid="2" _delta="redefine">
<fileref ref="company_0faae3b9d86b7c382b2e4cdae570bc3c" revisionid="62"/>
</icon>
<main_color>#4E79A5</main_color>
<complementary_color>white</complementary_color>
</style>
</properties>
<fields>
<field id="status" xsi:type="AttributeEnum">
<always_load_in_tables>true</always_load_in_tables>
<values>
<value id="new">
<code>new</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="waiting_for_approval">
<code>waiting_for_approval</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
<field id="operational_status" xsi:type="AttributeMetaEnum">
<values>
<value id="ongoing">
<code>ongoing</code>
<style>
<main_color>#2C5382</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</style>
</value>
<value id="resolved">
<code>resolved</code>
</value>
</values>
<default_style>
<main_color>#2B6CB0</main_color>
<complementary_color>#FFFFFF</complementary_color>
<decoration_classes/>
</default_style>
</field>
</fields>
</class>
</classes>
<menus>
<menu id="WelcomeMenuLink1" xsi:type="WebPageMenuNode" _delta="define">
<rank>100</rank>
<parent>WelcomeMenu</parent>
<url>$$http://fr.wikipedia.org/</url>
<in_new_window>true</in_new_window>
</menu>
<menu id="RequestManagement" xsi:type="MenuGroup" _delta="define">
<rank>30</rank>
<enable_stimulus/>
<style>
<decoration_classes>fas fa-comment-alt</decoration_classes>
</style>
</menu>
</menus>
<branding>
<main_logo _delta="define">images/itop-logo.png</main_logo>
<main_logo_compact _delta="define">images/itop-logo-square.png</main_logo_compact>
</branding>
</itop_design>

View File

@@ -56,9 +56,12 @@ class TestForITopDesignFormatClass extends ItopTestCase
public function ConvertProvider()
{
return array(
'1.6 to 1.7 acl' => array('1.7', '1.6_to_1.7_acl'),
'1.7 to 1.6 acl' => array('1.6', '1.7_to_1.6_acl'),
'1.7 to 1.6' => array('1.6', '1.7_to_1.6'),
'1.7 to 3.0' => array('3.0', '1.7_to_3.0'),
'3.0 to 1.7' => array('1.7', '3.0_to_1.7'),
'3.0 to 1.7 no previous' => array('1.7', '3.0_to_1.7_no_previous'),
);
}