private function buildInitializeContent(PhabricatorProject $project) { $request = $this->getRequest(); $viewer = $this->getViewer(); $type = $request->getStr('initialize-type'); $id = $project->getID(); $profile_uri = $this->getApplicationURI("profile/{$id}/"); $board_uri = $this->getApplicationURI("board/{$id}/"); $import_uri = $this->getApplicationURI("board/{$id}/import/"); $set_default = $request->getBool('default'); if ($set_default) { $this->getProfilePanelEngine()->adjustDefault(PhabricatorProject::PANEL_WORKBOARD); } if ($request->isFormPost()) { if ($type == 'backlog-only') { $column = PhabricatorProjectColumn::initializeNewColumn($viewer)->setSequence(0)->setProperty('isDefault', true)->setProjectPHID($project->getPHID())->save(); $project->setHasWorkboard(1)->save(); return id(new AphrontRedirectResponse())->setURI($board_uri); } else { return id(new AphrontRedirectResponse())->setURI($import_uri); } } $new_selector = id(new AphrontFormRadioButtonControl())->setLabel(pht('Columns'))->setName('initialize-type')->setValue('backlog-only')->addButton('backlog-only', pht('New Empty Board'), pht('Create a new board with just a backlog column.'))->addButton('import', pht('Import Columns'), pht('Import board columns from another project.')); $default_checkbox = id(new AphrontFormCheckboxControl())->setLabel(pht('Make Default'))->addCheckbox('default', 1, pht('Make the workboard the default view for this project.'), true); $form = id(new AphrontFormView())->setUser($viewer)->appendRemarkupInstructions(pht('The workboard for this project has not been created yet.'))->appendControl($new_selector)->appendControl($default_checkbox)->appendControl(id(new AphrontFormSubmitControl())->addCancelButton($profile_uri)->setValue(pht('Create Workboard'))); $box = id(new PHUIObjectBoxView())->setHeaderText(pht('Create Workboard'))->setForm($form); return $box; }
private function addColumn(PhabricatorUser $viewer, PhabricatorProject $project, $sequence) { $project->setHasWorkboard(1)->save(); return PhabricatorProjectColumn::initializeNewColumn($viewer)->setSequence(0)->setProperty('isDefault', $sequence == 0)->setProjectPHID($project->getPHID())->save(); }