diff --git a/src/applications/project/controller/PhabricatorProjectMembersAddController.php b/src/applications/project/controller/PhabricatorProjectMembersAddController.php --- a/src/applications/project/controller/PhabricatorProjectMembersAddController.php +++ b/src/applications/project/controller/PhabricatorProjectMembersAddController.php @@ -27,9 +27,14 @@ $copy = pht('Parent projects and milestones do not support adding '. 'members. You can add members directly to any non-parent subproject.'); + $subprojects_uri = "/project/subprojects/{$id}/"; + return $this->newDialog() ->setTitle(pht('Unsupported Project')) ->appendParagraph($copy) + ->setSubmitURI($subprojects_uri) + ->addSubmitButton(pht('See Subprojects')) + ->setDisableWorkflowOnSubmit(true) ->addCancelButton($done_uri); } diff --git a/src/applications/project/controller/PhabricatorProjectUpdateController.php b/src/applications/project/controller/PhabricatorProjectUpdateController.php --- a/src/applications/project/controller/PhabricatorProjectUpdateController.php +++ b/src/applications/project/controller/PhabricatorProjectUpdateController.php @@ -38,9 +38,14 @@ $copy = pht('Parent projects and milestones do not support adding '. 'members. You can add members directly to any non-parent subproject.'); + $subprojects_uri = "/project/subprojects/{$id}/"; + return $this->newDialog() ->setTitle(pht('Unsupported Project')) ->appendParagraph($copy) + ->setSubmitURI($subprojects_uri) + ->addSubmitButton(pht('See Subprojects')) + ->setDisableWorkflowOnSubmit(true) ->addCancelButton($done_uri); } diff --git a/src/view/AphrontDialogView.php b/src/view/AphrontDialogView.php --- a/src/view/AphrontDialogView.php +++ b/src/view/AphrontDialogView.php @@ -51,6 +51,15 @@ return $this->isStandalone; } + /** + * Set the URI associated to the Submit Button + * + * If you want a normal link and not any form submission, + * see also: setDisableWorkflowOnSubmit(false). + * + * @param string $uri + * @return self + */ public function setSubmitURI($uri) { $this->submitURI = $uri; return $this; @@ -92,6 +101,15 @@ return $this->resizeX; } + /** + * Add a Submit Button and specify its text + * + * If you want to associate an URI for this Button, + * see also: setSubmitURI(). + * + * @param string $text Text shown for that button + * @return self + */ public function addSubmitButton($text = null) { if (!$text) { $text = pht('Okay'); @@ -228,6 +246,14 @@ return $this->appendChild($form->buildLayoutView()); } + /** + * Enable or Disable a Workflow on Submit + * + * For example, if your Submit Button should be a normal link, + * without activating any Workflow, you can set false. + * @param bool $disable_workflow_on_submit + * @return self + */ public function setDisableWorkflowOnSubmit($disable_workflow_on_submit) { $this->disableWorkflowOnSubmit = $disable_workflow_on_submit; return $this;