From 3b76dd11a9d8f126549615e4dfa269a10fd28f9b Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 3 Aug 2011 06:37:18 -0700 Subject: [PATCH] Add object status to Handles Summary: We use ObjectHandles as proxy objects which can refer to any other object in the system. Add the concept of the underlying object's "status" (e.g., open, closed or busy). This allows us to render completed tasks and revisions with strikethrough. In the future, if we implement OOO or something, we could render users with a "busy" status if they're on vacation, etc. Test Plan: Viewed a task with closed revisions and dependencies: https://secure.phabricator.com/file/view/PHID-FILE-6183e81286fa3288d33d/ Reviewed By: codeblock Reviewers: codeblock, hunterbridges, jungejason, tuomaspelkonen, aran CC: aran, codeblock Differential Revision: 772 --- src/__celerity_resource_map__.php | 36 +++++++++---------- src/__phutil_library_map__.php | 3 ++ .../phid/handle/PhabricatorObjectHandle.php | 19 +++++++++- src/applications/phid/handle/__init__.php | 1 + .../base/PhabricatorObjectHandleConstants.php | 21 +++++++++++ .../phid/handle/const/base/__init__.php | 10 ++++++ .../status/PhabricatorObjectHandleStatus.php | 25 +++++++++++++ .../phid/handle/const/status/__init__.php | 12 +++++++ .../data/PhabricatorObjectHandleData.php | 12 +++++++ .../phid/handle/data/__init__.php | 3 ++ .../application/base/standard-page-view.css | 4 +++ 11 files changed, 127 insertions(+), 19 deletions(-) create mode 100644 src/applications/phid/handle/const/base/PhabricatorObjectHandleConstants.php create mode 100644 src/applications/phid/handle/const/base/__init__.php create mode 100644 src/applications/phid/handle/const/status/PhabricatorObjectHandleStatus.php create mode 100644 src/applications/phid/handle/const/status/__init__.php diff --git a/src/__celerity_resource_map__.php b/src/__celerity_resource_map__.php index b4c3c87315..3b7b5a7985 100644 --- a/src/__celerity_resource_map__.php +++ b/src/__celerity_resource_map__.php @@ -1218,7 +1218,7 @@ celerity_register_resource_map(array( ), 'phabricator-standard-page-view' => array( - 'uri' => '/res/cbc3bb69/rsrc/css/application/base/standard-page-view.css', + 'uri' => '/res/325b5b0f/rsrc/css/application/base/standard-page-view.css', 'type' => 'css', 'requires' => array( @@ -1274,7 +1274,7 @@ celerity_register_resource_map(array( 'uri' => '/res/pkg/03ef179e/diffusion.pkg.css', 'type' => 'css', ), - '124bba3b' => + '1258c2b0' => array ( 'name' => 'core.pkg.css', 'symbols' => @@ -1295,7 +1295,7 @@ celerity_register_resource_map(array( 13 => 'phabricator-remarkup-css', 14 => 'syntax-highlighting-css', ), - 'uri' => '/res/pkg/124bba3b/core.pkg.css', + 'uri' => '/res/pkg/1258c2b0/core.pkg.css', 'type' => 'css', ), '25f94e94' => @@ -1383,15 +1383,15 @@ celerity_register_resource_map(array( ), 'reverse' => array ( - 'aphront-crumbs-view-css' => '124bba3b', - 'aphront-dialog-view-css' => '124bba3b', - 'aphront-form-view-css' => '124bba3b', - 'aphront-list-filter-view-css' => '124bba3b', - 'aphront-panel-view-css' => '124bba3b', - 'aphront-side-nav-view-css' => '124bba3b', - 'aphront-table-view-css' => '124bba3b', - 'aphront-tokenizer-control-css' => '124bba3b', - 'aphront-typeahead-control-css' => '124bba3b', + 'aphront-crumbs-view-css' => '1258c2b0', + 'aphront-dialog-view-css' => '1258c2b0', + 'aphront-form-view-css' => '1258c2b0', + 'aphront-list-filter-view-css' => '1258c2b0', + 'aphront-panel-view-css' => '1258c2b0', + 'aphront-side-nav-view-css' => '1258c2b0', + 'aphront-table-view-css' => '1258c2b0', + 'aphront-tokenizer-control-css' => '1258c2b0', + 'aphront-typeahead-control-css' => '1258c2b0', 'differential-changeset-view-css' => '3f2092d7', 'differential-core-view-css' => '3f2092d7', 'differential-revision-add-comment-css' => '3f2092d7', @@ -1428,13 +1428,13 @@ celerity_register_resource_map(array( 'javelin-util' => '307df223', 'javelin-vector' => '307df223', 'javelin-workflow' => 'd0713563', - 'phabricator-core-buttons-css' => '124bba3b', - 'phabricator-core-css' => '124bba3b', - 'phabricator-directory-css' => '124bba3b', + 'phabricator-core-buttons-css' => '1258c2b0', + 'phabricator-core-css' => '1258c2b0', + 'phabricator-directory-css' => '1258c2b0', 'phabricator-keyboard-shortcut' => 'd0713563', 'phabricator-keyboard-shortcut-manager' => 'd0713563', - 'phabricator-remarkup-css' => '124bba3b', - 'phabricator-standard-page-view' => '124bba3b', - 'syntax-highlighting-css' => '124bba3b', + 'phabricator-remarkup-css' => '1258c2b0', + 'phabricator-standard-page-view' => '1258c2b0', + 'syntax-highlighting-css' => '1258c2b0', ), )); diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php index 17f1cd4339..9d2dcabed5 100644 --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -439,7 +439,9 @@ phutil_register_library_map(array( 'PhabricatorOAuthUnlinkController' => 'applications/auth/controller/unlink', 'PhabricatorObjectGraph' => 'applications/phid/graph', 'PhabricatorObjectHandle' => 'applications/phid/handle', + 'PhabricatorObjectHandleConstants' => 'applications/phid/handle/const/base', 'PhabricatorObjectHandleData' => 'applications/phid/handle/data', + 'PhabricatorObjectHandleStatus' => 'applications/phid/handle/const/status', 'PhabricatorObjectSelectorDialog' => 'view/control/objectselector', 'PhabricatorOwnersController' => 'applications/owners/controller/base', 'PhabricatorOwnersDAO' => 'applications/owners/storage/base', @@ -985,6 +987,7 @@ phutil_register_library_map(array( 'PhabricatorOAuthRegistrationController' => 'PhabricatorAuthController', 'PhabricatorOAuthUnlinkController' => 'PhabricatorAuthController', 'PhabricatorObjectGraph' => 'AbstractDirectedGraph', + 'PhabricatorObjectHandleStatus' => 'PhabricatorObjectHandleConstants', 'PhabricatorOwnersController' => 'PhabricatorController', 'PhabricatorOwnersDAO' => 'PhabricatorLiskDAO', 'PhabricatorOwnersDeleteController' => 'PhabricatorOwnersController', diff --git a/src/applications/phid/handle/PhabricatorObjectHandle.php b/src/applications/phid/handle/PhabricatorObjectHandle.php index 3b1b88de1c..ab29065be4 100644 --- a/src/applications/phid/handle/PhabricatorObjectHandle.php +++ b/src/applications/phid/handle/PhabricatorObjectHandle.php @@ -27,6 +27,8 @@ class PhabricatorObjectHandle { private $imageURI; private $timestamp; private $alternateID; + private $status = 'open'; + public function setURI($uri) { $this->uri = $uri; @@ -55,6 +57,15 @@ class PhabricatorObjectHandle { return $this->name; } + public function setStatus($status) { + $this->status = $status; + return $this; + } + + public function getStatus() { + return $this->status; + } + public function setFullName($full_name) { $this->fullName = $full_name; return $this; @@ -134,10 +145,16 @@ class PhabricatorObjectHandle { $name = $this->getFullName(); } + $class = null; + if ($this->status != PhabricatorObjectHandleStatus::STATUS_OPEN) { + $class = 'handle-status-'.phutil_escape_html($this->status); + } + return phutil_render_tag( 'a', array( - 'href' => $this->getURI(), + 'href' => $this->getURI(), + 'class' => $class, ), phutil_escape_html($name)); } diff --git a/src/applications/phid/handle/__init__.php b/src/applications/phid/handle/__init__.php index 7c818b3409..5520ae9262 100644 --- a/src/applications/phid/handle/__init__.php +++ b/src/applications/phid/handle/__init__.php @@ -7,6 +7,7 @@ phutil_require_module('phabricator', 'applications/phid/constants'); +phutil_require_module('phabricator', 'applications/phid/handle/const/status'); phutil_require_module('phutil', 'markup'); phutil_require_module('phutil', 'utils'); diff --git a/src/applications/phid/handle/const/base/PhabricatorObjectHandleConstants.php b/src/applications/phid/handle/const/base/PhabricatorObjectHandleConstants.php new file mode 100644 index 0000000000..347db8dfcc --- /dev/null +++ b/src/applications/phid/handle/const/base/PhabricatorObjectHandleConstants.php @@ -0,0 +1,21 @@ +setName($rev->getTitle()); $handle->setURI('/D'.$rev->getID()); $handle->setFullName('D'.$rev->getID().': '.$rev->getTitle()); + + $status = $rev->getStatus(); + if (($status == DifferentialRevisionStatus::COMMITTED) || + ($status == DifferentialRevisionStatus::ABANDONED)) { + $closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $handle->setStatus($closed); + } + } $handles[$phid] = $handle; } @@ -271,6 +279,10 @@ class PhabricatorObjectHandleData { $handle->setName($task->getTitle()); $handle->setURI('/T'.$task->getID()); $handle->setFullName('T'.$task->getID().': '.$task->getTitle()); + if ($task->getStatus() != ManiphestTaskStatus::STATUS_OPEN) { + $closed = PhabricatorObjectHandleStatus::STATUS_CLOSED; + $handle->setStatus($closed); + } } $handles[$phid] = $handle; } diff --git a/src/applications/phid/handle/data/__init__.php b/src/applications/phid/handle/data/__init__.php index da94fb9894..70dd759d83 100644 --- a/src/applications/phid/handle/data/__init__.php +++ b/src/applications/phid/handle/data/__init__.php @@ -6,10 +6,13 @@ +phutil_require_module('phabricator', 'applications/differential/constants/revisionstatus'); phutil_require_module('phabricator', 'applications/files/uri'); phutil_require_module('phabricator', 'applications/maniphest/constants/owner'); +phutil_require_module('phabricator', 'applications/maniphest/constants/status'); phutil_require_module('phabricator', 'applications/phid/constants'); phutil_require_module('phabricator', 'applications/phid/handle'); +phutil_require_module('phabricator', 'applications/phid/handle/const/status'); phutil_require_module('phabricator', 'applications/phriction/storage/document'); phutil_require_module('phabricator', 'applications/repository/constants/repositorytype'); phutil_require_module('phabricator', 'applications/repository/storage/repository'); diff --git a/webroot/rsrc/css/application/base/standard-page-view.css b/webroot/rsrc/css/application/base/standard-page-view.css index 6d497322b2..be20e780cc 100644 --- a/webroot/rsrc/css/application/base/standard-page-view.css +++ b/webroot/rsrc/css/application/base/standard-page-view.css @@ -169,3 +169,7 @@ td.phabricator-login-details { .workflow-header button { float: right; } + +.handle-status-closed { + text-decoration: line-through; +}