2016-01-14 15:47:06 +01:00
|
|
|
<?php
|
|
|
|
|
2016-12-11 18:00:44 +01:00
|
|
|
final class PhabricatorPeopleProfileMenuEngine
|
|
|
|
extends PhabricatorProfileMenuEngine {
|
2016-01-14 15:47:06 +01:00
|
|
|
|
|
|
|
const PANEL_PROFILE = 'people.profile';
|
2016-01-24 16:07:17 +01:00
|
|
|
const PANEL_MANAGE = 'people.manage';
|
2016-01-14 15:47:06 +01:00
|
|
|
|
2016-12-11 18:00:44 +01:00
|
|
|
protected function isMenuEngineConfigurable() {
|
2016-01-14 15:47:06 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getPanelURI($path) {
|
|
|
|
$user = $this->getProfileObject();
|
|
|
|
$username = $user->getUsername();
|
|
|
|
$username = phutil_escape_uri($username);
|
|
|
|
return "/p/{$username}/panel/{$path}";
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getBuiltinProfilePanels($object) {
|
|
|
|
$viewer = $this->getViewer();
|
|
|
|
|
|
|
|
$panels = array();
|
|
|
|
|
|
|
|
$panels[] = $this->newPanel()
|
|
|
|
->setBuiltinKey(self::PANEL_PROFILE)
|
|
|
|
->setPanelKey(PhabricatorPeopleDetailsProfilePanel::PANELKEY);
|
|
|
|
|
|
|
|
$have_maniphest = PhabricatorApplication::isClassInstalledForViewer(
|
|
|
|
'PhabricatorManiphestApplication',
|
|
|
|
$viewer);
|
|
|
|
if ($have_maniphest) {
|
|
|
|
$uri = urisprintf(
|
|
|
|
'/maniphest/?statuses=open()&assigned=%s#R',
|
|
|
|
$object->getPHID());
|
|
|
|
|
|
|
|
$panels[] = $this->newPanel()
|
|
|
|
->setBuiltinKey('tasks')
|
|
|
|
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)
|
|
|
|
->setPanelProperty('icon', 'maniphest')
|
|
|
|
->setPanelProperty('name', pht('Open Tasks'))
|
|
|
|
->setPanelProperty('uri', $uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
$have_differential = PhabricatorApplication::isClassInstalledForViewer(
|
|
|
|
'PhabricatorDifferentialApplication',
|
|
|
|
$viewer);
|
|
|
|
if ($have_differential) {
|
|
|
|
$uri = urisprintf(
|
|
|
|
'/differential/?authors=%s#R',
|
|
|
|
$object->getPHID());
|
|
|
|
|
|
|
|
$panels[] = $this->newPanel()
|
|
|
|
->setBuiltinKey('revisions')
|
|
|
|
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)
|
|
|
|
->setPanelProperty('icon', 'differential')
|
|
|
|
->setPanelProperty('name', pht('Revisions'))
|
|
|
|
->setPanelProperty('uri', $uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
$have_diffusion = PhabricatorApplication::isClassInstalledForViewer(
|
|
|
|
'PhabricatorDiffusionApplication',
|
|
|
|
$viewer);
|
|
|
|
if ($have_diffusion) {
|
|
|
|
$uri = urisprintf(
|
|
|
|
'/audit/?authors=%s#R',
|
|
|
|
$object->getPHID());
|
|
|
|
|
|
|
|
$panels[] = $this->newPanel()
|
|
|
|
->setBuiltinKey('commits')
|
|
|
|
->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY)
|
|
|
|
->setPanelProperty('icon', 'diffusion')
|
|
|
|
->setPanelProperty('name', pht('Commits'))
|
|
|
|
->setPanelProperty('uri', $uri);
|
|
|
|
}
|
|
|
|
|
2016-01-24 16:07:17 +01:00
|
|
|
$panels[] = $this->newPanel()
|
|
|
|
->setBuiltinKey(self::PANEL_MANAGE)
|
|
|
|
->setPanelKey(PhabricatorPeopleManageProfilePanel::PANELKEY);
|
|
|
|
|
2016-01-14 15:47:06 +01:00
|
|
|
return $panels;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|