Differential D15174 Diff 36642 src/applications/project/events/PhabricatorProjectUIEventListener.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/events/PhabricatorProjectUIEventListener.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | private function handlePropertyEvent($event) { | ||||
// If this object can appear on boards, build the workboard annotations. | // If this object can appear on boards, build the workboard annotations. | ||||
// Some day, this might be a generic interface. For now, only tasks can | // Some day, this might be a generic interface. For now, only tasks can | ||||
// appear on boards. | // appear on boards. | ||||
$can_appear_on_boards = ($object instanceof ManiphestTask); | $can_appear_on_boards = ($object instanceof ManiphestTask); | ||||
$annotations = array(); | $annotations = array(); | ||||
if ($handles && $can_appear_on_boards) { | if ($handles && $can_appear_on_boards) { | ||||
$engine = id(new PhabricatorBoardLayoutEngine()) | |||||
->setViewer($user) | |||||
->setBoardPHIDs($project_phids) | |||||
->setObjectPHIDs(array($object->getPHID())) | |||||
->executeLayout(); | |||||
// TDOO: Generalize this UI and move it out of Maniphest. | // TDOO: Generalize this UI and move it out of Maniphest. | ||||
require_celerity_resource('maniphest-task-summary-css'); | require_celerity_resource('maniphest-task-summary-css'); | ||||
$positions_query = id(new PhabricatorProjectColumnPositionQuery()) | |||||
->setViewer($user) | |||||
->withBoardPHIDs($project_phids) | |||||
->withObjectPHIDs(array($object->getPHID())) | |||||
->needColumns(true); | |||||
// This is important because positions will be created "on demand" | |||||
// based on the set of columns. If we don't specify it, positions | |||||
// won't be created. | |||||
$columns = id(new PhabricatorProjectColumnQuery()) | |||||
->setViewer($user) | |||||
->withProjectPHIDs($project_phids) | |||||
->execute(); | |||||
if ($columns) { | |||||
$positions_query->withColumns($columns); | |||||
} | |||||
$positions = $positions_query->execute(); | |||||
$positions = mpull($positions, null, 'getBoardPHID'); | |||||
foreach ($project_phids as $project_phid) { | foreach ($project_phids as $project_phid) { | ||||
$handle = $handles[$project_phid]; | $handle = $handles[$project_phid]; | ||||
$position = idx($positions, $project_phid); | $columns = $engine->getObjectColumns( | ||||
if ($position) { | $project_phid, | ||||
$column = $position->getColumn(); | $object->getPHID()); | ||||
$annotation = array(); | |||||
foreach ($columns as $column) { | |||||
$column_name = pht('(%s)', $column->getDisplayName()); | $column_name = pht('(%s)', $column->getDisplayName()); | ||||
$column_link = phutil_tag( | $column_link = phutil_tag( | ||||
'a', | 'a', | ||||
array( | array( | ||||
'href' => $handle->getURI().'board/', | 'href' => $handle->getURI().'board/', | ||||
'class' => 'maniphest-board-link', | 'class' => 'maniphest-board-link', | ||||
), | ), | ||||
$column_name); | $column_name); | ||||
$annotation[] = $column_link; | |||||
} | |||||
if ($annotation) { | |||||
$annotations[$project_phid] = array( | $annotations[$project_phid] = array( | ||||
' ', | ' ', | ||||
$column_link, | phutil_implode_html(', ', $annotation), | ||||
); | ); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
if ($handles) { | if ($handles) { | ||||
$list = id(new PHUIHandleTagListView()) | $list = id(new PHUIHandleTagListView()) | ||||
Show All 12 Lines |