diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 3f8d654711..70a164f785 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2836,7 +2836,6 @@ phutil_register_library_map(array( 'PhabricatorProfilePanelEditor' => 'applications/search/editor/PhabricatorProfilePanelEditor.php', 'PhabricatorProfilePanelEngine' => 'applications/search/engine/PhabricatorProfilePanelEngine.php', 'PhabricatorProfilePanelIconSet' => 'applications/search/profilepanel/PhabricatorProfilePanelIconSet.php', - 'PhabricatorProfilePanelInterface' => 'applications/search/interface/PhabricatorProfilePanelInterface.php', 'PhabricatorProfilePanelPHIDType' => 'applications/search/phidtype/PhabricatorProfilePanelPHIDType.php', 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 'PhabricatorProjectAddHeraldAction' => 'applications/project/herald/PhabricatorProjectAddHeraldAction.php', @@ -2902,6 +2901,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPHIDResolver' => 'applications/phid/resolver/PhabricatorProjectPHIDResolver.php', 'PhabricatorProjectPanelController' => 'applications/project/controller/PhabricatorProjectPanelController.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', + 'PhabricatorProjectProfilePanelEngine' => 'applications/project/engine/PhabricatorProjectProfilePanelEngine.php', 'PhabricatorProjectProjectHasMemberEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasMemberEdgeType.php', 'PhabricatorProjectProjectHasObjectEdgeType' => 'applications/project/edge/PhabricatorProjectProjectHasObjectEdgeType.php', 'PhabricatorProjectProjectPHIDType' => 'applications/project/phid/PhabricatorProjectProjectPHIDType.php', @@ -7214,7 +7214,6 @@ phutil_register_library_map(array( 'PhabricatorDestructibleInterface', 'PhabricatorFulltextInterface', 'PhabricatorConduitResultInterface', - 'PhabricatorProfilePanelInterface', ), 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 'PhabricatorProjectApplication' => 'PhabricatorApplication', @@ -7289,6 +7288,7 @@ phutil_register_library_map(array( 'PhabricatorProjectPHIDResolver' => 'PhabricatorPHIDResolver', 'PhabricatorProjectPanelController' => 'PhabricatorProjectController', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', + 'PhabricatorProjectProfilePanelEngine' => 'PhabricatorProfilePanelEngine', 'PhabricatorProjectProjectHasMemberEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectHasObjectEdgeType' => 'PhabricatorEdgeType', 'PhabricatorProjectProjectPHIDType' => 'PhabricatorPHIDType', diff --git a/src/applications/project/controller/PhabricatorProjectController.php b/src/applications/project/controller/PhabricatorProjectController.php index 9c6fa2f4e2..56f5774391 100644 --- a/src/applications/project/controller/PhabricatorProjectController.php +++ b/src/applications/project/controller/PhabricatorProjectController.php @@ -102,7 +102,7 @@ abstract class PhabricatorProjectController extends PhabricatorController { if ($project) { $viewer = $this->getViewer(); - $engine = id(new PhabricatorProfilePanelEngine()) + $engine = id(new PhabricatorProjectProfilePanelEngine()) ->setViewer($viewer) ->setProfileObject($project); diff --git a/src/applications/project/controller/PhabricatorProjectPanelController.php b/src/applications/project/controller/PhabricatorProjectPanelController.php index 02b16dcfb4..49ed00f34e 100644 --- a/src/applications/project/controller/PhabricatorProjectPanelController.php +++ b/src/applications/project/controller/PhabricatorProjectPanelController.php @@ -12,7 +12,7 @@ final class PhabricatorProjectPanelController $viewer = $this->getViewer(); $project = $this->getProject(); - return id(new PhabricatorProfilePanelEngine()) + return id(new PhabricatorProjectProfilePanelEngine()) ->setProfileObject($project) ->setController($this) ->buildResponse(); diff --git a/src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php b/src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php new file mode 100644 index 0000000000..d37caeecf8 --- /dev/null +++ b/src/applications/project/engine/PhabricatorProjectProfilePanelEngine.php @@ -0,0 +1,51 @@ +getProfileObject(); + $id = $project->getID(); + return "/project/{$id}/panel/{$path}"; + } + + protected function getBuiltinProfilePanels($object) { + $panels = array(); + + $panels[] = $this->newPanel() + ->setBuiltinKey(PhabricatorProject::PANEL_PROFILE) + ->setPanelKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); + + $panels[] = $this->newPanel() + ->setBuiltinKey(PhabricatorProject::PANEL_WORKBOARD) + ->setPanelKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); + + // TODO: This is temporary. + $uri = urisprintf( + '/maniphest/?statuses=open()&projects=%s#R', + $object->getPHID()); + + $panels[] = $this->newPanel() + ->setBuiltinKey('tasks') + ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setPanelProperty('icon', 'maniphest') + ->setPanelProperty('name', pht('Open Tasks')) + ->setPanelProperty('uri', $uri); + + // TODO: This is temporary. + $id = $object->getID(); + $panels[] = $this->newPanel() + ->setBuiltinKey('feed') + ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) + ->setPanelProperty('icon', 'feed') + ->setPanelProperty('name', pht('Feed')) + ->setPanelProperty('uri', "/project/feed/{$id}/"); + + $panels[] = $this->newPanel() + ->setBuiltinKey(PhabricatorProject::PANEL_MEMBERS) + ->setPanelKey(PhabricatorProjectMembersProfilePanel::PANELKEY); + + return $panels; + } + +} diff --git a/src/applications/project/storage/PhabricatorProject.php b/src/applications/project/storage/PhabricatorProject.php index 99fe366583..387882df2c 100644 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -10,8 +10,7 @@ final class PhabricatorProject extends PhabricatorProjectDAO PhabricatorCustomFieldInterface, PhabricatorDestructibleInterface, PhabricatorFulltextInterface, - PhabricatorConduitResultInterface, - PhabricatorProfilePanelInterface { + PhabricatorConduitResultInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -651,47 +650,4 @@ final class PhabricatorProject extends PhabricatorProjectDAO return array(); } - -/* -( PhabricatorProfilePanelInterface )----------------------------------- */ - - - public function getBuiltinProfilePanels() { - $panels = array(); - - $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin() - ->setBuiltinKey(self::PANEL_PROFILE) - ->setPanelKey(PhabricatorProjectDetailsProfilePanel::PANELKEY); - - $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin() - ->setBuiltinKey(self::PANEL_WORKBOARD) - ->setPanelKey(PhabricatorProjectWorkboardProfilePanel::PANELKEY); - - // TODO: This is temporary. - $uri = urisprintf( - '/maniphest/?statuses=open()&projects=%s#R', - $this->getPHID()); - - $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin() - ->setBuiltinKey('tasks') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'maniphest') - ->setPanelProperty('name', pht('Open Tasks')) - ->setPanelProperty('uri', $uri); - - // TODO: This is temporary. - $id = $this->getID(); - $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin() - ->setBuiltinKey('feed') - ->setPanelKey(PhabricatorLinkProfilePanel::PANELKEY) - ->setPanelProperty('icon', 'feed') - ->setPanelProperty('name', pht('Feed')) - ->setPanelProperty('uri', "/project/feed/{$id}/"); - - $panels[] = PhabricatorProfilePanelConfiguration::initializeNewBuiltin() - ->setBuiltinKey(self::PANEL_MEMBERS) - ->setPanelKey(PhabricatorProjectMembersProfilePanel::PANELKEY); - - return $panels; - } - } diff --git a/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php b/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php index 7713a97f7c..3a2f725719 100644 --- a/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php +++ b/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php @@ -23,8 +23,7 @@ final class PhabricatorProfilePanelEditEngine return $this->panelEngine; } - public function setProfileObject( - PhabricatorProfilePanelInterface $profile_object) { + public function setProfileObject($profile_object) { $this->profileObject = $profile_object; return $this; } diff --git a/src/applications/search/engine/PhabricatorProfilePanelEngine.php b/src/applications/search/engine/PhabricatorProfilePanelEngine.php index 40e95a4acc..15fee9437a 100644 --- a/src/applications/search/engine/PhabricatorProfilePanelEngine.php +++ b/src/applications/search/engine/PhabricatorProfilePanelEngine.php @@ -1,6 +1,6 @@ viewer; } - public function setProfileObject( - PhabricatorProfilePanelInterface $profile_object) { + public function setProfileObject($profile_object) { $this->profileObject = $profile_object; return $this; } @@ -35,6 +34,8 @@ final class PhabricatorProfilePanelEngine extends Phobject { return $this->controller; } + abstract protected function getPanelURI($path); + public function buildResponse() { $controller = $this->getController(); @@ -132,7 +133,7 @@ final class PhabricatorProfilePanelEngine extends Phobject { public function buildNavigation() { $nav = id(new AphrontSideNavFilterView()) ->setIsProfileMenu(true) - ->setBaseURI(new PhutilURI('/project/')); + ->setBaseURI(new PhutilURI($this->getPanelURI(''))); $panels = $this->getPanels(); @@ -225,7 +226,7 @@ final class PhabricatorProfilePanelEngine extends Phobject { private function loadBuiltinProfilePanels() { $object = $this->getProfileObject(); - $builtins = $object->getBuiltinProfilePanels(); + $builtins = $this->getBuiltinProfilePanels($object); $panels = PhabricatorProfilePanel::getAllPanels(); @@ -310,12 +311,6 @@ final class PhabricatorProfilePanelEngine extends Phobject { return $this->getPanelURI('configure/'); } - private function getPanelURI($path) { - $project = $this->getProfileObject(); - $id = $project->getID(); - return "/project/{$id}/panel/{$path}"; - } - private function buildPanelReorderContent(array $panels) { $viewer = $this->getViewer(); $object = $this->getProfileObject(); @@ -646,4 +641,8 @@ final class PhabricatorProfilePanelEngine extends Phobject { ->addSubmitButton(pht('Save Changes')); } + protected function newPanel() { + return PhabricatorProfilePanelConfiguration::initializeNewBuiltin(); + } + } diff --git a/src/applications/search/interface/PhabricatorProfilePanelInterface.php b/src/applications/search/interface/PhabricatorProfilePanelInterface.php deleted file mode 100644 index 34d68458a8..0000000000 --- a/src/applications/search/interface/PhabricatorProfilePanelInterface.php +++ /dev/null @@ -1,7 +0,0 @@ -assertAttached($this->panel); } - public function attachProfileObject( - PhabricatorProfilePanelInterface $profile_object) { + public function attachProfileObject($profile_object) { $this->profileObject = $profile_object; return $this; }