Explorar o código

Archives: clean breadcrumb entry if attempting to navigate to the details of an archived object (while not being in archive mode)

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4704 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=8) %!d(string=hai) anos
pai
achega
68f8d6618c
Modificáronse 1 ficheiros con 18 adicións e 7 borrados
  1. 18 7
      pages/UI.php

+ 18 - 7
pages/UI.php

@@ -169,6 +169,22 @@ function DisplayMessages($sMessageKey, WebPage $oPage)
 }
 
 /**
+ * Helper to update the breadrumb for the current object
+ * @param DBObject $oObj
+ * @param WebPage $oPage
+ */
+function SetObjectBreadCrumbEntry(DBObject $oObj, WebPage $oPage)
+{
+	$sClass = get_class($oObj); // get the leaf class
+	$sIcon = MetaModel::GetClassIcon($sClass, false);
+	if ($sIcon == '')
+	{
+		$sIcon = utils::GetAbsoluteUrlAppRoot().'images/breadcrumb_object.png';
+	}
+	$oPage->SetBreadCrumbEntry("ui-details-$sClass-".$oObj->GetKey(), $oObj->Get('friendlyname'), MetaModel::GetName($sClass).': '.$oObj->Get('friendlyname'), '', $sIcon);
+}
+
+/**
  * Displays the result of a search request
  * @param $oP WebPage Web page for the output
  * @param $oFilter DBSearch The search of objects to display
@@ -396,6 +412,7 @@ try
 				}
 				else
 				{
+					SetObjectBreadCrumbEntry($oObj, $oP);
 					$oP->P(Dict::S('UI:ObjectArchived'));
 				}
 			}
@@ -419,13 +436,7 @@ try
 				}
 				if (!is_null($oObj))
 				{
-					$sClass = get_class($oObj); // get the leaf class
-					$sIcon = MetaModel::GetClassIcon($sClass, false);
-					if ($sIcon == '')
-					{
-						$sIcon = utils::GetAbsoluteUrlAppRoot().'images/breadcrumb_object.png';
-					}
-					$oP->SetBreadCrumbEntry("ui-details-$sClass-$id", $oObj->Get('friendlyname'), MetaModel::GetName($sClass).': '.$oObj->Get('friendlyname'), '', $sIcon);
+					SetObjectBreadCrumbEntry($oObj, $oP);
 					DisplayDetails($oP, $sClass, $oObj, $id);
 				}				
 			}