1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

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
This commit is contained in:
epriestley 2011-08-03 06:37:18 -07:00
parent 774211af76
commit 3b76dd11a9
11 changed files with 127 additions and 19 deletions

View file

@ -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',
),
));

View file

@ -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',

View file

@ -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));
}

View file

@ -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');

View file

@ -0,0 +1,21 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
abstract class PhabricatorObjectHandleConstants {
}

View file

@ -0,0 +1,10 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_source('PhabricatorObjectHandleConstants.php');

View file

@ -0,0 +1,25 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorObjectHandleStatus
extends PhabricatorObjectHandleConstants {
const STATUS_OPEN = 'open';
const STATUS_CLOSED = 'closed';
}

View file

@ -0,0 +1,12 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'applications/phid/handle/const/base');
phutil_require_source('PhabricatorObjectHandleStatus.php');

View file

@ -199,6 +199,14 @@ class PhabricatorObjectHandleData {
$handle->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;
}

View file

@ -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');

View file

@ -169,3 +169,7 @@ td.phabricator-login-details {
.workflow-header button {
float: right;
}
.handle-status-closed {
text-decoration: line-through;
}