Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/controller/HeraldTranscriptController.php
Show First 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | private function buildApplyTranscriptPanel(HeraldTranscript $xscript) { | ||||
$list = new PHUIObjectItemListView(); | $list = new PHUIObjectItemListView(); | ||||
$list->setStates(true); | $list->setStates(true); | ||||
$list->setNoDataString(pht('No actions were taken.')); | $list->setNoDataString(pht('No actions were taken.')); | ||||
foreach ($xscript->getApplyTranscripts() as $apply_xscript) { | foreach ($xscript->getApplyTranscripts() as $apply_xscript) { | ||||
$target = $apply_xscript->getTarget(); | $target = $apply_xscript->getTarget(); | ||||
switch ($apply_xscript->getAction()) { | switch ($apply_xscript->getAction()) { | ||||
case HeraldAdapter::ACTION_NOTHING: | |||||
$target = null; | |||||
break; | |||||
case HeraldAdapter::ACTION_FLAG: | case HeraldAdapter::ACTION_FLAG: | ||||
$target = PhabricatorFlagColor::getColorName($target); | $target = PhabricatorFlagColor::getColorName($target); | ||||
break; | break; | ||||
case HeraldAdapter::ACTION_BLOCK: | case HeraldAdapter::ACTION_BLOCK: | ||||
// Target is a text string. | // Target is a text string. | ||||
$target = $target; | $target = $target; | ||||
break; | break; | ||||
default: | default: | ||||
// TODO: This should be driven by HeraldActions. | |||||
if (is_array($target) && $target) { | if (is_array($target) && $target) { | ||||
foreach ($target as $k => $phid) { | foreach ($target as $k => $phid) { | ||||
if (isset($handles[$phid])) { | if (isset($handles[$phid])) { | ||||
$target[$k] = $handles[$phid]->getName(); | $target[$k] = $handles[$phid]->getName(); | ||||
} | } | ||||
} | } | ||||
$target = implode(', ', $target); | $target = implode(', ', $target); | ||||
} else if (is_string($target)) { | } else if (is_string($target)) { | ||||
Show All 14 Lines | foreach ($xscript->getApplyTranscripts() as $apply_xscript) { | ||||
$rule = idx( | $rule = idx( | ||||
$action_names, | $action_names, | ||||
$apply_xscript->getAction(), | $apply_xscript->getAction(), | ||||
pht('Unknown Action "%s"', $apply_xscript->getAction())); | pht('Unknown Action "%s"', $apply_xscript->getAction())); | ||||
$item->setHeader(pht('%s: %s', $rule, $target)); | $item->setHeader(pht('%s: %s', $rule, $target)); | ||||
$item->addAttribute($apply_xscript->getReason()); | $item->addAttribute($apply_xscript->getReason()); | ||||
// TODO: This is a bit of a mess while actions convert. | |||||
$item->addAttribute( | $item->addAttribute( | ||||
pht('Outcome: %s', $apply_xscript->getAppliedReason())); | pht('Outcome: %s', $apply_xscript->getAppliedReason())); | ||||
$list->addItem($item); | $list->addItem($item); | ||||
} | } | ||||
$box = new PHUIObjectBoxView(); | $box = new PHUIObjectBoxView(); | ||||
$box->setHeaderText(pht('Actions Taken')); | $box->setHeaderText(pht('Actions Taken')); | ||||
▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines |