Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/engine/PhabricatorProjectEditEngine.php
Show All 37 Lines | public function getSummaryText() { | ||||
return pht('Configure forms for creating projects.'); | return pht('Configure forms for creating projects.'); | ||||
} | } | ||||
public function getEngineApplicationClass() { | public function getEngineApplicationClass() { | ||||
return 'PhabricatorProjectApplication'; | return 'PhabricatorProjectApplication'; | ||||
} | } | ||||
protected function newEditableObject() { | protected function newEditableObject() { | ||||
return PhabricatorProject::initializeNewProject($this->getViewer()); | $project = PhabricatorProject::initializeNewProject($this->getViewer()); | ||||
$milestone = $this->getMilestoneProject(); | |||||
if ($milestone) { | |||||
$default_name = pht( | |||||
'Milestone %s', | |||||
new PhutilNumber($milestone->loadNextMilestoneNumber())); | |||||
$project->setName($default_name); | |||||
} | |||||
return $project; | |||||
} | } | ||||
protected function newObjectQuery() { | protected function newObjectQuery() { | ||||
return id(new PhabricatorProjectQuery()) | return id(new PhabricatorProjectQuery()) | ||||
->needSlugs(true); | ->needSlugs(true); | ||||
} | } | ||||
protected function getObjectCreateTitleText($object) { | protected function getObjectCreateTitleText($object) { | ||||
Show All 32 Lines | protected function getObjectCreateCancelURI($object) { | ||||
return parent::getObjectCreateCancelURI($object); | return parent::getObjectCreateCancelURI($object); | ||||
} | } | ||||
protected function getCreateNewObjectPolicy() { | protected function getCreateNewObjectPolicy() { | ||||
return $this->getApplication()->getPolicy( | return $this->getApplication()->getPolicy( | ||||
ProjectCreateProjectsCapability::CAPABILITY); | ProjectCreateProjectsCapability::CAPABILITY); | ||||
} | } | ||||
protected function willConfigureFields($object, array $fields) { | |||||
$is_milestone = ($this->getMilestoneProject() || $object->isMilestone()); | |||||
$unavailable = array( | |||||
PhabricatorTransactions::TYPE_VIEW_POLICY, | |||||
PhabricatorTransactions::TYPE_EDIT_POLICY, | |||||
PhabricatorTransactions::TYPE_JOIN_POLICY, | |||||
); | |||||
$unavailable = array_fuse($unavailable); | |||||
if ($is_milestone) { | |||||
foreach ($fields as $key => $field) { | |||||
$xaction_type = $field->getTransactionType(); | |||||
if (isset($unavailable[$xaction_type])) { | |||||
unset($fields[$key]); | |||||
} | |||||
} | |||||
} | |||||
return $fields; | |||||
} | |||||
protected function newBuiltinEngineConfigurations() { | protected function newBuiltinEngineConfigurations() { | ||||
$configuration = head(parent::newBuiltinEngineConfigurations()); | $configuration = head(parent::newBuiltinEngineConfigurations()); | ||||
// TODO: This whole method is clumsy, and the ordering for the custom | // TODO: This whole method is clumsy, and the ordering for the custom | ||||
// field is especially clumsy. Maybe try to make this more natural to | // field is especially clumsy. Maybe try to make this more natural to | ||||
// express. | // express. | ||||
$configuration | $configuration | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |