#1040 Graphical display of "impact/depends on" is not consistent with the "list" tab

SVN:trunk[3471]
This commit is contained in:
Denis Flaven
2014-12-16 13:40:51 +00:00
parent 715ba066d3
commit 83e2974b10
4 changed files with 17 additions and 7 deletions

View File

@@ -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)

View File

@@ -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');

View File

@@ -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)

View File

@@ -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