Jelajahi Sumber

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3471 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 10 tahun lalu
induk
melakukan
e00b5527ad
4 mengubah file dengan 17 tambahan dan 7 penghapusan
  1. 8 0
      core/config.class.inc.php
  2. 2 1
      pages/UI.php
  3. 6 6
      pages/xml.navigator.php
  4. 1 0
      readme.txt

+ 8 - 0
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)

+ 2 - 1
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');

+ 6 - 6
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)

+ 1 - 0
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