@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding the create flow for Project Board (Workphlow) columns.

Summary: This adds in the create flow for the Project board columns on the super secret board page which totally doesn't do anything right now.

Test Plan:
1. Apply diff.
2. Go to super secret page.
3. Click link close to top with a way too long name.
4. Enter a name for the column.
5. Enjoy a new column briefly before realising you cannot remove it.
6. Stay happy!

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley

CC: tmaroschik, Korvin, epriestley, aran

Differential Revision: https://secure.phabricator.com/D7925

authored by

Mikael Knutsson and committed by
epriestley
5417f91b efe187d5

+123
+5
resources/sql/autopatches/20140109.projectcolumnsdates.sql
··· 1 + ALTER TABLE {$NAMESPACE}_project.project_column 2 + ADD dateCreated INT UNSIGNED NOT NULL; 3 + 4 + ALTER TABLE {$NAMESPACE}_project.project_column 5 + ADD dateModified INT UNSIGNED NOT NULL;
+2
src/__phutil_library_map__.php
··· 1753 1753 'PhabricatorPolicyType' => 'applications/policy/constants/PhabricatorPolicyType.php', 1754 1754 'PhabricatorProject' => 'applications/project/storage/PhabricatorProject.php', 1755 1755 'PhabricatorProjectBoardController' => 'applications/project/controller/PhabricatorProjectBoardController.php', 1756 + 'PhabricatorProjectBoardEditController' => 'applications/project/controller/PhabricatorProjectBoardEditController.php', 1756 1757 'PhabricatorProjectColumn' => 'applications/project/storage/PhabricatorProjectColumn.php', 1757 1758 'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php', 1758 1759 'PhabricatorProjectConstants' => 'applications/project/constants/PhabricatorProjectConstants.php', ··· 4362 4363 2 => 'PhabricatorPolicyInterface', 4363 4364 ), 4364 4365 'PhabricatorProjectBoardController' => 'PhabricatorProjectController', 4366 + 'PhabricatorProjectBoardEditController' => 'PhabricatorProjectController', 4365 4367 'PhabricatorProjectColumn' => 4366 4368 array( 4367 4369 0 => 'PhabricatorProjectDAO',
+2
src/applications/project/application/PhabricatorApplicationProject.php
··· 46 46 'PhabricatorProjectProfilePictureController', 47 47 'create/' => 'PhabricatorProjectCreateController', 48 48 'board/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectBoardController', 49 + 'board/(?P<projectID>[1-9]\d*)/edit/(?:(?P<id>\d+)/)?' 50 + => 'PhabricatorProjectBoardEditController', 49 51 'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/' 50 52 => 'PhabricatorProjectUpdateController', 51 53 'history/(?P<id>[1-9]\d*)/' => 'PhabricatorProjectHistoryController',
+114
src/applications/project/controller/PhabricatorProjectBoardEditController.php
··· 1 + <?php 2 + 3 + final class PhabricatorProjectBoardEditController 4 + extends PhabricatorProjectController { 5 + 6 + private $id; 7 + private $projectID; 8 + 9 + public function willProcessRequest(array $data) { 10 + $this->projectID = $data['projectID']; 11 + $this->id = idx($data, 'id'); 12 + } 13 + 14 + public function processRequest() { 15 + $request = $this->getRequest(); 16 + $viewer = $request->getUser(); 17 + 18 + $project = id(new PhabricatorProjectQuery()) 19 + ->setViewer($viewer) 20 + ->requireCapabilities( 21 + array( 22 + PhabricatorPolicyCapability::CAN_VIEW, 23 + PhabricatorPolicyCapability::CAN_EDIT, 24 + )) 25 + ->withIDs(array($this->projectID)) 26 + ->executeOne(); 27 + 28 + if (!$project) { 29 + return new Aphront404Response(); 30 + } 31 + 32 + $is_new = ($this->id ? false : true); 33 + 34 + if (!$is_new) { 35 + // TODO: LATER! 36 + throw new Exception("When I'm ready!"); 37 + } else { 38 + $column = new PhabricatorProjectColumn(); 39 + } 40 + 41 + $errors = array(); 42 + $e_name = true; 43 + $error_view = null; 44 + $view_uri = $this->getApplicationURI('/board/'.$this->projectID.'/'); 45 + 46 + if ($request->isFormPost()) { 47 + $new_name = $request->getStr('name'); 48 + $column->setName($new_name); 49 + 50 + if (!strlen($column->getName())) { 51 + $errors[] = pht('Column name is required.'); 52 + $e_name = pht('Required'); 53 + } else { 54 + $e_name = null; 55 + } 56 + 57 + $column->setProjectPHID($project->getPHID()); 58 + $column->attachProject($project); 59 + $column->setSequence(0); 60 + 61 + if (!$errors) { 62 + $column->save(); 63 + return id(new AphrontRedirectResponse())->setURI($view_uri); 64 + } 65 + } 66 + if ($errors) { 67 + $error_view = new AphrontErrorView(); 68 + $error_view->setTitle(pht('Form Errors')); 69 + $error_view->setErrors($errors); 70 + } 71 + 72 + $form = new AphrontFormView(); 73 + $form->setUser($request->getUser()) 74 + ->appendChild( 75 + id(new AphrontFormTextControl()) 76 + ->setValue($column->getName()) 77 + ->setLabel(pht('Name')) 78 + ->setName('name') 79 + ->setError($e_name) 80 + ->setCaption( 81 + pht('This will be displayed as the header of the column.'))); 82 + 83 + if ($is_new) { 84 + $title = pht('Create Column'); 85 + $submit = pht('Create Column'); 86 + } else { 87 + $title = pht('Edit %s', $column->getName()); 88 + $submit = pht('Save Column'); 89 + } 90 + 91 + $form->appendChild( 92 + id(new AphrontFormSubmitControl()) 93 + ->setValue($submit) 94 + ->addCancelButton($view_uri)); 95 + 96 + $crumbs = $this->buildApplicationCrumbs(); 97 + $crumbs->addTextCrumb($title); 98 + 99 + $form_box = id(new PHUIObjectBoxView()) 100 + ->setHeaderText($title) 101 + ->setFormError($errors) 102 + ->setForm($form); 103 + 104 + return $this->buildApplicationPage( 105 + array( 106 + $crumbs, 107 + $form_box, 108 + ), 109 + array( 110 + 'title' => $title, 111 + 'device' => true, 112 + )); 113 + } 114 + }