2011-01-27 23:55:52 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DifferentialRevisionDetailView extends AphrontView {
|
|
|
|
|
|
|
|
private $revision;
|
|
|
|
private $actions;
|
2014-02-27 20:06:14 +01:00
|
|
|
private $customFields;
|
2012-12-11 23:59:27 +01:00
|
|
|
private $diff;
|
2013-07-13 19:33:32 +02:00
|
|
|
private $uri;
|
2014-04-03 21:01:04 +02:00
|
|
|
private $actionList;
|
2013-07-13 19:33:32 +02:00
|
|
|
|
|
|
|
public function setURI($uri) {
|
|
|
|
$this->uri = $uri;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
public function getURI() {
|
|
|
|
return $this->uri;
|
|
|
|
}
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
public function setDiff(DifferentialDiff $diff) {
|
|
|
|
$this->diff = $diff;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
private function getDiff() {
|
|
|
|
return $this->diff;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setRevision(DifferentialRevision $revision) {
|
2011-01-27 23:55:52 +01:00
|
|
|
$this->revision = $revision;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setActions(array $actions) {
|
|
|
|
$this->actions = $actions;
|
|
|
|
return $this;
|
|
|
|
}
|
2012-12-11 23:59:27 +01:00
|
|
|
private function getActions() {
|
|
|
|
return $this->actions;
|
|
|
|
}
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2014-04-03 21:01:04 +02:00
|
|
|
public function setActionList(PhabricatorActionListView $list) {
|
|
|
|
$this->actionList = $list;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getActionList() {
|
|
|
|
return $this->actionList;
|
|
|
|
}
|
|
|
|
|
2014-02-27 20:06:14 +01:00
|
|
|
public function setCustomFields(PhabricatorCustomFieldList $list) {
|
|
|
|
$this->customFields = $list;
|
2011-08-10 22:46:01 +02:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2011-01-27 23:55:52 +01:00
|
|
|
public function render() {
|
|
|
|
|
2014-01-02 20:59:35 +01:00
|
|
|
$this->requireResource('differential-core-view-css');
|
2011-01-27 23:55:52 +01:00
|
|
|
|
|
|
|
$revision = $this->revision;
|
2012-12-11 23:59:27 +01:00
|
|
|
$user = $this->getUser();
|
|
|
|
|
|
|
|
$header = $this->renderHeader($revision);
|
|
|
|
|
|
|
|
$actions = id(new PhabricatorActionListView())
|
|
|
|
->setUser($user)
|
2013-07-13 19:33:32 +02:00
|
|
|
->setObject($revision)
|
|
|
|
->setObjectURI($this->getURI());
|
2012-12-11 23:59:27 +01:00
|
|
|
foreach ($this->getActions() as $action) {
|
2014-02-27 20:06:14 +01:00
|
|
|
$actions->addAction($action);
|
2012-12-11 23:59:27 +01:00
|
|
|
}
|
|
|
|
|
2013-10-11 16:53:56 +02:00
|
|
|
$properties = id(new PHUIPropertyListView())
|
2013-02-15 16:47:14 +01:00
|
|
|
->setUser($user)
|
|
|
|
->setObject($revision);
|
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
$status = $revision->getStatus();
|
|
|
|
$local_vcs = $this->getDiff()->getSourceControlSystem();
|
|
|
|
|
|
|
|
$next_step = null;
|
|
|
|
if ($status == ArcanistDifferentialRevisionStatus::ACCEPTED) {
|
|
|
|
switch ($local_vcs) {
|
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:
|
2013-02-14 20:58:20 +01:00
|
|
|
$bookmark = $this->getDiff()->getBookmark();
|
2013-02-20 00:25:27 +01:00
|
|
|
$next_step = ($bookmark != ''
|
2013-02-14 20:58:20 +01:00
|
|
|
? csprintf('arc land %s', $bookmark)
|
|
|
|
: 'arc land');
|
|
|
|
break;
|
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:
|
2013-02-14 20:58:20 +01:00
|
|
|
$branch = $this->getDiff()->getBranch();
|
2013-02-20 00:25:27 +01:00
|
|
|
$next_step = ($branch != ''
|
2013-02-14 20:58:20 +01:00
|
|
|
? csprintf('arc land %s', $branch)
|
|
|
|
: 'arc land');
|
2012-12-11 23:59:27 +01:00
|
|
|
break;
|
2013-02-14 20:58:20 +01:00
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:
|
2013-02-20 00:25:27 +01:00
|
|
|
$next_step = 'arc commit';
|
2012-12-11 23:59:27 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($next_step) {
|
2013-02-20 00:25:27 +01:00
|
|
|
$next_step = phutil_tag('tt', array(), $next_step);
|
2013-01-24 22:18:44 +01:00
|
|
|
$properties->addProperty(pht('Next Step'), $next_step);
|
2012-12-11 23:59:27 +01:00
|
|
|
}
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
$properties->setHasKeyboardShortcuts(true);
|
2013-10-11 16:53:56 +02:00
|
|
|
$properties->setActionList($actions);
|
2014-04-03 21:01:04 +02:00
|
|
|
$this->setActionList($actions);
|
2011-08-10 22:46:01 +02:00
|
|
|
|
2014-02-27 20:06:14 +01:00
|
|
|
$field_list = $this->customFields;
|
|
|
|
if ($field_list) {
|
|
|
|
$field_list->appendFieldsToPropertyList(
|
|
|
|
$revision,
|
|
|
|
$user,
|
|
|
|
$properties);
|
2013-10-22 02:01:27 +02:00
|
|
|
}
|
|
|
|
|
2013-09-29 00:55:38 +02:00
|
|
|
$object_box = id(new PHUIObjectBoxView())
|
Provide more structure to PHUIObjectBoxView
Summary:
Three changes here.
- Add `setActionList()`, and use that to set the action list.
- Add `setPropertyList()`, and use that to set the property list.
These will let us add some apropriate CSS so we can fix the border issue, and get rid of a bunch of goofy `.x + .y` selectors.
- Replace `addContent()` with `appendChild()`.
This is just a consistency thing; `AphrontView` already provides `appendChild()`, and `addContent()` did the same thing.
Test Plan:
- Viewed "All Config".
- Viewed a countdown.
- Viewed a revision (add comment, change list, table of contents, comment, local commits, open revisions affecting these files, update history).
- Viewed Diffusion (browse, change, history, repository, lint).
- Viewed Drydock (resource, lease).
- Viewed Files.
- Viewed Herald.
- Viewed Legalpad.
- Viewed macro (edit, edit audio, view).
- Viewed Maniphest.
- Viewed Applications.
- Viewed Paste.
- Viewed People.
- Viewed Phulux.
- Viewed Pholio.
- Viewed Phame (blog, post).
- Viewed Phortune (account, product).
- Viewed Ponder (questions, answers, comments).
- Viewed Releeph.
- Viewed Projects.
- Viewed Slowvote.
NOTE: Images in Files aren't on a black background anymore -- I assume that's on purpose?
NOTE: Some jankiness in Phortune, I'll clean that up when I get back to it. Not related to this diff.
Reviewers: chad
Reviewed By: chad
CC: aran
Differential Revision: https://secure.phabricator.com/D7174
2013-09-30 18:36:04 +02:00
|
|
|
->setHeader($header)
|
2013-10-11 16:53:56 +02:00
|
|
|
->addPropertyList($properties);
|
2013-09-29 00:55:38 +02:00
|
|
|
|
|
|
|
return $object_box;
|
2012-12-11 23:59:27 +01:00
|
|
|
}
|
2011-02-20 21:50:28 +01:00
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
private function renderHeader(DifferentialRevision $revision) {
|
2013-09-17 18:12:37 +02:00
|
|
|
$view = id(new PHUIHeaderView())
|
2013-09-26 21:37:05 +02:00
|
|
|
->setHeader($revision->getTitle($revision))
|
|
|
|
->setUser($this->getUser())
|
|
|
|
->setPolicyObject($revision);
|
2013-04-03 17:28:18 +02:00
|
|
|
|
2013-09-24 17:42:04 +02:00
|
|
|
$status = $revision->getStatus();
|
|
|
|
$status_name =
|
|
|
|
DifferentialRevisionStatus::renderFullDescription($status);
|
|
|
|
|
|
|
|
$view->addProperty(PHUIHeaderView::PROPERTY_STATUS, $status_name);
|
2013-04-03 17:28:18 +02:00
|
|
|
|
|
|
|
return $view;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function renderTagForRevision(
|
|
|
|
DifferentialRevision $revision) {
|
2011-01-27 23:55:52 +01:00
|
|
|
|
2012-12-11 23:59:27 +01:00
|
|
|
$status = $revision->getStatus();
|
|
|
|
$status_name =
|
|
|
|
ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
|
2012-03-30 23:12:10 +02:00
|
|
|
|
2014-01-14 23:09:52 +01:00
|
|
|
return id(new PHUITagView())
|
|
|
|
->setType(PHUITagView::TYPE_STATE)
|
2013-09-24 17:42:04 +02:00
|
|
|
->setName($status_name);
|
2011-01-27 23:55:52 +01:00
|
|
|
}
|
2013-09-24 17:42:04 +02:00
|
|
|
|
2011-01-27 23:55:52 +01:00
|
|
|
}
|