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

SVN:trunk[4704]
This commit is contained in:
Romain Quetiez
2017-04-27 09:56:05 +00:00
parent e70e1de75e
commit 23556e3a43

View File

@@ -168,6 +168,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
@@ -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);
}
}