diff --git a/core/config.class.inc.php b/core/config.class.inc.php index a0d0021d8..bcf24aab9 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -801,6 +801,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'relations_max_depth' => array( + 'type' => 'integer', + 'description' => 'Maximum number of successive levels (depth) to explore when displaying the impact/depends on relations.', + 'default' => 20, // In iTop 2.0.3, this was the hardcoded value + 'value' => '', + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), ); public function IsProperty($sPropCode) diff --git a/pages/UI.php b/pages/UI.php index b53a43d5f..479ec5b49 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -1532,7 +1532,8 @@ EOF $aResults = array(); $oObj = MetaModel::GetObject($sClass, $id); - $oObj->GetRelatedObjects($sRelation, 20 /* iMaxDepth */, $aResults); + $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20); + $oObj->GetRelatedObjects($sRelation, $iMaxRecursionDepth /* iMaxDepth */, $aResults); $oP->AddTabContainer('Navigator'); $oP->SetCurrentTabContainer('Navigator'); diff --git a/pages/xml.navigator.php b/pages/xml.navigator.php index 1b663bedf..01473be07 100755 --- a/pages/xml.navigator.php +++ b/pages/xml.navigator.php @@ -32,8 +32,6 @@ require_once(APPROOT.'/application/ajaxwebpage.class.inc.php'); require_once(APPROOT.'/application/wizardhelper.class.inc.php'); require_once(APPROOT.'/application/ui.linkswidget.class.inc.php'); -define('MAX_RECURSION_DEPTH', 20); - /** * Fills the given XML node with te details of the specified object */ @@ -65,10 +63,11 @@ $G_aCachedObjects = array(); function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXmlDoc, &$oXmlNode, $iDepth = 0, $aExcludedClasses) { global $G_aCachedObjects; + $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20); $aResults = array(); $bAddLinks = false; - if ($iDepth > MAX_RECURSION_DEPTH) return; + if ($iDepth > ($iMaxRecursionDepth - 1)) return; $sIdxKey = get_class($oObj).':'.$oObj->GetKey(); if (!array_key_exists($sIdxKey, $G_aCachedObjects)) @@ -90,7 +89,7 @@ function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXml { if (in_array(get_class($oTargetObj), $aExcludedClasses)) { - GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oLinks, $oXmlDoc, $oXmlNode, $iDepth++, $aExcludedClasses); + GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oLinks, $oXmlDoc, $oXmlNode, $iDepth+1, $aExcludedClasses); } else { @@ -106,7 +105,7 @@ function GetRelatedObjectsAsXml(DBObject $oObj, $sRelationName, &$oLinks, &$oXml AddNodeDetails($oLinkedNode, $oTargetObj); $oSubLinks = $oXmlDoc->CreateElement('links'); // Recurse - GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oSubLinks, $oXmlDoc, $oLinkedNode, $iDepth++, $aExcludedClasses); + GetRelatedObjectsAsXml($oTargetObj, $sRelationName, $oSubLinks, $oXmlDoc, $oLinkedNode, $iDepth+1, $aExcludedClasses); $oLinkingNode->AppendChild($oLinkedNode); $oLinks->AppendChild($oLinkingNode); $bAddLinks = true; @@ -161,7 +160,8 @@ try $oPage->SetContentType('text/html'); $oObj = MetaModel::GetObject($sClass, $id, true /* object must exist */); $aResults = array(); - $oObj->GetRelatedObjects($sRelation, MAX_RECURSION_DEPTH /* iMaxDepth */, $aResults); + $iMaxRecursionDepth = MetaModel::GetConfig()->Get('relations_max_depth', 20); + $oObj->GetRelatedObjects($sRelation, $iMaxRecursionDepth /* iMaxDepth */, $aResults); $iBlock = 1; // Zero is not a valid blockid foreach($aResults as $sClass => $aObjects) diff --git a/readme.txt b/readme.txt index d61b48ea1..5d4c69ce4 100644 --- a/readme.txt +++ b/readme.txt @@ -287,6 +287,7 @@ Prevent the JS validation (on focus) to create multiple entries for the same fie #1039 Prevent concurrent executions of either synchro_import.php or synchro_exec.php for a given data source, since it would lead to unpredictable results. #1037 Refresh "priority" when either "impact" or "urgency" changes. #1038 Duplicate column name (service name) when importing service subcategories +#1040 The graphical display of "impact/depends on" is not consistent with the "list" tab Extending the data model