Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2895675
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
13 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/maniphest/controller/ManiphestTaskDetailController.php b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
index cbb55413ad..d1d93b6c1b 100644
--- a/src/applications/maniphest/controller/ManiphestTaskDetailController.php
+++ b/src/applications/maniphest/controller/ManiphestTaskDetailController.php
@@ -1,360 +1,348 @@
<?php
final class ManiphestTaskDetailController extends ManiphestController {
public function shouldAllowPublic() {
return true;
}
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$id = $request->getURIData('id');
$task = id(new ManiphestTaskQuery())
->setViewer($viewer)
->withIDs(array($id))
->needSubscriberPHIDs(true)
->executeOne();
if (!$task) {
return new Aphront404Response();
}
$field_list = PhabricatorCustomField::getObjectFields(
$task,
PhabricatorCustomField::ROLE_VIEW);
$field_list
->setViewer($viewer)
->readFieldsFromStorage($task);
$e_commit = ManiphestTaskHasCommitEdgeType::EDGECONST;
$e_dep_on = ManiphestTaskDependsOnTaskEdgeType::EDGECONST;
$e_dep_by = ManiphestTaskDependedOnByTaskEdgeType::EDGECONST;
$e_rev = ManiphestTaskHasRevisionEdgeType::EDGECONST;
$e_mock = ManiphestTaskHasMockEdgeType::EDGECONST;
$phid = $task->getPHID();
$query = id(new PhabricatorEdgeQuery())
->withSourcePHIDs(array($phid))
->withEdgeTypes(
array(
$e_commit,
$e_dep_on,
$e_dep_by,
$e_rev,
$e_mock,
));
$edges = idx($query->execute(), $phid);
$phids = array_fill_keys($query->getDestinationPHIDs(), true);
if ($task->getOwnerPHID()) {
$phids[$task->getOwnerPHID()] = true;
}
$phids[$task->getAuthorPHID()] = true;
$phids = array_keys($phids);
$handles = $viewer->loadHandles($phids);
$engine = id(new PhabricatorMarkupEngine())
->setViewer($viewer)
->setContextObject($task)
->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
$timeline = $this->buildTransactionTimeline(
$task,
new ManiphestTransactionQuery(),
$engine);
$monogram = $task->getMonogram();
$crumbs = $this->buildApplicationCrumbs()
->addTextCrumb($monogram)
->setBorder(true);
$header = $this->buildHeaderView($task);
$details = $this->buildPropertyView($task, $field_list, $edges, $handles);
$description = $this->buildDescriptionView($task, $engine);
- $actions = $this->buildActionView($task);
- $properties = $this->buildPropertyListView($task, $handles);
+ $curtain = $this->buildCurtain($task);
$title = pht('%s %s', $monogram, $task->getTitle());
$comment_view = id(new ManiphestEditEngine())
->setViewer($viewer)
->buildEditEngineCommentView($task);
$timeline->setQuoteRef($monogram);
$comment_view->setTransactionTimeline($timeline);
$view = id(new PHUITwoColumnView())
->setHeader($header)
+ ->setCurtain($curtain)
->setMainColumn(array(
$timeline,
$comment_view,
))
->addPropertySection(pht('DETAILS'), $details)
- ->addPropertySection(pht('DESCRIPTION'), $description)
- ->setPropertyList($properties)
- ->setActionList($actions);
+ ->addPropertySection(pht('DESCRIPTION'), $description);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->setPageObjectPHIDs(
array(
$task->getPHID(),
))
->appendChild(
array(
$view,
));
}
private function buildHeaderView(ManiphestTask $task) {
$view = id(new PHUIHeaderView())
->setHeader($task->getTitle())
->setUser($this->getRequest()->getUser())
->setPolicyObject($task);
$priority_name = ManiphestTaskPriority::getTaskPriorityName(
$task->getPriority());
$priority_color = ManiphestTaskPriority::getTaskPriorityColor(
$task->getPriority());
$status = $task->getStatus();
$status_name = ManiphestTaskStatus::renderFullDescription(
$status, $priority_name, $priority_color);
$view->addProperty(PHUIHeaderView::PROPERTY_STATUS, $status_name);
$view->setHeaderIcon(ManiphestTaskStatus::getStatusIcon(
$task->getStatus()).' '.$priority_color);
if (ManiphestTaskPoints::getIsEnabled()) {
$points = $task->getPoints();
if ($points !== null) {
$points_name = pht('%s %s',
$task->getPoints(),
ManiphestTaskPoints::getPointsLabel());
$tag = id(new PHUITagView())
->setName($points_name)
->setShade('blue')
->setType(PHUITagView::TYPE_SHADE);
$view->addTag($tag);
}
}
return $view;
}
- private function buildActionView(ManiphestTask $task) {
- $viewer = $this->getRequest()->getUser();
+ private function buildCurtain(ManiphestTask $task) {
+ $viewer = $this->getViewer();
$id = $task->getID();
$phid = $task->getPHID();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$task,
PhabricatorPolicyCapability::CAN_EDIT);
- $view = id(new PhabricatorActionListView())
- ->setUser($viewer)
- ->setObject($task);
+ $curtain = $this->newCurtainView($task);
- $view->addAction(
+ $curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Task'))
->setIcon('fa-pencil')
->setHref($this->getApplicationURI("/task/edit/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
- $view->addAction(
+ $curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Merge Duplicates In'))
->setHref("/search/attach/{$phid}/TASK/merge/")
->setWorkflow(true)
->setIcon('fa-compress')
->setDisabled(!$can_edit)
->setWorkflow(true));
$edit_config = id(new ManiphestEditEngine())
->setViewer($viewer)
->loadDefaultEditConfiguration();
$can_create = (bool)$edit_config;
if ($can_create) {
$form_key = $edit_config->getIdentifier();
$edit_uri = id(new PhutilURI("/task/edit/form/{$form_key}/"))
->setQueryParam('parent', $id)
->setQueryParam('template', $id)
->setQueryParam('status', ManiphestTaskStatus::getDefaultStatus());
$edit_uri = $this->getApplicationURI($edit_uri);
} else {
// TODO: This will usually give us a somewhat-reasonable error page, but
// could be a bit cleaner.
$edit_uri = "/task/edit/{$id}/";
$edit_uri = $this->getApplicationURI($edit_uri);
}
- $view->addAction(
+ $curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Create Subtask'))
->setHref($edit_uri)
->setIcon('fa-level-down')
->setDisabled(!$can_create)
->setWorkflow(!$can_create));
- $view->addAction(
+ $curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Blocking Tasks'))
->setHref("/search/attach/{$phid}/TASK/blocks/")
->setWorkflow(true)
->setIcon('fa-link')
->setDisabled(!$can_edit)
->setWorkflow(true));
- return $view;
+
+ $owner_phid = $task->getOwnerPHID();
+ if ($owner_phid) {
+ $assigned_to = $viewer
+ ->renderHandle($owner_phid)
+ ->setShowHovercard(true);
+ } else {
+ $assigned_to = phutil_tag('em', array(), pht('None'));
+ }
+
+ $curtain->newPanel()
+ ->setHeaderText(pht('Assigned To'))
+ ->appendChild($assigned_to);
+
+ $author_phid = $task->getAuthorPHID();
+ $author = $viewer
+ ->renderHandle($author_phid)
+ ->setShowHovercard(true);
+
+ $curtain->newPanel()
+ ->setHeaderText(pht('Author'))
+ ->appendChild($author);
+
+ return $curtain;
}
private function buildPropertyView(
ManiphestTask $task,
PhabricatorCustomFieldList $field_list,
array $edges,
$handles) {
$viewer = $this->getRequest()->getUser();
$view = id(new PHUIPropertyListView())
->setUser($viewer);
$source = $task->getOriginalEmailSource();
if ($source) {
$subject = '[T'.$task->getID().'] '.$task->getTitle();
$view->addProperty(
pht('From Email'),
phutil_tag(
'a',
array(
'href' => 'mailto:'.$source.'?subject='.$subject,
),
$source));
}
$edge_types = array(
ManiphestTaskDependedOnByTaskEdgeType::EDGECONST
=> pht('Blocks'),
ManiphestTaskDependsOnTaskEdgeType::EDGECONST
=> pht('Blocked By'),
ManiphestTaskHasRevisionEdgeType::EDGECONST
=> pht('Differential Revisions'),
ManiphestTaskHasMockEdgeType::EDGECONST
=> pht('Pholio Mocks'),
);
$revisions_commits = array();
$commit_phids = array_keys(
$edges[ManiphestTaskHasCommitEdgeType::EDGECONST]);
if ($commit_phids) {
$commit_drev = DiffusionCommitHasRevisionEdgeType::EDGECONST;
$drev_edges = id(new PhabricatorEdgeQuery())
->withSourcePHIDs($commit_phids)
->withEdgeTypes(array($commit_drev))
->execute();
foreach ($commit_phids as $phid) {
$revisions_commits[$phid] = $handles->renderHandle($phid)
->setShowHovercard(true);
$revision_phid = key($drev_edges[$phid][$commit_drev]);
$revision_handle = $handles->getHandleIfExists($revision_phid);
if ($revision_handle) {
$task_drev = ManiphestTaskHasRevisionEdgeType::EDGECONST;
unset($edges[$task_drev][$revision_phid]);
$revisions_commits[$phid] = hsprintf(
'%s / %s',
$revision_handle->renderHovercardLink($revision_handle->getName()),
$revisions_commits[$phid]);
}
}
}
foreach ($edge_types as $edge_type => $edge_name) {
if ($edges[$edge_type]) {
$edge_handles = $viewer->loadHandles(array_keys($edges[$edge_type]));
$view->addProperty(
$edge_name,
$edge_handles->renderList());
}
}
if ($revisions_commits) {
$view->addProperty(
pht('Commits'),
phutil_implode_html(phutil_tag('br'), $revisions_commits));
}
$field_list->appendFieldsToPropertyList(
$task,
$viewer,
$view);
if ($view->hasAnyProperties()) {
return $view;
}
return null;
}
- private function buildPropertyListView(ManiphestTask $task, $handles) {
- $viewer = $this->getRequest()->getUser();
- $view = id(new PHUIPropertyListView())
- ->setUser($viewer)
- ->setObject($task);
-
- $view->invokeWillRenderEvent();
-
- $owner_phid = $task->getOwnerPHID();
- if ($owner_phid) {
- $assigned_to = $handles
- ->renderHandle($owner_phid)
- ->setShowHovercard(true);
- } else {
- $assigned_to = phutil_tag('em', array(), pht('None'));
- }
-
- $view->addProperty(pht('Assigned To'), $assigned_to);
-
- $author_phid = $task->getAuthorPHID();
- $author = $handles
- ->renderHandle($author_phid)
- ->setShowHovercard(true);
-
- $date = phabricator_datetime($task->getDateCreated(), $viewer);
-
- $view->addProperty(pht('Author'), $author);
-
- return $view;
- }
-
private function buildDescriptionView(
ManiphestTask $task,
PhabricatorMarkupEngine $engine) {
$section = null;
if (strlen($task->getDescription())) {
$section = new PHUIPropertyListView();
$section->addTextContent(
phutil_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION)));
}
return $section;
}
}
diff --git a/src/view/layout/PHUICurtainView.php b/src/view/layout/PHUICurtainView.php
index 6d2388802b..af02ceb932 100644
--- a/src/view/layout/PHUICurtainView.php
+++ b/src/view/layout/PHUICurtainView.php
@@ -1,52 +1,63 @@
<?php
final class PHUICurtainView extends AphrontTagView {
private $actionList;
private $panels = array();
public function addAction(PhabricatorActionView $action) {
$this->getActionList()->addAction($action);
return $this;
}
public function addPanel(PHUICurtainPanelView $curtain_panel) {
$this->panels[] = $curtain_panel;
return $this;
}
+ public function newPanel() {
+ $panel = new PHUICurtainPanelView();
+ $this->addPanel($panel);
+
+ // By default, application panels go at the bottom of the curtain, below
+ // extension panels.
+ $panel->setOrder(100000);
+
+ return $panel;
+ }
+
public function setActionList(PhabricatorActionListView $action_list) {
$this->actionList = $action_list;
return $this;
}
public function getActionList() {
return $this->actionList;
}
protected function canAppendChild() {
return false;
}
protected function getTagContent() {
$action_list = $this->actionList;
require_celerity_resource('phui-curtain-view-css');
$panels = $this->renderPanels();
return id(new PHUIObjectBoxView())
->appendChild($action_list)
->appendChild($panels)
->addClass('phui-two-column-properties');
}
private function renderPanels() {
$panels = $this->panels;
$panels = msortv($panels, 'getOrderVector');
return $panels;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jan 19 2025, 21:51 (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1129123
Default Alt Text
(13 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment