Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14110804
D20277.id48414.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
4 KB
Referenced Files
None
Subscribers
None
D20277.id48414.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -4065,6 +4065,7 @@
'PhabricatorProjectColumnPriorityOrder' => 'applications/project/order/PhabricatorProjectColumnPriorityOrder.php',
'PhabricatorProjectColumnQuery' => 'applications/project/query/PhabricatorProjectColumnQuery.php',
'PhabricatorProjectColumnSearchEngine' => 'applications/project/query/PhabricatorProjectColumnSearchEngine.php',
+ 'PhabricatorProjectColumnStatusOrder' => 'applications/project/order/PhabricatorProjectColumnStatusOrder.php',
'PhabricatorProjectColumnTransaction' => 'applications/project/storage/PhabricatorProjectColumnTransaction.php',
'PhabricatorProjectColumnTransactionEditor' => 'applications/project/editor/PhabricatorProjectColumnTransactionEditor.php',
'PhabricatorProjectColumnTransactionQuery' => 'applications/project/query/PhabricatorProjectColumnTransactionQuery.php',
@@ -10155,6 +10156,7 @@
'PhabricatorProjectColumnPriorityOrder' => 'PhabricatorProjectColumnOrder',
'PhabricatorProjectColumnQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PhabricatorProjectColumnSearchEngine' => 'PhabricatorApplicationSearchEngine',
+ 'PhabricatorProjectColumnStatusOrder' => 'PhabricatorProjectColumnOrder',
'PhabricatorProjectColumnTransaction' => 'PhabricatorApplicationTransaction',
'PhabricatorProjectColumnTransactionEditor' => 'PhabricatorApplicationTransactionEditor',
'PhabricatorProjectColumnTransactionQuery' => 'PhabricatorApplicationTransactionQuery',
diff --git a/src/applications/project/order/PhabricatorProjectColumnStatusOrder.php b/src/applications/project/order/PhabricatorProjectColumnStatusOrder.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/order/PhabricatorProjectColumnStatusOrder.php
@@ -0,0 +1,106 @@
+<?php
+
+final class PhabricatorProjectColumnStatusOrder
+ extends PhabricatorProjectColumnOrder {
+
+ const ORDERKEY = 'status';
+
+ public function getDisplayName() {
+ return pht('Group by Status');
+ }
+
+ protected function newMenuIconIcon() {
+ return 'fa-check';
+ }
+
+ public function getHasHeaders() {
+ return true;
+ }
+
+ public function getCanReorder() {
+ return true;
+ }
+
+ public function getMenuOrder() {
+ return 3000;
+ }
+
+ protected function newHeaderKeyForObject($object) {
+ return $this->newHeaderKeyForStatus($object->getStatus());
+ }
+
+ private function newHeaderKeyForStatus($status) {
+ return sprintf('status(%s)', $status);
+ }
+
+ protected function newSortVectorsForObjects(array $objects) {
+ $status_sequence = $this->newStatusSequence();
+
+ $vectors = array();
+ foreach ($objects as $object_key => $object) {
+ $vectors[$object_key] = array(
+ (int)idx($status_sequence, $object->getStatus(), 0),
+ );
+ }
+
+ return $vectors;
+ }
+
+ private function newStatusSequence() {
+ $statuses = ManiphestTaskStatus::getTaskStatusMap();
+ return array_combine(
+ array_keys($statuses),
+ range(1, count($statuses)));
+ }
+
+ protected function newHeadersForObjects(array $objects) {
+ $headers = array();
+
+ $statuses = ManiphestTaskStatus::getTaskStatusMap();
+ $sequence = $this->newStatusSequence();
+
+ foreach ($statuses as $status_key => $status_name) {
+ $header_key = $this->newHeaderKeyForStatus($status_key);
+
+ $sort_vector = array(
+ (int)idx($sequence, $status_key, 0),
+ );
+
+ $status_icon = ManiphestTaskStatus::getStatusIcon($status_key);
+ $status_color = ManiphestTaskStatus::getStatusColor($status_key);
+
+ $icon_view = id(new PHUIIconView())
+ ->setIcon($status_icon, $status_color);
+
+ $header = $this->newHeader()
+ ->setHeaderKey($header_key)
+ ->setSortVector($sort_vector)
+ ->setName($status_name)
+ ->setIcon($icon_view)
+ ->setEditProperties(
+ array(
+ 'value' => $status_key,
+ ));
+
+ $headers[] = $header;
+ }
+
+ return $headers;
+ }
+
+ protected function newColumnTransactions($object, array $header) {
+ $new_status = idx($header, 'value');
+
+ if ($object->getStatus() === $new_status) {
+ return null;
+ }
+
+ $xactions = array();
+ $xactions[] = $this->newTransaction($object)
+ ->setTransactionType(ManiphestTaskStatusTransaction::TRANSACTIONTYPE)
+ ->setNewValue($new_status);
+
+ return $xactions;
+ }
+
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Nov 28, 7:08 PM (20 h, 18 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6795134
Default Alt Text
D20277.id48414.diff (4 KB)
Attached To
Mode
D20277: Add "Group by Status" to Workboards
Attached
Detach File
Event Timeline
Log In to Comment