diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -2836,7 +2836,6 @@ '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 @@ '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 @@ 'PhabricatorDestructibleInterface', 'PhabricatorFulltextInterface', 'PhabricatorConduitResultInterface', - 'PhabricatorProfilePanelInterface', ), 'PhabricatorProjectAddHeraldAction' => 'PhabricatorProjectHeraldAction', 'PhabricatorProjectApplication' => 'PhabricatorApplication', @@ -7289,6 +7288,7 @@ '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 --- a/src/applications/project/controller/PhabricatorProjectController.php +++ b/src/applications/project/controller/PhabricatorProjectController.php @@ -102,7 +102,7 @@ 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 --- a/src/applications/project/controller/PhabricatorProjectPanelController.php +++ b/src/applications/project/controller/PhabricatorProjectPanelController.php @@ -12,7 +12,7 @@ $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 --- /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 --- a/src/applications/project/storage/PhabricatorProject.php +++ b/src/applications/project/storage/PhabricatorProject.php @@ -10,8 +10,7 @@ PhabricatorCustomFieldInterface, PhabricatorDestructibleInterface, PhabricatorFulltextInterface, - PhabricatorConduitResultInterface, - PhabricatorProfilePanelInterface { + PhabricatorConduitResultInterface { protected $name; protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; @@ -651,47 +650,4 @@ 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 --- a/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php +++ b/src/applications/search/editor/PhabricatorProfilePanelEditEngine.php @@ -23,8 +23,7 @@ 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 --- 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 @@ return $this->controller; } + abstract protected function getPanelURI($path); + public function buildResponse() { $controller = $this->getController(); @@ -132,7 +133,7 @@ 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 @@ private function loadBuiltinProfilePanels() { $object = $this->getProfileObject(); - $builtins = $object->getBuiltinProfilePanels(); + $builtins = $this->getBuiltinProfilePanels($object); $panels = PhabricatorProfilePanel::getAllPanels(); @@ -310,12 +311,6 @@ 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 @@ ->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 --- 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; }