diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index dc461e0808..a2020265e9 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1844,8 +1844,10 @@ phutil_register_library_map(array( 'PhabricatorProjectCustomFieldStringIndex' => 'applications/project/storage/PhabricatorProjectCustomFieldStringIndex.php', 'PhabricatorProjectDAO' => 'applications/project/storage/PhabricatorProjectDAO.php', 'PhabricatorProjectDescriptionField' => 'applications/project/customfield/PhabricatorProjectDescriptionField.php', + 'PhabricatorProjectEditDetailsController' => 'applications/project/controller/PhabricatorProjectEditDetailsController.php', + 'PhabricatorProjectEditMainController' => 'applications/project/controller/PhabricatorProjectEditMainController.php', + 'PhabricatorProjectEditPictureController' => 'applications/project/controller/PhabricatorProjectEditPictureController.php', 'PhabricatorProjectEditorTestCase' => 'applications/project/editor/__tests__/PhabricatorProjectEditorTestCase.php', - 'PhabricatorProjectHistoryController' => 'applications/project/controller/PhabricatorProjectHistoryController.php', 'PhabricatorProjectListController' => 'applications/project/controller/PhabricatorProjectListController.php', 'PhabricatorProjectMembersEditController' => 'applications/project/controller/PhabricatorProjectMembersEditController.php', 'PhabricatorProjectMoveController' => 'applications/project/controller/PhabricatorProjectMoveController.php', @@ -1853,8 +1855,6 @@ phutil_register_library_map(array( 'PhabricatorProjectPHIDTypeColumn' => 'applications/project/phid/PhabricatorProjectPHIDTypeColumn.php', 'PhabricatorProjectPHIDTypeProject' => 'applications/project/phid/PhabricatorProjectPHIDTypeProject.php', 'PhabricatorProjectProfileController' => 'applications/project/controller/PhabricatorProjectProfileController.php', - 'PhabricatorProjectProfileEditController' => 'applications/project/controller/PhabricatorProjectProfileEditController.php', - 'PhabricatorProjectProfilePictureController' => 'applications/project/controller/PhabricatorProjectProfilePictureController.php', 'PhabricatorProjectQuery' => 'applications/project/query/PhabricatorProjectQuery.php', 'PhabricatorProjectSearchEngine' => 'applications/project/query/PhabricatorProjectSearchEngine.php', 'PhabricatorProjectSearchIndexer' => 'applications/project/search/PhabricatorProjectSearchIndexer.php', @@ -4591,8 +4591,10 @@ phutil_register_library_map(array( 'PhabricatorProjectCustomFieldStringIndex' => 'PhabricatorCustomFieldStringIndexStorage', 'PhabricatorProjectDAO' => 'PhabricatorLiskDAO', 'PhabricatorProjectDescriptionField' => 'PhabricatorProjectStandardCustomField', + 'PhabricatorProjectEditDetailsController' => 'PhabricatorProjectController', + 'PhabricatorProjectEditMainController' => 'PhabricatorProjectController', + 'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController', 'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase', - 'PhabricatorProjectHistoryController' => 'PhabricatorProjectController', 'PhabricatorProjectListController' => array( 0 => 'PhabricatorProjectController', @@ -4604,8 +4606,6 @@ phutil_register_library_map(array( 'PhabricatorProjectPHIDTypeColumn' => 'PhabricatorPHIDType', 'PhabricatorProjectPHIDTypeProject' => 'PhabricatorPHIDType', 'PhabricatorProjectProfileController' => 'PhabricatorProjectController', - 'PhabricatorProjectProfileEditController' => 'PhabricatorProjectController', - 'PhabricatorProjectProfilePictureController' => 'PhabricatorProjectController', 'PhabricatorProjectQuery' => 'PhabricatorCursorPagedPolicyAwareQuery', 'PhabricatorProjectSearchEngine' => 'PhabricatorApplicationSearchEngine', 'PhabricatorProjectSearchIndexer' => 'PhabricatorSearchDocumentIndexer', diff --git a/src/applications/project/application/PhabricatorApplicationProject.php b/src/applications/project/application/PhabricatorApplicationProject.php index 8014ef62d8..919472a451 100644 --- a/src/applications/project/application/PhabricatorApplicationProject.php +++ b/src/applications/project/application/PhabricatorApplicationProject.php @@ -37,15 +37,17 @@ final class PhabricatorApplicationProject extends PhabricatorApplication { '/project/' => array( '(?:query/(?P[^/]+)/)?' => 'PhabricatorProjectListController', 'filter/(?P[^/]+)/' => 'PhabricatorProjectListController', - 'edit/(?P[1-9]\d*)/' => 'PhabricatorProjectProfileEditController', + 'edit/(?P[1-9]\d*)/' => 'PhabricatorProjectEditMainController', + 'details/(?P[1-9]\d*)/' + => 'PhabricatorProjectEditDetailsController', 'archive/(?P[1-9]\d*)/' => 'PhabricatorProjectArchiveController', 'members/(?P[1-9]\d*)/' => 'PhabricatorProjectMembersEditController', - 'view/(?P[1-9]\d*)/(?:(?P\w+)/)?' + 'view/(?P[1-9]\d*)/' => 'PhabricatorProjectProfileController', 'picture/(?P[1-9]\d*)/' => - 'PhabricatorProjectProfilePictureController', + 'PhabricatorProjectEditPictureController', 'create/' => 'PhabricatorProjectCreateController', 'board/(?P[1-9]\d*)/' => 'PhabricatorProjectBoardController', 'move/(?P[1-9]\d*)/' => 'PhabricatorProjectMoveController', diff --git a/src/applications/project/controller/PhabricatorProjectArchiveController.php b/src/applications/project/controller/PhabricatorProjectArchiveController.php index 5081e59cfa..aa6fd6f178 100644 --- a/src/applications/project/controller/PhabricatorProjectArchiveController.php +++ b/src/applications/project/controller/PhabricatorProjectArchiveController.php @@ -26,7 +26,7 @@ final class PhabricatorProjectArchiveController return new Aphront404Response(); } - $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); if ($request->isFormPost()) { if ($project->isArchived()) { @@ -48,7 +48,7 @@ final class PhabricatorProjectArchiveController ->setContinueOnMissingFields(true) ->applyTransactions($project, $xactions); - return id(new AphrontRedirectResponse())->setURI($view_uri); + return id(new AphrontRedirectResponse())->setURI($edit_uri); } if ($project->isArchived()) { @@ -65,7 +65,7 @@ final class PhabricatorProjectArchiveController ->setUser($viewer) ->setTitle($title) ->appendChild($body) - ->addCancelButton($view_uri) + ->addCancelButton($edit_uri) ->addSubmitButton($button); return id(new AphrontDialogResponse())->setDialog($dialog); diff --git a/src/applications/project/controller/PhabricatorProjectProfileEditController.php b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php similarity index 93% rename from src/applications/project/controller/PhabricatorProjectProfileEditController.php rename to src/applications/project/controller/PhabricatorProjectEditDetailsController.php index 5830e1d113..38ae1ceab8 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileEditController.php +++ b/src/applications/project/controller/PhabricatorProjectEditDetailsController.php @@ -1,6 +1,6 @@ readFieldsFromStorage($project); $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); $e_name = true; $e_edit = null; @@ -81,7 +82,7 @@ final class PhabricatorProjectProfileEditController try { $editor->applyTransactions($project, $xactions); - return id(new AphrontRedirectResponse())->setURI($view_uri); + return id(new AphrontRedirectResponse())->setURI($edit_uri); } catch (PhabricatorApplicationTransactionValidationException $ex) { $validation_exception = $ex; @@ -119,7 +120,6 @@ final class PhabricatorProjectProfileEditController id(new AphrontFormPolicyControl()) ->setUser($viewer) ->setName('can_view') - ->setCaption(pht('Members can always view a project.')) ->setPolicyObject($project) ->setPolicies($policies) ->setCapability(PhabricatorPolicyCapability::CAN_VIEW)) @@ -142,7 +142,7 @@ final class PhabricatorProjectProfileEditController ->setCapability(PhabricatorPolicyCapability::CAN_JOIN)) ->appendChild( id(new AphrontFormSubmitControl()) - ->addCancelButton($view_uri) + ->addCancelButton($edit_uri) ->setValue(pht('Save'))); $form_box = id(new PHUIObjectBoxView()) @@ -152,7 +152,8 @@ final class PhabricatorProjectProfileEditController $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView()) ->addTextCrumb($project->getName(), $view_uri) - ->addTextCrumb(pht('Edit Project'), $this->getApplicationURI()); + ->addTextCrumb(pht('Edit'), $edit_uri) + ->addTextCrumb(pht('Details')); return $this->buildApplicationPage( array( diff --git a/src/applications/project/controller/PhabricatorProjectEditMainController.php b/src/applications/project/controller/PhabricatorProjectEditMainController.php new file mode 100644 index 0000000000..1920789df9 --- /dev/null +++ b/src/applications/project/controller/PhabricatorProjectEditMainController.php @@ -0,0 +1,155 @@ +id = idx($data, 'id'); + } + + public function processRequest() { + $request = $this->getRequest(); + $viewer = $request->getUser(); + + $project = id(new PhabricatorProjectQuery()) + ->setViewer($viewer) + ->withIDs(array($this->id)) + ->needImages(true) + ->executeOne(); + if (!$project) { + return new Aphront404Response(); + } + + $header = id(new PHUIHeaderView()) + ->setHeader(pht('Edit %s', $project->getName())) + ->setUser($viewer) + ->setPolicyObject($project) + ->setImage($project->getProfileImageURI()); + + if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ACTIVE) { + $header->setStatus('oh-ok', '', pht('Active')); + } else { + $header->setStatus('policy-noone', '', pht('Archived')); + } + + $actions = $this->buildActionListView($project); + $properties = $this->buildPropertyListView($project, $actions); + + $crumbs = $this->buildApplicationCrumbs(); + $crumbs->addTextCrumb( + $project->getName(), + $this->getApplicationURI('view/'.$project->getID().'/')); + $crumbs->addTextCrumb(pht('Edit')); + + $object_box = id(new PHUIObjectBoxView()) + ->setHeader($header) + ->addPropertyList($properties); + + $xactions = id(new PhabricatorProjectTransactionQuery()) + ->setViewer($viewer) + ->withObjectPHIDs(array($project->getPHID())) + ->execute(); + + $timeline = id(new PhabricatorApplicationTransactionView()) + ->setUser($viewer) + ->setObjectPHID($project->getPHID()) + ->setTransactions($xactions); + + return $this->buildApplicationPage( + array( + $crumbs, + $object_box, + $timeline, + ), + array( + 'title' => $project->getName(), + 'device' => true, + )); + } + + private function buildActionListView(PhabricatorProject $project) { + $request = $this->getRequest(); + $viewer = $request->getUser(); + + $id = $project->getID(); + + $view = id(new PhabricatorActionListView()) + ->setUser($viewer) + ->setObjectURI($request->getRequestURI()); + + $can_edit = PhabricatorPolicyFilter::hasCapability( + $viewer, + $project, + PhabricatorPolicyCapability::CAN_EDIT); + + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Edit Details')) + ->setIcon('edit') + ->setHref($this->getApplicationURI("details/{$id}/")) + ->setDisabled(!$can_edit) + ->setWorkflow(!$can_edit)); + + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Edit Picture')) + ->setIcon('image') + ->setHref($this->getApplicationURI("picture/{$id}/")) + ->setDisabled(!$can_edit) + ->setWorkflow(!$can_edit)); + + if ($project->isArchived()) { + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Unarchive Project')) + ->setIcon('enable') + ->setHref($this->getApplicationURI("archive/{$id}/")) + ->setDisabled(!$can_edit) + ->setWorkflow(true)); + } else { + $view->addAction( + id(new PhabricatorActionView()) + ->setName(pht('Archive Project')) + ->setIcon('disable') + ->setHref($this->getApplicationURI("archive/{$id}/")) + ->setDisabled(!$can_edit) + ->setWorkflow(true)); + } + + return $view; + } + + private function buildPropertyListView( + PhabricatorProject $project, + PhabricatorActionListView $actions) { + $request = $this->getRequest(); + $viewer = $request->getUser(); + + $view = id(new PHUIPropertyListView()) + ->setUser($viewer) + ->setObject($project) + ->setActionList($actions); + + $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions( + $viewer, + $project); + + $view->addProperty( + pht('Visible To'), + $descriptions[PhabricatorPolicyCapability::CAN_VIEW]); + + $view->addProperty( + pht('Editable By'), + $descriptions[PhabricatorPolicyCapability::CAN_EDIT]); + + $view->addProperty( + pht('Joinable By'), + $descriptions[PhabricatorPolicyCapability::CAN_JOIN]); + + return $view; + } + + +} diff --git a/src/applications/project/controller/PhabricatorProjectProfilePictureController.php b/src/applications/project/controller/PhabricatorProjectEditPictureController.php similarity index 93% rename from src/applications/project/controller/PhabricatorProjectProfilePictureController.php rename to src/applications/project/controller/PhabricatorProjectEditPictureController.php index a821bb1e60..b4e7452e53 100644 --- a/src/applications/project/controller/PhabricatorProjectProfilePictureController.php +++ b/src/applications/project/controller/PhabricatorProjectEditPictureController.php @@ -1,6 +1,6 @@ getApplicationURI('view/'.$project->getID().'/'); + $edit_uri = $this->getApplicationURI('edit/'.$project->getID().'/'); + $view_uri = $this->getApplicationURI('view/'.$project->getID().'/'); $supported_formats = PhabricatorFile::getTransformableImageFormats(); $e_file = true; @@ -93,14 +94,15 @@ final class PhabricatorProjectProfilePictureController $editor->applyTransactions($project, $xactions); - return id(new AphrontRedirectResponse())->setURI($project_uri); + return id(new AphrontRedirectResponse())->setURI($edit_uri); } } $title = pht('Edit Project Picture'); $crumbs = $this->buildApplicationCrumbs(); - $crumbs->addTextCrumb($project->getName(), $project_uri); - $crumbs->addTextCrumb($title); + $crumbs->addTextCrumb($project->getName(), $view_uri); + $crumbs->addTextCrumb(pht('Edit'), $edit_uri); + $crumbs->addTextCrumb(pht('Picture')); $form = id(new PHUIFormLayoutView()) ->setUser($viewer); @@ -244,7 +246,7 @@ final class PhabricatorProjectProfilePictureController pht('Supported formats: %s', implode(', ', $supported_formats)))) ->appendChild( id(new AphrontFormSubmitControl()) - ->addCancelButton($project_uri) + ->addCancelButton($edit_uri) ->setValue(pht('Upload Picture'))); $form_box = id(new PHUIObjectBoxView()) diff --git a/src/applications/project/controller/PhabricatorProjectHistoryController.php b/src/applications/project/controller/PhabricatorProjectHistoryController.php deleted file mode 100644 index cd92ed338d..0000000000 --- a/src/applications/project/controller/PhabricatorProjectHistoryController.php +++ /dev/null @@ -1,57 +0,0 @@ -id = $data['id']; - } - - public function processRequest() { - $request = $this->getRequest(); - $viewer = $request->getUser(); - - $id = $this->id; - - $project = id(new PhabricatorProjectQuery()) - ->setViewer($viewer) - ->withIDs(array($id)) - ->executeOne(); - if (!$project) { - return new Aphront404Response(); - } - - $xactions = id(new PhabricatorProjectTransactionQuery()) - ->setViewer($viewer) - ->withObjectPHIDs(array($project->getPHID())) - ->execute(); - - $timeline = id(new PhabricatorApplicationTransactionView()) - ->setUser($viewer) - ->setObjectPHID($project->getPHID()) - ->setTransactions($xactions); - - $crumbs = $this->buildApplicationCrumbs() - ->addTextCrumb( - $project->getName(), - $this->getApplicationURI("view/{$id}/")) - ->addTextCrumb(pht('History')); - - return $this->buildApplicationPage( - array( - $crumbs, - $timeline, - ), - array( - 'title' => $project->getName(), - 'device' => true, - )); - } - -} diff --git a/src/applications/project/controller/PhabricatorProjectProfileController.php b/src/applications/project/controller/PhabricatorProjectProfileController.php index ed8b1a8388..6143907f3d 100644 --- a/src/applications/project/controller/PhabricatorProjectProfileController.php +++ b/src/applications/project/controller/PhabricatorProjectProfileController.php @@ -4,7 +4,6 @@ final class PhabricatorProjectProfileController extends PhabricatorProjectController { private $id; - private $page; public function shouldAllowPublic() { return true; @@ -12,7 +11,6 @@ final class PhabricatorProjectProfileController public function willProcessRequest(array $data) { $this->id = idx($data, 'id'); - $this->page = idx($data, 'page'); } public function processRequest() { @@ -200,45 +198,16 @@ final class PhabricatorProjectProfileController id(new PhabricatorActionView()) ->setName(pht('Edit Project')) ->setIcon('edit') - ->setHref($this->getApplicationURI("edit/{$id}/")) - ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit)); - - if ($project->isArchived()) { - $view->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Unarchive Project')) - ->setIcon('enable') - ->setHref($this->getApplicationURI("archive/{$id}/")) - ->setDisabled(!$can_edit) - ->setWorkflow(true)); - } else { - $view->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Archive Project')) - ->setIcon('disable') - ->setHref($this->getApplicationURI("archive/{$id}/")) - ->setDisabled(!$can_edit) - ->setWorkflow(true)); - } + ->setHref($this->getApplicationURI("edit/{$id}/"))); $view->addAction( id(new PhabricatorActionView()) ->setName(pht('Edit Members')) - ->setIcon('edit') + ->setIcon('user') ->setHref($this->getApplicationURI("members/{$id}/")) ->setDisabled(!$can_edit) ->setWorkflow(!$can_edit)); - $view->addAction( - id(new PhabricatorActionView()) - ->setName(pht('Edit Picture')) - ->setIcon('image') - ->setHref($this->getApplicationURI("picture/{$id}/")) - ->setDisabled(!$can_edit) - ->setWorkflow(!$can_edit)); - - $action = null; if (!$project->isUserMember($viewer->getPHID())) { $can_join = PhabricatorPolicyFilter::hasCapability( @@ -262,12 +231,6 @@ final class PhabricatorProjectProfileController } $view->addAction($action); - $view->addAction( - id(new PhabricatorActionView()) - ->setName(pht('View History')) - ->setHref($this->getApplicationURI("history/{$id}/")) - ->setIcon('transcript')); - return $view; } @@ -284,10 +247,6 @@ final class PhabricatorProjectProfileController ->setObject($project) ->setActionList($actions); - $view->addProperty( - pht('Created'), - phabricator_datetime($project->getDateCreated(), $viewer)); - $view->addProperty( pht('Members'), $project->getMemberPHIDs()