Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProject.php
<?php | <?php | ||||
final class PhabricatorProject extends PhabricatorProjectDAO | final class PhabricatorProject extends PhabricatorProjectDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorExtendedPolicyInterface, | PhabricatorExtendedPolicyInterface, | ||||
PhabricatorCustomFieldInterface, | PhabricatorCustomFieldInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorFulltextInterface, | PhabricatorFulltextInterface, | ||||
PhabricatorFerretInterface, | PhabricatorFerretInterface, | ||||
PhabricatorConduitResultInterface, | PhabricatorConduitResultInterface, | ||||
PhabricatorColumnProxyInterface, | PhabricatorColumnProxyInterface, | ||||
PhabricatorSpacesInterface { | PhabricatorSpacesInterface, | ||||
PhabricatorEditEngineSubtypeInterface { | |||||
protected $name; | protected $name; | ||||
protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; | protected $status = PhabricatorProjectStatus::STATUS_ACTIVE; | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $primarySlug; | protected $primarySlug; | ||||
protected $profileImagePHID; | protected $profileImagePHID; | ||||
protected $icon; | protected $icon; | ||||
protected $color; | protected $color; | ||||
Show All 11 Lines | final class PhabricatorProject extends PhabricatorProjectDAO | ||||
protected $milestoneNumber; | protected $milestoneNumber; | ||||
protected $projectPath; | protected $projectPath; | ||||
protected $projectDepth; | protected $projectDepth; | ||||
protected $projectPathKey; | protected $projectPathKey; | ||||
protected $properties = array(); | protected $properties = array(); | ||||
protected $spacePHID; | protected $spacePHID; | ||||
protected $subtype; | |||||
private $memberPHIDs = self::ATTACHABLE; | private $memberPHIDs = self::ATTACHABLE; | ||||
private $watcherPHIDs = self::ATTACHABLE; | private $watcherPHIDs = self::ATTACHABLE; | ||||
private $sparseWatchers = self::ATTACHABLE; | private $sparseWatchers = self::ATTACHABLE; | ||||
private $sparseMembers = self::ATTACHABLE; | private $sparseMembers = self::ATTACHABLE; | ||||
private $customFields = self::ATTACHABLE; | private $customFields = self::ATTACHABLE; | ||||
private $profileImageFile = self::ATTACHABLE; | private $profileImageFile = self::ATTACHABLE; | ||||
private $slugs = self::ATTACHABLE; | private $slugs = self::ATTACHABLE; | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | return id(new PhabricatorProject()) | ||||
->setJoinPolicy($join_policy) | ->setJoinPolicy($join_policy) | ||||
->setSpacePHID($space_phid) | ->setSpacePHID($space_phid) | ||||
->setIsMembershipLocked(0) | ->setIsMembershipLocked(0) | ||||
->attachMemberPHIDs(array()) | ->attachMemberPHIDs(array()) | ||||
->attachSlugs(array()) | ->attachSlugs(array()) | ||||
->setHasWorkboard(0) | ->setHasWorkboard(0) | ||||
->setHasMilestones(0) | ->setHasMilestones(0) | ||||
->setHasSubprojects(0) | ->setHasSubprojects(0) | ||||
->setSubtype(PhabricatorEditEngineSubtype::SUBTYPE_DEFAULT) | |||||
->attachParentProject(null); | ->attachParentProject(null); | ||||
} | } | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
PhabricatorPolicyCapability::CAN_JOIN, | PhabricatorPolicyCapability::CAN_JOIN, | ||||
▲ Show 20 Lines • Show All 119 Lines • ▼ Show 20 Lines | return array( | ||||
'parentProjectPHID' => 'phid?', | 'parentProjectPHID' => 'phid?', | ||||
'hasWorkboard' => 'bool', | 'hasWorkboard' => 'bool', | ||||
'hasMilestones' => 'bool', | 'hasMilestones' => 'bool', | ||||
'hasSubprojects' => 'bool', | 'hasSubprojects' => 'bool', | ||||
'milestoneNumber' => 'uint32?', | 'milestoneNumber' => 'uint32?', | ||||
'projectPath' => 'hashpath64', | 'projectPath' => 'hashpath64', | ||||
'projectDepth' => 'uint32', | 'projectDepth' => 'uint32', | ||||
'projectPathKey' => 'bytes4', | 'projectPathKey' => 'bytes4', | ||||
'subtype' => 'text64', | |||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'key_icon' => array( | 'key_icon' => array( | ||||
'columns' => array('icon'), | 'columns' => array('icon'), | ||||
), | ), | ||||
'key_color' => array( | 'key_color' => array( | ||||
'columns' => array('color'), | 'columns' => array('color'), | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 513 Lines • ▼ Show 20 Lines | return array( | ||||
->setKey('name') | ->setKey('name') | ||||
->setType('string') | ->setType('string') | ||||
->setDescription(pht('The name of the project.')), | ->setDescription(pht('The name of the project.')), | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
->setKey('slug') | ->setKey('slug') | ||||
->setType('string') | ->setType('string') | ||||
->setDescription(pht('Primary slug/hashtag.')), | ->setDescription(pht('Primary slug/hashtag.')), | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
->setKey('subtype') | |||||
->setType('string') | |||||
->setDescription(pht('Subtype of the project.')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('milestone') | ->setKey('milestone') | ||||
->setType('int?') | ->setType('int?') | ||||
->setDescription(pht('For milestones, milestone sequence number.')), | ->setDescription(pht('For milestones, milestone sequence number.')), | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
->setKey('parent') | ->setKey('parent') | ||||
->setType('map<string, wild>?') | ->setType('map<string, wild>?') | ||||
->setDescription( | ->setDescription( | ||||
pht( | pht( | ||||
Show All 32 Lines | if ($parent) { | ||||
$parent_ref = $parent->getRefForConduit(); | $parent_ref = $parent->getRefForConduit(); | ||||
} else { | } else { | ||||
$parent_ref = null; | $parent_ref = null; | ||||
} | } | ||||
return array( | return array( | ||||
'name' => $this->getName(), | 'name' => $this->getName(), | ||||
'slug' => $this->getPrimarySlug(), | 'slug' => $this->getPrimarySlug(), | ||||
'subtype' => $this->getSubtype(), | |||||
'milestone' => $milestone, | 'milestone' => $milestone, | ||||
'depth' => (int)$this->getProjectDepth(), | 'depth' => (int)$this->getProjectDepth(), | ||||
'parent' => $parent_ref, | 'parent' => $parent_ref, | ||||
'icon' => array( | 'icon' => array( | ||||
'key' => $this->getDisplayIconKey(), | 'key' => $this->getDisplayIconKey(), | ||||
'name' => $this->getDisplayIconName(), | 'name' => $this->getDisplayIconName(), | ||||
'icon' => $this->getDisplayIconIcon(), | 'icon' => $this->getDisplayIconIcon(), | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | public function getProxyColumnClass() { | ||||
if ($this->isMilestone()) { | if ($this->isMilestone()) { | ||||
return 'phui-workboard-column-milestone'; | return 'phui-workboard-column-milestone'; | ||||
} | } | ||||
return null; | return null; | ||||
} | } | ||||
/* -( PhabricatorEditEngineSubtypeInterface )------------------------------ */ | |||||
public function getEditEngineSubtype() { | |||||
return $this->getSubtype(); | |||||
} | |||||
public function setEditEngineSubtype($value) { | |||||
return $this->setSubtype($value); | |||||
} | |||||
public function newEditEngineSubtypeMap() { | |||||
$config = PhabricatorEnv::getEnvConfig('projects.subtypes'); | |||||
return PhabricatorEditEngineSubtype::newSubtypeMap($config); | |||||
} | |||||
public function newSubtypeObject() { | |||||
$subtype_key = $this->getEditEngineSubtype(); | |||||
$subtype_map = $this->newEditEngineSubtypeMap(); | |||||
return $subtype_map->getSubtype($subtype_key); | |||||
} | |||||
} | } |