Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProjectColumn.php
Show All 12 Lines | final class PhabricatorProjectColumn | ||||
const STATUS_HIDDEN = 1; | const STATUS_HIDDEN = 1; | ||||
protected $name; | protected $name; | ||||
protected $status; | protected $status; | ||||
protected $projectPHID; | protected $projectPHID; | ||||
protected $proxyPHID; | protected $proxyPHID; | ||||
protected $sequence; | protected $sequence; | ||||
protected $properties = array(); | protected $properties = array(); | ||||
protected $triggerPHID; | |||||
private $project = self::ATTACHABLE; | private $project = self::ATTACHABLE; | ||||
private $proxy = self::ATTACHABLE; | private $proxy = self::ATTACHABLE; | ||||
private $trigger = self::ATTACHABLE; | |||||
public static function initializeNewColumn(PhabricatorUser $user) { | public static function initializeNewColumn(PhabricatorUser $user) { | ||||
return id(new PhabricatorProjectColumn()) | return id(new PhabricatorProjectColumn()) | ||||
->setName('') | ->setName('') | ||||
->setStatus(self::STATUS_ACTIVE) | ->setStatus(self::STATUS_ACTIVE) | ||||
->attachProxy(null); | ->attachProxy(null); | ||||
} | } | ||||
protected function getConfiguration() { | protected function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
'properties' => self::SERIALIZATION_JSON, | 'properties' => self::SERIALIZATION_JSON, | ||||
), | ), | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'name' => 'text255', | 'name' => 'text255', | ||||
'status' => 'uint32', | 'status' => 'uint32', | ||||
'sequence' => 'uint32', | 'sequence' => 'uint32', | ||||
'proxyPHID' => 'phid?', | 'proxyPHID' => 'phid?', | ||||
'triggerPHID' => 'phid?', | |||||
), | ), | ||||
self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
'key_status' => array( | 'key_status' => array( | ||||
'columns' => array('projectPHID', 'status', 'sequence'), | 'columns' => array('projectPHID', 'status', 'sequence'), | ||||
), | ), | ||||
'key_sequence' => array( | 'key_sequence' => array( | ||||
'columns' => array('projectPHID', 'sequence'), | 'columns' => array('projectPHID', 'sequence'), | ||||
), | ), | ||||
'key_proxy' => array( | 'key_proxy' => array( | ||||
'columns' => array('projectPHID', 'proxyPHID'), | 'columns' => array('projectPHID', 'proxyPHID'), | ||||
'unique' => true, | 'unique' => true, | ||||
), | ), | ||||
'key_trigger' => array( | |||||
'columns' => array('triggerPHID'), | |||||
), | |||||
), | ), | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
public function generatePHID() { | public function generatePHID() { | ||||
return PhabricatorPHID::generateNewPHID( | return PhabricatorPHID::generateNewPHID( | ||||
PhabricatorProjectColumnPHIDType::TYPECONST); | PhabricatorProjectColumnPHIDType::TYPECONST); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | public function getOrderingKey() { | ||||
} else { | } else { | ||||
$group = 'B'; | $group = 'B'; | ||||
$sequence = $proxy->getMilestoneNumber(); | $sequence = $proxy->getMilestoneNumber(); | ||||
} | } | ||||
return sprintf('%s%012d', $group, $sequence); | return sprintf('%s%012d', $group, $sequence); | ||||
} | } | ||||
public function attachTrigger(PhabricatorProjectTrigger $trigger = null) { | |||||
$this->trigger = $trigger; | |||||
return $this; | |||||
} | |||||
public function getTrigger() { | |||||
return $this->assertAttached($this->trigger); | |||||
} | |||||
public function canHaveTrigger() { | |||||
// Backlog columns and proxy (subproject / milestone) columns can't have | |||||
// triggers because cards routinely end up in these columns through tag | |||||
// edits rather than drag-and-drop and it would likely be confusing to | |||||
// have these triggers act only a small fraction of the time. | |||||
if ($this->isDefaultColumn()) { | |||||
return false; | |||||
} | |||||
if ($this->getProxy()) { | |||||
return false; | |||||
} | |||||
return true; | |||||
} | |||||
public function getBoardURI() { | |||||
return urisprintf( | |||||
'/project/board/%d/', | |||||
$this->getProject()->getID()); | |||||
} | |||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */ | /* -( PhabricatorConduitResultInterface )---------------------------------- */ | ||||
public function getFieldSpecificationsForConduit() { | public function getFieldSpecificationsForConduit() { | ||||
return array( | return array( | ||||
id(new PhabricatorConduitSearchFieldSpecification()) | id(new PhabricatorConduitSearchFieldSpecification()) | ||||
->setKey('name') | ->setKey('name') | ||||
->setType('string') | ->setType('string') | ||||
->setDescription(pht('The display name of the column.')), | ->setDescription(pht('The display name of the column.')), | ||||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |