Differential D15396 Diff 37133 src/applications/maniphest/controller/ManiphestTaskDetailController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/maniphest/controller/ManiphestTaskDetailController.php
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | $engine = id(new PhabricatorMarkupEngine()) | ||||
->setContextObject($task) | ->setContextObject($task) | ||||
->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION); | ->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION); | ||||
$timeline = $this->buildTransactionTimeline( | $timeline = $this->buildTransactionTimeline( | ||||
$task, | $task, | ||||
new ManiphestTransactionQuery(), | new ManiphestTransactionQuery(), | ||||
$engine); | $engine); | ||||
$actions = $this->buildActionView($task); | |||||
$monogram = $task->getMonogram(); | $monogram = $task->getMonogram(); | ||||
$crumbs = $this->buildApplicationCrumbs() | $crumbs = $this->buildApplicationCrumbs() | ||||
->addTextCrumb($monogram, '/'.$monogram); | ->addTextCrumb($monogram) | ||||
->setBorder(true); | |||||
$header = $this->buildHeaderView($task); | $header = $this->buildHeaderView($task); | ||||
$properties = $this->buildPropertyView( | $details = $this->buildPropertyView($task, $field_list, $edges, $handles); | ||||
$task, $field_list, $edges, $actions, $handles); | |||||
$description = $this->buildDescriptionView($task, $engine); | $description = $this->buildDescriptionView($task, $engine); | ||||
$actions = $this->buildActionView($task); | |||||
$object_box = id(new PHUIObjectBoxView()) | $properties = $this->buildPropertyListView($task, $handles); | ||||
->setHeader($header) | |||||
->addPropertyList($properties); | |||||
if ($description) { | |||||
$object_box->addPropertyList($description); | |||||
} | |||||
$title = pht('%s %s', $monogram, $task->getTitle()); | $title = pht('%s %s', $monogram, $task->getTitle()); | ||||
$comment_view = id(new ManiphestEditEngine()) | $comment_view = id(new ManiphestEditEngine()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->buildEditEngineCommentView($task); | ->buildEditEngineCommentView($task); | ||||
$timeline->setQuoteRef($monogram); | $timeline->setQuoteRef($monogram); | ||||
$comment_view->setTransactionTimeline($timeline); | $comment_view->setTransactionTimeline($timeline); | ||||
$view = id(new PHUITwoColumnView()) | |||||
->setHeader($header) | |||||
->setMainColumn(array( | |||||
$timeline, | |||||
$comment_view, | |||||
)) | |||||
->addPropertySection(pht('DETAILS'), $details) | |||||
->addPropertySection(pht('DESCRIPTION'), $description) | |||||
->setPropertyList($properties) | |||||
->setActionList($actions); | |||||
return $this->newPage() | return $this->newPage() | ||||
->setTitle($title) | ->setTitle($title) | ||||
->setCrumbs($crumbs) | ->setCrumbs($crumbs) | ||||
->setPageObjectPHIDs( | ->setPageObjectPHIDs( | ||||
array( | array( | ||||
$task->getPHID(), | $task->getPHID(), | ||||
)) | )) | ||||
->appendChild( | ->appendChild( | ||||
array( | array( | ||||
$object_box, | $view, | ||||
$timeline, | |||||
$comment_view, | |||||
)); | )); | ||||
} | } | ||||
private function buildHeaderView(ManiphestTask $task) { | private function buildHeaderView(ManiphestTask $task) { | ||||
$view = id(new PHUIHeaderView()) | $view = id(new PHUIHeaderView()) | ||||
->setHeader($task->getTitle()) | ->setHeader($task->getTitle()) | ||||
->setUser($this->getRequest()->getUser()) | ->setUser($this->getRequest()->getUser()) | ||||
->setPolicyObject($task); | ->setPolicyObject($task); | ||||
$status = $task->getStatus(); | $priority_name = ManiphestTaskPriority::getTaskPriorityName( | ||||
$status_name = ManiphestTaskStatus::renderFullDescription($status); | $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->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; | return $view; | ||||
} | } | ||||
private function buildActionView(ManiphestTask $task) { | private function buildActionView(ManiphestTask $task) { | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
$id = $task->getID(); | $id = $task->getID(); | ||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | private function buildActionView(ManiphestTask $task) { | ||||
return $view; | return $view; | ||||
} | } | ||||
private function buildPropertyView( | private function buildPropertyView( | ||||
ManiphestTask $task, | ManiphestTask $task, | ||||
PhabricatorCustomFieldList $field_list, | PhabricatorCustomFieldList $field_list, | ||||
array $edges, | array $edges, | ||||
PhabricatorActionListView $actions, | |||||
$handles) { | $handles) { | ||||
$viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
$view = id(new PHUIPropertyListView()) | $view = id(new PHUIPropertyListView()) | ||||
->setUser($viewer) | ->setUser($viewer); | ||||
->setObject($task) | |||||
->setActionList($actions); | |||||
$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); | |||||
$view->addProperty( | |||||
pht('Priority'), | |||||
ManiphestTaskPriority::getTaskPriorityName($task->getPriority())); | |||||
$author = $handles | |||||
->renderHandle($task->getAuthorPHID()) | |||||
->setShowHovercard(true); | |||||
$view->addProperty(pht('Author'), $author); | |||||
if (ManiphestTaskPoints::getIsEnabled()) { | |||||
$points = $task->getPoints(); | |||||
if ($points !== null) { | |||||
$view->addProperty( | |||||
ManiphestTaskPoints::getPointsLabel(), | |||||
$task->getPoints()); | |||||
} | |||||
} | |||||
$source = $task->getOriginalEmailSource(); | $source = $task->getOriginalEmailSource(); | ||||
if ($source) { | if ($source) { | ||||
$subject = '[T'.$task->getID().'] '.$task->getTitle(); | $subject = '[T'.$task->getID().'] '.$task->getTitle(); | ||||
$view->addProperty( | $view->addProperty( | ||||
pht('From Email'), | pht('From Email'), | ||||
phutil_tag( | phutil_tag( | ||||
'a', | 'a', | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | private function buildPropertyView( | ||||
} | } | ||||
if ($revisions_commits) { | if ($revisions_commits) { | ||||
$view->addProperty( | $view->addProperty( | ||||
pht('Commits'), | pht('Commits'), | ||||
phutil_implode_html(phutil_tag('br'), $revisions_commits)); | phutil_implode_html(phutil_tag('br'), $revisions_commits)); | ||||
} | } | ||||
$view->invokeWillRenderEvent(); | |||||
$field_list->appendFieldsToPropertyList( | $field_list->appendFieldsToPropertyList( | ||||
$task, | $task, | ||||
$viewer, | $viewer, | ||||
$view); | $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; | return $view; | ||||
} | } | ||||
private function buildDescriptionView( | private function buildDescriptionView( | ||||
ManiphestTask $task, | ManiphestTask $task, | ||||
PhabricatorMarkupEngine $engine) { | PhabricatorMarkupEngine $engine) { | ||||
$section = null; | $section = null; | ||||
if (strlen($task->getDescription())) { | if (strlen($task->getDescription())) { | ||||
$section = new PHUIPropertyListView(); | $section = new PHUIPropertyListView(); | ||||
$section->addSectionHeader( | |||||
pht('Description'), | |||||
PHUIPropertyListView::ICON_SUMMARY); | |||||
$section->addTextContent( | $section->addTextContent( | ||||
phutil_tag( | phutil_tag( | ||||
'div', | 'div', | ||||
array( | array( | ||||
'class' => 'phabricator-remarkup', | 'class' => 'phabricator-remarkup', | ||||
), | ), | ||||
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION))); | $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION))); | ||||
} | } | ||||
return $section; | return $section; | ||||
} | } | ||||
} | } |